diff --git a/alliance/src/druc/Makefile.am b/alliance/src/druc/Makefile.am new file mode 100644 index 00000000..5fcaa0d3 --- /dev/null +++ b/alliance/src/druc/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src man1 diff --git a/alliance/src/druc/configure.in b/alliance/src/druc/configure.in new file mode 100644 index 00000000..d0c4aaf4 --- /dev/null +++ b/alliance/src/druc/configure.in @@ -0,0 +1,48 @@ +dnl +/* +dnl This file is part of the Alliance CAD System +dnl Copyright (C) Laboratoire LIP6 - Département ASIM +dnl Universite Pierre et Marie Curie +dnl +dnl Home page : http://www-asim.lip6.fr/alliance/ +dnl E-mail support : mailto:alliance-support@asim.lip6.fr +dnl +dnl This library is free software; you can redistribute it and/or modify it +dnl under the terms of the GNU Library General Public License as published +dnl by the Free Software Foundation; either version 2 of the License, or (at +dnl your option) any later version. +dnl +dnl Alliance VLSI CAD System is distributed in the hope that it will be +dnl useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +dnl Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License along +dnl with the GNU C Library; see the file COPYING. If not, write to the Free +dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +dnl +dnl Purpose : Auto stuffing Alliance +dnl Almost ten years since I wrote this stuff, I just can't +dnl believe it +dnl Date : 01/02/2002 +dnl Author : Frederic Petrot +dnl $Id: configure.in,v 1.1 2002/03/29 17:39:32 ludo Exp $ +dnl +dnl +AC_INIT(src/vrd.h) +AM_INIT_AUTOMAKE(vrd, 3.4) +AC_PROG_INSTALL +AC_PROG_CC +AC_PROG_YACC +AM_PROG_LEX +AC_HEADER_STDC +AC_C_CONST +AC_PROG_RANLIB + +AM_ALLIANCE + +AC_OUTPUT([ +Makefile +src/Makefile +man1/Makefile +]) diff --git a/alliance/src/druc/man1/Makefile.am b/alliance/src/druc/man1/Makefile.am new file mode 100644 index 00000000..2e7be5e8 --- /dev/null +++ b/alliance/src/druc/man1/Makefile.am @@ -0,0 +1,2 @@ +man_MANS = druc.1 +EXTRA_DIST = $(man_MANS) diff --git a/alliance/src/druc/man1/druc.1 b/alliance/src/druc/man1/druc.1 new file mode 100644 index 00000000..9d85ec61 --- /dev/null +++ b/alliance/src/druc/man1/druc.1 @@ -0,0 +1,519 @@ +.\" $Id: druc.1,v 1.1 2002/03/29 17:39:32 ludo Exp $ +.\" @(#)Labo.l 1.2 93/12/08 UPMC; Author: Patrick RENNAUD +.pl -.4 +.TH DRUC 1 "October 1, 1997" "ASIM/LIP6" "CAO\-VLSI Reference Manual" +.SH NAME +DRuC - Design Rule Checker +.so man1/alc_origin.1 +.SH SYNOPSIS +.TP +\fBdruc\fP \<\fIroot_name\fP\> +.br +.br +.br +.br +.SH DESCRIPTION +.br +\fBDRuC\fP is a general parametrized VLSI design rule checker. +.br +This tool replace the \fBVERSATIL\fP tool that is not anymore supported. +.br +This manual presents the layout rules for tle \fBALLIANCE\fP symbolic layout approach. +The rules are described in a technology file defined by the environment variable \fB RDS_TECHNO_NAME\fP (see bellow). +.br +The root cell and all the instanciated cells (except the intanciated libraries cells) must be in the current directory. +.br +The default mode of \fBDRuC\fP is (currently) full flat: +it first flatten all the hierarchy in order to obtain a flat, rectangle level description. +.br +.fi +.ft R +.bp +\fBO: LAYER NAME.\fP +.br + + + +This section explicits the layer name used in the following rules. +.br +.br +.nf +.ie t \{\ +.ft CR \} +.el \{\ +.ft B\} +- NWELL : N well +.br +- NTIE : N well polarisation +.br +- PTIE : P substrat polarisation +.br +- NDIF : N diffusion +.br +- PDIF : P diffusion +.br +- GATE : transistor gate +.br +- POLY : polysilicon wire +.br +- ALU1 : first level of metal +.br +- ALU2 : second level of metal +.br +- CONT : contact between ALU1 and POLY or DIFF +.br +- VIA : contact between ALU1 and ALU2 +.br +.fi +.ft R +.bp +\fBI: LAYER WIDTH.\fP +.br + + + + +This class of rules deals with the width limits of a layer. +and the conditions for equipotentiality between +two overlapping or abutting segments. +.br +.br +.nf +.ie t \{\ +.ft CR \} +.el \{\ +.ft B\} + +rule 1 : + the minimum width for a segment of NWELL is 4 + corresponding error codes are : 100 101 +.br +rule 2 : + the minimum width for a segment of NTIE is 2 + corresponding error code is : 119 +.br +rule 3 : + the minimum width for a segment of PTIE is 2 + corresponding error codes are : 122 123 +.br +rule 4 : + the minimum width for a segment of NDIF is 2 + corresponding error codes are : 140 141 +.br +rule 5 : + the minimum width for a segment of PDIF is 2 + corresponding error codes are : 165 166 +.br +rule 6 : + the minimum width for a segment of GATE is 1 + corresponding error codes are : 234 235 +.br +rule 7 : + the minimum width for a segment of POLY is 1 + corresponding error codes are : 234 235 +.br +rule 8 : + the minimum width for a segment of ALU1 is 1 + corresponding error codes are : 238 239 +.br +rule 9 : + the minimum width for a segment of ALU2 is 2 + corresponding error codes are : 242 243 +.br +rule 10 : + the width of a CONT must be equal to 1 + corresponding error codes are : 246 247 +.br +rule 11 : + the width of a VIA must be equal to 1 + corresponding error codes are : 261 262 +.br +.fi +.ft R +.bp +\fBII: FORBIDDEN OVERLAP\fP +.br + + + + +This class of rules specifies the forbidden overlaps between two layers. (The distance between them must be strictly positive) +.br +.br +.nf +.ie t \{\ +.ft CR \} +.el \{\ +.ft B\} +.br +rule 12 : + contact between PTIE and NWELL is forbidden. + corresponding error codes are : 126 127 128 129 130 131 +.br +rule 13 : + contact between PTIE and NTIE is forbidden. + corresponding error codes are : 133 134 135 136 137 138 +.br +rule 14 : + contact between NDIF and NWELL is forbidden. + corresponding error codes are : 144 145 146 147 148 149 +.br +rule 15 : + contact between NDIF and NTIE is forbidden. + corresponding error codes are : 151 152 153 154 155 156 +.br +rule 16 : + contact between NDIF and PTIE is forbidden. + corresponding error codes are : 158 159 160 161 162 163 +.br +rule 17 : + contact between PDIF and NTIE is forbidden. + corresponding error codes are : 169 170 171 172 173 174 +.br +rule 18 : + contact between PDIF and PTIE is forbidden. + corresponding error codes are : 176 177 178 179 180 181 +.br +rule 19 : + contact between PDIF and NDIF is forbidden. + corresponding error codes are : 183 184 185 186 187 188 +.br +rule 20 : + contact between GATE and NTIE is forbidden. + corresponding error codes are : 191 192 193 194 195 196 +.br +rule 21 : + contact between GATE and PTIE is forbidden. + corresponding error codes are : 198 199 200 201 202 203 +.br +rule 22 : + contact between POLY and NTIE is forbidden. + corresponding error codes are : 207 208 209 210 211 212 +.br +rule 23 : + contact between POLY and PTIE is forbidden. + corresponding error codes are : 214 215 216 217 218 219 +.br +rule 24 : + contact between POLY and NDIF is forbidden. + corresponding error codes are : 221 222 223 224 225 226 +.br +rule 25 : + contact between POLY and PDIF is forbidden. + corresponding error codes are : 228 229 230 231 232 233 +.bp +.br +rule 26 : + contact between CONT and GATE or POLY is forbidden. + corresponding error codes are : 249 250 251 252 253 +.br +rule 27 : + contact between VIA and GATE is forbidden. + corresponding error codes are : 264 265 266 267 268 269 +.br +rule 28 : + contact between VIA and POLY is forbidden. + corresponding error codes are : 271 272 273 274 275 276 +.br +rule 29 : + contact between VIA and CONT is forbidden. + corresponding error codes are : 278 279 280 281 282 283 +.br +rule 30 : + contact between NTIE and NWELL is forbidden. + corresponding error code is : 109 +.br +rule 31 : + contact between PDIF and NWELL is forbidden. + corresponding error code is : 117 +.br +.fi +.ft R +.bp +\fBIII: LAYER NOTCH.\fP +.br + + + + +This class of rules deals with the notch limits of a layer. +.br +.br +.nf +.ie t \{\ +.ft CR \} +.el \{\ +.ft B\} +.br +rule 32 : + the minimum notch for a segment of NWELL is 4 + corresponding error code is : 102 +.br +rule 33 : + the minimum notch for a segment of NTIE is 2 + corresponding error code is : 120 +.br +rule 34 : + the minimum notch for a segment of PTIE is 2 + corresponding error code is : 124 +.br +rule 35 : + the minimum notch for a segment of NDIF is 2 + corresponding error code is : 142 +.br +rule 36 : + the minimum notch for a segment of PDIF is 2 + corresponding error code is : 167 +.br +rule 37 : + the minimum notch for a segment of POLY is 1 + corresponding error code is : 236 +.br +rule 38 : + the minimum notch for a segment of ALU1 is 2.5 + corresponding error code is : 240 +.br +rule 39 : + the minimum notch for a segment of ALU2 is 2 + corresponding error code is : 244 +.br +.fi +.ft R +.bp +\fBIV: MINIMUM SPACING\fP +.br + + + + +This class of rules specifies the minimum edge-to-edge distance allowed between +two layers. +.br +.nf +.ie t \{\ +.ft CR \} +.el \{\ +.ft B\} +rule 40 : + the minimum distance between NWELL and NWELL is 12 + corresponding error code is : 118 +.br +rule 42 : + the minimum distance between NTIE and NTIE is 3 + corresponding error code is : 121 +.br +rule 43 : + the minimum distance between PTIE and NWELL is 7.5 + corresponding error code is : 125 +.br +rule 44 : + the minimum distance between PTIE and NTIE is 8 + corresponding error code is : 132 +.br +rule 45 : + the minimum distance between PTIE and PTIE is 3 + corresponding error code is : 139 +.br +rule 46 : + the minimum distance between NDIF and NWELL is 7.5 + corresponding error code is : 143 +.br +rule 47 : + the minimum distance between NDIF and NTIE is 8 + corresponding error code is : 150 +.br +rule 48 : + the minimum distance between NDIF and PTIE is 3 + corresponding error code is : 157 +.br +rule 49 : + the minimum distance between NDIF and NDIF is 3 + corresponding error code is : 164 +.br +rule 51 : + the minimum distance between PDIF and NTIE is 3 + corresponding error code is : 168 +.br +rule 52 : + the minimum distance between PDIF and PTIE is 8 + corresponding error code is : 175 +.br +rule 53 : + the minimum distance between PDIF and NDIF is 8 + corresponding error code is : 182 +.br +rule 54 : + the minimum distance between PDIF and PDIF is 3 + corresponding error code is : 189 +.br +rule 55 : + the minimum distance between GATE and NTIE is 1 + corresponding error code is : 190 +.br +rule 56 : + the minimum distance between GATE and PTIE is 1 + corresponding error code is : 197 +.br +rule 57 : + the minimum distance between GATE and NDIF is 1 + corresponding error code is : 204 +.br +rule 58 : + the minimum distance between GATE and PDIF is 1 + corresponding error code is : 205 +.br +rule 59 : + the minimum distance between GATE and GATE is 2 + corresponding error code is : 237 +.br +rule 60 : + the minimum distance between POLY and NTIE is 1 + corresponding error code is : 206 +.br +rule 61 : + the minimum distance between POLY and PTIE is 1 + corresponding error code is : 213 +.br +rule 62 : + the minimum distance between POLY and NDIF is 1 + corresponding error code is : 220 +.br +rule 63 : + the minimum distance between POLY and PDIF is 1 + corresponding error code is : 227 +.br +rule 64 : + the minimum distance between POLY and GATE is 2 + corresponding error code is : 237 +.br +rule 65 : + the minimum distance between POLY and POLY is 2 + corresponding error code is : 237 +.br +rule 66 : + the minimum distance between ALU1 and ALU1 is 2.5 + corresponding error code is : 241 +.br +rule 67 : + the minimum distance between ALU2 and ALU2 is 2 + corresponding error code is : 245 +.br +rule 68 : + the minimum distance between CONT and CONT is 3 + corresponding error code is : 254 +.br +.br +rule 69 : + the minimum distance between VIA and GATE is 2 + corresponding error code is : 263 +.br +rule 70 : + the minimum distance between VIA and POLY is 2 + corresponding error code is : 270 +.br +rule 71 : + the minimum distance between VIA and CONT is 2 + corresponding error code is : 277 +.br +rule 72 : + the minimum distance between VIA and VIA is 3 + corresponding error code is : 284 +.br +rule 73 : + the minimum distance between CONT and GATE or POLY is 1.5 + corresponding error code is : 248 +.br +.fi +.ft R +.bp + \fBV: TOTAL INCLUSION.\fP +.br + + + + +The last class of rules deals with the inclusion of a layer in another one. +.br + +.br +.nf +.ie t \{\ +.ft CR \} +.el \{\ +.ft B\} +rule 74 : + NTIE must be included in NWELL with a minimun margin of 0.5 + corresponding error code is : 103 +.br +rule 75 : + PDIF must be included in NWELL with a minimun margin of 0.5 + corresponding error code is : 110 +.br + +.br +.fi +.ft R +.SH OPTIONS +.br + + +No optons are currently avalable. +.br + + + +.SH FILES +.br + + +If design errors are found, \fBDRuC\fP produces the list of them in two files : + +.br +.IP +- \<\fIroot_name.drc\fP\>: +.br +This ascii file contains the list of DRC violations. + +.br +- \<\fIroot_name.iii\fP\>: +.br +This \fBgds\fP ro \fBcif\fp file contains only rectangles detected in violation. +.br +( suffix iii is defined with the environment ) +.br + +\fIRDS_OUT_PH\fP is default setted to gds. +.br + + + +.SH ENVIRONMENT VARIABLES +.br + + +\fBDRuC\fP uses several environment variables: +.ti 8 +- MBK_IN_PH - defines the layout input format. +.br +.ti 8 +- RDS_OUT_PH - defines the layout output format. +.br +.ti 8 +- RDS_TECHNO_NAME - defines the technology file. +.br +.ti 8 +- MBK_CATA_LIB - defines the catalog directory. +.HP +See the corresponding manual pages for further informations. + + + +.SH EXAMPLE + druc register +.br + + + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/druc/src/Makefile.am b/alliance/src/druc/src/Makefile.am new file mode 100644 index 00000000..11bd3f2b --- /dev/null +++ b/alliance/src/druc/src/Makefile.am @@ -0,0 +1,28 @@ +lib_LIBRARIES = libVrd.a +include_HEADERS = vrd.h +libVrd_a_SOURCES = drucompi_l.l drucompi_y.y \ +defdefin.c defdefin.h defexclu.c defexclu.h definclu.c definclu.h definter.c \ +definter.h defresiz.c defresiz.h deftools.c deftools.h defunion.c defunion.h \ +drucgral.c drucgral.h druchier.c druchier.h drucmin.c drucmin.h drucompi.c \ +drucompi.h drucring.c drucring.h drucutil.c drucutil.h vmcaract.c vmcaract.h \ +vmcasmld.c vmcasmld.h vmcerror.c vmcerror.h vmcmesur.c vmcmesur.h vmcrelat.c \ +vmcrelat.h vmctools.c vmctools.h vmcunify.c vmcunify.h + +CLEANFILES = drucompi_l.c drucompi_y.h drucompi_y.c + +drucompi_y.c drucompi_y.h : $(srcdir)/drucompi_y.y + $(YACC) -d $(YFLAGS) $(srcdir)/drucompi_y.y && sed -e "s/yy/vrd_y_/g" -e "s/YY/VRD_Y_/g" y.tab.c > drucompi_y.c && sed -e "s/yy/vrd_y_/g" -e "s/YY/VRD_Y_/g" y.tab.h > drucompi_y.h +drucompi_l.c : $(srcdir)/drucompi_l.l drucompi_y.h + $(LEX) -t $(srcdir)/drucompi_l.l | sed -e "s/yy/vrd_y_/g" -e "s/YY/VRD_Y_/g" > drucompi_l.c + + +bin_PROGRAMS = druc + +CFLAGS = @CFLAGS@ -DBOOM_VERSION=\"@BOOM_VERSION@\" + +druc_LDADD = @LIBS@ \ +-L. -lVrd -lRtl -lRgs -lRcf -lRfm -lRpr -lRwi -lRut -lRds -lMpu -lMcp -lMap -lMmg -lMph \ +-lMut -lm + +druc_SOURCES = \ +drucbath.c drucbath.h diff --git a/alliance/src/druc/src/defdefin.c b/alliance/src/druc/src/defdefin.c new file mode 100644 index 00000000..cf519cf4 --- /dev/null +++ b/alliance/src/druc/src/defdefin.c @@ -0,0 +1,317 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DEFDEFIN.C | +| | +| Authors : Renaud Patrick | +| | +| Date : 26/07/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +#include +#include +#include +#include "mph.h" +#include "mut.h" +#include "rds.h" +#include "rwi.h" +#include "rut.h" +#include "rtl.h" +#include "rfm.h" +#include "rpr.h" + +#include "drucutil.h" +#include "vmctools.h" +#include "deftools.h" +#include "defunion.h" +#include "definter.h" +#include "defexclu.h" +#include "definclu.h" +#include "defresiz.h" +#include "defdefin.h" +/*------------------------------------------------------------\ +| | +| DefDefin Fonctions | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| DrucDefine | +| Definit un layer temporaire caracterise par les parametres | +| contenus dans la StructInstruction pointee par son numero | +| puis chaine le layer en equipotentielles | +\------------------------------------------------------------*/ + +void DrucDefine ( DrucFigureRds, + DrucRdsWindow , + DrucInstructionCourante + ) + rdsfig_list *DrucFigureRds; + rdswindow *DrucRdsWindow; + DrucTypeStructInstruction *DrucInstructionCourante; + +{ + +/*\ + * DrucViewInstruction ( DrucInstructionCourante ); +\*/ + switch ( DrucInstructionCourante->OP_COMPOSE ) + { + case DRUC_COMPOSE_UNION : + { + DrucDefineUnion ( DrucFigureRds, + DrucRdsWindow , + DrucInstructionCourante + ); + break; + } + case DRUC_COMPOSE_INTERSECT : + { + DrucDefineIntersection ( DrucFigureRds, + DrucRdsWindow, + DrucInstructionCourante + ); + break; + } + case DRUC_COMPOSE_EXCLUSION : + { + DrucDefineExclusion ( DrucFigureRds, + DrucRdsWindow, + DrucInstructionCourante + ); +/*\ +DrucViewString ("\nfin EXCLUSION\n"); +viewrdsfig ( DrucFigureRds + ); +DrucViewString ("\n"); +\*/ + break; + } + case DRUC_COMPOSE_RESIZE : + { + DrucDefineResize ( DrucFigureRds, + DrucRdsWindow, + DrucInstructionCourante + ); + +/*\ +DrucViewString ("\nfin RESIZE\n"); +viewrdsfig ( DrucFigureRds + ); +DrucViewString ("\n"); +saverdsfig ( DrucFigureRds ); +\*/ + + break; + } + case DRUC_COMPOSE_INCLUSION : + { + DrucDefineInclusion ( DrucFigureRds, + DrucRdsWindow, + DrucInstructionCourante + ); +/*\ +DrucViewString ("\nfin INCLUSION\n"); +viewrdsfig ( DrucFigureRds + ); +DrucViewString ("\n"); +\*/ + break; + } + }/* switch */ + + DrucComputeEquiLayer ( DrucFigureRds , + DrucInstructionCourante->LAYER_DEST + ); +/*\ +DrucViewString (" DEFINE: COMPUTE EQUI AVANT UNIFICATION \n" + ); +DrucVerifEquiLayer ( DrucFigureRds, + DrucInstructionCourante->LAYER_DEST + ); +DrucViewString (" DEFINE: FIN COMPUTE EQUI AVANT UNIFICATION \n" + ); +\*/ + + +/*\ + * Patrick le 22/03/94 la largeur min d'un layer construit ne peut pas etre + * le max des largeurs des layers sources. Il pourrait etre le min des 2 + * mais en cas d,intersection on pourrait avoir des rectangles de taille + * inferieure + * L'unificateur supprime tous les rectangles de taille inf au min donc on met 0 + * + * DrucStructRdsLayer [ DrucInstructionCourante->LAYER_DEST ].WIDTH = + * ( DrucStructRdsLayer [ DrucInstructionCourante->LAYER_1 ].WIDTH > + * DrucStructRdsLayer [ DrucInstructionCourante->LAYER_2 ].WIDTH ? + * DrucStructRdsLayer [ DrucInstructionCourante->LAYER_2 ].WIDTH : + * DrucStructRdsLayer [ DrucInstructionCourante->LAYER_1 ].WIDTH + * ); +\*/ + DrucStructRdsLayer [ DrucInstructionCourante->LAYER_DEST ].WIDTH = 0; + + DrucStructRdsLayer [ DrucInstructionCourante->LAYER_DEST ].CTM = + ( DrucStructRdsLayer [ DrucInstructionCourante->LAYER_1 ].CTM > + DrucStructRdsLayer [ DrucInstructionCourante->LAYER_2 ].CTM ? + DrucStructRdsLayer [ DrucInstructionCourante->LAYER_1 ].CTM : + DrucStructRdsLayer [ DrucInstructionCourante->LAYER_2 ].CTM + ); + + DrucUnifyLayer ( DrucFigureRds, + DrucRdsWindow, + DrucInstructionCourante->LAYER_DEST + ); + DrucDestroyLayerWindow ( DrucFigureRds, + DrucRdsWindow, + DrucInstructionCourante->LAYER_DEST + ); + DrucBuiltLayerWindow ( DrucFigureRds, + DrucRdsWindow, + DrucInstructionCourante->LAYER_DEST + ); +/*\ + * On reconstruit les equi car l'unificateur a modifie les rectangles + * il en a modifie, detruit et cree +\*/ + DrucComputeEquiLayer ( DrucFigureRds , + DrucInstructionCourante->LAYER_DEST + ); +/*\ +viewrdsfig ( DrucFigureRds + ); +DrucViewString ("\nDEFINE: FIN COMPUTE EQUI APRES UNIFICATION \n"); +DrucViewString (" DEFINE: COMPUTE EQUI APRES UNIFICATION \n" + ); +DrucViewString ( RDS_LAYER_NAME[DrucInstructionCourante->LAYER_1] + ); +DrucViewString (": c'est le Layer source \n"); +DrucViewString ( RDS_LAYER_NAME[DrucInstructionCourante->LAYER_2] + ); +DrucViewString (": c'est le Layer source \n"); + +DrucVerifEquiLayer ( DrucFigureRds, + DrucInstructionCourante->LAYER_DEST + ); +DrucViewString (" DEFINE: FIN COMPUTE EQUI APRES UNIFICATION \n"); +\*/ +} + +/*------------------------------------------------------------\ +| | +| DrucUndefine | +| Detruit le layer temporaire caracterise par les parametres | +| contenus dans la StructInstruction pointee par son numero | +| on parcourt tous les rectangles du layer defini dans la | +| fenetre et on les remet dans le tas gere par rdswin | +\------------------------------------------------------------*/ + +void DrucUndefine ( DrucFigureRds , + DrucRdsWindow, + DrucInstructionCourante + ) + rdsfig_list *DrucFigureRds; + rdswindow *DrucRdsWindow; + DrucTypeStructInstruction *DrucInstructionCourante; + +{ + +register rdsrec_list *TmpRectangleDest; +register rdsrec_list *TmpRectangleSuivant; + DrucTypeStructPlusRect *TmpPlusRec; + DrucTypeStructPlusRect *TmpPlusRecSuivant; + /*\ + * detruire la window associee au layer + \*/ + for ( TmpRectangleDest = DrucFigureRds->LAYERTAB[ DrucInstructionCourante->LAYER_1 ]; + TmpRectangleDest != (rdsrec_list *)NULL; + TmpRectangleDest = TmpRectangleDest->NEXT + ) + { + delrdsrecwindow ( TmpRectangleDest, + DrucRdsWindow + ); + } + /*\ + * detruire les rectangles du layer + \*/ + TmpRectangleDest = DrucFigureRds->LAYERTAB[ DrucInstructionCourante->LAYER_1 ]; + + while ( TmpRectangleDest != (rdsrec_list *)NULL + ) + { + if ( MACRO_NEXT_DEFINE ( TmpRectangleDest ) != ( DrucTypeStructPlusRect *)NULL + ) + { + /*\ + * destruction des StructPlusRect du rectangle scourant + \*/ + TmpPlusRec = MACRO_NEXT_DEFINE ( TmpRectangleDest ); + + while ( TmpPlusRec != ( DrucTypeStructPlusRect *)NULL + ) + { + TmpPlusRecSuivant = TmpPlusRec->NEXT_DEFINE; + + rdsfreeheap ( TmpPlusRec , + MACRO_PLUS_TAILLE + ); + + TmpPlusRec = TmpPlusRecSuivant; + } + } + TmpRectangleSuivant = TmpRectangleDest->NEXT; + + /*\ + * destruction du rectangle courant dans la fenetre + \*/ + delrdsrecwindow ( TmpRectangleDest, + DrucRdsWindow + ); + /*\ + * destruction du rectangle courant dans la figure + \*/ + freerdsrec ( TmpRectangleDest, + sizeof ( DrucTypeStructPlusRect ) + ); + + TmpRectangleDest = TmpRectangleSuivant; + } + + DrucFigureRds->LAYERTAB[ DrucInstructionCourante->LAYER_1 ] = + + (rdsrec_list *)NULL; +} +/* + * algo de NotInclus: + * + * Pour tout rectangle a + * si a n,est pas marque + * alors + * Pour tout rectangle b + * si a est entierement inclus dans b + * alors + * je le marque + * fsi + * fpour b + * fsi + * si a n'est pas marque + * alors + * je le met dans le layer utilisateur + * fpour a + */ +/*------------------------------------------------------------\ +| | +| VMCDEFIN MODIFS | +| | +| PATRICK 22/03/94: ligne 739 | +| mise a 0 du with min des layers construits | +| | +| | +\------------------------------------------------------------*/ diff --git a/alliance/src/druc/src/defdefin.h b/alliance/src/druc/src/defdefin.h new file mode 100644 index 00000000..cc98136b --- /dev/null +++ b/alliance/src/druc/src/defdefin.h @@ -0,0 +1,35 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DEFDEFIN.H | +| | +| Authors : Patrick Renaud | +| | +| Date : 26/07/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DefDefin Fonctions | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| DrucDefine | +| Definit un layer temporaire caracterise par les parametres | +| contenus dans la StructInstruction pointee par son numero | +| puis chaine le layer en equipotentielles | +\------------------------------------------------------------*/ +extern void DrucDefine (); + +/*------------------------------------------------------------\ +| | +| DrucUndefine | +| Detruit le layer temporaire caracterise par les parametres | +| contenus dans la StructInstruction pointee par son numero | +| on parcourt tous les rectangles du layer defini dans la | +| fenetre et on les remet dans le tas gere par rdswin | +\------------------------------------------------------------*/ +extern void DrucUndefine (); diff --git a/alliance/src/druc/src/defexclu.c b/alliance/src/druc/src/defexclu.c new file mode 100644 index 00000000..3d2d58ed --- /dev/null +++ b/alliance/src/druc/src/defexclu.c @@ -0,0 +1,152 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DEFEXCLU.C | +| | +| Authors : Renaud Patrick | +| | +| Date : 26/07/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +#include +#include +#include +#include "mph.h" +#include "mut.h" +#include "rds.h" +#include "rwi.h" +#include "rut.h" +#include "rtl.h" +#include "rfm.h" +#include "rpr.h" + +#include "drucutil.h" +#include "vmctools.h" +#include "deftools.h" +#include "defexclu.h" +/*------------------------------------------------------------\ +| | +| DefExclu Fonctions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DrucDefineExclusion | +| Definit un layer temporaire caracterise par l'operateur | +| contenu dans l'instruction ayant les deux layers source | +| comme operandes | +| range le resultat dans le tableau des layers userdefini par | +| l'instruction | +\------------------------------------------------------------*/ + +void DrucDefineExclusion ( DrucFigureRds, + DrucRdsWindow, + DrucInstructionCourante + ) + rdsfig_list *DrucFigureRds; + rdswindow *DrucRdsWindow; + DrucTypeStructInstruction *DrucInstructionCourante; + +{ + + chain_list *PtChaine; + rdsrec_list *TmpRectangleSource; + rdswin_list *TmpWindowSource2; + long UnaireX; + long UnaireDX; + long UnaireY; + long UnaireDY; +register int TabIndex2; +register rdswinrec_list *TabRectangleSource2 = NULL; + + for ( TmpRectangleSource = DrucFigureRds->LAYERTAB [ DrucInstructionCourante->LAYER_1 ]; + TmpRectangleSource != (rdsrec_list *)NULL; + TmpRectangleSource = TmpRectangleSource->NEXT + ) + { + /*\ + * recuperer toutes les fenetres liees au rectangle + \*/ + DrucCalculOperationUnaire ( DrucRdsWindow, + DrucInstructionCourante, + TmpRectangleSource, + & UnaireX, + & UnaireDX, + & UnaireY, + & UnaireDY + ); + + PtChaine = getrdswindow ( UnaireX, + UnaireY, + UnaireDX, + UnaireDY, + DrucRdsWindow + ); + + while ( PtChaine != (chain_list *)NULL + ) + { + /*\ + * parcours de chaque fenetre + \*/ + TmpWindowSource2 = ( rdswin_list *) PtChaine->DATA; + PtChaine = PtChaine ->NEXT; + TabRectangleSource2 = TmpWindowSource2->LAYERTAB + [ DrucInstructionCourante->LAYER_2 ]; + /*\ + * parcours des tableaux de la fenetre du layer 2 + \*/ + while ( TabRectangleSource2 != (rdswinrec_list *)NULL + ) + { + /*\ + * parcourir tous les rectangles du layer B + \*/ + TabIndex2 = 0; + + while ( TabIndex2 < RWI_MAX_REC + ) + { + if ( MACRO_RECT_SOURCE2 [ TabIndex2 ] != ( rdsrec_list *)NULL ) + { + DrucMarqueInclusion ( UnaireX, + UnaireDX, + UnaireY, + UnaireDY, + TmpRectangleSource, + MACRO_RECT_SOURCE2 [ TabIndex2 ] + ); + } + + TabIndex2 ++; + } /* while les rectangles d'un tableau du layer 2 */ + TabRectangleSource2 = TabRectangleSource2->NEXT; + } /* while les tableaux du layer 2 */ + } /* while les fenetres du layer 2 */ + + if ( ( TmpRectangleSource->FLAGS & + DRUC_FLAG_REC_INCLUS ) == DRUC_NOFLAGS + ) + { + DrucExclusionRectangle ( DrucFigureRds, + DrucRdsWindow, + TmpRectangleSource, + DrucInstructionCourante, + UnaireX, + UnaireDX, + UnaireY, + UnaireDY + ); + } + } /* for le parcours des rectangles du layer 1 */ + + DrucClearFlag ( DrucFigureRds->LAYERTAB[ DrucInstructionCourante->LAYER_1 ], + DRUC_FLAG_REC_INCLUS + ); +} diff --git a/alliance/src/druc/src/defexclu.h b/alliance/src/druc/src/defexclu.h new file mode 100644 index 00000000..0c51a79a --- /dev/null +++ b/alliance/src/druc/src/defexclu.h @@ -0,0 +1,26 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DEFEXCLU.H | +| | +| Authors : Patrick Renaud | +| | +| Date : 26/07/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| defExclu Fonctions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DrucDefineExclusion | +| Definit un layer temporaire caracterise par l'operateur | +| contenu dans l'instruction ayant les deux layers source | +| comme operandes | +| range le resultat dans le tableau des layers userdefini par | +| l'instruction | +\------------------------------------------------------------*/ +extern void DrucDefineExclusion (); diff --git a/alliance/src/druc/src/definclu.c b/alliance/src/druc/src/definclu.c new file mode 100644 index 00000000..ad382087 --- /dev/null +++ b/alliance/src/druc/src/definclu.c @@ -0,0 +1,112 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DEFINCLU.C | +| | +| Authors : Renaud Patrick | +| | +| Date : 26/07/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +#include +#include +#include +#include "mph.h" +#include "mut.h" +#include "rds.h" +#include "rwi.h" +#include "rut.h" +#include "rtl.h" +#include "rfm.h" +#include "rpr.h" + +#include "drucutil.h" +#include "vmctools.h" +#include "deftools.h" +#include "definclu.h" +/*------------------------------------------------------------\ +| | +| DefInclu Fonctions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DrucDefineInclusion | +| Definit un layer temporaire caracterise par l'operateur | +| contenu dans l'instruction ayant les deux layers source | +| comme operandes | +| range le resultat dans le tableau des layers userdefini par | +| l'instruction | +\------------------------------------------------------------*/ + +void DrucDefineInclusion ( DrucFigureRds, + DrucRdsWindow, + DrucInstructionCourante + ) + rdsfig_list *DrucFigureRds; + rdswindow *DrucRdsWindow; + DrucTypeStructInstruction *DrucInstructionCourante; + +{ + + rdsrec_list *TmpRectangleSource; + rdsrecwin_list *TmpWindowSource2; +register int TabIndex2; +register rdswinrec_list *TabRectangleSource2 = NULL; + + for ( TmpRectangleSource = DrucFigureRds->LAYERTAB [ DrucInstructionCourante->LAYER_1 ]; + TmpRectangleSource != (rdsrec_list *)NULL; + TmpRectangleSource = TmpRectangleSource->NEXT + ) + { + /*\ + * recuperer toutes les fenetres liees au rectangle, marquer le rectangle visite + \*/ + TmpWindowSource2 = DrucChercheWindow ( TmpRectangleSource + ); + /*\ + * parcours de chaque fenetre + \*/ + while ( TmpWindowSource2 != (rdsrecwin_list *)NULL + ) + { + TabRectangleSource2 = ( TmpWindowSource2->WINDOW )->LAYERTAB + [ DrucInstructionCourante->LAYER_2 ]; + /*\ + * parcours des tableaux de la fenetre du layer 1 + \*/ + while ( TabRectangleSource2 != (rdswinrec_list *)NULL + ) + { + /*\ + * parcourir tous les rectangles du layer 1 + \*/ + TabIndex2 = 0; + + while ( TabIndex2 < RWI_MAX_REC + ) + { + if ( MACRO_RECT_SOURCE2 [ TabIndex2 ] != ( rdsrec_list *)NULL ) + { + DrucInclusionRectangle ( DrucFigureRds, + DrucRdsWindow, + DrucInstructionCourante, + TmpRectangleSource, + MACRO_RECT_SOURCE2 [ TabIndex2 ] + ); + } + + TabIndex2 ++; + } /* while les rectangles d'un tableau du layer 2 */ + TabRectangleSource2 = TabRectangleSource2->NEXT; + } /* while les tableaux du layer 2 */ + TmpWindowSource2 = TmpWindowSource2->NEXT; + } /* while les fenetres du layer 2 */ + } /* for des rectangles du layer 1 */ +} diff --git a/alliance/src/druc/src/definclu.h b/alliance/src/druc/src/definclu.h new file mode 100644 index 00000000..72ddfcef --- /dev/null +++ b/alliance/src/druc/src/definclu.h @@ -0,0 +1,26 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DEFINCLU.H | +| | +| Authors : Patrick Renaud | +| | +| Date : 26/07/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DefInclu Fonctions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DrucDefineInclusion | +| Definit un layer temporaire caracterise par l'operateur | +| contenu dans l'instruction ayant les deux layers source | +| comme operandes | +| range le resultat dans le tableau des layers userdefini par | +| l'instruction | +\------------------------------------------------------------*/ +extern void DrucDefineInclusion (); diff --git a/alliance/src/druc/src/definter.c b/alliance/src/druc/src/definter.c new file mode 100644 index 00000000..f4e6291b --- /dev/null +++ b/alliance/src/druc/src/definter.c @@ -0,0 +1,112 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DEFINTER.C | +| | +| Authors : Renaud Patrick | +| | +| Date : 26/07/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +#include +#include +#include +#include "mph.h" +#include "mut.h" +#include "rds.h" +#include "rwi.h" +#include "rut.h" +#include "rtl.h" +#include "rfm.h" +#include "rpr.h" + +#include "drucutil.h" +#include "vmctools.h" +#include "deftools.h" +#include "definter.h" +/*------------------------------------------------------------\ +| | +| DefInter Fonctions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DrucDefineIntersection | +| Definit un layer temporaire caracterise par l'operateur | +| contenu dans l'instruction ayant les deux layers source | +| comme operandes | +| range le resultat dans le tableau des layers userdefini par | +| l'instruction | +\------------------------------------------------------------*/ + +void DrucDefineIntersection ( DrucFigureRds, + DrucRdsWindow, + DrucInstructionCourante + ) + rdsfig_list *DrucFigureRds; + rdswindow *DrucRdsWindow; + DrucTypeStructInstruction *DrucInstructionCourante; + +{ + + rdsrec_list *TmpRectangleSource; + rdsrecwin_list *TmpWindowSource2; +register int TabIndex2; +register rdswinrec_list *TabRectangleSource2 = NULL; + + for ( TmpRectangleSource = DrucFigureRds->LAYERTAB [ DrucInstructionCourante->LAYER_1 ]; + TmpRectangleSource != (rdsrec_list *)NULL; + TmpRectangleSource = TmpRectangleSource->NEXT + ) + { + /*\ + * recuperer toutes les fenetres liees au rectangle, marquer le rectangle visite + \*/ + TmpWindowSource2 = DrucChercheWindow ( TmpRectangleSource + ); + /*\ + * parcours de chaque fenetre + \*/ + while ( TmpWindowSource2 != (rdsrecwin_list *)NULL + ) + { + TabRectangleSource2 = ( TmpWindowSource2->WINDOW )->LAYERTAB + [ DrucInstructionCourante->LAYER_2 ]; + /*\ + * parcours des tableaux de la fenetre du layer 2 + \*/ + while ( TabRectangleSource2 != (rdswinrec_list *)NULL + ) + { + /*\ + * parcourir tous les rectangles du layer B + \*/ + TabIndex2 = 0; + + while ( TabIndex2 < RWI_MAX_REC + ) + { + if ( MACRO_RECT_SOURCE2 [ TabIndex2 ] != ( rdsrec_list *)NULL ) + { + DrucIntersectRectangle ( DrucFigureRds, + DrucRdsWindow, + DrucInstructionCourante, + TmpRectangleSource, + MACRO_RECT_SOURCE2 [ TabIndex2 ] + ); + } + + TabIndex2 ++; + } /* while les rectangles d'un tableau du layer 2 */ + TabRectangleSource2 = TabRectangleSource2->NEXT; + } /* while les tableaux du layer 2 */ + TmpWindowSource2 = TmpWindowSource2->NEXT; + } /* while les fenetres du layer 2 */ + } /* for le parcours des rectangles du layer 1 */ +} diff --git a/alliance/src/druc/src/definter.h b/alliance/src/druc/src/definter.h new file mode 100644 index 00000000..18ebd4b7 --- /dev/null +++ b/alliance/src/druc/src/definter.h @@ -0,0 +1,26 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DEFINTER.H | +| | +| Authors : Patrick Renaud | +| | +| Date : 11/01/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DefInter Fonctions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DrucDefineIntersection | +| Definit un layer temporaire caracterise par l'operateur | +| contenu dans l'instruction ayant les deux layers source | +| comme operandes | +| range le resultat dans le tableau des layers userdefini par | +| l'instruction | +\------------------------------------------------------------*/ +extern void DrucDefineIntersection (); diff --git a/alliance/src/druc/src/defresiz.c b/alliance/src/druc/src/defresiz.c new file mode 100644 index 00000000..df6aaeb1 --- /dev/null +++ b/alliance/src/druc/src/defresiz.c @@ -0,0 +1,202 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DEFRESIZ.C | +| | +| Authors : Renaud Patrick | +| | +| Date : 26/07/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +#include +#include +#include +#include "mph.h" +#include "mut.h" +#include "rds.h" +#include "rwi.h" +#include "rut.h" +#include "rtl.h" +#include "rfm.h" +#include "rpr.h" + +#include "drucutil.h" +#include "vmctools.h" +#include "deftools.h" +#include "defresiz.h" +/*------------------------------------------------------------\ +| | +| DefResiz Fonctions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DrucDefineUnion | +| Definit un layer temporaire caracterise par l'union | +| des deux layers source | +| range le resultat dans le tableau des layers user defini par| +| l'instruction | +\------------------------------------------------------------*/ + +void DrucDefineResize ( DrucFigureRds, + DrucRdsWindow , + DrucInstructionCourante + ) + rdsfig_list *DrucFigureRds; + rdswindow *DrucRdsWindow; + DrucTypeStructInstruction *DrucInstructionCourante; + +{ + + int TmpLayerDest; + int TmpLayerSource1; + int TmpLayerSource2; +register rdsrec_list *TmpRectangleSource; +register rdsrec_list *TmpRectangleDest; + + TmpLayerDest = DrucInstructionCourante->LAYER_DEST; + TmpLayerSource1 = DrucInstructionCourante->LAYER_1; + TmpLayerSource2 = DrucInstructionCourante->LAYER_2; + /*\ + * modifier tous les rectangles du layer source 1 + \*/ + + if ( TmpLayerSource1 == TmpLayerDest ) + { + for ( TmpRectangleSource = DrucFigureRds->LAYERTAB[ TmpLayerSource1 ]; + TmpRectangleSource != (rdsrec_list *)NULL; + TmpRectangleSource = TmpRectangleSource->NEXT + ) + { + /*\ + * modif des dimensions X + \*/ +/*\ +printf ("\nTmpRectangleSource %d %d %d %d\n", + TmpRectangleSource->X, + TmpRectangleSource->Y, + TmpRectangleSource->DX, + TmpRectangleSource->DY); +\*/ + + if ( ( DrucInstructionCourante->DEF_VALEUR < 0 ) && + ( TmpRectangleSource->DX < abs ( DrucInstructionCourante->DEF_VALEUR ) * 2 ) + ) + { + TmpRectangleSource->X = TmpRectangleSource->X + ( TmpRectangleSource->DX / 2 ); + TmpRectangleSource->DX = 0; + } + else + { + TmpRectangleSource->X = TmpRectangleSource->X - + DrucInstructionCourante->DEF_VALEUR; + + TmpRectangleSource->DX = TmpRectangleSource->DX + + (DrucInstructionCourante->DEF_VALEUR * 2); + } + + /*\ + * modif des dimensions Y + \*/ + if ( ( DrucInstructionCourante->DEF_VALEUR < 0 ) && + ( TmpRectangleSource->DY < abs ( DrucInstructionCourante->DEF_VALEUR ) * 2 ) + ) + { + TmpRectangleSource->Y = TmpRectangleSource->Y + ( TmpRectangleSource->DY / 2 ); + TmpRectangleSource->DY = 0; + } + else + { + TmpRectangleSource->Y = TmpRectangleSource->Y - + DrucInstructionCourante->DEF_VALEUR; + + TmpRectangleSource->DY = TmpRectangleSource->DY + + (DrucInstructionCourante->DEF_VALEUR * 2); + } +/*\ +printf ("TmpRectangleSource %d %d %d %d\n", + TmpRectangleSource->X, + TmpRectangleSource->Y, + TmpRectangleSource->DX, + TmpRectangleSource->DY); +\*/ + + } + } + else + /*\ + * dupliquer tous les rectangles du layer source 1 + \*/ + + { + for ( TmpRectangleSource = DrucFigureRds->LAYERTAB[ TmpLayerSource1 ]; + TmpRectangleSource != (rdsrec_list *)NULL; + TmpRectangleSource = TmpRectangleSource->NEXT + ) + { + TmpRectangleDest = allocrdsrec ( sizeof ( DrucTypeStructPlusRect )); + TmpRectangleDest->NEXT = ( rdsrec_list *)NULL; + /*\ + * modif des dimensions X + \*/ + if ( ( DrucInstructionCourante->DEF_VALEUR < 0 ) && + ( TmpRectangleSource->DX < abs ( DrucInstructionCourante->DEF_VALEUR ) * 2 ) + ) + { + TmpRectangleDest->X = TmpRectangleSource->X + ( TmpRectangleSource->DX / 2 ); + TmpRectangleDest->DX = 0; + } + else + { + TmpRectangleDest->X = TmpRectangleSource->X - + DrucInstructionCourante->DEF_VALEUR; + + TmpRectangleDest->DX = TmpRectangleSource->DX + + (DrucInstructionCourante->DEF_VALEUR * 2); + } + + /*\ + * modif des dimensions Y + \*/ + if ( ( DrucInstructionCourante->DEF_VALEUR < 0 ) && + ( TmpRectangleSource->DY < abs ( DrucInstructionCourante->DEF_VALEUR ) * 2 ) + ) + { + TmpRectangleDest->Y = TmpRectangleSource->Y + ( TmpRectangleSource->DY / 2 ); + TmpRectangleDest->DY = 0; + } + else + { + TmpRectangleDest->Y = TmpRectangleSource->Y - + DrucInstructionCourante->DEF_VALEUR; + + TmpRectangleDest->DY = TmpRectangleSource->DY + + (DrucInstructionCourante->DEF_VALEUR * 2); + } + TmpRectangleDest->USER = (rdsrec_list *)NULL; + TmpRectangleDest->NAME = TmpRectangleSource->NAME; + + SetRdsLayer ( TmpRectangleDest , + TmpLayerDest + ); + MACRO_NEXT_EQUI ( TmpRectangleDest ) = (rdsrec_list *)NULL; + DrucChaineCompose ( TmpRectangleDest , + TmpRectangleSource, + TmpLayerSource1 + ); + addrdsrecwindow ( TmpRectangleDest , + DrucRdsWindow + ); + DrucAddRecFigure ( TmpRectangleDest , + DrucFigureRds , + TmpLayerDest + ); + } + } +} diff --git a/alliance/src/druc/src/defresiz.h b/alliance/src/druc/src/defresiz.h new file mode 100644 index 00000000..053e6a6a --- /dev/null +++ b/alliance/src/druc/src/defresiz.h @@ -0,0 +1,25 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DEFRESIZ.H | +| | +| Authors : Patrick Renaud | +| | +| Date : 26/07/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DefResiz Fonctions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DrucDefineResize | +| Definit un layer temporaire caracterise par la modification | +| des dimensions des rectangles par valeur positive ou negative +| range le resultat dans le tableau des layers user defini par| +| l'instruction | +\------------------------------------------------------------*/ +extern void DrucDefineResize (); diff --git a/alliance/src/druc/src/deftools.c b/alliance/src/druc/src/deftools.c new file mode 100644 index 00000000..5676c182 --- /dev/null +++ b/alliance/src/druc/src/deftools.c @@ -0,0 +1,437 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DEFTOOLS.C | +| | +| Authors : Renaud Patrick | +| | +| Date : 26/07/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +#include +#include +#include +#include "mph.h" +#include "mut.h" +#include "rds.h" +#include "rwi.h" +#include "rut.h" +#include "rtl.h" +#include "rfm.h" +#include "rpr.h" + +#include "drucutil.h" +#include "vmctools.h" +#include "deftools.h" +/*------------------------------------------------------------\ +| | +| DefTools Fonctions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DrucChaineCompose | +| Accroche le rectangle source au rectangle dest par le champ | +| NEXT_DEFINE pour connaite la liste des rectangles ayant | +| contribue a la creation du rectangle dest | +| on chaine des structures PlusRect entre elles a chaque | +| nouveau rectangle composant le layer virtuel | +| Le champ NEXT_EQUI de la structure ajoutee sert a retrouver | +| le rectangle ayant ete utilise pour composer le rectangle | +| dest | +\------------------------------------------------------------*/ + +void DrucChaineCompose ( RectangleDest , + RectangleSource, + IndexLayer + ) + + rdsrec_list *RectangleDest; + rdsrec_list *RectangleSource; + int IndexLayer; + +{ + +DrucTypeStructPlusRect *TmpPlusRec; + + TmpPlusRec = ( DrucTypeStructPlusRect *)rdsalloc ( MACRO_PLUS_TAILLE , + DRUC_ON_HEAP + ); + + if ( MACRO_INSTANCE_NUM ( RectangleDest ) == (rdsins_list*)NULL ) + { + MACRO_INSTANCE_NUM ( RectangleDest ) = MACRO_INSTANCE_NUM ( RectangleSource ); + } + + TmpPlusRec->NEXT_EQUI = RectangleSource; + TmpPlusRec->NOMBRE = IndexLayer; + TmpPlusRec->NEXT_DEFINE = MACRO_NEXT_DEFINE ( RectangleDest ); + MACRO_NEXT_DEFINE ( RectangleDest ) = TmpPlusRec; +} + +/*------------------------------------------------------------\ +| | +| DrucInclusionRectangle | +| Cree la copie du rectangle 2 s'il est inclus entierement| +| dans le rectangle 1 puis chaine les 2 rectangles source | +| par le pointeur USER au rectangle cree | +| ou retoune NULL | +\------------------------------------------------------------*/ + +void DrucInclusionRectangle ( DrucFigureRds, + DrucRdsWindow, + DrucInstructionCourante, + Rectangle1, + Rectangle2 + ) + + rdsfig_list *DrucFigureRds; + rdswindow *DrucRdsWindow; + DrucTypeStructInstruction *DrucInstructionCourante; + register rdsrec_list *Rectangle1; + register rdsrec_list *Rectangle2; + +{ + +register int TmpLayerDest = DrucInstructionCourante->LAYER_DEST; + rdsrec_list *TmpRectangleDest; + + if ( ( ( Rectangle2->X <= + Rectangle1->X ) && + ( Rectangle2->X + Rectangle2->DX >= + Rectangle1->X + Rectangle1->DX ) ) && + ( ( Rectangle2->Y <= + Rectangle1->Y ) && + ( Rectangle2->Y + Rectangle2->DY >= + Rectangle1->Y + Rectangle1->DY ) ) + ) + { + TmpRectangleDest = allocrdsrec( sizeof ( DrucTypeStructPlusRect )); + TmpRectangleDest->X = Rectangle1->X; + TmpRectangleDest->Y = Rectangle1->Y; + TmpRectangleDest->DX = Rectangle1->DX; + TmpRectangleDest->DY = Rectangle1->DY; + + SetRdsLayer ( TmpRectangleDest , + TmpLayerDest + ); + DrucChaineCompose ( TmpRectangleDest , + Rectangle2, + DrucInstructionCourante->LAYER_2 + ); + DrucChaineCompose ( TmpRectangleDest , + Rectangle1, + DrucInstructionCourante->LAYER_1 + ); + addrdsrecwindow ( TmpRectangleDest, + DrucRdsWindow + ); + DrucAddRecFigure ( TmpRectangleDest , + DrucFigureRds , + TmpLayerDest + ); + } +} + +/*------------------------------------------------------------\ +| | +| DrucIntersectRectangle | +| Cree un rectangle de dimensions et coordonnees | +| correspondant a l'intersection des 2 rectangles passes en | +| parametre | +| ou retoune NULL si les 2 rectangles ne sont pas en | +| intersection | +\------------------------------------------------------------*/ + +void DrucIntersectRectangle ( DrucFigureRds, + DrucRdsWindow, + DrucInstructionCourante, + Rectangle1, + Rectangle2 + ) + rdsfig_list *DrucFigureRds; + + rdswindow *DrucRdsWindow; + DrucTypeStructInstruction *DrucInstructionCourante; + register rdsrec_list *Rectangle1; + register rdsrec_list *Rectangle2; + +{ + +register long TmpDx1 = Rectangle1->X + Rectangle1->DX; +register long TmpDy1 = Rectangle1->Y + Rectangle1->DY; +register long TmpDx2 = Rectangle2->X + Rectangle2->DX; +register long TmpDy2 = Rectangle2->Y + Rectangle2->DY; +register int TmpLayerDest = DrucInstructionCourante->LAYER_DEST; + rdsrec_list *TmpRectangleDest; + + if ( ( TmpDx1 < Rectangle2->X ) || + ( TmpDx2 < Rectangle1->X ) + ) + { + return; + } + + if ( ( TmpDy1 < Rectangle2->Y ) || + ( TmpDy2 < Rectangle1->Y ) + ) + { + return; + } + + TmpRectangleDest = allocrdsrec( sizeof + ( DrucTypeStructPlusRect ) + ); + + TmpRectangleDest->X = ( ( Rectangle1->X < Rectangle2->X ) ? + Rectangle2->X : + Rectangle1->X + ); + + TmpRectangleDest->Y = ( ( Rectangle1->Y < Rectangle2->Y ) ? + Rectangle2->Y : + Rectangle1->Y + ); + + TmpRectangleDest->DX = ( ( TmpDx1 < TmpDx2 ) ? + TmpDx1 - TmpRectangleDest->X : + TmpDx2 - TmpRectangleDest->X + ); + TmpRectangleDest->DY = ( ( TmpDy1 < TmpDy2 ) ? + TmpDy1 - TmpRectangleDest->Y : + TmpDy2 - TmpRectangleDest->Y + ); + SetRdsLayer ( TmpRectangleDest , + TmpLayerDest + ); + DrucChaineCompose ( TmpRectangleDest , + Rectangle1, + DrucInstructionCourante->LAYER_1 + ); + DrucChaineCompose ( TmpRectangleDest , + Rectangle2, + DrucInstructionCourante->LAYER_2 + ); + addrdsrecwindow ( TmpRectangleDest , + DrucRdsWindow + ); + DrucAddRecFigure ( TmpRectangleDest , + DrucFigureRds , + TmpLayerDest + ); +} + +/*------------------------------------------------------------\ +| | +| DrucExclusionRectangle | +| Retourne la copie du rectangle 2 si il n'est pas en | +| intersection ou en contact avec le rectangle 1 | +| ou retoune NULL | +\------------------------------------------------------------*/ + +void DrucExclusionRectangle ( DrucFigureRds, + DrucRdsWindow, + TmpRectangle1, + DrucInstructionCourante, + UnaireX, + UnaireDX, + UnaireY, + UnaireDY + ) + rdsfig_list *DrucFigureRds; + rdswindow *DrucRdsWindow; + DrucTypeStructInstruction *DrucInstructionCourante; +register rdsrec_list *TmpRectangle1; +register long UnaireX; +register long UnaireDX; +register long UnaireY; +register long UnaireDY; + + +{ + +register rdsrec_list *TmpRectangleDest; +register int TmpLayerDest = DrucInstructionCourante->LAYER_DEST; +register int TmpLayerSource = DrucInstructionCourante->LAYER_1; + + TmpRectangleDest = allocrdsrec( sizeof ( DrucTypeStructPlusRect )); + TmpRectangleDest->X = UnaireX ; + TmpRectangleDest->Y = UnaireY ; + TmpRectangleDest->DX = UnaireDX ; + TmpRectangleDest->DY = UnaireDY ; + + SetRdsLayer ( TmpRectangleDest , + TmpLayerDest + ); + DrucChaineCompose ( TmpRectangleDest , + TmpRectangle1, + DrucInstructionCourante->LAYER_1 + ); + addrdsrecwindow ( TmpRectangleDest , + DrucRdsWindow + ); + DrucAddRecFigure ( TmpRectangleDest , + DrucFigureRds , + TmpLayerDest + ); +/*\ +DrucViewString ("\nCREATION DE RECTANGLE EXCLUS\n" + ); +viewrdsrec (TmpRectangleDest + ); +\*/ +} + +/*------------------------------------------------------------\ +| | +| DrucMarqueInclusion | +| Marque le rectangle 1 si il est en contact avec | +| le rectangle 2 | +\------------------------------------------------------------*/ + +void DrucMarqueInclusion ( UnaireX, + UnaireDX, + UnaireY, + UnaireDY, + Rectangle1, + Rectangle2 + ) +register long UnaireX; +register long UnaireDX; +register long UnaireY; +register long UnaireDY; +register rdsrec_list *Rectangle1; +register rdsrec_list *Rectangle2; + +{ + + +register long TmpDx2 = Rectangle2->X + Rectangle2->DX; +register long TmpDy2 = Rectangle2->Y + Rectangle2->DY; + + if ( ( UnaireX + UnaireDX < Rectangle2->X ) || + ( Rectangle2->X + Rectangle2->DX < UnaireX ) + ) + { + return; + } + + if ( ( UnaireY + UnaireDY < Rectangle2->Y ) || + ( Rectangle2->Y + Rectangle2->DY < UnaireY ) + ) + { + return; + } + + Rectangle1->FLAGS |= DRUC_FLAG_REC_INCLUS; +} + +/*------------------------------------------------------------\ +| | +| DrucCalculOperationUnaire | +| Retourne les dimensions d'un rectangle ayant subi l'ope | +| ration unaire contenue dans la struct instruction | +\------------------------------------------------------------*/ +void DrucCalculOperationUnaire ( DrucRdsWindow, + DrucInstructionCourante, + TmpRectangleSource, + UnaireX, + UnaireDX, + UnaireY, + UnaireDY + ) +rdswindow *DrucRdsWindow; +DrucTypeStructInstruction *DrucInstructionCourante; +rdsrec_list *TmpRectangleSource; +long *UnaireX; +long *UnaireDX; +long *UnaireY; +long *UnaireDY; + +{ + + if ( DrucInstructionCourante->OP_UNAIRE == DRUC_UNDEFINED_OP_COMPOSE ) + { + *UnaireX = TmpRectangleSource->X; + *UnaireDX = TmpRectangleSource->DX; + *UnaireY = TmpRectangleSource->Y; + *UnaireDY = TmpRectangleSource->DY; + return; + } + + switch ( DrucInstructionCourante->OP_UNAIRE ) + { + case DRUC_COMPOSE_RESIZE : + { + /*\ + * modif des dimensions X + \*/ + + if ( ( DrucInstructionCourante->DEF_VALEUR < 0 ) && + ( TmpRectangleSource->DX < abs ( DrucInstructionCourante->DEF_VALEUR ) * 2 ) + ) + { + *UnaireX = TmpRectangleSource->X + ( TmpRectangleSource->DX / 2 ); + *UnaireDX = 0; + } + else + { + *UnaireX = ( ( TmpRectangleSource->X - + DrucInstructionCourante->DEF_VALEUR ) < + DrucRdsWindow->XMIN ? + DrucRdsWindow->XMIN : + TmpRectangleSource->X - + DrucInstructionCourante->DEF_VALEUR + ); + *UnaireDX = ( ( TmpRectangleSource->X + + TmpRectangleSource->DX + + DrucInstructionCourante->DEF_VALEUR ) > + DrucRdsWindow->XMAX ? + DrucRdsWindow->XMAX - *UnaireX : + TmpRectangleSource->X + + TmpRectangleSource->DX + + DrucInstructionCourante->DEF_VALEUR - + *UnaireX + ); + } + /*\ + * modif des dimensions Y + \*/ + + if ( ( DrucInstructionCourante->DEF_VALEUR < 0 ) && + ( TmpRectangleSource->DY < abs ( DrucInstructionCourante->DEF_VALEUR ) * 2 ) + ) + { + *UnaireY = TmpRectangleSource->Y + ( TmpRectangleSource->DY / 2 ); + *UnaireDY = 0; + } + else + { + *UnaireY = ( ( TmpRectangleSource->Y - + DrucInstructionCourante->DEF_VALEUR ) < + DrucRdsWindow->YMIN ? + DrucRdsWindow->YMIN : + TmpRectangleSource->Y - + DrucInstructionCourante->DEF_VALEUR + ); + *UnaireDY = ( ( TmpRectangleSource->Y + + TmpRectangleSource->DY + + DrucInstructionCourante->DEF_VALEUR ) > + DrucRdsWindow->YMAX ? + DrucRdsWindow->YMAX - *UnaireY : + TmpRectangleSource->Y + + TmpRectangleSource->DY + + DrucInstructionCourante->DEF_VALEUR - + *UnaireY + ); + } + } + } +} + diff --git a/alliance/src/druc/src/deftools.h b/alliance/src/druc/src/deftools.h new file mode 100644 index 00000000..9aa39a73 --- /dev/null +++ b/alliance/src/druc/src/deftools.h @@ -0,0 +1,67 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DEFTOOLS.H | +| | +| Authors : Patrick Renaud | +| | +| Date : 26/07/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DefTools Fonctions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DrucChaineCompose | +| Accroche le rectangle source au rectangle dest par le champ | +| NEXT_DEFINE pour connaite la liste des rectangles ayant | +| contribue a la creation du rectangle dest | +\------------------------------------------------------------*/ +extern void DrucChaineCompose (); +/*------------------------------------------------------------\ +| | +| DrucAddRecFigure | +| insert le rectangle (initialise) dans la liste des | +| rectangles du layer donne | +\------------------------------------------------------------*/ +extern void DrucAddRecFigure (); +/*------------------------------------------------------------\ +| | +| DrucInclusionRectangle | +| Cree la copie du rectangle 2 s'il est inclus entierement| +| dans le rectangle 1 puis chaine les 2 rectangles source | +| par le pointeur USER au rectangle cree | +| ou retoune NULL | +\------------------------------------------------------------*/ +extern void DrucInclusionRectangle (); +/*------------------------------------------------------------\ +| | +| DrucIntersectRectangle | +| Cree un rectangle de dimensions et coordonnees | +| correspondant a l'intersection des 2 rectangles passes en | +| parametre | +| ou retoune NULL si les 2 rectangles ne sont pas en | +| intersection | +\------------------------------------------------------------*/ +extern void DrucIntersectRectangle (); +/*------------------------------------------------------------\ +| | +| DrucExclusionRectangle | +| Retourne la copie du rectangle 2 si il n'est pas en | +| intersection ou en contact avec le rectangle 1 | +| ou retoune NULL | +\------------------------------------------------------------*/ +extern void DrucExclusionRectangle (); +/*------------------------------------------------------------\ +| | +| DrucMarqueInclusion | +| Marque le rectangle 2 si il est inclus entierement | +| dans le rectangle 1 puis chaine les 2 rectangles source | +| par le pointeur USER au rectangle cree | +| ou retoune NULL | +\------------------------------------------------------------*/ +extern void DrucMarqueInclusion (); diff --git a/alliance/src/druc/src/defunion.c b/alliance/src/druc/src/defunion.c new file mode 100644 index 00000000..f104f16e --- /dev/null +++ b/alliance/src/druc/src/defunion.c @@ -0,0 +1,136 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DEFUNION.C | +| | +| Authors : Renaud Patrick | +| | +| Date : 26/07/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +#include +#include +#include +#include "mph.h" +#include "mut.h" +#include "rds.h" +#include "rwi.h" +#include "rut.h" +#include "rtl.h" +#include "rfm.h" +#include "rpr.h" + +#include "drucutil.h" +#include "vmctools.h" +#include "deftools.h" +#include "defunion.h" +/*------------------------------------------------------------\ +| | +| DefUnion Fonctions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DrucDefineUnion | +| Definit un layer temporaire caracterise par l'union | +| des deux layers source | +| range le resultat dans le tableau des layers user defini par| +| l'instruction | +\------------------------------------------------------------*/ + +void DrucDefineUnion ( DrucFigureRds, + DrucRdsWindow , + DrucInstructionCourante + ) + rdsfig_list *DrucFigureRds; + rdswindow *DrucRdsWindow; + DrucTypeStructInstruction *DrucInstructionCourante; + +{ + + int TmpLayerDest; + int TmpLayerSource1; + int TmpLayerSource2; +register rdsrec_list *TmpRectangleSource; +register rdsrec_list *TmpRectangleDest; + + TmpLayerDest = DrucInstructionCourante->LAYER_DEST; + TmpLayerSource1 = DrucInstructionCourante->LAYER_1; + TmpLayerSource2 = DrucInstructionCourante->LAYER_2; + /*\ + * dupliquer tous les rectangles du layer source 1 + \*/ + for ( TmpRectangleSource = DrucFigureRds->LAYERTAB[ TmpLayerSource1 ]; + TmpRectangleSource != (rdsrec_list *)NULL; + TmpRectangleSource = TmpRectangleSource->NEXT + ) + { + TmpRectangleDest = allocrdsrec ( sizeof ( DrucTypeStructPlusRect )); + TmpRectangleDest->NEXT = ( rdsrec_list *)NULL; + TmpRectangleDest->X = TmpRectangleSource->X; + TmpRectangleDest->Y = TmpRectangleSource->Y; + TmpRectangleDest->DX = TmpRectangleSource->DX; + TmpRectangleDest->DY = TmpRectangleSource->DY; + TmpRectangleDest->USER = ( rdsrec_list *)NULL; + TmpRectangleDest->NAME = TmpRectangleSource->NAME; + + SetRdsLayer ( TmpRectangleDest , + TmpLayerDest + ); + MACRO_NEXT_EQUI ( TmpRectangleDest ) = (rdsrec_list *)NULL; + DrucChaineCompose ( TmpRectangleDest , + TmpRectangleSource, + TmpLayerSource1 + ); + addrdsrecwindow ( TmpRectangleDest , + DrucRdsWindow + ); + DrucAddRecFigure ( TmpRectangleDest , + DrucFigureRds , + TmpLayerDest + ); + } + /*\ + * dupliquer tous les rectangles du layer source 2 + \*/ + + for ( TmpRectangleSource = DrucFigureRds->LAYERTAB[ TmpLayerSource2 ]; + TmpRectangleSource != (rdsrec_list *)NULL; + TmpRectangleSource = TmpRectangleSource->NEXT + ) + { + TmpRectangleDest = allocrdsrec ( sizeof ( DrucTypeStructPlusRect )); + TmpRectangleDest->NEXT = ( rdsrec_list *)NULL; + TmpRectangleDest->X = TmpRectangleSource->X; + TmpRectangleDest->Y = TmpRectangleSource->Y; + TmpRectangleDest->DX = TmpRectangleSource->DX; + TmpRectangleDest->DY = TmpRectangleSource->DY; + TmpRectangleDest->USER = (rdsrec_list *)NULL; + TmpRectangleDest->NAME = TmpRectangleSource->NAME; + + SetRdsLayer ( TmpRectangleDest , + TmpLayerDest + ); + +MACRO_INSTANCE_NUM ( TmpRectangleDest ) = MACRO_INSTANCE_NUM ( TmpRectangleSource ); + + MACRO_NEXT_EQUI ( TmpRectangleDest ) = (rdsrec_list *)NULL; + DrucChaineCompose ( TmpRectangleDest , + TmpRectangleSource, + TmpLayerSource2 + ); + addrdsrecwindow ( TmpRectangleDest , + DrucRdsWindow + ); + DrucAddRecFigure ( TmpRectangleDest , + DrucFigureRds , + TmpLayerDest + ); + } +} diff --git a/alliance/src/druc/src/defunion.h b/alliance/src/druc/src/defunion.h new file mode 100644 index 00000000..c7b90ed8 --- /dev/null +++ b/alliance/src/druc/src/defunion.h @@ -0,0 +1,25 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DEFUNION.H | +| | +| Authors : Patrick Renaud | +| | +| Date : 26/07/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DefUnion Fonctions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DrucDefineUnion | +| Definit un layer temporaire caracterise par l'union | +| des deux layers source | +| range le resultat dans le tableau des layers user defini par| +| l'instruction | +\------------------------------------------------------------*/ +extern void DrucDefineEquipot (); diff --git a/alliance/src/druc/src/drucbath.c b/alliance/src/druc/src/drucbath.c new file mode 100644 index 00000000..6abe2bdd --- /dev/null +++ b/alliance/src/druc/src/drucbath.c @@ -0,0 +1,708 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DRUCBATH.C | +| | +| Authors : Renaud Patrick | +| | +| Date : 03/07/95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +#include +#include +#include +#include +#include "mut.h" +#include "mph.h" +#include "mpu.h" +#include "rds.h" +#include "rwi.h" +#include "rut.h" +#include "rtl.h" +#include "rfm.h" +#include "rpr.h" + +#include "drucutil.h" +#include "vmctools.h" +#include "vmcerror.h" +#include "druchier.h" +#include "vmcasmld.h" +#include "vmcaract.h" +#include "defdefin.h" +#include "vmcrelat.h" +#include "drucmin.h" +#include "vmcunify.h" +#include "drucring.h" +#include "drucbath.h" +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +extern rdsfig_list *DrucFigureRdsErreur; +extern FILE *DrucErrorFile; + +/*------------------------------------------------------------\ +| | +| DrucConcateneErrorFiles | +| | +\------------------------------------------------------------*/ + +void DrucConcateneErrorFiles ( DrucFigureRds, + DrucErrorFile + ) + rdsfig_list *DrucFigureRds; + FILE *DrucErrorFile; + +{ + +rdsins_list *InstanceCourante; +char *TmpErrorFileName; +FILE *TmpErrorFile; +char DrucTmpFileBuffer [ DRUC_MAX_STRING_BUFFER + 1 ]; + + fputs ( "\n" , + DrucErrorFile + ); + fputs ( DrucFigureRds->NAME , + DrucErrorFile + ); + fputs ( "\n" , + DrucErrorFile + ); + +DrucViewString ( "Merge Errorfiles: " + ); +DrucViewString ( "\n" + ); + + for ( InstanceCourante = DrucFigureRds->INSTANCE; + InstanceCourante != (rdsins_list *)NULL; + InstanceCourante = InstanceCourante->NEXT + ) + { + TmpErrorFileName = DrucAddSuffixeName ( InstanceCourante->FIGNAME, + DRUC_ERROR_FILE_SUFFIXE + ); + + DrucViewString ("\r"); + DrucViewString ( TmpErrorFileName); + DrucViewString (" "); + + TmpErrorFile = fopen ( TmpErrorFileName, + "r" + ); + + if ( TmpErrorFile != NULL ) + { + while ( fgets( DrucTmpFileBuffer, + DRUC_MAX_FILE_BUFFER, + TmpErrorFile + ) + != (char *)NULL + ) + { + fputs ( DrucTmpFileBuffer , + DrucErrorFile + ); + } + + fclose ( TmpErrorFile + ); +/*\ + unlink ( TmpErrorFileName + ); +\*/ + } + } + DrucViewString ( "\n"); +} + +/*------------------------------------------------------------\ +| | +| DrucConcateneErrorFigures | +| | +\------------------------------------------------------------*/ + +void DrucConcateneErrorFigures ( DrucFigureRds, + DrucFigureRdsErreur + ) + rdsfig_list *DrucFigureRds; + rdsfig_list *DrucFigureRdsErreur; + +{ + +rdsfig_list *InstanceModele; +rdsins_list *InstanceCourante; +rdsrec_list *RectangleCourant; +rdsrec_list *NouveauRectangle; +char *TmpName; +int IndexLayer; + +DrucViewString ( "Merge Error Instances:" + ); + DrucViewString ( "\n" + ); + + for ( InstanceCourante = DrucFigureRds->INSTANCE; + InstanceCourante != (rdsins_list *)NULL; + InstanceCourante = InstanceCourante->NEXT + ) + { +/*\ + * pour toutes les instances de la figure inserer les rectangles + * du modele de l'instance dans le bloc +\*/ + TmpName = DrucAddSuffixeName ( InstanceCourante->FIGNAME, + DRUC_ERROR_EXTEND + ); + + InstanceModele = searchrdsfig( TmpName + ); + + if ( InstanceModele == (rdsfig_list *)NULL + ) + { + continue; + } + DrucViewString ( TmpName + ); + DrucViewString ( "\n" + ); + + for ( IndexLayer = 0; + IndexLayer < RDS_MAX_LAYER; + IndexLayer ++ + ) + { + if ( ( IndexLayer == DRUC_BBOX ) || + ( IndexLayer == RDS_USER0 ) || + ( IndexLayer == RDS_USER1 ) || + ( IndexLayer == RDS_USER2 ) || + ( IndexLayer == RDS_USER3 ) || + ( IndexLayer == RDS_USER4 ) || + ( IndexLayer == RDS_USER5 ) || + ( IndexLayer == RDS_USER6 ) || + ( IndexLayer == RDS_USER7 ) || + ( IndexLayer == RDS_USER8 ) || + ( IndexLayer == RDS_USER9 ) + ) + { + continue; + } + + for ( RectangleCourant = InstanceModele->LAYERTAB [ IndexLayer ]; + RectangleCourant != (rdsrec_list *)NULL; + RectangleCourant = RectangleCourant->NEXT + ) + { + NouveauRectangle = addrdsfigrec ( DrucFigureRdsErreur, + RectangleCourant->NAME, + IndexLayer, + RectangleCourant->X, + RectangleCourant->Y, + RectangleCourant->DX, + RectangleCourant->DY + ); + + applyrdssym ( & NouveauRectangle->X, + & NouveauRectangle->Y, + & NouveauRectangle->DX, + & NouveauRectangle->DY, + InstanceCourante->X, + InstanceCourante->Y, + InstanceCourante->TRANSF + ); + } /* for tous les rectangles */ + }/* for tous les layers */ + }/* for toutes les instances */ +} + +/*------------------------------------------------------------\ +| | +| DrucSaveFgureErreur | +| | +\------------------------------------------------------------*/ + +void DrucSaveFigureErreur ( DrucFigureRdsErreur + ) + rdsfig_list *DrucFigureRdsErreur; + +{ + +rdsrec_list *RectangleCourant; + + DrucDelLayer ( DrucFigureRdsErreur, + RDS_USER0 + ); + DrucDelLayer ( DrucFigureRdsErreur, + RDS_USER1 + ); + DrucDelLayer ( DrucFigureRdsErreur, + RDS_USER2 + ); + DrucDelLayer ( DrucFigureRdsErreur, + RDS_USER3 + ); + DrucDelLayer ( DrucFigureRdsErreur, + RDS_USER4 + ); + DrucDelLayer ( DrucFigureRdsErreur, + RDS_USER5 + ); + DrucDelLayer ( DrucFigureRdsErreur, + RDS_USER6 + ); + DrucDelLayer ( DrucFigureRdsErreur, + RDS_USER7 + ); + DrucDelLayer ( DrucFigureRdsErreur, + RDS_USER8 + ); + DrucDelLayer ( DrucFigureRdsErreur, + RDS_USER9 + ); +/*\ +viewrdsfig ( DrucFigureRdsErreur + ); +\*/ + saverdsfig ( DrucFigureRdsErreur + ); +} +/*------------------------------------------------------------\ +| | +| DrucBloc | +| | +\------------------------------------------------------------*/ + +void DrucBloc ( DrucFigureName + ) +char *DrucFigureName; + +{ + +extern DrucTypeStructRdsLayer DrucStructRdsLayer[]; +rdswindow *DrucRdsWindow; +DrucTypeStructInstruction *DrucTabInstruction = ( DrucTypeStructInstruction *)NULL; +phfig_list *DrucFigureMbk; +rdsfig_list *DrucFigureRds; +rdsins_list *InstanceCourante; +rdsfig_list *InstanceModele; +char *TmpName; +char *DrucErrorName; +char *DrucCouronneName; + + DrucFigureMbk = getphfig ( DrucFigureName, + 'A' + ); + + if ( incatalog ( DrucFigureName) || + DrucStructStat.FLAG_FLATTEN_MODE == DRUC_FLATTEN + ) + { + DrucViewString ( "Flatten DRC on: " + ); + DrucViewString ( DrucFigureName + ); + DrucViewString ( "\n" + ); + rflattenphfig ( DrucFigureMbk, + YES, + NO + ); + + DrucFigureRds = figmbkrds ( DrucFigureMbk, + MACRO_PLUS_TAILLE, + 0 + ); + +/*\ +viewrdsfig ( DrucFigureRds ); +\*/ + DrucViewString ( "Delete MBK figure : " + ); + DrucViewString ( DrucFigureName + ); + DrucViewString ( "\n" + ); + delphfig ( DrucFigureName + ); + DrucViewString ( "Load Flatten Rules : " + ); + DrucViewString ( RDS_TECHNO_NAME + ); + DrucViewString ( "\n" + ); + + DrucInitInstruction ( & DrucTabInstruction + ); + DrucViewString ( "Unify : " + ); + DrucViewString ( DrucFigureName + ); + DrucViewString ( "\n" + ); + DrucUnifyFigure ( DrucFigureRds, + DrucStructRdsLayer + ); + + DrucRdsWindow = buildrdswindow ( DrucFigureRds + ); + + DrucComputeEquiFigure ( DrucFigureRds + ); + } + else + { +/*\ + * le bloc n'est pas dans le catalogue alors on fait sa verification hierarchique +\*/ + DrucViewString ( "Hierarchical DRC on : " + ); + DrucViewString ( DrucFigureName + ); + DrucViewString ( "\n" + ); + + DrucFigureRds = figmbkrds ( DrucFigureMbk, + MACRO_PLUS_TAILLE, + 0 + ); + +/*\ +viewrdsfig ( DrucFigureRds ); +\*/ + + if ( DrucFigureRds->LAYERTAB [ DRUC_BBOX ] + != (rdsrec_list *)NULL + ) + { + delrdsfigrec ( DrucFigureRds, + DrucFigureRds->LAYERTAB [ DRUC_BBOX ] + ); + } + + DrucViewString ( "Delete MBK figure : " + ); + DrucViewString ( DrucFigureName + ); + DrucViewString ( "\n" + ); + delphfig ( DrucFigureName + ); + + for ( InstanceCourante = DrucFigureRds->INSTANCE; + InstanceCourante != (rdsins_list *)NULL; + InstanceCourante = InstanceCourante->NEXT + ) + { +/*\ + * pour toutes les instances de la figure lancer la verif hierarchique +\*/ + TmpName = DrucAddSuffixeName ( InstanceCourante->FIGNAME, + DRUC_COURONNE_EXTEND + ); + + InstanceModele = searchrdsfig ( TmpName + ); +/*\ + * si la couronne de l'instance n'exite pas lancer la verif hierarchique +\*/ + if ( InstanceModele == ( rdsfig_list *)NULL + ) + { + DrucBloc ( InstanceCourante->FIGNAME + ); + } + } + DrucViewString ( "Load Hierarchical Rules" + ); + DrucViewString ( "\n" + ); + + DrucInitInstruction ( & DrucTabInstruction + ); + + DrucViewString ( "Unify : " + ); + DrucViewString ( DrucFigureName + ); + DrucViewString ( "\n" + ); + DrucUnifyFigure ( DrucFigureRds, + DrucStructRdsLayer + ); + DrucFlattenInstanceRings ( DrucFigureRds + ); + + InstanceCourante = DrucFigureRds->INSTANCE; + DrucFigureRds->INSTANCE = (rdsins_list *)NULL; + DrucRdsWindow = buildrdswindow ( DrucFigureRds + ); + DrucFigureRds->INSTANCE = InstanceCourante; + + DrucComputeEquiFigure ( DrucFigureRds + ); + }/* else */ +/*\ + * la figure RDS est chargee soit a plat soit avec ses couronnes on n'a plus besoin de MBK +\*/ + DrucCouronneName = DrucAddSuffixeName ( DrucFigureName, + DRUC_COURONNE_EXTEND + ); + + DrucViewString ( "\nCreate Ring : " + ); + DrucViewString ( DrucCouronneName + ); + DrucViewString ( "\n" + ); + + DrucCreateCouron ( DrucFigureRds, + DrucRdsWindow, + DrucCouronneName + ); +/*\ + * ici se colle la concatenation des fichiers d'erreurs + * ici se colle la verification +\*/ + + DrucErrorName = DrucAddSuffixeName ( DrucFigureName, + DRUC_ERROR_FILE_SUFFIXE + ); + + DrucOpenErrorFile ( DrucErrorName, + "w" + ); + DrucConcateneErrorFiles ( DrucFigureRds, + DrucErrorFile + ); +/*\ + * concatener les figures des erreurs +\*/ + DrucConcateneErrorFigures ( DrucFigureRds, + DrucFigureRdsErreur + ); +/*\ + * envoyer la verif des regles +\*/ + DrucMin ( DrucFigureRds, + DrucRdsWindow, + DrucTabInstruction , + DrucNombreInstructions + ); + +/*\ + * fermer le fichier des erreurs + * sauver la figure des erreurs +\*/ + DrucSaveFigureErreur ( DrucFigureRdsErreur + ); + DrucDelLayer ( DrucFigureRds, + DRUC_BBOX + ); + DrucDelLayer ( DrucFigureRds, + RDS_USER0 + ); + DrucDelLayer ( DrucFigureRds, + RDS_USER1 + ); + DrucDelLayer ( DrucFigureRds, + RDS_USER2 + ); + DrucDelLayer ( DrucFigureRdsErreur, + RDS_USER3 + ); + DrucDelLayer ( DrucFigureRdsErreur, + RDS_USER4 + ); + DrucDelLayer ( DrucFigureRdsErreur, + RDS_USER5 + ); + DrucDelLayer ( DrucFigureRdsErreur, + RDS_USER6 + ); + DrucDelLayer ( DrucFigureRdsErreur, + RDS_USER7 + ); + DrucDelLayer ( DrucFigureRdsErreur, + RDS_USER8 + ); + DrucDelLayer ( DrucFigureRdsErreur, + RDS_USER9 + ); + InstanceCourante = DrucFigureRds->INSTANCE; + DrucFigureRds->INSTANCE = (rdsins_list *)NULL; + + + DrucFigureRds->INSTANCE = InstanceCourante; +/*\ +\*/ + DrucFigureRds->INSTANCE = (rdsins_list *)NULL; + + destroyrdswindow ( DrucFigureRds, + DrucRdsWindow + ); + delrdsfig ( DrucFigureName + ); + DrucViewString ( "End DRC on: " + ); + DrucViewString ( DrucFigureName + ); + DrucViewString ( "\n" + ); + DrucCloseErrorFile ( + ); +} + +/*------------------------------------------------------------\ +| | +| Main | +| | +\------------------------------------------------------------*/ +void main (argc , argv ) + int argc; + char *argv[]; +{ +phfig_list *DrucFigureMbk; +rdsfig_list *DrucFigureRds; +rdswindow *DrucRdsWindow; +char *Name; +char *DrucFigureName; +char *DrucErrorName = (char *)NULL; +char *DrucCouronneRdsName; +char *DrucNetworkName; +DrucTypeStructInstruction *DrucTabInstruction = ( DrucTypeStructInstruction *)NULL; +int IndexLayer; +int Resultat; +int IndexName = 1; + + int i; + boolean A,B; + + mbkenv ( + ); + +/*\ + * affichage de la banniere standard +\*/ + alliancebanner ( "DRuC", + VERSION, + "Design Rule Checker", + "1993", + ALLIANCE_VERSION + ); + +if ( argc < 2 || argc > 4 + ) +{ + printf ( "Usage : %s figure_name (without extention) [-verbose] [-hierarchy]\n",argv [0]); +/*\ +\*/ + exit ( 2 ); +} + A = DRUC_SILENT; + B = DRUC_FLATTEN; + + for ( i = 1 ; + i < argc; + i ++ + ) + { + if (strcmp ( argv [i], "-verbose" )==0) + { + A = DRUC_VERBOSE; + } + else + { + if (strcmp ( argv [i], "-hierarchy" )==0) + { + B = DRUC_HIERARCHIE; + } + else + { + IndexName = i; + } + } + } + DrucStatInit ( B, + DRUC_VERBOSE, + A, + DRUC_ERROR_FILE + ); + + Name = argv [ IndexName ]; + + DrucFigureName = namealloc ( Name + ); + Name = malloc ( strlen ( DrucFigureName ) + + strlen ( DRUC_ERROR_EXTEND) + + 1 + ); + + strcpy ( Name , + DrucFigureName + ); + strcat ( Name, + DRUC_ERROR_EXTEND + ); + DrucErrorName = namealloc ( Name ); + free ( Name + ); + rdsenv ( + ); + loadrdsparam ( + ); +/*\ + * creer la figure des erreurs locales +\*/ + DrucFigureRdsErreur = addrdsfig ( DrucErrorName, + MACRO_PLUS_TAILLE + ); + + DrucBloc ( DrucFigureName + ); + DrucViewString ( "Saving the Error file figure\n" + ); + DrucDelLayer ( DrucFigureRdsErreur, + DRUC_BBOX + ); + DrucViewString ( "Done\n" + ); + DrucViewNumber ( DrucStructStat.ERROR_NUMBER + ); + DrucViewString ( "\n" + ); + + if ( DrucStructStat.ERROR_NUMBER == 0 + ) + { + fprintf ( stdout, + "\nFile: %s%s is empty: no errors detected.\n", + DrucFigureName, + namealloc ( DRUC_ERROR_FILE_SUFFIXE + ) + ); + } + else + { + fprintf ( stdout, + "\nSome errors have been detected, see file: %s%s for detailled\n", + DrucFigureName, + namealloc ( DRUC_ERROR_FILE_SUFFIXE + ) + ); + } + exit ( DrucStructStat.ERROR_NUMBER + ); +} + + + diff --git a/alliance/src/druc/src/drucbath.h b/alliance/src/druc/src/drucbath.h new file mode 100644 index 00000000..266ff8e8 --- /dev/null +++ b/alliance/src/druc/src/drucbath.h @@ -0,0 +1,29 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DRUCFLAT.H | +| | +| Authors : Renaud Patrick | +| | +| Date : 11/01/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +extern rdsfig_list *DrucFigureRdsErreur; +extern DrucTypeStructRdsLayer DrucStructRdsLayer[]; +/*------------------------------------------------------------\ +| | +| Fonction main | +| | +\------------------------------------------------------------*/ +#define DRUC_OPTION_FIGURE_NAME "-f=" +#define DRUC_OPTION_ERROR_NAME "-e=" +#define DRUC_OPTION_NETWORK_NAME "-n=" +#define DRUC_CATAL_NAME "CATAL" +#define DRUC_TECHNO_NAME "DRUC_ASM.TMP" +#define DRUC_NETWORK_NAME "" diff --git a/alliance/src/druc/src/drucgral.c b/alliance/src/druc/src/drucgral.c new file mode 100644 index 00000000..1b639ed7 --- /dev/null +++ b/alliance/src/druc/src/drucgral.c @@ -0,0 +1,184 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DRUCGRAAL.C | +| | +| Authors : Renaud Patrick | +| | +| Date : 11/01/94 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +#include +#include +#include +#include "mph.h" +#include "mut.h" +#include "rds.h" +#include "rwi.h" +#include "rut.h" +#include "rtl.h" +#include "rfm.h" +#include "rpr.h" + +#include "drucutil.h" +#include "vmctools.h" +#include "vmcerror.h" +#include "druchier.h" +#include "vmcasmld.h" +#include "vmcaract.h" +#include "defdefin.h" +#include "vmcrelat.h" +#include "vmcunify.h" +#include "drucmin.h" + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +extern rdsfig_list *DrucFigureRdsErreur; +extern DrucTypeStructRdsLayer DrucStructRdsLayer[]; + +/*------------------------------------------------------------\ +| | +| Fonctions | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| drucgeterror | +| | +\------------------------------------------------------------*/ + +char *drucgeterror( Rule + ) + long Rule; + +{ + + return ( DrucGetRuleComment ( Rule + ) + ); +} + +/*------------------------------------------------------------\ +| | +| drucrdsfig | +| | +\------------------------------------------------------------*/ +rdsfig_list *drucrdsfig ( DrucFigureRds, + DrucFigureRdsErrorName + ) + rdsfig_list *DrucFigureRds; + char *DrucFigureRdsErrorName; + +{ + +rdswindow *DrucRdsWindow; +static DrucTypeStructInstruction *DrucTabInstruction = ( DrucTypeStructInstruction *)NULL; +int LayerCourant; +int IndexLayer; + + DrucStatInit ( DRUC_FLATTEN, + DRUC_SILENT, + DRUC_SILENT, + DRUC_NO_ERROR_FILE + ); + + DrucFigureRdsErreur = addrdsfig ( DrucFigureRdsErrorName, + MACRO_PLUS_TAILLE + ); + +/* +** Modified by L.Jacomme the 14/10/95 +*/ + if ( DrucTabInstruction == ( DrucTypeStructInstruction * )NULL ) + { + DrucInitInstruction ( & DrucTabInstruction + ); + } +/* +** End +*/ + + DrucRdsWindow = buildrdswindow ( DrucFigureRds + ); + + for ( IndexLayer = 0; + IndexLayer < RDS_MAX_LAYER -1; + IndexLayer ++ + ) + { + LayerCourant = DrucStructRdsLayer [ IndexLayer ].RDS_INDEX ; + + if ( LayerCourant != DRUC_UNDEFINED_LAYER + ) + { + if ( DrucFigureRds->LAYERTAB [ LayerCourant ] != ( rdsrec_list * ) NULL + ) + { + DrucComputeEquiLayer ( DrucFigureRds , + LayerCourant + ); + } + } + } + + destroyrdswindow ( DrucFigureRds, + DrucRdsWindow + ); +/*\ + * le parametre DrucRdsWindow etait ooublie dans l'appel de DrucUnify + * thnaks to Xavier +\*/ + DrucUnify ( DrucFigureRds, + DrucRdsWindow + ); + + DrucRdsWindow = buildrdswindow ( DrucFigureRds + ); + for ( IndexLayer = 0; + IndexLayer < RDS_MAX_LAYER -1; + IndexLayer ++ + ) + { + LayerCourant = DrucStructRdsLayer [ IndexLayer ].RDS_INDEX ; + + if ( LayerCourant != DRUC_UNDEFINED_LAYER + ) + { + if ( DrucFigureRds->LAYERTAB [ LayerCourant ] != ( rdsrec_list * ) NULL + ) + { + DrucComputeEquiLayer ( DrucFigureRds , + LayerCourant + ); + } + } + } + + DrucMin ( DrucFigureRds, + DrucRdsWindow, + DrucTabInstruction , + DrucNombreInstructions + ); + destroyrdswindow ( DrucFigureRds, + DrucRdsWindow + ); + delrdsfig ( DrucFigureRds->NAME + ); + return ( DrucFigureRdsErreur + ); +} + + diff --git a/alliance/src/druc/src/drucgral_test.c b/alliance/src/druc/src/drucgral_test.c new file mode 100644 index 00000000..816eac01 --- /dev/null +++ b/alliance/src/druc/src/drucgral_test.c @@ -0,0 +1,191 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DRUCGRAL_TEST.C | +| | +| Authors : Renaud Patrick | +| | +| Date : 11/01/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +#include +#include +#include +#include +#include "mph.h" +#include "mut.h" +#include "rds.h" +#include "rut.h" +#include "rtl.h" +#include "rwi.h" +#include "rfm.h" +#include "rpr.h" + +#include "drucutil.h" +#include "vmctools.h" +#include "vmcerror.h" +#include "druchier.h" +#include "vmcasmld.h" +#include "vmcaract.h" +#include "defdefin.h" +#include "vmcrelat.h" +#include "drucmin.h" +#include "vmcunify.h" +#include "drucring.h" + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +extern rdsfig_list *DrucFigureRdsErreur; + +/*------------------------------------------------------------\ +| | +| Main | +| | +\------------------------------------------------------------*/ +void main (argc , argv ) + int argc; + char *argv[]; +{ +phfig_list *DrucFigureMbk; +rdsfig_list *DrucFigureRds; +rdswindow *DrucRdsWindow; +char *Name; +char *DrucFigureName; +char *DrucErrorName = (char *)NULL; +char *DrucCouronneRdsName; +char *DrucNetworkName; +DrucTypeStructInstruction *DrucTabInstruction = ( DrucTypeStructInstruction *)NULL; +int DrucNombreInstructions; +int IndexLayer; +int Resultat; + +/*\ + * lecture des parametres d'entree +\*/ + if ( argc != 2 + ) + { + printf ( "Usage : %s figure_name (without extention)\n",argv [0] + ); + exit ( 1 + ); + } + +/*\ + * affichage de la banniere standard +\*/ + alliancebanner ( "DRCGraL", + VERSION, + "Design Rule Checker", + "1993", + ALLIANCE_VERSION + ); + DrucStatInit ( DRUC_FLATTEN, + DRUC_SILENT, + DRUC_SILENT, + DRUC_NO_ERROR_FILE + ); + + Name = argv [ 1 ]; + + DrucFigureName = namealloc ( Name + ); + + Name = malloc ( strlen ( DrucFigureName ) + + strlen ( DRUC_ERROR_EXTEND) + + 1 + ); + + strcpy ( Name , + DrucFigureName + ); + strcat ( Name, + DRUC_ERROR_EXTEND + ); + + DrucErrorName = namealloc ( Name + ); + + free ( Name + ); + mbkenv ( + ); + rdsenv ( + ); + loadrdsparam ( + ); + DrucFigureMbk = getphfig ( DrucFigureName, + 'A' + ); + + DrucViewString ( "Flatten DRC on: " + ); + DrucViewString ( DrucFigureName + ); + DrucViewString ( "\n" + ); + rflattenphfig ( DrucFigureMbk, + YES, + NO + ); + DrucFigureRds = figmbkrds ( DrucFigureMbk, + MACRO_PLUS_TAILLE, + 0 + ); + + DrucViewString ( "Delete MBK figure : " + ); + DrucViewString ( DrucFigureName + ); + DrucViewString ( "\n" + ); + + delphfig ( DrucFigureName + ); + + DrucViewString ( "Load Flatten Rules : " + ); + DrucViewString ( RDS_TECHNO_NAME + ); + DrucViewString ( "\n" + ); + + DrucOpenErrorFile ( DrucErrorName, + "w" + ); + DrucFigureRdsErreur = drucrdsfig ( DrucFigureRds, + DrucErrorName + ); + + DrucStatInit ( DRUC_FLATTEN, + DRUC_VERBOSE, + DRUC_NO_ERROR_FILE + ); + viewrdsfig ( DrucFigureRdsErreur + ); + DrucViewString ( "\n" + ); + DrucViewRuleComment ( + ); + DrucViewString ( "\nnombre d'erreurs rencontrees = valeur de sortie: " + ); + DrucViewNumber ( DrucStructStat.ERROR_NUMBER + ); + DrucViewString ( "\n" + ); + exit ( DrucStructStat.ERROR_NUMBER + ); +} + + + diff --git a/alliance/src/druc/src/druchier.c b/alliance/src/druc/src/druchier.c new file mode 100644 index 00000000..fb314d4c --- /dev/null +++ b/alliance/src/druc/src/druchier.c @@ -0,0 +1,1330 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DRUCHIER.C | +| | +| Authors : Patrick Renaud | +| | +| Date : 03/07/95 | +| | +\------------------------------------------------------------*/ +#include +#include +#include +#include +#include +#include "mph.h" +#include "mut.h" +#include "rds.h" +#include "rwi.h" +#include "rut.h" +#include "rtl.h" +#include "rfm.h" +#include "rpr.h" + +#include "drucutil.h" +#include "druchier.h" +/*------------------------------------------------------------\ +| | +| DRUCRING Constantes | +| | +\------------------------------------------------------------*/ +/*\ + * tableau des equivalences layer <-> transparences +\*/ +DrucTypeStructTransEquiv TabTransEquivalence [ ] = + { + { RDS_LAYER_ALU1 , RDS_LAYER_TALU1 }, + { RDS_LAYER_ALU2 , RDS_LAYER_TALU2 }, + { RDS_LAYER_ALU3 , RDS_LAYER_TALU3 }, + { RDS_LAYER_POLY , RDS_LAYER_TPOLY } + }; + +/*\ + * tableau des equivalences layer <-> virtuels +\*/ +DrucTypeStructVirtuEquiv TabVirtuEquivalence [ ] = + { + { RDS_LAYER_ALU1 , RDS_LAYER_VALU1 } + }; + +/*------------------------------------------------------------\ +| | +| DRUCHIER variables | +| | +\------------------------------------------------------------*/ +extern long DrucCtmMax; + +static char DrucFileBuffer [ DRUC_MAX_FILE_BUFFER + 1 ]; + +/*------------------------------------------------------------\ +| | +| DRUCHIER Fonctions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DrucAsTransparenceEquivalent | +| | +\------------------------------------------------------------*/ +int DrucAsTransparenceEquivalent ( LayerInitial + ) + int LayerInitial; +{ +int IndexTransp; + + LayerInitial = RDS_STATIC_LAYER[ LayerInitial ]; + + for ( IndexTransp = 0; + IndexTransp < DRUC_MAX_TRANSPARENCES; + IndexTransp ++ + ) + { + if ( ( ( TabTransEquivalence [ IndexTransp ] ).LAYER_INDEX ) == + LayerInitial + ) + { + return ( RDS_DYNAMIC_LAYER[ ( TabTransEquivalence [ IndexTransp ] ).LAYER_TRANSPARENCE ] ); + } + } +/*\ + * erreur l'appelant a trouve une transparence et la on ne l'a pas trouve +\*/ + return ( DRUC_UNDEFINED_LAYER ); +} +/*------------------------------------------------------------\ +| | +| DrucAsVietuelEquivalent | +| | +\------------------------------------------------------------*/ +int DrucAsVirtuelEquivalent ( LayerInitial + ) + int LayerInitial; +{ +int IndexVirtu; + + LayerInitial = RDS_STATIC_LAYER[ LayerInitial ]; + + for ( IndexVirtu = 0; + IndexVirtu < DRUC_MAX_VIRTUELS; + IndexVirtu ++ + ) + { + if ( ( ( TabVirtuEquivalence [ IndexVirtu ] ).LAYER_INDEX ) == + LayerInitial + ) + { +int toto; +toto = RDS_DYNAMIC_LAYER[ ( TabVirtuEquivalence [ IndexVirtu ] ).LAYER_VIRTUEL ] ; + return ( toto ); + } + } +/*\ + * erreur l'appelant a trouve une transparence et la on ne l'a pas trouve +\*/ + return ( DRUC_UNDEFINED_LAYER ); +} +/*------------------------------------------------------------\ +| | +| DrucInitialiseRegle | +| | +\------------------------------------------------------------*/ +void DrucInitialiseRegle ( DrucStructInstruction + ) +DrucTypeStructInstruction *DrucStructInstruction; +{ +int IndexMesure; + + DrucStructInstruction->NEXT = ( DrucTypeStructInstruction *)NULL; + DrucStructInstruction->INSTRUCTION = DRUC_UNDEFINED_INSTRUCTION; + DrucStructInstruction->LAYER_DEST = DRUC_UNDEFINED_LAYER; + DrucStructInstruction->LAYER_1 = DRUC_UNDEFINED_LAYER;; + DrucStructInstruction->LAYER_2 = DRUC_UNDEFINED_LAYER;; + DrucStructInstruction->OP_COMPOSE = DRUC_UNDEFINED_OPERATEUR; + for ( IndexMesure = 0; + IndexMesure < DRUC_MAX_MESURES; + IndexMesure ++ + ) + { + DrucStructInstruction->REGLE_NUM [ IndexMesure ] = DRUC_UNDEFINED_REGLE; + DrucStructInstruction->RELATION [ IndexMesure ] = DRUC_UNDEFINED_RELATION; + DrucStructInstruction->MESURE [ IndexMesure ] = DRUC_UNDEFINED_MESURE; + DrucStructInstruction->OP_COMPARE [ IndexMesure ] = DRUC_UNDEFINED_OPERATEUR; + DrucStructInstruction->VALEUR [ IndexMesure ] =DRUC_UNDEFINED_VALEUR; + } +} +/*------------------------------------------------------------\ +| | +| DrucAddBBoxRules | +| | +\------------------------------------------------------------*/ +void DrucAddABoxRules ( DrucStructInstruction, + DrucNombreInstructions + ) +DrucTypeStructInstruction **DrucStructInstruction; +int *DrucNombreInstructions; +{ +DrucTypeStructInstruction *TmpStructInstruction; +int InstructionAddNumber ; +int IndexMesure; + +InstructionAddNumber = DRUC_RULES_BASE_ABOX; + TmpStructInstruction = + ( DrucTypeStructInstruction *)malloc (sizeof ( DrucTypeStructInstruction )); + if (TmpStructInstruction == (DrucTypeStructInstruction *)NULL ) + { + DRUC_EXIT ( DRUC_ERROR_MEMOIRE ); + } + DrucInitialiseRegle ( TmpStructInstruction + ); + TmpStructInstruction->NEXT = *DrucStructInstruction; + TmpStructInstruction->INSTRUCTION = DRUC_ASM_BEGIN_REGLE; + TmpStructInstruction->LAYER_DEST = DRUC_UNDEFINED_LAYER; + TmpStructInstruction->LAYER_1 = DRUC_BBOX; + TmpStructInstruction->LAYER_2 = DRUC_BBOX; + TmpStructInstruction->OP_COMPOSE = DRUC_INSTR_RELATION; + + for ( IndexMesure = 0; + IndexMesure < 6; + IndexMesure ++ + ) + { + TmpStructInstruction->REGLE_NUM [ IndexMesure ] = InstructionAddNumber ++; + } + TmpStructInstruction->RELATION [ 0 ] = DRUC_RELATION_ENVELOPPE; + TmpStructInstruction->MESURE [ 0 ] = DRUC_MESURE_LARGEUR_INTER; + TmpStructInstruction->OP_COMPARE [ 0 ] = DRUC_OPERATION_INF; + TmpStructInstruction->VALEUR [ 0 ] = 0; + TmpStructInstruction->RELATION [ 1 ] = DRUC_RELATION_MARGE; + TmpStructInstruction->MESURE [ 1 ] = DRUC_MESURE_PENETRE_INTER; + TmpStructInstruction->OP_COMPARE [ 1 ] = DRUC_OPERATION_INFEQ; + TmpStructInstruction->VALEUR [ 1 ] = 0; + TmpStructInstruction->RELATION [ 2 ] = DRUC_RELATION_CROIX; + TmpStructInstruction->MESURE [ 2 ] = DRUC_MESURE_LARGEUR_INTER; + TmpStructInstruction->OP_COMPARE [ 2 ] = DRUC_OPERATION_INF; + TmpStructInstruction->VALEUR [ 2 ] = 0; + TmpStructInstruction->RELATION [ 3 ] = DRUC_RELATION_INTERSECTION; + TmpStructInstruction->MESURE [ 3 ] = DRUC_MESURE_LARGEUR_INTER; + TmpStructInstruction->OP_COMPARE [ 3 ] = DRUC_OPERATION_INFEQ; + TmpStructInstruction->VALEUR [ 3 ] = 0; + TmpStructInstruction->RELATION [ 4 ] = DRUC_RELATION_EXTENSION; + TmpStructInstruction->MESURE [ 4 ] = DRUC_MESURE_PENETRE_INTER; + TmpStructInstruction->OP_COMPARE [ 4 ] = DRUC_OPERATION_INFEQ; + TmpStructInstruction->VALEUR [ 4 ] = 0; + TmpStructInstruction->RELATION [ 5 ] = DRUC_RELATION_INCLUSION; + TmpStructInstruction->MESURE [ 5 ] = DRUC_MESURE_LARGEUR_INTER; + TmpStructInstruction->OP_COMPARE [ 5 ] = DRUC_OPERATION_INF; + TmpStructInstruction->VALEUR [ 5 ] = 0; + *DrucStructInstruction = TmpStructInstruction; + (*DrucNombreInstructions) ++; +} +/*------------------------------------------------------------\ +| | +| DrucAddOneLayerTransparentRule | +| cree les regles specifiques de contact nul et distance | +| identiques | +| | +\------------------------------------------------------------*/ +void DrucAddOneLayerTransparentRule ( DrucInstructionRef, + DrucStructInstruction, + DrucNombreInstructions + ) +DrucTypeStructInstruction *DrucInstructionRef; +DrucTypeStructInstruction **DrucStructInstruction; +int *DrucNombreInstructions; +{ +DrucTypeStructInstruction *TmpStructInstruction; +int InstructionAddNumber ; +int IndexMesure; +int IndexSuite; +int LayerTransparent; +int LayerSource; +int LayerSource2; + + LayerSource = DrucInstructionRef->LAYER_1 ; + LayerSource2 = DrucInstructionRef->LAYER_2 ; + LayerTransparent = DrucAsTransparenceEquivalent ( LayerSource ); + + TmpStructInstruction = + ( DrucTypeStructInstruction *)malloc (sizeof ( DrucTypeStructInstruction )); + if (TmpStructInstruction == (DrucTypeStructInstruction *)NULL ) + { + DRUC_EXIT ( DRUC_ERROR_MEMOIRE ); + } + DrucInitialiseRegle ( TmpStructInstruction); + + TmpStructInstruction->NEXT = *DrucStructInstruction; + TmpStructInstruction->INSTRUCTION = DrucInstructionRef->INSTRUCTION; + TmpStructInstruction->LAYER_DEST = DrucInstructionRef->LAYER_DEST; + TmpStructInstruction->LAYER_1 = LayerTransparent; + TmpStructInstruction->LAYER_2 = LayerSource2; + TmpStructInstruction->OP_COMPOSE = DrucInstructionRef->OP_COMPOSE; + + DrucStructRdsLayer [ LayerTransparent ].RDS_INDEX = LayerTransparent; + DrucStructRdsLayer [ LayerTransparent ].WIDTH = + ( DrucStructRdsLayer [ LayerSource ] ).WIDTH; + DrucStructRdsLayer [ LayerTransparent ].CTM = + ( DrucStructRdsLayer [ LayerSource ] ).CTM; + + /*\ + * recopier les regles de distance + \*/ + IndexSuite = 0; + for ( IndexMesure = 0; + IndexMesure < DRUC_MAX_MESURES; + IndexMesure ++ + ) + { + if ( ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + != DRUC_UNDEFINED_REGLE + ) + { + if ( (DrucInstructionRef->RELATION [ IndexMesure ] ) == + DRUC_RELATION_DISTANCE + ) + { + TmpStructInstruction->REGLE_NUM [ IndexSuite ] = + ( DrucInstructionRef->REGLE_NUM [ 0 ] ) + IndexSuite + + DRUC_DEUX_CORPS_TRANS_METAL; + TmpStructInstruction->RELATION [ IndexSuite ] = + DrucInstructionRef->RELATION [ IndexMesure ]; + TmpStructInstruction->MESURE [ IndexSuite ] = + DrucInstructionRef->MESURE [ IndexMesure] ; + TmpStructInstruction->OP_COMPARE [ IndexSuite ] = + DrucInstructionRef->OP_COMPARE [ IndexMesure ] ; + TmpStructInstruction->VALEUR [ IndexSuite ] = + DrucInstructionRef->VALEUR [ IndexMesure] ; + IndexSuite ++ ; + } + } + } + + /*\ + * creer les regles de contact nulles + \*/ + TmpStructInstruction->RELATION [ IndexSuite ] = DRUC_RELATION_ENVELOPPE; + TmpStructInstruction->MESURE [ IndexSuite ] = DRUC_MESURE_LARGEUR_INTER; + TmpStructInstruction->OP_COMPARE [ IndexSuite ] = DRUC_OPERATION_INF; + TmpStructInstruction->VALEUR [ IndexSuite ] = 0; + TmpStructInstruction->REGLE_NUM [ IndexSuite ] = + ( DrucInstructionRef->REGLE_NUM [ 0 ] ) + IndexSuite + + DRUC_DEUX_CORPS_TRANS_METAL; + IndexSuite ++ ; + + TmpStructInstruction->RELATION [ IndexSuite ] = DRUC_RELATION_MARGE; + TmpStructInstruction->MESURE [ IndexSuite ] = DRUC_MESURE_PENETRE_INTER; + TmpStructInstruction->OP_COMPARE [ IndexSuite ] = DRUC_OPERATION_INF; + TmpStructInstruction->VALEUR [ IndexSuite ] = 0; + TmpStructInstruction->REGLE_NUM [ IndexSuite ] = + ( DrucInstructionRef->REGLE_NUM [ 0 ] ) + IndexSuite + + DRUC_DEUX_CORPS_TRANS_METAL; + IndexSuite ++ ; + + TmpStructInstruction->RELATION [ IndexSuite ] = DRUC_RELATION_CROIX; + TmpStructInstruction->MESURE [ IndexSuite ] = DRUC_MESURE_LARGEUR_INTER; + TmpStructInstruction->OP_COMPARE [ IndexSuite ] = DRUC_OPERATION_INF; + TmpStructInstruction->VALEUR [ IndexSuite ] = 0; + TmpStructInstruction->REGLE_NUM [ IndexSuite ] = + ( DrucInstructionRef->REGLE_NUM [ 0 ] ) + IndexSuite + + DRUC_DEUX_CORPS_TRANS_METAL; + IndexSuite ++ ; + + TmpStructInstruction->RELATION [ IndexSuite ] = DRUC_RELATION_INTERSECTION; + TmpStructInstruction->MESURE [ IndexSuite ] = DRUC_MESURE_LARGEUR_INTER; + TmpStructInstruction->OP_COMPARE [ IndexSuite ] = DRUC_OPERATION_INF; + TmpStructInstruction->VALEUR [ IndexSuite ] = 0; + TmpStructInstruction->REGLE_NUM [ IndexSuite ] = + ( DrucInstructionRef->REGLE_NUM [ 0 ] ) + IndexSuite + + DRUC_DEUX_CORPS_TRANS_METAL; + IndexSuite ++ ; + + TmpStructInstruction->RELATION [ IndexSuite ] = DRUC_RELATION_EXTENSION; + TmpStructInstruction->MESURE [ IndexSuite ] = DRUC_MESURE_PENETRE_INTER; + TmpStructInstruction->OP_COMPARE [ IndexSuite ] = DRUC_OPERATION_INF; + TmpStructInstruction->VALEUR [ IndexSuite ] = 0; + TmpStructInstruction->REGLE_NUM [ IndexSuite ] = + ( DrucInstructionRef->REGLE_NUM [ 0 ] ) + IndexSuite + + DRUC_DEUX_CORPS_TRANS_METAL; + IndexSuite ++ ; + + TmpStructInstruction->RELATION [ IndexSuite ] = DRUC_RELATION_INCLUSION; + TmpStructInstruction->MESURE [ IndexSuite ] = DRUC_MESURE_LARGEUR_INTER; + TmpStructInstruction->OP_COMPARE [ IndexSuite ] = DRUC_OPERATION_INF; + TmpStructInstruction->VALEUR [ IndexSuite ] = 0; + TmpStructInstruction->REGLE_NUM [ IndexSuite ] = + ( DrucInstructionRef->REGLE_NUM [ 0 ] ) + IndexSuite + + DRUC_DEUX_CORPS_TRANS_METAL; + + *DrucStructInstruction = TmpStructInstruction; + (*DrucNombreInstructions) ++; + + /*\ + * creer les regles Transparences<-->Transparences pour le meme layer + \*/ + TmpStructInstruction = + ( DrucTypeStructInstruction *)malloc (sizeof ( DrucTypeStructInstruction )); + if (TmpStructInstruction == (DrucTypeStructInstruction *)NULL ) + { + DRUC_EXIT ( DRUC_ERROR_MEMOIRE ); + } + DrucInitialiseRegle ( TmpStructInstruction); + + TmpStructInstruction->NEXT = *DrucStructInstruction; + TmpStructInstruction->INSTRUCTION = DrucInstructionRef->INSTRUCTION; + TmpStructInstruction->LAYER_DEST = DrucInstructionRef->LAYER_DEST; + TmpStructInstruction->LAYER_1 = LayerTransparent; + TmpStructInstruction->LAYER_2 = LayerTransparent; + TmpStructInstruction->OP_COMPOSE = DrucInstructionRef->OP_COMPOSE; + + /*\ + * recopier les regles + \*/ + IndexSuite = 0; + for ( IndexMesure = 0; + IndexMesure < DRUC_MAX_MESURES; + IndexMesure ++ + ) + { + if ( ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + != DRUC_UNDEFINED_REGLE + ) + { + TmpStructInstruction->REGLE_NUM [ IndexSuite ] = + ( DrucInstructionRef->REGLE_NUM [ 0 ] ) + IndexSuite + + DRUC_DEUX_CORPS_TRANS_TRANS; + TmpStructInstruction->RELATION [ IndexSuite ] = + DrucInstructionRef->RELATION [ IndexMesure ]; + TmpStructInstruction->MESURE [ IndexSuite ] = + DrucInstructionRef->MESURE [ IndexMesure ]; + TmpStructInstruction->OP_COMPARE [ IndexSuite ] = + DrucInstructionRef->OP_COMPARE [ IndexMesure ]; + TmpStructInstruction->VALEUR [ IndexSuite ] = + DrucInstructionRef->VALEUR [ IndexMesure ]; + IndexSuite ++ ; + } + } + *DrucStructInstruction = TmpStructInstruction; + (*DrucNombreInstructions) ++; + +} +/*------------------------------------------------------------\ +| | +| DrucDuplicateUnCorpsTransparent | +| cree les regles specifiques de contact possible et distance | +| identiques | +| | +\------------------------------------------------------------*/ +void DrucDuplicateUnCorpsTransparent ( DrucInstructionRef, + DrucStructInstruction, + DrucNombreInstructions + ) +DrucTypeStructInstruction *DrucInstructionRef; +DrucTypeStructInstruction **DrucStructInstruction; +int *DrucNombreInstructions; +{ +DrucTypeStructInstruction *TmpStructInstruction; +int InstructionAddNumber ; +int IndexMesure; +int IndexSuite; +int LayerTransparent; +int LayerSource; +int LayerSource2; + + LayerSource = DrucInstructionRef->LAYER_1 ; + LayerSource2 = DrucInstructionRef->LAYER_2 ; + LayerTransparent = DrucAsTransparenceEquivalent ( LayerSource ); + + TmpStructInstruction = + ( DrucTypeStructInstruction *)malloc (sizeof ( DrucTypeStructInstruction )); + if (TmpStructInstruction == (DrucTypeStructInstruction *)NULL ) + { + DRUC_EXIT ( DRUC_ERROR_MEMOIRE ); + } + DrucInitialiseRegle ( TmpStructInstruction); + + TmpStructInstruction->NEXT = *DrucStructInstruction; + TmpStructInstruction->INSTRUCTION = DrucInstructionRef->INSTRUCTION; + TmpStructInstruction->LAYER_DEST = DrucInstructionRef->LAYER_DEST; + TmpStructInstruction->LAYER_1 = LayerTransparent; + TmpStructInstruction->LAYER_2 = LayerSource2; + TmpStructInstruction->OP_COMPOSE = DrucInstructionRef->OP_COMPOSE; + + DrucStructRdsLayer [ LayerTransparent ].RDS_INDEX = LayerTransparent; + DrucStructRdsLayer [ LayerTransparent ].WIDTH = + ( DrucStructRdsLayer [ LayerSource ] ).WIDTH; + DrucStructRdsLayer [ LayerTransparent ].CTM = + ( DrucStructRdsLayer [ LayerSource ] ).CTM; + + /*\ + * creer les regles identiques + \*/ + for ( IndexMesure = 0; + IndexMesure < DRUC_MAX_MESURES; + IndexMesure ++ + ) + { + if ( ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + != DRUC_UNDEFINED_REGLE + ) + { + TmpStructInstruction->REGLE_NUM [ IndexMesure ] = + ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + + DRUC_UN_CORPS_TRANS_METAL; + TmpStructInstruction->RELATION [ IndexMesure ] = + DrucInstructionRef->RELATION [ IndexMesure ]; + TmpStructInstruction->MESURE [ IndexMesure ] = + DrucInstructionRef->MESURE [ IndexMesure ]; + TmpStructInstruction->OP_COMPARE [ IndexMesure ] = + DrucInstructionRef->OP_COMPARE [ IndexMesure ]; + TmpStructInstruction->VALEUR [ IndexMesure ] = + DrucInstructionRef->VALEUR [ IndexMesure ]; + } + } + *DrucStructInstruction = TmpStructInstruction; + (*DrucNombreInstructions) ++; + +} +/*------------------------------------------------------------\ +| | +| DrucDuplicateUnCorpsVirtuel | +| cree les regles specifiques de contact possible et distance | +| identiques | +| | +\------------------------------------------------------------*/ +void DrucDuplicateUnCorpsVirtuel ( DrucInstructionRef, + DrucStructInstruction, + DrucNombreInstructions + ) +DrucTypeStructInstruction *DrucInstructionRef; +DrucTypeStructInstruction **DrucStructInstruction; +int *DrucNombreInstructions; +{ +DrucTypeStructInstruction *TmpStructInstruction; +int InstructionAddNumber ; +int IndexMesure; +int IndexSuite; +int LayerVirtuel; +int LayerSource; +int LayerSource2; + + LayerSource = DrucInstructionRef->LAYER_1 ; + LayerSource2 = DrucInstructionRef->LAYER_2 ; + LayerVirtuel = DrucAsVirtuelEquivalent ( LayerSource ); + + TmpStructInstruction = + ( DrucTypeStructInstruction *)malloc (sizeof ( DrucTypeStructInstruction )); + if (TmpStructInstruction == (DrucTypeStructInstruction *)NULL ) + { + DRUC_EXIT ( DRUC_ERROR_MEMOIRE ); + } + DrucInitialiseRegle ( TmpStructInstruction); + + TmpStructInstruction->NEXT = *DrucStructInstruction; + TmpStructInstruction->INSTRUCTION = DrucInstructionRef->INSTRUCTION; + TmpStructInstruction->LAYER_DEST = DrucInstructionRef->LAYER_DEST; + TmpStructInstruction->LAYER_1 = LayerVirtuel; + TmpStructInstruction->LAYER_2 = LayerSource2; + TmpStructInstruction->OP_COMPOSE = DrucInstructionRef->OP_COMPOSE; + + DrucStructRdsLayer [ LayerVirtuel ].RDS_INDEX = LayerVirtuel; + DrucStructRdsLayer [ LayerVirtuel ].WIDTH = + ( DrucStructRdsLayer [ LayerSource ] ).WIDTH; + DrucStructRdsLayer [ LayerVirtuel ].CTM = + ( DrucStructRdsLayer [ LayerSource ] ).CTM; + + /*\ + * creer les regles identiques + \*/ + for ( IndexMesure = 0; + IndexMesure < DRUC_MAX_MESURES; + IndexMesure ++ + ) + { + if ( ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + != DRUC_UNDEFINED_REGLE + ) + { + TmpStructInstruction->REGLE_NUM [ IndexMesure ] = + ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + + DRUC_UN_CORPS_VIRT_METAL; + TmpStructInstruction->RELATION [ IndexMesure ] = + DrucInstructionRef->RELATION [ IndexMesure ]; + TmpStructInstruction->MESURE [ IndexMesure ] = + DrucInstructionRef->MESURE [ IndexMesure ]; + TmpStructInstruction->OP_COMPARE [ IndexMesure ] = + DrucInstructionRef->OP_COMPARE [ IndexMesure ]; + TmpStructInstruction->VALEUR [ IndexMesure ] = + DrucInstructionRef->VALEUR [ IndexMesure ]; + } + } + *DrucStructInstruction = TmpStructInstruction; + (*DrucNombreInstructions) ++; + +} +/*------------------------------------------------------------\ +| | +| DrucAddOneLayerVirtuelRule | +| cree les regles specifiques de contact possible et distance | +| identiques | +| | +\------------------------------------------------------------*/ +void DrucAddOneLayerVirtuelRule ( DrucInstructionRef, + DrucStructInstruction, + DrucNombreInstructions + ) +DrucTypeStructInstruction *DrucInstructionRef; +DrucTypeStructInstruction **DrucStructInstruction; +int *DrucNombreInstructions; +{ +DrucTypeStructInstruction *TmpStructInstruction; +int InstructionAddNumber ; +int IndexMesure; +int IndexSuite; +int LayerTransparent; +int LayerVirtuel; +int LayerSource; +int LayerSource2; + + LayerSource = DrucInstructionRef->LAYER_1 ; + LayerSource2 = DrucInstructionRef->LAYER_2 ; + LayerVirtuel = DrucAsVirtuelEquivalent ( LayerSource ); + LayerTransparent = DrucAsTransparenceEquivalent ( LayerSource ); + + + TmpStructInstruction = + ( DrucTypeStructInstruction *)malloc (sizeof ( DrucTypeStructInstruction )); + if (TmpStructInstruction == (DrucTypeStructInstruction *)NULL ) + { + DRUC_EXIT ( DRUC_ERROR_MEMOIRE ); + } + DrucInitialiseRegle ( TmpStructInstruction); + + TmpStructInstruction->NEXT = *DrucStructInstruction; + TmpStructInstruction->INSTRUCTION = DrucInstructionRef->INSTRUCTION; + TmpStructInstruction->LAYER_DEST = DrucInstructionRef->LAYER_DEST; + TmpStructInstruction->LAYER_1 = LayerVirtuel; + TmpStructInstruction->LAYER_2 = LayerSource2; + TmpStructInstruction->OP_COMPOSE = DrucInstructionRef->OP_COMPOSE; + + DrucStructRdsLayer [ LayerVirtuel ].RDS_INDEX = LayerVirtuel; + DrucStructRdsLayer [ LayerVirtuel ].WIDTH = + ( DrucStructRdsLayer [ LayerSource ] ).WIDTH; + DrucStructRdsLayer [ LayerVirtuel ].CTM = + ( DrucStructRdsLayer [ LayerSource ] ).CTM; + + /*\ + * creer les regles identiques + \*/ + for ( IndexMesure = 0; + IndexMesure < DRUC_MAX_MESURES; + IndexMesure ++ + ) + { + if ( ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + != DRUC_UNDEFINED_REGLE + ) + { + TmpStructInstruction->REGLE_NUM [ IndexMesure ] = + ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + + DRUC_DEUX_CORPS_VIRT_METAL; + TmpStructInstruction->RELATION [ IndexMesure ] = + DrucInstructionRef->RELATION [ IndexMesure ]; + TmpStructInstruction->MESURE [ IndexMesure ] = + DrucInstructionRef->MESURE [ IndexMesure ]; + TmpStructInstruction->OP_COMPARE [ IndexMesure ] = + DrucInstructionRef->OP_COMPARE [ IndexMesure ]; + TmpStructInstruction->VALEUR [ IndexMesure ] = + DrucInstructionRef->VALEUR [ IndexMesure ]; + } + } + *DrucStructInstruction = TmpStructInstruction; + (*DrucNombreInstructions) ++; + + if ( LayerTransparent != DRUC_UNDEFINED_LAYER ) + { + /*\ + * creer les regles virtuel<-->transparence pour le meme layer + \*/ + TmpStructInstruction = + ( DrucTypeStructInstruction *)malloc (sizeof ( DrucTypeStructInstruction )); + if (TmpStructInstruction == (DrucTypeStructInstruction *)NULL ) + { + DRUC_EXIT ( DRUC_ERROR_MEMOIRE ); + } + DrucInitialiseRegle ( TmpStructInstruction); + + TmpStructInstruction->NEXT = *DrucStructInstruction; + TmpStructInstruction->INSTRUCTION = DrucInstructionRef->INSTRUCTION; + TmpStructInstruction->LAYER_DEST = DrucInstructionRef->LAYER_DEST; + TmpStructInstruction->LAYER_1 = LayerVirtuel; + TmpStructInstruction->LAYER_2 = LayerTransparent; + TmpStructInstruction->OP_COMPOSE = DrucInstructionRef->OP_COMPOSE; + + /*\ + * recopier les regles de distance + \*/ + IndexSuite = 0; + for ( IndexMesure = 0; + IndexMesure < DRUC_MAX_MESURES; + IndexMesure ++ + ) + { + if ( ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + != DRUC_UNDEFINED_REGLE + ) + { + if ( (DrucInstructionRef->RELATION [ IndexMesure ] ) == + DRUC_RELATION_DISTANCE + ) + { + TmpStructInstruction->REGLE_NUM [ IndexSuite ] = + ( DrucInstructionRef->REGLE_NUM [ 0 ] ) + IndexSuite + + DRUC_DEUX_CORPS_VIRT_TRANS; + TmpStructInstruction->RELATION [ IndexSuite ] = + DrucInstructionRef->RELATION [ IndexMesure ]; + TmpStructInstruction->MESURE [ IndexSuite ] = + DrucInstructionRef->MESURE [ IndexMesure ]; + TmpStructInstruction->OP_COMPARE [ IndexSuite ] = + DrucInstructionRef->OP_COMPARE [ IndexMesure ]; + TmpStructInstruction->VALEUR [ IndexSuite ] = + DrucInstructionRef->VALEUR [ IndexMesure ]; + IndexSuite ++ ; + } + } + } + + /*\ + * creer les regles de contact nulles + \*/ + TmpStructInstruction->RELATION [ IndexSuite ] = DRUC_RELATION_ENVELOPPE; + TmpStructInstruction->MESURE [ IndexSuite ] = DRUC_MESURE_LARGEUR_INTER; + TmpStructInstruction->OP_COMPARE [ IndexSuite ] = DRUC_OPERATION_INF; + TmpStructInstruction->VALEUR [ IndexSuite ] = 0; + TmpStructInstruction->REGLE_NUM [ IndexSuite ] = + ( DrucInstructionRef->REGLE_NUM [ 0 ] ) + IndexSuite + + DRUC_DEUX_CORPS_VIRT_TRANS; + IndexSuite ++ ; + + TmpStructInstruction->RELATION [ IndexSuite ] = DRUC_RELATION_MARGE; + TmpStructInstruction->MESURE [ IndexSuite ] = DRUC_MESURE_PENETRE_INTER; + TmpStructInstruction->OP_COMPARE [ IndexSuite ] = DRUC_OPERATION_INF; + TmpStructInstruction->VALEUR [ IndexSuite ] = 0; + TmpStructInstruction->REGLE_NUM [ IndexSuite ] = + ( DrucInstructionRef->REGLE_NUM [ 0 ] ) + IndexSuite + + DRUC_DEUX_CORPS_VIRT_TRANS; + IndexSuite ++ ; + + TmpStructInstruction->RELATION [ IndexSuite ] = DRUC_RELATION_CROIX; + TmpStructInstruction->MESURE [ IndexSuite ] = DRUC_MESURE_LARGEUR_INTER; + TmpStructInstruction->OP_COMPARE [ IndexSuite ] = DRUC_OPERATION_INF; + TmpStructInstruction->VALEUR [ IndexSuite ] = 0; + TmpStructInstruction->REGLE_NUM [ IndexSuite ] = + ( DrucInstructionRef->REGLE_NUM [ 0 ] ) + IndexSuite + + DRUC_DEUX_CORPS_VIRT_TRANS; + IndexSuite ++ ; + + TmpStructInstruction->RELATION [ IndexSuite ] = DRUC_RELATION_INTERSECTION; + TmpStructInstruction->MESURE [ IndexSuite ] = DRUC_MESURE_LARGEUR_INTER; + TmpStructInstruction->OP_COMPARE [ IndexSuite ] = DRUC_OPERATION_INF; + TmpStructInstruction->VALEUR [ IndexSuite ] = 0; + TmpStructInstruction->REGLE_NUM [ IndexSuite ] = + ( DrucInstructionRef->REGLE_NUM [ 0 ] ) + IndexSuite + + DRUC_DEUX_CORPS_VIRT_TRANS; + IndexSuite ++ ; + + TmpStructInstruction->RELATION [ IndexSuite ] = DRUC_RELATION_EXTENSION; + TmpStructInstruction->MESURE [ IndexSuite ] = DRUC_MESURE_PENETRE_INTER; + TmpStructInstruction->OP_COMPARE [ IndexSuite ] = DRUC_OPERATION_INF; + TmpStructInstruction->VALEUR [ IndexSuite ] = 0; + TmpStructInstruction->REGLE_NUM [ IndexSuite ] = + ( DrucInstructionRef->REGLE_NUM [ 0 ] ) + IndexSuite + + DRUC_DEUX_CORPS_VIRT_TRANS; + IndexSuite ++ ; + + TmpStructInstruction->RELATION [ IndexSuite ] = DRUC_RELATION_INCLUSION; + TmpStructInstruction->MESURE [ IndexSuite ] = DRUC_MESURE_LARGEUR_INTER; + TmpStructInstruction->OP_COMPARE [ IndexSuite ] = DRUC_OPERATION_INF; + TmpStructInstruction->VALEUR [ IndexSuite ] = 0; + TmpStructInstruction->REGLE_NUM [ IndexSuite ] = + ( DrucInstructionRef->REGLE_NUM [ 0 ] ) + IndexSuite + + DRUC_DEUX_CORPS_VIRT_TRANS; + + *DrucStructInstruction = TmpStructInstruction; + (*DrucNombreInstructions) ++; + } + + /*\ + * creer les regles virtuel<-->virtuel pour le meme layer + \*/ + TmpStructInstruction = + ( DrucTypeStructInstruction *)malloc (sizeof ( DrucTypeStructInstruction )); + if (TmpStructInstruction == (DrucTypeStructInstruction *)NULL ) + { + DRUC_EXIT ( DRUC_ERROR_MEMOIRE ); + } + DrucInitialiseRegle ( TmpStructInstruction); + + TmpStructInstruction->NEXT = *DrucStructInstruction; + TmpStructInstruction->INSTRUCTION = DrucInstructionRef->INSTRUCTION; + TmpStructInstruction->LAYER_DEST = DrucInstructionRef->LAYER_DEST; + TmpStructInstruction->LAYER_1 = LayerVirtuel; + TmpStructInstruction->LAYER_2 = LayerVirtuel; + TmpStructInstruction->OP_COMPOSE = DrucInstructionRef->OP_COMPOSE; + + /*\ + * creer les regles identiques + \*/ + for ( IndexMesure = 0; + IndexMesure < DRUC_MAX_MESURES; + IndexMesure ++ + ) + { + if ( ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + != DRUC_UNDEFINED_REGLE + ) + { + TmpStructInstruction->REGLE_NUM [ IndexMesure ] = + ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + + DRUC_DEUX_CORPS_VIRT_VIRT; + TmpStructInstruction->RELATION [ IndexMesure ] = + DrucInstructionRef->RELATION [ IndexMesure ]; + TmpStructInstruction->MESURE [ IndexMesure ] = + DrucInstructionRef->MESURE [ IndexMesure ]; + TmpStructInstruction->OP_COMPARE [ IndexMesure ] = + DrucInstructionRef->OP_COMPARE [ IndexMesure ]; + TmpStructInstruction->VALEUR [ IndexMesure ] = + DrucInstructionRef->VALEUR [ IndexMesure ]; + } + } + *DrucStructInstruction = TmpStructInstruction; + (*DrucNombreInstructions) ++; +} +/*------------------------------------------------------------\ +| | +| DrucDuplicateHierarchicalRule | +| | +\------------------------------------------------------------*/ +void DrucDuplicateHierarchicalRule ( DrucStructInstruction, + DrucNombreInstructions + ) +DrucTypeStructInstruction **DrucStructInstruction; +int *DrucNombreInstructions; +{ +DrucTypeStructInstruction *DrucInstructionRef; +DrucTypeStructInstruction *TmpStructInstruction; +int LayerTransparent; +int LayerTransparent2; +int IndexMesure; +int LayerSource; +int LayerSource2; +int LayerVirtuel; +int LayerVirtuel2; + + DrucInstructionRef = *DrucStructInstruction; + LayerSource = (*DrucStructInstruction)->LAYER_1 ; + LayerSource2 = (*DrucStructInstruction)->LAYER_2 ; + LayerTransparent = DrucAsTransparenceEquivalent ( LayerSource ); + LayerTransparent2 = DrucAsTransparenceEquivalent ( LayerSource2 ); + LayerVirtuel = DrucAsVirtuelEquivalent ( LayerSource ); + LayerVirtuel2 = DrucAsVirtuelEquivalent ( LayerSource2 ); + + if ( DrucInstructionRef->INSTRUCTION == DRUC_INSTR_CARACTERISE ) + { + /*\ + * c'est une instruction a un corps + \*/ + if ( LayerTransparent != DRUC_UNDEFINED_LAYER ) + { + DrucDuplicateUnCorpsTransparent ( DrucInstructionRef, + DrucStructInstruction, + DrucNombreInstructions + ); + } + if ( LayerVirtuel != DRUC_UNDEFINED_LAYER ) + { + DrucDuplicateUnCorpsVirtuel ( DrucInstructionRef, + DrucStructInstruction, + DrucNombreInstructions + ); + } + return; + } + + /*\ + * Donc c'est une instruction a 2 corps + \*/ + if ( DrucInstructionRef->LAYER_1 == DrucInstructionRef->LAYER_2 ) + { + /*\ + * on n'a qu'une transformation a faire L1-->T1 L1-->V1 + * et T1 ne doit pas toucher L1 + \*/ + if ( LayerTransparent != DRUC_UNDEFINED_LAYER ) + { + DrucAddOneLayerTransparentRule ( DrucInstructionRef, + DrucStructInstruction, + DrucNombreInstructions + ); + } + if ( LayerVirtuel != DRUC_UNDEFINED_LAYER ) + { + DrucAddOneLayerVirtuelRule ( DrucInstructionRef, + DrucStructInstruction, + DrucNombreInstructions + ); + } + } + else + { + /*\ + * on doit faire les transformations suivantes: + * L1,L2 -->L1,T2 . + * L1,V2 . + * T1,L2 . + * T1,T2 . + * T1,V2 + * V1,L2 . + * V1,T2 + * V1,V2 . + \*/ + if ( LayerTransparent != DRUC_UNDEFINED_LAYER ) + { + /*\ + * creer T1,L2 + \*/ + TmpStructInstruction = + ( DrucTypeStructInstruction *)malloc (sizeof ( DrucTypeStructInstruction )); + if (TmpStructInstruction == (DrucTypeStructInstruction *)NULL ) + { + DRUC_EXIT ( DRUC_ERROR_MEMOIRE ); + } + DrucInitialiseRegle ( TmpStructInstruction + ); + TmpStructInstruction->NEXT = *DrucStructInstruction; + TmpStructInstruction->INSTRUCTION = DrucInstructionRef->INSTRUCTION; + TmpStructInstruction->LAYER_DEST = DrucInstructionRef->LAYER_DEST; + TmpStructInstruction->LAYER_1 = LayerTransparent; + TmpStructInstruction->LAYER_2 = LayerSource2; + TmpStructInstruction->OP_COMPOSE = DrucInstructionRef->OP_COMPOSE; + + DrucStructRdsLayer [ LayerTransparent ].RDS_INDEX = LayerTransparent; + DrucStructRdsLayer [ LayerTransparent ].WIDTH = + ( DrucStructRdsLayer [ LayerSource ] ).WIDTH; + DrucStructRdsLayer [ LayerTransparent ].CTM = + ( DrucStructRdsLayer [ LayerSource ] ).CTM; + + for ( IndexMesure = 0; + IndexMesure < DRUC_MAX_MESURES; + IndexMesure ++ + ) + { + if ( ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + != DRUC_UNDEFINED_REGLE + ) + { + TmpStructInstruction->REGLE_NUM [ IndexMesure ] = + ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + + DRUC_DEUX_CORPS_TRANS_METAL; + TmpStructInstruction->RELATION [ IndexMesure ] = + DrucInstructionRef->RELATION [ IndexMesure ]; + TmpStructInstruction->MESURE [ IndexMesure ] = + DrucInstructionRef->MESURE [ IndexMesure ]; + TmpStructInstruction->OP_COMPARE [ IndexMesure ] = + DrucInstructionRef->OP_COMPARE [ IndexMesure ]; + TmpStructInstruction->VALEUR [ IndexMesure ] = + DrucInstructionRef->VALEUR [ IndexMesure ]; + } + } + *DrucStructInstruction = TmpStructInstruction; + (*DrucNombreInstructions) ++; + } + if ( LayerTransparent2 != DRUC_UNDEFINED_LAYER ) + { + /*\ + * creer L1,T2 + \*/ + TmpStructInstruction = + ( DrucTypeStructInstruction *)malloc (sizeof ( DrucTypeStructInstruction )); + if (TmpStructInstruction == (DrucTypeStructInstruction *)NULL ) + { + DRUC_EXIT ( DRUC_ERROR_MEMOIRE ); + } + DrucInitialiseRegle ( TmpStructInstruction + ); + TmpStructInstruction->NEXT = *DrucStructInstruction; + TmpStructInstruction->INSTRUCTION = DrucInstructionRef->INSTRUCTION; + TmpStructInstruction->LAYER_DEST = DrucInstructionRef->LAYER_DEST; + TmpStructInstruction->LAYER_1 = LayerSource; + TmpStructInstruction->LAYER_2 = LayerTransparent2; + TmpStructInstruction->OP_COMPOSE = DrucInstructionRef->OP_COMPOSE; + + DrucStructRdsLayer [ LayerTransparent2 ].RDS_INDEX = LayerTransparent2; + DrucStructRdsLayer [ LayerTransparent2 ].WIDTH = + ( DrucStructRdsLayer [ LayerSource2 ] ).WIDTH; + DrucStructRdsLayer [ LayerTransparent2 ].CTM = + ( DrucStructRdsLayer [ LayerSource2 ] ).CTM; + + for ( IndexMesure = 0; + IndexMesure < DRUC_MAX_MESURES; + IndexMesure ++ + ) + { + if ( ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + != DRUC_UNDEFINED_REGLE + ) + { + TmpStructInstruction->REGLE_NUM [ IndexMesure ] = + ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + + DRUC_DEUX_CORPS_METAL_TRANS; + TmpStructInstruction->RELATION [ IndexMesure ] = + DrucInstructionRef->RELATION [ IndexMesure ]; + TmpStructInstruction->MESURE [ IndexMesure ] = + DrucInstructionRef->MESURE [ IndexMesure ]; + TmpStructInstruction->OP_COMPARE [ IndexMesure ] = + DrucInstructionRef->OP_COMPARE [ IndexMesure ]; + TmpStructInstruction->VALEUR [ IndexMesure ] = + DrucInstructionRef->VALEUR [ IndexMesure ]; + } + } + *DrucStructInstruction = TmpStructInstruction; + (*DrucNombreInstructions) ++; + } + if ( ( LayerTransparent != DRUC_UNDEFINED_LAYER ) && + ( LayerTransparent2 != DRUC_UNDEFINED_LAYER ) + ) + { + /*\ + * creer T1,T2 + \*/ + TmpStructInstruction = + ( DrucTypeStructInstruction *)malloc (sizeof ( DrucTypeStructInstruction )); + if (TmpStructInstruction == (DrucTypeStructInstruction *)NULL ) + { + DRUC_EXIT ( DRUC_ERROR_MEMOIRE ); + } + DrucInitialiseRegle ( TmpStructInstruction); + TmpStructInstruction->NEXT = *DrucStructInstruction; + TmpStructInstruction->INSTRUCTION = DrucInstructionRef->INSTRUCTION; + TmpStructInstruction->LAYER_DEST = DrucInstructionRef->LAYER_DEST; + TmpStructInstruction->LAYER_1 = LayerTransparent; + TmpStructInstruction->LAYER_2 = LayerTransparent2; + TmpStructInstruction->OP_COMPOSE = DrucInstructionRef->OP_COMPOSE; + + DrucStructRdsLayer [ LayerTransparent ].RDS_INDEX = LayerTransparent; + DrucStructRdsLayer [ LayerTransparent ].WIDTH = + ( DrucStructRdsLayer [ LayerSource ] ).WIDTH; + DrucStructRdsLayer [ LayerTransparent ].CTM = + ( DrucStructRdsLayer [ LayerSource ] ).CTM; + + DrucStructRdsLayer [ LayerTransparent2 ].RDS_INDEX = LayerTransparent2; + DrucStructRdsLayer [ LayerTransparent2 ].WIDTH = + ( DrucStructRdsLayer [ LayerSource2 ] ).WIDTH; + DrucStructRdsLayer [ LayerTransparent2 ].CTM = + ( DrucStructRdsLayer [ LayerSource2 ] ).CTM; + + for ( IndexMesure = 0; + IndexMesure < DRUC_MAX_MESURES; + IndexMesure ++ + ) + { + if ( ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + != DRUC_UNDEFINED_REGLE + ) + { + TmpStructInstruction->REGLE_NUM [ IndexMesure ] = + ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + + DRUC_DEUX_CORPS_TRANS_TRANS; + TmpStructInstruction->RELATION [ IndexMesure ] = + DrucInstructionRef->RELATION [ IndexMesure ]; + TmpStructInstruction->MESURE [ IndexMesure ] = + DrucInstructionRef->MESURE [ IndexMesure ]; + TmpStructInstruction->OP_COMPARE [ IndexMesure ] = + DrucInstructionRef->OP_COMPARE [ IndexMesure ]; + TmpStructInstruction->VALEUR [ IndexMesure ] = + DrucInstructionRef->VALEUR [ IndexMesure ]; + } + } + *DrucStructInstruction = TmpStructInstruction; + (*DrucNombreInstructions) ++; + } + if ( LayerVirtuel != DRUC_UNDEFINED_LAYER ) + { + /*\ + * creer V1,L2 + \*/ + TmpStructInstruction = + ( DrucTypeStructInstruction *)malloc (sizeof ( DrucTypeStructInstruction )); + if (TmpStructInstruction == (DrucTypeStructInstruction *)NULL ) + { + DRUC_EXIT ( DRUC_ERROR_MEMOIRE ); + } + DrucInitialiseRegle ( TmpStructInstruction + ); + TmpStructInstruction->NEXT = *DrucStructInstruction; + TmpStructInstruction->INSTRUCTION = DrucInstructionRef->INSTRUCTION; + TmpStructInstruction->LAYER_DEST = DrucInstructionRef->LAYER_DEST; + TmpStructInstruction->LAYER_1 = LayerVirtuel; + TmpStructInstruction->LAYER_2 = LayerSource2; + TmpStructInstruction->OP_COMPOSE = DrucInstructionRef->OP_COMPOSE; + + DrucStructRdsLayer [ LayerVirtuel ].RDS_INDEX = LayerVirtuel; + DrucStructRdsLayer [ LayerVirtuel ].WIDTH = + ( DrucStructRdsLayer [ LayerSource ] ).WIDTH; + DrucStructRdsLayer [ LayerVirtuel ].CTM = + ( DrucStructRdsLayer [ LayerSource ] ).CTM; + + for ( IndexMesure = 0; + IndexMesure < DRUC_MAX_MESURES; + IndexMesure ++ + ) + { + if ( ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + != DRUC_UNDEFINED_REGLE + ) + { + TmpStructInstruction->REGLE_NUM [ IndexMesure ] = + ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + + DRUC_DEUX_CORPS_VIRT_METAL; + TmpStructInstruction->RELATION [ IndexMesure ] = + DrucInstructionRef->RELATION [ IndexMesure ]; + TmpStructInstruction->MESURE [ IndexMesure ] = + DrucInstructionRef->MESURE [ IndexMesure ]; + TmpStructInstruction->OP_COMPARE [ IndexMesure ] = + DrucInstructionRef->OP_COMPARE [ IndexMesure ]; + TmpStructInstruction->VALEUR [ IndexMesure ] = + DrucInstructionRef->VALEUR [ IndexMesure ]; + } + } + *DrucStructInstruction = TmpStructInstruction; + (*DrucNombreInstructions) ++; + } + if ( LayerVirtuel2 != DRUC_UNDEFINED_LAYER ) + { + /*\ + * creer L1,V2 + \*/ + TmpStructInstruction = + ( DrucTypeStructInstruction *)malloc (sizeof ( DrucTypeStructInstruction )); + if (TmpStructInstruction == (DrucTypeStructInstruction *)NULL ) + { + DRUC_EXIT ( DRUC_ERROR_MEMOIRE ); + } + DrucInitialiseRegle ( TmpStructInstruction + ); + TmpStructInstruction->NEXT = *DrucStructInstruction; + TmpStructInstruction->INSTRUCTION = DrucInstructionRef->INSTRUCTION; + TmpStructInstruction->LAYER_DEST = DrucInstructionRef->LAYER_DEST; + TmpStructInstruction->LAYER_1 = LayerSource; + TmpStructInstruction->LAYER_2 = LayerVirtuel2; + TmpStructInstruction->OP_COMPOSE = DrucInstructionRef->OP_COMPOSE; + + DrucStructRdsLayer [ LayerVirtuel2 ].RDS_INDEX = LayerVirtuel2; + DrucStructRdsLayer [ LayerVirtuel2 ].WIDTH = + ( DrucStructRdsLayer [ LayerSource2 ] ).WIDTH; + DrucStructRdsLayer [ LayerVirtuel2 ].CTM = + ( DrucStructRdsLayer [ LayerSource2 ] ).CTM; + + for ( IndexMesure = 0; + IndexMesure < DRUC_MAX_MESURES; + IndexMesure ++ + ) + { + if ( ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + != DRUC_UNDEFINED_REGLE + ) + { + TmpStructInstruction->REGLE_NUM [ IndexMesure ] = + ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + + DRUC_DEUX_CORPS_METAL_VIRT; + TmpStructInstruction->RELATION [ IndexMesure ] = + DrucInstructionRef->RELATION [ IndexMesure ]; + TmpStructInstruction->MESURE [ IndexMesure ] = + DrucInstructionRef->MESURE [ IndexMesure ]; + TmpStructInstruction->OP_COMPARE [ IndexMesure ] = + DrucInstructionRef->OP_COMPARE [ IndexMesure ]; + TmpStructInstruction->VALEUR [ IndexMesure ] = + DrucInstructionRef->VALEUR [ IndexMesure ]; + } + } + *DrucStructInstruction = TmpStructInstruction; + (*DrucNombreInstructions) ++; + } + if ( ( LayerVirtuel != DRUC_UNDEFINED_LAYER ) && + ( LayerVirtuel2 != DRUC_UNDEFINED_LAYER ) + ) + { + /*\ + * creer V1,V2 + \*/ + TmpStructInstruction = + ( DrucTypeStructInstruction *)malloc (sizeof ( DrucTypeStructInstruction )); + if (TmpStructInstruction == (DrucTypeStructInstruction *)NULL ) + { + DRUC_EXIT ( DRUC_ERROR_MEMOIRE ); + } + DrucInitialiseRegle ( TmpStructInstruction); + TmpStructInstruction->NEXT = *DrucStructInstruction; + TmpStructInstruction->INSTRUCTION = DrucInstructionRef->INSTRUCTION; + TmpStructInstruction->LAYER_DEST = DrucInstructionRef->LAYER_DEST; + TmpStructInstruction->LAYER_1 = LayerVirtuel; + TmpStructInstruction->LAYER_2 = LayerVirtuel2; + TmpStructInstruction->OP_COMPOSE = DrucInstructionRef->OP_COMPOSE; + + DrucStructRdsLayer [ LayerVirtuel ].RDS_INDEX = LayerVirtuel; + DrucStructRdsLayer [ LayerVirtuel ].WIDTH = + ( DrucStructRdsLayer [ LayerSource ] ).WIDTH; + DrucStructRdsLayer [ LayerVirtuel ].CTM = + ( DrucStructRdsLayer [ LayerSource ] ).CTM; + + DrucStructRdsLayer [ LayerVirtuel2 ].RDS_INDEX = LayerVirtuel2; + DrucStructRdsLayer [ LayerVirtuel2 ].WIDTH = + ( DrucStructRdsLayer [ LayerSource2 ] ).WIDTH; + DrucStructRdsLayer [ LayerVirtuel2 ].CTM = + ( DrucStructRdsLayer [ LayerSource2 ] ).CTM; + + for ( IndexMesure = 0; + IndexMesure < DRUC_MAX_MESURES; + IndexMesure ++ + ) + { + if ( ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + != DRUC_UNDEFINED_REGLE + ) + { + TmpStructInstruction->REGLE_NUM [ IndexMesure ] = + ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + + DRUC_DEUX_CORPS_VIRT_VIRT; + TmpStructInstruction->RELATION [ IndexMesure ] = + DrucInstructionRef->RELATION [ IndexMesure ]; + TmpStructInstruction->MESURE [ IndexMesure ] = + DrucInstructionRef->MESURE [ IndexMesure ]; + TmpStructInstruction->OP_COMPARE [ IndexMesure ] = + DrucInstructionRef->OP_COMPARE [ IndexMesure ]; + TmpStructInstruction->VALEUR [ IndexMesure ] = + DrucInstructionRef->VALEUR [ IndexMesure ]; + } + } + *DrucStructInstruction = TmpStructInstruction; + (*DrucNombreInstructions) ++; + } + if ( ( LayerTransparent != DRUC_UNDEFINED_LAYER ) && + ( LayerVirtuel2 != DRUC_UNDEFINED_LAYER ) + ) + { + /*\ + * creer T1,V2 + \*/ + TmpStructInstruction = + ( DrucTypeStructInstruction *)malloc (sizeof ( DrucTypeStructInstruction )); + if (TmpStructInstruction == (DrucTypeStructInstruction *)NULL ) + { + DRUC_EXIT ( DRUC_ERROR_MEMOIRE ); + } + DrucInitialiseRegle ( TmpStructInstruction); + TmpStructInstruction->NEXT = *DrucStructInstruction; + TmpStructInstruction->INSTRUCTION = DrucInstructionRef->INSTRUCTION; + TmpStructInstruction->LAYER_DEST = DrucInstructionRef->LAYER_DEST; + TmpStructInstruction->LAYER_1 = LayerTransparent; + TmpStructInstruction->LAYER_2 = LayerVirtuel2; + TmpStructInstruction->OP_COMPOSE = DrucInstructionRef->OP_COMPOSE; + + DrucStructRdsLayer [ LayerTransparent ].RDS_INDEX = LayerTransparent; + DrucStructRdsLayer [ LayerTransparent ].WIDTH = + ( DrucStructRdsLayer [ LayerSource ] ).WIDTH; + DrucStructRdsLayer [ LayerTransparent ].CTM = + ( DrucStructRdsLayer [ LayerSource ] ).CTM; + + DrucStructRdsLayer [ LayerVirtuel2 ].RDS_INDEX = LayerVirtuel2; + DrucStructRdsLayer [ LayerVirtuel2 ].WIDTH = + ( DrucStructRdsLayer [ LayerSource2 ] ).WIDTH; + DrucStructRdsLayer [ LayerVirtuel2 ].CTM = + ( DrucStructRdsLayer [ LayerSource2 ] ).CTM; + + for ( IndexMesure = 0; + IndexMesure < DRUC_MAX_MESURES; + IndexMesure ++ + ) + { + if ( ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + != DRUC_UNDEFINED_REGLE + ) + { + TmpStructInstruction->REGLE_NUM [ IndexMesure ] = + ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + + DRUC_DEUX_CORPS_TRANS_VIRT; + TmpStructInstruction->RELATION [ IndexMesure ] = + DrucInstructionRef->RELATION [ IndexMesure ]; + TmpStructInstruction->MESURE [ IndexMesure ] = + DrucInstructionRef->MESURE [ IndexMesure ]; + TmpStructInstruction->OP_COMPARE [ IndexMesure ] = + DrucInstructionRef->OP_COMPARE [ IndexMesure ]; + TmpStructInstruction->VALEUR [ IndexMesure ] = + DrucInstructionRef->VALEUR [ IndexMesure ]; + } + } + *DrucStructInstruction = TmpStructInstruction; + (*DrucNombreInstructions) ++; + + } + if ( ( LayerVirtuel != DRUC_UNDEFINED_LAYER ) && + ( LayerTransparent2 != DRUC_UNDEFINED_LAYER ) + ) + { + /*\ + * creer V1,T2 + \*/ + TmpStructInstruction = + ( DrucTypeStructInstruction *)malloc (sizeof ( DrucTypeStructInstruction )); + if (TmpStructInstruction == (DrucTypeStructInstruction *)NULL ) + { + DRUC_EXIT ( DRUC_ERROR_MEMOIRE ); + } + DrucInitialiseRegle ( TmpStructInstruction); + TmpStructInstruction->NEXT = *DrucStructInstruction; + TmpStructInstruction->INSTRUCTION = DrucInstructionRef->INSTRUCTION; + TmpStructInstruction->LAYER_DEST = DrucInstructionRef->LAYER_DEST; + TmpStructInstruction->LAYER_1 = LayerVirtuel; + TmpStructInstruction->LAYER_2 = LayerTransparent2; + TmpStructInstruction->OP_COMPOSE = DrucInstructionRef->OP_COMPOSE; + + DrucStructRdsLayer [ LayerVirtuel ].RDS_INDEX = LayerVirtuel; + DrucStructRdsLayer [ LayerVirtuel ].WIDTH = + ( DrucStructRdsLayer [ LayerSource ] ).WIDTH; + DrucStructRdsLayer [ LayerVirtuel ].CTM = + ( DrucStructRdsLayer [ LayerSource ] ).CTM; + + DrucStructRdsLayer [ LayerTransparent2 ].RDS_INDEX = LayerTransparent2; + DrucStructRdsLayer [ LayerTransparent2 ].WIDTH = + ( DrucStructRdsLayer [ LayerSource2 ] ).WIDTH; + DrucStructRdsLayer [ LayerTransparent2 ].CTM = + ( DrucStructRdsLayer [ LayerSource2 ] ).CTM; + + for ( IndexMesure = 0; + IndexMesure < DRUC_MAX_MESURES; + IndexMesure ++ + ) + { + if ( ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + != DRUC_UNDEFINED_REGLE + ) + { + TmpStructInstruction->REGLE_NUM [ IndexMesure ] = + ( DrucInstructionRef->REGLE_NUM [ IndexMesure ] ) + + DRUC_DEUX_CORPS_VIRT_TRANS; + TmpStructInstruction->RELATION [ IndexMesure ] = + DrucInstructionRef->RELATION [ IndexMesure ]; + TmpStructInstruction->MESURE [ IndexMesure ] = + DrucInstructionRef->MESURE [ IndexMesure ]; + TmpStructInstruction->OP_COMPARE [ IndexMesure ] = + DrucInstructionRef->OP_COMPARE [ IndexMesure ]; + TmpStructInstruction->VALEUR [ IndexMesure ] = + DrucInstructionRef->VALEUR [ IndexMesure ]; + } + } + *DrucStructInstruction = TmpStructInstruction; + (*DrucNombreInstructions) ++; + + } + } +} diff --git a/alliance/src/druc/src/druchier.h b/alliance/src/druc/src/druchier.h new file mode 100644 index 00000000..8c252938 --- /dev/null +++ b/alliance/src/druc/src/druchier.h @@ -0,0 +1,55 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DRUCHIER.H | +| | +| Authors : Patrick Renaud | +| | +| Date : 11/01/94 | +| | +| Modifications: voir fin de fichier | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DrucHier Types | +| | +\------------------------------------------------------------*/ +typedef struct struct_trans_equiv + { + int LAYER_INDEX; + int LAYER_TRANSPARENCE; + }DrucTypeStructTransEquiv; + +typedef struct struct_virtuel_equiv + { + int LAYER_INDEX; + int LAYER_VIRTUEL; + }DrucTypeStructVirtuEquiv; + +/*------------------------------------------------------------\ +| | +| DrucHier Defines | +| | +\------------------------------------------------------------*/ +#define DRUC_MAX_VIRTUELS 1 +#define DRUC_MAX_TRANSPARENCES 4 +#define DRUC_BBOX RDS_USER2 +/*------------------------------------------------------------\ +| | +| DrucHier Variables | +| | +\------------------------------------------------------------*/ +extern DrucTypeStructTransEquiv TabTransEquivalence []; +extern DrucTypeStructVirtuEquiv TabVirtuEquivalence []; + +/*------------------------------------------------------------\ +| | +| DrucHier Modifications | +| | +| Patrick 31/03/94: | +| ligne 36 | +| ajouter extern au tableau DrucTypeStructTransEquiv | +| | +\------------------------------------------------------------*/ diff --git a/alliance/src/druc/src/drucmin.c b/alliance/src/druc/src/drucmin.c new file mode 100644 index 00000000..ed333e29 --- /dev/null +++ b/alliance/src/druc/src/drucmin.c @@ -0,0 +1,157 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DRUCMIN.C | +| | +| Authors : Renaud Patrick | +| | +| Date : 03/07/95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +#include +#include +#include +#include "mph.h" +#include "mut.h" +#include "rds.h" +#include "rwi.h" +#include "rut.h" +#include "rtl.h" +#include "rfm.h" +#include "rpr.h" + +#include "drucutil.h" +#include "vmctools.h" +#include "vmcerror.h" +#include "vmcasmld.h" +#include "vmcaract.h" +#include "defdefin.h" +#include "vmcrelat.h" +#include "drucmin.h" + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Fonctions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DrucMin | +| | +\------------------------------------------------------------*/ + +void DrucMin ( DrucFigureRds, + DrucRdsWindow, + DrucTabInstruction , + DrucNombreInstructions + ) + rdsfig_list *DrucFigureRds; + rdswindow *DrucRdsWindow; + DrucTypeStructInstruction *DrucTabInstruction; + int DrucNombreInstructions; + +{ + +int InstructionCourante; + +DrucViewString ( "instructionCourante : 000" + ); + +/*\ + * cette sauvegarde est pour cacher des pb de compilation de graal + * enlever quand graal link correctement + * saverdsfig ( DrucFigureRds + * ); +\*/ + + for ( InstructionCourante = 0; + InstructionCourante != DrucNombreInstructions; + InstructionCourante = InstructionCourante + 1 + ) + { + + DrucViewString ( "\b\b\b" + ); + DrucViewNumber ( InstructionCourante + ); + +/*\ + DrucViewInstruction ( DrucTabInstruction [InstructionCourante] + ); +\*/ + + if ( MACRO_REGLE_COURANTE.LAYER_1 == DRUC_UNDEFINED_LAYER + ) + { +/*\ + * DrucViewString ("\ninstruction non verifiee\n)"); +\*/ + continue; + } + + switch ( MACRO_REGLE_COURANTE.INSTRUCTION + ) + { + case DRUC_ASM_BEGIN_REGLE : + { + switch ( MACRO_REGLE_COURANTE.OP_COMPOSE + ) + { + case DRUC_INSTR_RELATION : + { + DrucRelation ( DrucFigureRds, + DrucRdsWindow, + & MACRO_REGLE_COURANTE + ); + break; + } + case DRUC_INSTR_CARACTERISE : + { + + DrucCaracterise ( DrucFigureRds, + & MACRO_REGLE_COURANTE + ); + break; + } + } + break; + } + case DRUC_ASM_BEGIN_DEFINE : + { + DrucDefine ( DrucFigureRds, + DrucRdsWindow , + & MACRO_REGLE_COURANTE + ); + break; + } + case DRUC_ASM_BEGIN_UNDEFINE: + { + DrucUndefine ( DrucFigureRds, + DrucRdsWindow, + & MACRO_REGLE_COURANTE + ); + break; + } + }/* switch */ + }/* for InstructionCourante */ + +DrucViewString ( "\n" + ); + +/*\ +saverdsfig (DrucFigureRds); +\*/ +}/* DrucVerif */ diff --git a/alliance/src/druc/src/drucmin.h b/alliance/src/druc/src/drucmin.h new file mode 100644 index 00000000..3d6738a6 --- /dev/null +++ b/alliance/src/druc/src/drucmin.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DRUCMIN.H | +| | +| Authors : Renaud Patrick | +| | +| Date : 11/01/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +extern rdsfig_list *DrucFigureRdsErreur; +extern DrucTypeStructRdsLayer DrucStructRdsLayer[]; +/*------------------------------------------------------------\ +| | +| Fonctions | +| | +\------------------------------------------------------------*/ +extern void DrucMin (); diff --git a/alliance/src/druc/src/drucompi.c b/alliance/src/druc/src/drucompi.c new file mode 100644 index 00000000..03524826 --- /dev/null +++ b/alliance/src/druc/src/drucompi.c @@ -0,0 +1,1056 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DRUCOMPI.C | +| | +| Authors : Patrick Renaud | +| | +| Date : 11/01/94 | +| | +\------------------------------------------------------------*/ +#include +#include +#include +#include +#include +#include "mph.h" +#include "mut.h" +#include "rds.h" +#include "rwi.h" +#include "rut.h" +#include "rtl.h" +#include "rfm.h" +#include "rpr.h" +#include "drucompi_y.h" +#include "drucutil.h" +#include "vmctools.h" +#include "drucompi.h" +/*------------------------------------------------------------\ +| | +| DRUCOMPI variables | +| | +\------------------------------------------------------------*/ +DrucTypeStructDefine DrucStructDefine; +DrucTypeStructRegle DrucStructRegle; +DrucTypeStructInstruction *DrucStructInstruction; + + +int DrucNombreInstructions; +int CurrentIndexDrucLayer; +long DrucCtmMax; + +FILE *TmpFileAssembler; +char DRUC_OUTPUT_NAME[256]; +char DRUC_TMP_OUTPUT_NAME[256]; + +/*------------------------------------------------------------\ +| | +| DRUCOMPI Fonctions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Druc vrd_y_error | +| | +\------------------------------------------------------------*/ +void vrd_y_error(s) + char *s; +{ + fprintf (stdout,"\nErreur Langage ligne %d : %s\n",vrd_y_lineno,s); + EXIT(1); +} +/*------------------------------------------------------------\ +| | +| DrucInitCompiler | +| | +| Ouvre le fichier de destination du code assembleur de DRUC | +| Initialise la structure DrucStructRdsLayer | +| Initialise la structure DrucStructDefine | +| Initialise la structure DrucStructRegle | +\------------------------------------------------------------*/ +void DrucInitCompiler () +{ + int TmpIndexMesure; + int IndexLayer; + CurrentIndexDrucLayer = DRUC_UNDEFINED_LAYER; + DrucCtmMax = DRUC_UNDEFINED_CTM; + + for ( IndexLayer = 0; + IndexLayer < RDS_MAX_LAYER; + IndexLayer ++ + ) + { + DrucStructRdsLayer [ IndexLayer ].RDS_INDEX = DRUC_UNDEFINED_LAYER; + DrucStructRdsLayer [ IndexLayer ].WIDTH = DRUC_UNDEFINED_WIDTH; + DrucStructRdsLayer [ IndexLayer ].CTM = DRUC_UNDEFINED_CTM; + DrucStructRdsLayer [ IndexLayer ].FLAGS = DRUC_FLAG_LAYER_INTERDIT; + } + DrucStructRdsLayer [ DRUC_USER_LAYER_0 ].FLAGS = DRUC_FLAG_LAYER_LIBRE; + DrucStructRdsLayer [ DRUC_USER_LAYER_1 ].FLAGS = DRUC_FLAG_LAYER_LIBRE; + DrucStructRdsLayer [ DRUC_USER_LAYER_2 ].FLAGS = DRUC_FLAG_LAYER_LIBRE; + + DrucStructDefine.LAYER_DEST = DRUC_UNDEFINED_LAYER; + DrucStructDefine.OP_COMPOSE = DRUC_UNDEFINED_OP_COMPOSE; + DrucStructDefine.OP_UNAIRE = DRUC_UNDEFINED_OP_COMPOSE; + DrucStructDefine.LAYER_1 = DRUC_UNDEFINED_LAYER; + DrucStructDefine.LAYER_2 = DRUC_UNDEFINED_LAYER; + DrucStructDefine.USER_LAYER_0 = DRUC_UNDEFINED_LAYER; + DrucStructDefine.USER_LAYER_1 = DRUC_UNDEFINED_LAYER; + DrucStructDefine.USER_LAYER_2 = DRUC_UNDEFINED_LAYER; + DrucStructDefine.USER_LAYER_NAME_0 = (char *)NULL; + DrucStructDefine.USER_LAYER_NAME_1 = (char *)NULL; + DrucStructDefine.USER_LAYER_NAME_2 = (char *)NULL; + + DrucStructRegle.LIST_REGLE_NUM = (DataList *)NULL; + DrucStructRegle.INSTRUCTION = DRUC_UNDEFINED_INSTRUCTION; + DrucStructRegle.LAYER_1 = DRUC_UNDEFINED_LAYER; + DrucStructRegle.LAYER_2 = DRUC_UNDEFINED_LAYER; + for ( TmpIndexMesure = 0; + TmpIndexMesure < DRUC_MAX_MESURES; + TmpIndexMesure ++ + ) + { + DrucStructRegle.RELATION [TmpIndexMesure ] = DRUC_UNDEFINED_RELATION; + DrucStructRegle.REGLE_NUM [TmpIndexMesure ] = DRUC_UNDEFINED_REGLE; + DrucStructRegle.MESURE [TmpIndexMesure ] = DRUC_UNDEFINED_MESURE; + DrucStructRegle.OP_COMPARE [TmpIndexMesure ] = DRUC_UNDEFINED_OPERATEUR; + DrucStructRegle.VALEUR [TmpIndexMesure ] = DRUC_UNDEFINED_VALEUR; + } +} +/*------------------------------------------------------------\ +| | +| DrucCloseCompiler | +| | +| Ferme le fichier de destination du code assembleur de DRUC | +\------------------------------------------------------------*/ +void DrucCloseCompiler () +{ + if ( fclose( TmpFileAssembler ) == EOF ) + { + DRUC_EXIT ( DRUC_ERROR_CLOSE_DRC_FILE ); + } +} + +/*------------------------------------------------------------\ +| | +| DrucInitRdsLayerName | +| | +| Trouve le Name dans la liste des layers RDS ou sort | +| Range l'index associe dans DrucStructRdsLayer.RDS_INDEX | +\------------------------------------------------------------*/ +void DrucInitRdsLayerName (Name) + char *Name; +{ + int IndexLayer = 0; + + CurrentIndexDrucLayer = DRUC_UNDEFINED_LAYER; + while( IndexLayer < RDS_MAX_LAYER ) + { + if ( strncmp ( RDS_LAYER_NAME[ IndexLayer ], + Name , + strlen (Name) + ) + == 0 + ) + { + if ( DrucStructRdsLayer[ IndexLayer ].RDS_INDEX == DRUC_UNDEFINED_LAYER ) + { + DrucStructRdsLayer[ IndexLayer ].RDS_INDEX = IndexLayer; + DrucStructRdsLayer[ IndexLayer ].FLAGS = DRUC_FLAG_LAYER_OCCUPE; + CurrentIndexDrucLayer = IndexLayer; + return; + } + } + IndexLayer ++ ; + } + DRUC_EXIT( DRUC_ERROR_UNDEFINED_LAYER ); +} +/*------------------------------------------------------------\ +| | +| DrucInitRdsLayerDef | +| | +| Range la Value associe dans DrucStructRdsLayer.WIDTH | +| dont l'index est dans CurrentIndexDrucLayer | +\------------------------------------------------------------*/ +void DrucInitRdsLayerDef (Value) + int Value; +{ + if ( CurrentIndexDrucLayer == DRUC_UNDEFINED_LAYER) + { + DRUC_EXIT( DRUC_ERROR_UNDEFINED_LAYER ); + } +/*\ + * DrucViewString ("DrucInitRdsLayerDef"); + * DrucViewNumber (Value); +\*/ + DrucStructRdsLayer[ CurrentIndexDrucLayer ].WIDTH = Value; + CurrentIndexDrucLayer = DRUC_UNDEFINED_LAYER; +} +/*------------------------------------------------------------\ +| | +| DrucStoreRdsLayer | +| | +| Ecrit dans le fichier *TmpFileAssembler, les layers | +| contenus dans DrucStructRdsLayer[] avec leur valeur min | +| pour la verification des regles et l'unification | +| Stocke le checksumm des ecritures dans DrucCheckSumm | +\------------------------------------------------------------*/ + +void DrucStoreRdsLayer () +{ + register int IndexLayer; + + fprintf( TmpFileAssembler, + "%d ", + DRUC_ASM_BEGIN_LAYER + ); + + for( IndexLayer = 0; + IndexLayer != RDS_MAX_LAYER; + IndexLayer ++ + ) + { + if ((DrucStructRdsLayer[ IndexLayer ].RDS_INDEX != DRUC_UNDEFINED_LAYER ) && + (DrucStructRdsLayer[ IndexLayer ].CTM == DRUC_UNDEFINED_LAYER ) + ) + { + DrucStructRdsLayer[ IndexLayer ].CTM = DrucCtmMax; + } + fprintf( TmpFileAssembler, + "%d %d %d %d ", + DrucStructRdsLayer[ IndexLayer ].RDS_INDEX, + DrucStructRdsLayer[ IndexLayer ].WIDTH, + DrucStructRdsLayer[ IndexLayer ].CTM, + DrucStructRdsLayer[ IndexLayer ].FLAGS + ); + } + fprintf( TmpFileAssembler, + "%d\n", + DRUC_ASM_END_LAYER + ); +} +/*------------------------------------------------------------\ +| | +| DrucInitDefineLayerDest | +| | +| Verifie que: | +| soit le layer NAME est vide | +| soir le layer NAME est le meme que le layer A | +| | +\------------------------------------------------------------*/ +void DrucInitDefineLayerDest (Name) + char *Name; +{ + int IndexLayer = 0; + + while( IndexLayer < RDS_MAX_LAYER ) + { + if ( strstr( RDS_LAYER_NAME[ IndexLayer ] , Name ) != ( char *) NULL ) + { + /*\ + * Le nom existe dans la liste des layers RDS qui sont interdits + \*/ + if ( DrucStructRdsLayer [ IndexLayer ].FLAGS == DRUC_FLAG_LAYER_INTERDIT ) + { + DRUC_EXIT( DRUC_ERROR_NOT_DECLARED_LAYER); + } + /*\ + * Le nom existe dans la liste des layers RDS qui sont occupes + \*/ + if ( DrucStructRdsLayer [ IndexLayer ].FLAGS == DRUC_FLAG_LAYER_OCCUPE && + DrucStructDefine.OP_COMPOSE != DRUC_COMPOSE_RESIZE + ) + { + DRUC_EXIT( DRUC_ERROR_NOT_EMPTY_LAYER); + } + else + { + DrucStructDefine.LAYER_DEST = IndexLayer; + DrucStructRdsLayer [ IndexLayer ].FLAGS = DRUC_FLAG_LAYER_OCCUPE; + return; + } + } + IndexLayer ++ ; + } + /*\ + * Le nom existe dans la liste des layers USER en usage + \*/ + if ( DrucStructDefine.USER_LAYER_NAME_0 != (char *)NULL ) + { + if ( strstr( Name , DrucStructDefine.USER_LAYER_NAME_0 ) != (char *)NULL ) + { + DRUC_EXIT( DRUC_ERROR_DEFINE_USER_LAYER); + } + } + if ( DrucStructDefine.USER_LAYER_NAME_1 != (char *)NULL ) + { + if ( strstr( Name , DrucStructDefine.USER_LAYER_NAME_1 ) != (char *)NULL ) + { + DRUC_EXIT( DRUC_ERROR_DEFINE_USER_LAYER); + } + } + if ( DrucStructDefine.USER_LAYER_NAME_2 != (char *)NULL ) + { + if ( strstr( Name , DrucStructDefine.USER_LAYER_NAME_2 ) != (char *)NULL ) + { + DRUC_EXIT( DRUC_ERROR_DEFINE_USER_LAYER); + } + } + /*\ + * Les layers USER ne sont pas tous en usage + \*/ + if ( DrucStructDefine.USER_LAYER_NAME_0 != (char *)NULL ) + { + if ( DrucStructDefine.USER_LAYER_NAME_1 != (char *)NULL ) + { + if ( DrucStructDefine.USER_LAYER_NAME_2 != (char *)NULL ) + { + DRUC_EXIT( DRUC_ERROR_DEFINE_USER_LAYER ); + } + DrucStructRdsLayer [ DRUC_USER_LAYER_2 ].FLAGS = DRUC_FLAG_LAYER_OCCUPE; + DrucStructDefine.LAYER_DEST = DRUC_USER_LAYER_2; + DrucStructDefine.USER_LAYER_2 = DRUC_USER_LAYER_2; + DrucStructDefine.USER_LAYER_NAME_2 = (char *)malloc ( strlen ( Name ) +1 ); + strcpy ( DrucStructDefine.USER_LAYER_NAME_2 ,Name ); + return; + } + DrucStructRdsLayer [ DRUC_USER_LAYER_1 ].FLAGS = DRUC_FLAG_LAYER_OCCUPE; + DrucStructDefine.LAYER_DEST = DRUC_USER_LAYER_1; + DrucStructDefine.USER_LAYER_1 = DRUC_USER_LAYER_1; + DrucStructDefine.USER_LAYER_NAME_1 = (char *)malloc ( strlen ( Name ) +1 ); + strcpy ( DrucStructDefine.USER_LAYER_NAME_1 ,Name ); + return; + } + DrucStructRdsLayer [ DRUC_USER_LAYER_0 ].FLAGS = DRUC_FLAG_LAYER_OCCUPE; + DrucStructDefine.LAYER_DEST = DRUC_USER_LAYER_0; + DrucStructDefine.USER_LAYER_0 = DRUC_USER_LAYER_0; + DrucStructDefine.USER_LAYER_NAME_0 = (char *)malloc ( strlen ( Name ) +1 ); + strcpy ( DrucStructDefine.USER_LAYER_NAME_0 ,Name ); +} +/*------------------------------------------------------------\ +| | +| DrucStructDefineOpCompose | +| | +\------------------------------------------------------------*/ +void DrucStructDefineOpCompose ( Operateur ) + int Operateur; +{ + DrucStructDefine.OP_COMPOSE = Operateur; +} +/*------------------------------------------------------------\ +| | +| DrucInitOpUnaire | +| | +\------------------------------------------------------------*/ +void DrucInitOpUnaire ( ) +{ + DrucStructDefine.OP_UNAIRE = DrucStructDefine.OP_COMPOSE; + DrucStructDefine.OP_COMPOSE = DRUC_UNDEFINED_OP_COMPOSE; +} +/*------------------------------------------------------------\ +| | +| DrucInitDefineValeur | +| | +\------------------------------------------------------------*/ +void DrucInitDefineValeur ( Valeur ) + long Valeur; +{ + DrucStructDefine.VALEUR = Valeur; +} +/*------------------------------------------------------------\ +| | +| DrucInitDefineLayerA | +| | +| Verifie que le Name est dans la liste des layers RDS | +| ou sort | +| Verifie que le layer correspondant est initialise | +| ou sort | +| Range l'index associe dans | +| DrucTypeStructDefine.USER_LAYER_SOURCE_A | +\------------------------------------------------------------*/ +void DrucInitDefineLayerA (Name) + char *Name; +{ + int IndexLayer = 0; + + /*\ + * Le nom existe dans la liste des layers RDS + \*/ + while( IndexLayer < RDS_MAX_LAYER ) + { + if ( strncmp ( RDS_LAYER_NAME[ IndexLayer ], + Name , + strlen (Name) + ) + == 0 + ) + if ( DrucStructRdsLayer[ IndexLayer ].RDS_INDEX == IndexLayer + ) + { + DrucStructRegle.LAYER_1 = DrucStructRdsLayer[ IndexLayer ].RDS_INDEX; + DrucStructDefine.LAYER_1 = DrucStructRdsLayer[ IndexLayer ].RDS_INDEX; + return; + } + IndexLayer ++ ; + } + /*\ + * Le nom existe dans la liste des layers USER + \*/ + if ( DrucStructDefine.USER_LAYER_NAME_0 != (char *)NULL ) + { + if ( strstr( DrucStructDefine.USER_LAYER_NAME_0, Name ) != (char *)NULL ) + { + DrucStructRegle.LAYER_1 = DRUC_USER_LAYER_0; + DrucStructDefine.LAYER_1 = DRUC_USER_LAYER_0; + return; + } + } + if ( DrucStructDefine.USER_LAYER_NAME_1 != (char *)NULL ) + { + if ( strstr( DrucStructDefine.USER_LAYER_NAME_1, Name ) != (char *)NULL ) + { + DrucStructRegle.LAYER_1 = DRUC_USER_LAYER_1; + DrucStructDefine.LAYER_1 = DRUC_USER_LAYER_1; + return; + } + } + if ( DrucStructDefine.USER_LAYER_NAME_2 != (char *)NULL ) + { + if ( strstr( DrucStructDefine.USER_LAYER_NAME_2, Name ) != + (char *)NULL ) + { + DrucStructRegle.LAYER_1 = DRUC_USER_LAYER_2; + DrucStructDefine.LAYER_1 = DRUC_USER_LAYER_2; + return; + } + } + DRUC_EXIT( DRUC_ERROR_UNDEFINED_LAYER ); +} +/*------------------------------------------------------------\ +| | +| DrucInitDefineLayerB | +| | +| Verifie que le Name est dans la liste des layers RDS | +| ou sort | +| Verifie que le layer correspondant est initialise | +| ou sort | +| Range l'index associe dans | +| DrucTypeStructDefine.USER_LAYER_SOURCE_B | +\------------------------------------------------------------*/ +void DrucInitDefineLayerB (Name) + char *Name; +{ + int IndexLayer = 0; + + /*\ + * Le nom existe dans la liste des layers RDS + \*/ + while( IndexLayer < RDS_MAX_LAYER ) + { + if ( strncmp ( RDS_LAYER_NAME[ IndexLayer ], + Name , + strlen (Name) + ) + == 0 + ) + if ( DrucStructRdsLayer[ IndexLayer ].RDS_INDEX == IndexLayer + ) + { + DrucStructRegle.LAYER_2 = DrucStructRdsLayer[ IndexLayer ].RDS_INDEX; + DrucStructDefine.LAYER_2 = DrucStructRdsLayer[ IndexLayer ].RDS_INDEX; + return; + } + IndexLayer ++ ; + } + /*\ + * Le nom existe dans la liste des layers USER + \*/ + if ( DrucStructDefine.USER_LAYER_NAME_0 != (char *)NULL ) + { + if ( strstr( DrucStructDefine.USER_LAYER_NAME_0, Name ) != (char *)NULL ) + { + DrucStructRegle.LAYER_2 = DRUC_USER_LAYER_0; + DrucStructDefine.LAYER_2 = DRUC_USER_LAYER_0; + return; + } + } + if ( DrucStructDefine.USER_LAYER_NAME_1 != (char *)NULL ) + { + if ( strstr( DrucStructDefine.USER_LAYER_NAME_1, Name ) != (char *)NULL ) + { + DrucStructRegle.LAYER_2 = DRUC_USER_LAYER_1; + DrucStructDefine.LAYER_2 = DRUC_USER_LAYER_1; + return; + } + } + if ( DrucStructDefine.USER_LAYER_NAME_2 != (char *)NULL ) + { + if ( strstr( DrucStructDefine.USER_LAYER_NAME_2, Name ) != + (char *)NULL ) + { + DrucStructRegle.LAYER_2 = DRUC_USER_LAYER_2; + DrucStructDefine.LAYER_2 = DRUC_USER_LAYER_2; + return; + } + } + DRUC_EXIT( DRUC_ERROR_UNDEFINED_LAYER ); +} +/*------------------------------------------------------------\ +| | +| DrucStoreInstructionDefine | +| | +| Ecrit dans le fichier *TmpFileAssembler, l'instruction | +| contenue dans DrucStructDefine avec ses valeurs | +| Stocke le checksumm des ecritures dans DrucCheckSumm | +| DrucStructDefine.USER_LAYER_NAME_0 n'est pas ecrit | +| DrucStructDefine.USER_LAYER_NAME_1 n'est pas ecrit | +| DrucStructDefine.USER_LAYER_NAME_2 n'est pas ecrit | +| Seuls les numeros de layer associes sont ecrits | +\------------------------------------------------------------*/ +void DrucStoreInstructionDefine () +{ + fprintf( TmpFileAssembler, + "%d ", + DRUC_ASM_BEGIN_DEFINE + ); + + fprintf( TmpFileAssembler, + "%d %d %d %d ", + DrucStructDefine.LAYER_DEST, + DrucStructDefine.OP_COMPOSE, + DrucStructDefine.LAYER_1, + DrucStructDefine.LAYER_2 + ); + + fprintf( TmpFileAssembler, + "%d\n", + DRUC_ASM_END_DEFINE + ); + + DrucStructDefine.LAYER_DEST = DRUC_UNDEFINED_LAYER; + DrucStructDefine.OP_COMPOSE = DRUC_UNDEFINED_OP_COMPOSE; + DrucStructDefine.LAYER_1 = DRUC_UNDEFINED_LAYER; + DrucStructDefine.LAYER_2 = DRUC_UNDEFINED_LAYER; +} +/*------------------------------------------------------------\ +| | +| DrucLoadInstructionDefine | +| | +| Transfert le contenu de DrucStructDefine dans une nouvelle | +| instruction de TmpStructInstruction. | +| DrucStructDefine.USER_LAYER_NAME_0 n'est pas ecrit | +| DrucStructDefine.USER_LAYER_NAME_1 n'est pas ecrit | +| DrucStructDefine.USER_LAYER_NAME_2 n'est pas ecrit | +| Seuls les numeros de layer associes sont ecrits | +\------------------------------------------------------------*/ +void DrucLoadInstructionDefine () +{ + +int TmpIndexMesure; +DrucTypeStructInstruction *TmpStructInstruction; + + TmpStructInstruction = + ( DrucTypeStructInstruction *)malloc (sizeof ( DrucTypeStructInstruction )); + + if ( TmpStructInstruction == (DrucTypeStructInstruction *)NULL + ) + { + DRUC_EXIT ( DRUC_ERROR_MEMOIRE ); + } + + TmpStructInstruction->NEXT = DrucStructInstruction; + TmpStructInstruction->INSTRUCTION = DRUC_ASM_BEGIN_DEFINE; + TmpStructInstruction->LAYER_DEST = DrucStructDefine.LAYER_DEST; + TmpStructInstruction->LAYER_1 = DrucStructDefine.LAYER_1; + TmpStructInstruction->LAYER_2 = DrucStructDefine.LAYER_2; + TmpStructInstruction->OP_COMPOSE = DrucStructDefine.OP_COMPOSE; + TmpStructInstruction->OP_UNAIRE = DrucStructDefine.OP_UNAIRE; + TmpStructInstruction->DEF_VALEUR = DrucStructDefine.VALEUR; + + for ( TmpIndexMesure = 0; + TmpIndexMesure < DRUC_MAX_MESURES; + TmpIndexMesure ++ + ) + { + ( TmpStructInstruction->REGLE_NUM ) [ TmpIndexMesure ] = DRUC_UNDEFINED_REGLE; + ( TmpStructInstruction->RELATION ) [ TmpIndexMesure ] = DRUC_UNDEFINED_RELATION; + ( TmpStructInstruction->MESURE ) [ TmpIndexMesure ] = DRUC_UNDEFINED_MESURE; + ( TmpStructInstruction->OP_COMPARE) [ TmpIndexMesure ] = DRUC_UNDEFINED_OPERATEUR; + ( TmpStructInstruction->VALEUR ) [ TmpIndexMesure ] = DRUC_UNDEFINED_VALEUR; + } + + DrucStructInstruction = TmpStructInstruction; + DrucNombreInstructions ++; + + DrucStructDefine.LAYER_DEST = DRUC_UNDEFINED_LAYER; + DrucStructDefine.LAYER_1 = DRUC_UNDEFINED_LAYER; + DrucStructDefine.LAYER_2 = DRUC_UNDEFINED_LAYER; + DrucStructDefine.OP_COMPOSE = DRUC_UNDEFINED_OP_COMPOSE; + DrucStructDefine.OP_UNAIRE = DRUC_UNDEFINED_OP_COMPOSE; + DrucStructDefine.VALEUR = 0; +/*\ + * DrucViewInstruction ( TmpStructInstruction ); +\*/ +} +/*------------------------------------------------------------\ +| | +| DrucInitUndefineUserLayer | +| | +| Trouve Name dans DrucStructDefine.USER_LAYER_i ou sort | +| Range son index dans DrucStructDefine.USER_LAYER_i | +\------------------------------------------------------------*/ +void DrucInitUndefineUserLayer (Name) + char *Name; +{ + +int IndexLayer = 0; + + /*\ + * Le Name n'existe pas dans la liste des layers user + \*/ + + while( IndexLayer < RDS_MAX_LAYER ) + { + if ( strstr( RDS_LAYER_NAME[ IndexLayer ] , Name ) != ( char *) NULL ) + { + /*\ + * Le nom existe dans la liste des layers RDS qui sont interdits + \*/ + if ( DrucStructRdsLayer [ IndexLayer ].FLAGS == DRUC_FLAG_LAYER_INTERDIT ) + { + DRUC_EXIT( DRUC_ERROR_NOT_DECLARED_LAYER); + } + /*\ + * Le nom existe dans la liste des layers RDS qui sont libres + \*/ + if ( DrucStructRdsLayer [ IndexLayer ].FLAGS == DRUC_FLAG_LAYER_LIBRE ) + { + DRUC_EXIT( DRUC_ERROR_EMPTY_LAYER); + } + else + { + DrucStructDefine.LAYER_DEST = IndexLayer; + DrucStructRdsLayer [ IndexLayer ].FLAGS = DRUC_FLAG_LAYER_LIBRE; + return; + } + } + IndexLayer ++ ; + } + /*\ + * Le nom existe dans la liste des layers USER en usage + \*/ + if ( DrucStructDefine.USER_LAYER_NAME_0 != (char *)NULL ) + { + if ( strstr( DrucStructDefine.USER_LAYER_NAME_0, Name ) != (char *)NULL ) + { + DrucStructRdsLayer [ DRUC_USER_LAYER_0 ].FLAGS = DRUC_FLAG_LAYER_LIBRE; + DrucStructDefine.LAYER_DEST = DRUC_USER_LAYER_0; + DrucStructDefine.USER_LAYER_0 = DRUC_UNDEFINED_LAYER; + free ( DrucStructDefine.USER_LAYER_NAME_0 ); + DrucStructDefine.USER_LAYER_NAME_0 = (char *)NULL; + return; + } + } + if ( DrucStructDefine.USER_LAYER_NAME_1 != (char *)NULL ) + { + if ( strcmp( DrucStructDefine.USER_LAYER_NAME_1, Name ) == 0 ) + { + DrucStructRdsLayer [ DRUC_USER_LAYER_1 ].FLAGS = DRUC_FLAG_LAYER_LIBRE; + DrucStructDefine.LAYER_DEST = DRUC_USER_LAYER_1; + DrucStructDefine.USER_LAYER_1 = DRUC_UNDEFINED_LAYER; + free ( DrucStructDefine.USER_LAYER_NAME_1 ); + DrucStructDefine.USER_LAYER_NAME_1 = (char *)NULL; + return; + } + } + if ( DrucStructDefine.USER_LAYER_NAME_2 != (char *)NULL ) + { + if ( strcmp( DrucStructDefine.USER_LAYER_NAME_2, Name ) == 0 ) + { + DrucStructRdsLayer [ DRUC_USER_LAYER_2 ].FLAGS = DRUC_FLAG_LAYER_LIBRE; + DrucStructDefine.LAYER_DEST = DRUC_USER_LAYER_2; + DrucStructDefine.USER_LAYER_2 = DRUC_UNDEFINED_LAYER; + free ( DrucStructDefine.USER_LAYER_NAME_2 ); + DrucStructDefine.USER_LAYER_NAME_2 = (char *)NULL; + return; + } + } + DRUC_EXIT( DRUC_ERROR_UNDEFINED_LAYER ); +} +/*------------------------------------------------------------\ +| | +| DrucLoadInstructionUndefine | +| | +| Ecrit dans DrucStructInstruction l'instruction | +| contenue dans DrucStructDefine avec ses valeurs | +| Seuls le numero de layer user est ecrit | +\------------------------------------------------------------*/ +void DrucLoadInstructionUndefine () +{ + +int TmpIndexMesure; +DrucTypeStructInstruction *TmpStructInstruction; + + TmpStructInstruction = + ( DrucTypeStructInstruction *)malloc (sizeof ( DrucTypeStructInstruction )); + + if ( TmpStructInstruction == (DrucTypeStructInstruction *)NULL + ) + { + DRUC_EXIT ( DRUC_ERROR_MEMOIRE ); + } + + TmpStructInstruction->NEXT = DrucStructInstruction; + DrucStructInstruction = TmpStructInstruction; + TmpStructInstruction->INSTRUCTION = DRUC_ASM_BEGIN_UNDEFINE; + TmpStructInstruction->LAYER_DEST = DRUC_UNDEFINED_LAYER; + TmpStructInstruction->OP_COMPOSE = DRUC_UNDEFINED_OP_COMPOSE; + TmpStructInstruction->LAYER_1 = DrucStructDefine.LAYER_DEST; + TmpStructInstruction->LAYER_2 = DRUC_UNDEFINED_LAYER; + TmpStructInstruction->OP_UNAIRE = DRUC_UNDEFINED_OP_COMPOSE; + TmpStructInstruction->DEF_VALEUR = 0; + + + for ( TmpIndexMesure = 0; + TmpIndexMesure < DRUC_MAX_MESURES; + TmpIndexMesure ++ + ) + { + ( TmpStructInstruction->REGLE_NUM ) [ TmpIndexMesure ] = DRUC_UNDEFINED_REGLE; + ( TmpStructInstruction->RELATION ) [ TmpIndexMesure ] = DRUC_UNDEFINED_RELATION; + ( TmpStructInstruction->MESURE ) [ TmpIndexMesure ] = DRUC_UNDEFINED_MESURE; + ( TmpStructInstruction->OP_COMPARE) [ TmpIndexMesure ] = DRUC_UNDEFINED_OPERATEUR; + ( TmpStructInstruction->VALEUR ) [ TmpIndexMesure ] = DRUC_UNDEFINED_VALEUR; + } + + DrucNombreInstructions ++; + + DrucStructDefine.LAYER_DEST = DRUC_UNDEFINED_LAYER; +} +/*------------------------------------------------------------\ +| | +| DrucInitRegleNumero | +| | +\------------------------------------------------------------*/ +void DrucInitRegleNumero ( Value, + DrucIndexMesure + ) + int Value; + int DrucIndexMesure; +{ + DataList *TmpListReglNum; + + if ( DrucIndexMesure >= DRUC_MAX_MESURES ) + { + DRUC_EXIT( DRUC_ERROR_MAX_OPERATOR ); + } + for( TmpListReglNum = DrucStructRegle.LIST_REGLE_NUM; + TmpListReglNum != (DataList *)NULL; + TmpListReglNum = TmpListReglNum->NEXT + ) + { + if ( TmpListReglNum->REGLE_NUM == Value ) + { + DRUC_EXIT( DRUC_ERROR_RULE_NUMBER ); + } + } + DrucStructRegle.REGLE_NUM [ DrucIndexMesure ] = Value; + TmpListReglNum = DrucStructRegle.LIST_REGLE_NUM; + DrucStructRegle.LIST_REGLE_NUM = (DataList *)malloc( sizeof( DataList )); + ( DrucStructRegle.LIST_REGLE_NUM )->NEXT = TmpListReglNum; + ( DrucStructRegle.LIST_REGLE_NUM )->REGLE_NUM = Value; +} +/*------------------------------------------------------------\ +| | +| DrucInitRegleInstruction | +| | +\------------------------------------------------------------*/ +void DrucInitRegleInstruction ( Instruction ) + int Instruction; +{ + DrucStructRegle.INSTRUCTION = Instruction; +} +/*------------------------------------------------------------\ +| | +| DrucInitRegleRelation | +| | +\------------------------------------------------------------*/ +void DrucInitRegleRelation ( Relation, + DrucIndexMesure + ) + int Relation; + int DrucIndexMesure; +{ + DrucStructRegle.RELATION [ DrucIndexMesure ] = Relation; +} +/*------------------------------------------------------------\ +| | +| DrucInitRegleLayerA | +| | +| Verifie que le Name est dans la liste des layers RDS | +| ou | +| Verifie que le Name est dans la liste des layers | +| user deja declares pour DRUC | +| ou sort | +|Range le numero de layer RDS dans DrucStructRegle.LAYER_1 | +\------------------------------------------------------------*/ +void DrucInitRegleLayerA ( Name ) + char *Name; +{ + int IndexLayer = 0; + + /*\ + * Le nom existe dans la liste des layers RDS + \*/ + while( IndexLayer < RDS_MAX_LAYER ) + { + if ( strncmp ( RDS_LAYER_NAME[ IndexLayer ], + Name , + strlen (Name) + ) + == 0 + ) + if ( DrucStructRdsLayer[ IndexLayer ].RDS_INDEX == IndexLayer + ) + { + DrucStructRegle.LAYER_1 = DrucStructRdsLayer[ IndexLayer ].RDS_INDEX; + return; + } + IndexLayer ++ ; + } + /*\ + * Le nom existe dans la liste des layers USER + \*/ + if ( DrucStructDefine.USER_LAYER_NAME_0 != (char *)NULL ) + { + if ( strstr( DrucStructDefine.USER_LAYER_NAME_0, Name ) != (char *)NULL ) + { + DrucStructRegle.LAYER_1 = DRUC_USER_LAYER_0; + return; + } + } + if ( DrucStructDefine.USER_LAYER_NAME_1 != (char *)NULL ) + { + if ( strstr( DrucStructDefine.USER_LAYER_NAME_1, Name ) != (char *)NULL ) + { + DrucStructRegle.LAYER_1 = DRUC_USER_LAYER_1; + return; + } + } + if ( DrucStructDefine.USER_LAYER_NAME_2 != (char *)NULL ) + { + if ( strstr( DrucStructDefine.USER_LAYER_NAME_2, Name ) != + (char *)NULL ) + { + DrucStructRegle.LAYER_1 = DRUC_USER_LAYER_2; + return; + } + } + DRUC_EXIT( DRUC_ERROR_UNDEFINED_LAYER ); +} +/*------------------------------------------------------------\ +| | +| DrucInitRegleLayerB | +| | +| Verifie que le Name est dans la liste des layers RDS | +| ou | +| Verifie que le Name est dans la liste des layers | +| user deja declares pour DRUC | +| ou sort | +|Range le numero de layer RDS dans DrucStructRegle.LAYER_2 | +\------------------------------------------------------------*/ +void DrucInitRegleLayerB ( Name ) + char *Name; +{ + int IndexLayer = 0; + + /*\ + * Le nom existe dans la liste des layers RDS + \*/ + while( IndexLayer < RDS_MAX_LAYER ) + { + if ( strncmp ( RDS_LAYER_NAME[ IndexLayer ], + Name , + strlen (Name) + ) + == 0 + ) + if ( DrucStructRdsLayer[ IndexLayer ].RDS_INDEX == IndexLayer + ) + { + DrucStructRegle.LAYER_2 = DrucStructRdsLayer[ IndexLayer ].RDS_INDEX; + return; + } + IndexLayer ++ ; + } + /*\ + * Le nom existe dans la liste des layers USER + \*/ + if ( DrucStructDefine.USER_LAYER_NAME_0 != (char *)NULL ) + { + if ( strstr( DrucStructDefine.USER_LAYER_NAME_0, Name ) != (char *)NULL ) + { + DrucStructRegle.LAYER_2 = DRUC_USER_LAYER_0; + return; + } + } + if ( DrucStructDefine.USER_LAYER_NAME_1 != (char *)NULL ) + { + if ( strstr( DrucStructDefine.USER_LAYER_NAME_1, Name ) != (char *)NULL ) + { + DrucStructRegle.LAYER_2 = DRUC_USER_LAYER_1; + return; + } + } + if ( DrucStructDefine.USER_LAYER_NAME_2 != (char *)NULL ) + { + if ( strstr( DrucStructDefine.USER_LAYER_NAME_2, Name ) != (char *)NULL ) + { + DrucStructRegle.LAYER_2 = DRUC_USER_LAYER_2; + return; + } + } + DRUC_EXIT( DRUC_ERROR_UNDEFINED_LAYER ); +} +/*------------------------------------------------------------\ +| | +| DrucInitRegleMesure | +| | +\------------------------------------------------------------*/ +void DrucInitRegleMesure ( Mesure, + DrucIndexMesure + ) + int Mesure; + int DrucIndexMesure; +{ + DrucStructRegle.MESURE [ DrucIndexMesure ] = Mesure; +} +/*------------------------------------------------------------\ +| | +| DrucInitRegleValeur | +| | +\------------------------------------------------------------*/ +void DrucInitRegleValeur ( Value, + DrucIndexMesure + ) + long Value; + int DrucIndexMesure; +{ +/*\ + * DrucViewString ("DrucInitRegleValeur"); + * DrucViewNumber (Value); +\*/ + + if ( ( DrucStructRegle.MESURE [ DrucIndexMesure ] == DRUC_MESURE_SURFACE ) || + ( DrucStructRegle.MESURE [ DrucIndexMesure ] == DRUC_MESURE_SURFACE_INTER ) + ) + { + Value = ( RprTranslateParam ( 1.0 ) * Value ); + } + DrucStructRegle.VALEUR [ DrucIndexMesure ] = Value; + if ( ( DrucStructRegle.MESURE [ DrucIndexMesure ] == DRUC_MESURE_AXIALE ) || + ( DrucStructRegle.MESURE [ DrucIndexMesure ] == DRUC_MESURE_GEODESIQUE ) + ) + { +/*\ + DrucCtmMax = ( DrucCtmMax > Value ? + DrucCtmMax : + Value + ); + * la ctm max est calculee par le parser + * comme ca on peut charger en tete les layers valides + * suivis des regles et de leure duplications +\*/ + DrucStructRdsLayer[ DrucStructRegle.LAYER_1 ].CTM = Value; + } +} +/*------------------------------------------------------------\ +| | +| DrucInitRegleOpCompare | +| | +\------------------------------------------------------------*/ +void DrucInitRegleOpCompare ( Operateur, + DrucIndexMesure + ) + int Operateur; + int DrucIndexMesure; +{ + DrucStructRegle.OP_COMPARE [ DrucIndexMesure ] = Operateur; +} +/*------------------------------------------------------------\ +| | +| DrucLoadInstructionRegle | +| | +| Ecrit dans le fichier *TmpFileAssembler, l'instruction | +| contenue dans DrucStructRegle avec ses valeurs | +| Stocke le checksumm des ecritures dans DrucCheckSumm | +| Une instruction de relation est caracterisee par un code | +| RELATION dans ce cas deux layers sont enregistres au lieu | +| d'un seul. Les autre valeurs sont toutes enregistrees | +\------------------------------------------------------------*/ +void DrucLoadInstructionRegle () +{ +int TmpIndexMesure; +DrucTypeStructInstruction *TmpStructInstruction; + + TmpStructInstruction = + ( DrucTypeStructInstruction *)malloc (sizeof ( DrucTypeStructInstruction )); + + if ( TmpStructInstruction == (DrucTypeStructInstruction *)NULL + ) + { + DRUC_EXIT ( DRUC_ERROR_MEMOIRE ); + } + + TmpStructInstruction->NEXT = DrucStructInstruction; + DrucStructInstruction = TmpStructInstruction; + TmpStructInstruction->INSTRUCTION = DRUC_ASM_BEGIN_REGLE; + TmpStructInstruction->LAYER_DEST = DRUC_UNDEFINED_LAYER; + TmpStructInstruction->OP_COMPOSE = DrucStructRegle.INSTRUCTION; + TmpStructInstruction->LAYER_1 = DrucStructRegle.LAYER_1; + TmpStructInstruction->LAYER_2 = DrucStructRegle.LAYER_2; + TmpStructInstruction->OP_UNAIRE = DRUC_UNDEFINED_OP_COMPOSE; + TmpStructInstruction->DEF_VALEUR = 0; + + for ( TmpIndexMesure = 0; + TmpIndexMesure < DRUC_MAX_MESURES; + TmpIndexMesure ++ + ) + { + ( TmpStructInstruction->REGLE_NUM ) [ TmpIndexMesure ] = + DrucStructRegle.REGLE_NUM [ TmpIndexMesure ]; + ( TmpStructInstruction->RELATION ) [ TmpIndexMesure ] = + DrucStructRegle.RELATION [ TmpIndexMesure ]; + ( TmpStructInstruction->MESURE ) [ TmpIndexMesure ] = + DrucStructRegle.MESURE [ TmpIndexMesure ]; + ( TmpStructInstruction->OP_COMPARE) [ TmpIndexMesure ] = + DrucStructRegle.OP_COMPARE [ TmpIndexMesure ]; + ( TmpStructInstruction->VALEUR ) [ TmpIndexMesure ] = + DrucStructRegle.VALEUR [ TmpIndexMesure ]; + + DrucStructRegle.REGLE_NUM [ TmpIndexMesure ] = DRUC_UNDEFINED_REGLE; + DrucStructRegle.RELATION [ TmpIndexMesure ] = DRUC_UNDEFINED_RELATION; + DrucStructRegle.MESURE [ TmpIndexMesure ] = DRUC_UNDEFINED_MESURE; + DrucStructRegle.OP_COMPARE [ TmpIndexMesure ] = DRUC_UNDEFINED_OPERATEUR; + DrucStructRegle.VALEUR [ TmpIndexMesure ] = DRUC_UNDEFINED_VALEUR; + } + + DrucStructRegle.LAYER_1 = DRUC_UNDEFINED_LAYER; + DrucStructRegle.LAYER_2 = DRUC_UNDEFINED_LAYER; + DrucStructDefine.OP_UNAIRE = DRUC_UNDEFINED_OP_COMPOSE; + TmpStructInstruction->DEF_VALEUR = 0; + + DrucNombreInstructions ++; + + DrucComputeCtm ( TmpStructInstruction + ); + + if ( DrucStructStat.FLAG_FLATTEN_MODE == DRUC_HIERARCHIE + ) + { + DrucDuplicateHierarchicalRule ( & DrucStructInstruction, + & DrucNombreInstructions + ); + } +} diff --git a/alliance/src/druc/src/drucompi.h b/alliance/src/druc/src/drucompi.h new file mode 100644 index 00000000..048a9d3f --- /dev/null +++ b/alliance/src/druc/src/drucompi.h @@ -0,0 +1,113 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : Drucompi.h | +| | +| Authors : Patrick Renaud | +| | +| Date : 11/01/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Druc Compiler Defines | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Druc Compiler Types | +| | +\------------------------------------------------------------*/ +typedef struct data_list + { + struct data_list *NEXT; + int REGLE_NUM; + } DataList; + +typedef struct struct_define + { + int LAYER_DEST; + int OP_COMPOSE; + int OP_UNAIRE; + int LAYER_1; + int LAYER_2; + long VALEUR; + int USER_LAYER_0; + int USER_LAYER_1; + int USER_LAYER_2; + char *USER_LAYER_NAME_0; + char *USER_LAYER_NAME_1; + char *USER_LAYER_NAME_2; + } DrucTypeStructDefine; + +typedef struct struct_regle + { + DataList *LIST_REGLE_NUM; + int REGLE_NUM [ DRUC_MAX_MESURES ]; + int INSTRUCTION; + int RELATION [ DRUC_MAX_MESURES ]; + int LAYER_1; + int LAYER_2; + int MESURE [ DRUC_MAX_MESURES ]; + int OP_COMPARE [ DRUC_MAX_MESURES ]; + long VALEUR [ DRUC_MAX_MESURES ]; + } DrucTypeStructRegle; + +/*------------------------------------------------------------\ +| | +| Druc Compiler variables | +| | +\------------------------------------------------------------*/ +extern DrucTypeStructDefine DrucStructDefine; +extern DrucTypeStructRegle DrucStructRegle; +extern DrucTypeStructInstruction *DrucStructInstruction; +/*------------------------------------------------------------\ +| | +| Druc Variables LEX/YACC | +| | +\------------------------------------------------------------*/ +extern FILE *vrd_y_in; +extern int vrd_y_lineno; +extern int DrucInputEntier; +extern float DrucInputFloat; +extern char DrucInputChaine[]; +/*------------------------------------------------------------\ +| | +| Druc Fonctions LEX/YACC | +| | +\------------------------------------------------------------*/ +extern vrd_y_parse (); +extern void vrd_y_error (); +/*------------------------------------------------------------\ +| | +| Druc Fonctions | +| | +\------------------------------------------------------------*/ +extern void DrucInitCompiler (); +extern void DrucCloseCompiler (); + +extern void DrucInitRdsLayerName (); +extern void DrucInitRdsLayerDef (); +extern void DrucStoreRdsLayer (); + +extern void DrucInitDefineLayerDest (); +extern void DrucStructDefineOpCompose (); +extern void DrucInitDefineLayerA (); +extern void DrucInitDefineLayerB (); +extern void DrucStoreInstructionDefine (); + +extern void DrucInitUndefineUserLayer (); +extern void DrucStoreInstructionUndefine (); + +extern void DrucInitRegleNumero (); +extern void DrucInitRegleInstruction (); +extern void DrucInitRegleLayerA (); +extern void DrucInitRegleLayerB (); +extern void DrucInitRegleValeur (); +extern void DrucInitRegleRelation (); +extern void DrucInitRegleMesure (); +extern void DrucInitRegleOpCompare (); +extern void DrucStoreInstructionRegle (); + +extern void DrucEcho (); diff --git a/alliance/src/druc/src/drucompi_l.l b/alliance/src/druc/src/drucompi_l.l new file mode 100644 index 00000000..ad9b218a --- /dev/null +++ b/alliance/src/druc/src/drucompi_l.l @@ -0,0 +1,192 @@ +%{ +#include "mut.h" +#include "drucompi_y.h" +#include "drucutil.h" +#include "drucompi.h" + +#ifdef FLEX_SCANNER + +#ifdef YY_INPUT +#undef YY_INPUT +#endif + +#define YY_INPUT(buf,result,max_size) \ + do { \ + int c = getc(yyin); \ + result = (c == EOF) ? YY_NULL \ + : (buf[0] = isupper(c) ? toupper(c) : c, 1); \ + } while(0) + +int yylineno; + +#else /* using lex, for sure */ + +#ifdef input +#undef input +#endif + +#define input() (((yytchar = yysptr > yysbuf ? U(*--yysptr) \ + : getc(yyin)) == 10 ?(yylineno++,yytchar) \ + : yytchar) == EOF ? 0 \ + : isupper(yytchar) ? toupper(yytchar) \ + : yytchar) +#endif + +%} + +%p 3000 +%option yylineno + +delim [ \n\t] +esp [ \t] +rc [\n] +pct [\.\,\;\:\'\"\?\/\~\`\@\^<>\!\&\*\(\)\-\_\=\+\{\}\[\]\$\%\\\|] +blanc {delim}+ + +lettre [A-Za-z] +ident {lettre}({lettre}*|{dec}*|[_]*)* +dec [0-9] +decimal {dec}+ +reel {dec}*([\.]{dec}*) +negat [\-]{reel} +comment [#]({lettre}*{dec}*{esp}*{pct}*)*{rc} + +%% + + +{blanc} { DrucEcho ( yytext ); + } +layer { DrucEcho ( yytext ); + return(DRUC_LAYER);} +regle { DrucEcho ( yytext ); + return(DRUC_REGLE);} +regles { DrucEcho ( yytext ); + return(DRUC_REGLES);} +fin { DrucEcho ( yytext ); + return(DRUC_FIN);} + +define { DrucEcho ( yytext ); + return(DRUC_DEFINE);} +undefine { DrucEcho ( yytext ); + return(DRUC_UNDEFINE);} +caracterise { DrucEcho ( yytext ); + return(DRUC_CARACTERISE);} +relation { DrucEcho ( yytext ); + return(DRUC_RELATION);} + +resize { DrucEcho ( yytext ); + return(DRUC_RESIZE);} +exclusion { DrucEcho ( yytext ); + return(DRUC_EXCLUSION);} +union { DrucEcho ( yytext ); + return(DRUC_UNION);} +enveloppe { DrucEcho ( yytext ); + return(DRUC_ENVELOPPE);} +marge { DrucEcho ( yytext ); + return(DRUC_MARGE);} +croix { DrucEcho ( yytext ); + return(DRUC_CROIX);} +intersection { DrucEcho ( yytext ); + return(DRUC_INTERSECT);} +extension { DrucEcho ( yytext ); + return(DRUC_EXTENSION);} +inclusion { DrucEcho ( yytext ); + return(DRUC_INCLUSION);} +distance { DrucEcho ( yytext ); + return(DRUC_DISTANCE);} + +surface_inter { DrucEcho ( yytext ); + return(DRUC_SURFACE_INTER);} +longueur_inter { DrucEcho ( yytext ); + return(DRUC_LONG_INTER);} +largeur_inter { DrucEcho ( yytext ); + return(DRUC_LARGE_INTER);} +penetre_inter { DrucEcho ( yytext ); + return(DRUC_PENET_INTER);} +parallele_inter { DrucEcho ( yytext ); + return(DRUC_PARAL_INTER);} +perpendiculaire_inter { DrucEcho ( yytext ); + return(DRUC_PERPEN_INTER);} + +axiale { DrucEcho ( yytext ); + return(DRUC_AXIALE);} +geodesique { DrucEcho ( yytext ); + return(DRUC_GEODESIQUE);} +frontale { DrucEcho ( yytext ); + return(DRUC_FRONTALE);} +laterale_min { DrucEcho ( yytext ); + return(DRUC_LATERALE_MIN);} +laterale_max { DrucEcho ( yytext ); + return(DRUC_LATERALE_MAX);} + +longueur_min { DrucEcho ( yytext ); + return(DRUC_LONGUEUR_MIN);} +longueur_max { DrucEcho ( yytext ); + return(DRUC_LONGUEUR_MAX);} +largeur_min { DrucEcho ( yytext ); + return(DRUC_LARGEUR_MIN);} +largeur_max { DrucEcho ( yytext ); + return(DRUC_LARGEUR_MAX);} +superieure { DrucEcho ( yytext ); + return(DRUC_SUP);} +inferieure { DrucEcho ( yytext ); + return(DRUC_INF);} + +surface { DrucEcho ( yytext ); + return(DRUC_SURFACE);} +longueur { DrucEcho ( yytext ); + return(DRUC_LONGUEUR);} +largeur { DrucEcho ( yytext ); + return(DRUC_LARGEUR);} + +notch { DrucEcho ( yytext ); + return(DRUC_NOTCH);} +min { DrucEcho ( yytext ); + return(DRUC_MIN);} +max { DrucEcho ( yytext ); + return(DRUC_MAX);} +"<=" { DrucEcho ( yytext ); + return(DRUC_INFEQ);} +">=" { DrucEcho ( yytext ); + return(DRUC_SUPEQ);} + +"->" { DrucEcho ( yytext ); + return(DRUC_DESTINATION);} + +{decimal} { DrucEcho ( yytext ); + sscanf(yytext,"%d",&DrucInputEntier); + return(DRUC_ENTIER); + } +{reel} { DrucEcho ( yytext ); + sscanf( yytext,"%f",& DrucInputFloat); + return(DRUC_FLOAT); + } +{negat} { DrucEcho ( yytext ); + sscanf( yytext,"%f",& DrucInputFloat); + return(DRUC_NEG_FLOAT); + } +{ident} { DrucEcho ( yytext ); + sscanf(yytext,"%s",DrucInputChaine); + return(DRUC_NOM); + } +{comment} { DrucEcho ( yytext ); + } +. { DrucEcho ( yytext ); + return (*yytext);} + +%% + +void DrucEcho ( text ) +{ + if ( DrucStructStat.FLAG_VIEW_RULE_MODE == DRUC_VERBOSE + ) + { + DrucViewString ( text ); + } +} + +#ifndef yywrap + +int yywrap() +{ return(1) ; } +#endif diff --git a/alliance/src/druc/src/drucompi_y.y b/alliance/src/druc/src/drucompi_y.y new file mode 100644 index 00000000..8b19974d --- /dev/null +++ b/alliance/src/druc/src/drucompi_y.y @@ -0,0 +1,306 @@ +%{ +#include +#include "mph.h" +#include "mut.h" +#include "rds.h" +#include "rwi.h" +#include "rut.h" +#include "rtl.h" +#include "rfm.h" +#include "rpr.h" +#include "drucutil.h" +#include "drucompi.h" + +/*------------------------------------------------------------\ +| | +| Druc MODIFICATIONS | +| | +| Patrick: 07/03/94 | +| Ajouter DRUC_FRONTALE et DRUC_LATERALE_MIN | +| qui etaient oublies dans les derivations | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Druc Variables LEX/YACC | +| | +\------------------------------------------------------------*/ +extern int yylineno; +extern FILE *yyin; + int DrucIndexMesure; + int DrucInputEntier; + int DrucNegatif; + float DrucInputFloat; + char DrucInputChaine[DRUC_MAX_STRING_BUFFER + 1]; +%} + +/*------------------------------------------------------------\ +| | +| Druc Types LEX/YACC | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Druc Terminaux | +| | +\------------------------------------------------------------*/ +%token DRUC_REGLES DRUC_FIN DRUC_REGLE + + DRUC_DEFINE DRUC_UNDEFINE + DRUC_CARACTERISE DRUC_RELATION + + DRUC_LAYER DRUC_NOM + + DRUC_UNION DRUC_EXCLUSION DRUC_RESIZE + + DRUC_ENVELOPPE DRUC_MARGE DRUC_CROIX + DRUC_INTERSECT DRUC_EXTENSION DRUC_INCLUSION + DRUC_DISTANCE + + DRUC_SURFACE_INTER DRUC_LONG_INTER DRUC_LARGE_INTER + DRUC_PENET_INTER DRUC_PARAL_INTER DRUC_PERPEN_INTER + + DRUC_FRONTALE DRUC_LATERALE_MIN DRUC_LATERALE_MAX + DRUC_LARGEUR_MIN DRUC_LARGEUR_MAX + DRUC_LONGUEUR_MIN DRUC_LONGUEUR_MAX + DRUC_SUP DRUC_INF + DRUC_AXIALE DRUC_GEODESIQUE + + DRUC_SURFACE DRUC_LONGUEUR DRUC_LARGEUR + + DRUC_MIN DRUC_MAX + DRUC_INFEQ DRUC_SUPEQ + DRUC_DIFF DRUC_NOTCH + + DRUC_DESTINATION + + DRUC_ENTIER DRUC_FLOAT DRUC_NEG_FLOAT + +/*------------------------------------------------------------\ +| | +| Druc Racine | +| | +\------------------------------------------------------------*/ +%start drc + +/*------------------------------------------------------------\ +| | +| Druc Regles | +| | +\------------------------------------------------------------*/ +%% + +drc : { DrucNombreInstructions = 0; + DrucInitCompiler () ;} + list_layer + DRUC_REGLES + list_bloc + DRUC_FIN + DRUC_REGLES { return ;} + ; + +list_layer: list_layer layer + | layer + ; + +layer : DRUC_LAYER + DRUC_NOM { DrucInitRdsLayerName ( DrucInputChaine ) ;} + DRUC_FLOAT { DrucInitRdsLayerDef ( RprTranslateParam ( DrucInputFloat ) );} + ';' + ; + +list_bloc : list_bloc + bloc + | bloc + ; + +bloc : define { DrucLoadInstructionDefine () ;} + | undefine { DrucLoadInstructionUndefine () ;} + | caracter { DrucLoadInstructionRegle () ;} + | relation { DrucLoadInstructionRegle () ;} + ; + +define : DRUC_DEFINE + DRUC_NOM { DrucInitDefineLayerA ( DrucInputChaine ) ;} + ',' + resiz + DRUC_DESTINATION + DRUC_NOM { DrucInitDefineLayerDest ( DrucInputChaine ) ;} + ';' + ; + +resiz : valresiz + defmodif + defoper + | DRUC_NOM { DrucInitDefineLayerB ( DrucInputChaine ) ;} + compose + ; + +valresiz : DRUC_FLOAT { DrucInitDefineValeur ( RprTranslateParam ( DrucInputFloat)) ;} + | DRUC_NEG_FLOAT { long i ; + i = RprTranslateParam ( DrucInputFloat ); + DrucInitDefineValeur ( i );} + ; + +defoper : ',' { DrucInitOpUnaire ( ) ;} + DRUC_NOM { DrucInitDefineLayerB ( DrucInputChaine ) ;} + compose + | + ; + +compose : DRUC_UNION { DrucStructDefineOpCompose( DRUC_COMPOSE_UNION );} + | DRUC_INTERSECT { DrucStructDefineOpCompose( DRUC_COMPOSE_INTERSECT );} + | DRUC_EXCLUSION { DrucStructDefineOpCompose( DRUC_COMPOSE_EXCLUSION );} + | DRUC_INCLUSION { DrucStructDefineOpCompose( DRUC_COMPOSE_INCLUSION );} + ; + +defmodif : DRUC_RESIZE { DrucStructDefineOpCompose( DRUC_COMPOSE_RESIZE );} + ; + +undefine : DRUC_UNDEFINE + DRUC_NOM { DrucInitUndefineUserLayer ( DrucInputChaine ) ;} + ';' + ; + +caracter : DRUC_CARACTERISE + DRUC_NOM { DrucInitRegleLayerA ( DrucInputChaine ) ; + DrucInitRegleInstruction ( DRUC_INSTR_CARACTERISE ) ; + DrucIndexMesure = -1 ;} + '(' + lst_rgl_1 + ')' + ';' + ; + +lst_rgl_1 : lst_rgl_1 + regle_1 + | regle_1 + ; + +regle_1 : DRUC_REGLE { DrucIndexMesure ++ ;} + DRUC_ENTIER { DrucInitRegleNumero ( DrucInputEntier, + DrucIndexMesure) ;} + ':' + mesure + compar + DRUC_FLOAT { DrucInitRegleValeur ( RprTranslateParam ( DrucInputFloat ), + DrucIndexMesure );} + ';' + ; + +relation : DRUC_RELATION { DrucInitRegleInstruction ( DRUC_INSTR_RELATION ) ;} + DRUC_NOM { DrucInitRegleLayerA ( DrucInputChaine ) ;} + ',' + DRUC_NOM { DrucInitRegleLayerB ( DrucInputChaine ) ; + DrucIndexMesure = -1 ; } + '(' + lst_rgl_2 + ')' + ';' + ; + +lst_rgl_2 : lst_rgl_2 + regle_2 + | regle_2 + ; + +regle_2 : DRUC_REGLE { DrucIndexMesure ++ ;} + DRUC_ENTIER { DrucInitRegleNumero ( DrucInputEntier, + DrucIndexMesure ) ;} + ':' + config + mesure_rel + compar + DRUC_FLOAT { DrucInitRegleValeur ( RprTranslateParam ( DrucInputFloat ), + DrucIndexMesure );} + ';' + ; + +config : DRUC_DISTANCE { DrucInitRegleRelation( DRUC_RELATION_DISTANCE, + DrucIndexMesure );} + | DRUC_INTERSECT { DrucInitRegleRelation( DRUC_RELATION_INTERSECTION, + DrucIndexMesure );} + | DRUC_EXTENSION { DrucInitRegleRelation( DRUC_RELATION_EXTENSION, + DrucIndexMesure );} + | DRUC_INCLUSION { DrucInitRegleRelation( DRUC_RELATION_INCLUSION, + DrucIndexMesure );} + | DRUC_ENVELOPPE { DrucInitRegleRelation( DRUC_RELATION_ENVELOPPE, + DrucIndexMesure );} + | DRUC_MARGE { DrucInitRegleRelation( DRUC_RELATION_MARGE, + DrucIndexMesure );} + | DRUC_CROIX { DrucInitRegleRelation( DRUC_RELATION_CROIX, + DrucIndexMesure );} + ; + +mesure_rel: DRUC_SURFACE_INTER{ DrucInitRegleMesure( DRUC_MESURE_SURFACE_INTER, + DrucIndexMesure );} + | DRUC_LONG_INTER { DrucInitRegleMesure( DRUC_MESURE_LONGUEUR_INTER, + DrucIndexMesure );} + | DRUC_LARGE_INTER { DrucInitRegleMesure( DRUC_MESURE_LARGEUR_INTER, + DrucIndexMesure );} + | DRUC_PENET_INTER { DrucInitRegleMesure( DRUC_MESURE_PENETRE_INTER, + DrucIndexMesure );} + | DRUC_PARAL_INTER { DrucInitRegleMesure( DRUC_MESURE_PARALEL_INTER, + DrucIndexMesure );} + | DRUC_PERPEN_INTER{ DrucInitRegleMesure( DRUC_MESURE_PERPEND_INTER, + DrucIndexMesure );} + | DRUC_LONGUEUR_MIN{ DrucInitRegleMesure( DRUC_MESURE_LONGUEUR_MIN, + DrucIndexMesure );} + | DRUC_LONGUEUR_MAX{ DrucInitRegleMesure( DRUC_MESURE_LONGUEUR_MAX, + DrucIndexMesure );} + | DRUC_LARGEUR_MIN { DrucInitRegleMesure( DRUC_MESURE_LARGEUR_MIN, + DrucIndexMesure );} + | DRUC_LARGEUR_MAX { DrucInitRegleMesure( DRUC_MESURE_LARGEUR_MAX, + DrucIndexMesure );} + | DRUC_FRONTALE { DrucInitRegleMesure( DRUC_MESURE_FRONTALE, + DrucIndexMesure );} + | DRUC_LATERALE_MIN{ DrucInitRegleMesure( DRUC_MESURE_LATERALE_MIN, + DrucIndexMesure );} + | DRUC_LATERALE_MAX{ DrucInitRegleMesure( DRUC_MESURE_LATERALE_MAX, + DrucIndexMesure );} + | DRUC_SUP { DrucInitRegleMesure( DRUC_MESURE_SUP, + DrucIndexMesure );} + | DRUC_INF { DrucInitRegleMesure( DRUC_MESURE_INF, + DrucIndexMesure );} + | DRUC_AXIALE { DrucInitRegleMesure( DRUC_MESURE_AXIALE, + DrucIndexMesure );} + | DRUC_GEODESIQUE { DrucInitRegleMesure( DRUC_MESURE_GEODESIQUE, + DrucIndexMesure );} + ; + +mesure : DRUC_SURFACE { DrucInitRegleMesure( DRUC_MESURE_SURFACE, + DrucIndexMesure );} + | DRUC_LONGUEUR { DrucInitRegleMesure( DRUC_MESURE_LONGUEUR, + DrucIndexMesure );} + | DRUC_LARGEUR { DrucInitRegleMesure( DRUC_MESURE_LARGEUR, + DrucIndexMesure );} + | DRUC_NOTCH { DrucInitRegleMesure( DRUC_MESURE_NOTCH, + DrucIndexMesure );} + | DRUC_SURFACE_INTER { DrucInitRegleMesure( DRUC_MESURE_SURFACE_INTER, + DrucIndexMesure );} + | DRUC_LONG_INTER { DrucInitRegleMesure( DRUC_MESURE_LONGUEUR_INTER, + DrucIndexMesure );} + | DRUC_LARGE_INTER { DrucInitRegleMesure( DRUC_MESURE_LARGEUR_INTER, + DrucIndexMesure );} + ; + +compar : DRUC_MIN { DrucInitRegleOpCompare ( DRUC_OPERATION_MIN, + DrucIndexMesure );} + | DRUC_MAX { DrucInitRegleOpCompare ( DRUC_OPERATION_MAX, + DrucIndexMesure );} + | DRUC_INFEQ { DrucInitRegleOpCompare ( DRUC_OPERATION_INFEQ, + DrucIndexMesure );} + | DRUC_SUPEQ { DrucInitRegleOpCompare ( DRUC_OPERATION_SUPEQ, + DrucIndexMesure );} + | '<' { DrucInitRegleOpCompare ( DRUC_OPERATION_INF, + DrucIndexMesure );} + | '>' { DrucInitRegleOpCompare ( DRUC_OPERATION_SUP, + DrucIndexMesure );} + | '=' { DrucInitRegleOpCompare ( DRUC_OPERATION_EQUAL, + DrucIndexMesure );} + | DRUC_DIFF { DrucInitRegleOpCompare ( DRUC_OPERATION_DIFF, + DrucIndexMesure );} + ; + + +%% diff --git a/alliance/src/druc/src/drucring.c b/alliance/src/druc/src/drucring.c new file mode 100644 index 00000000..c48c683c --- /dev/null +++ b/alliance/src/druc/src/drucring.c @@ -0,0 +1,521 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DRUCRING.C | +| | +| Authors : Renaud Patrick | +| | +| Date : 03/07/95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | | +| Include Files | +| | +\------------------------------------------------------------*/ +#include +#include +#include +#include "mph.h" +#include "mut.h" +#include "rds.h" +#include "rwi.h" +#include "rut.h" +#include "rtl.h" +#include "rfm.h" +#include "rpr.h" +#include "drucutil.h" +#include "vmctools.h" +#include "druchier.h" +#include "drucring.h" +/*------------------------------------------------------------\ +| | +| DRUCRING Variables | +| | +\------------------------------------------------------------*/ +extern long DrucCtmMax; +/*------------------------------------------------------------\ +| | +| DRUCRING Fonctions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DrucDelLayer | +| | +\------------------------------------------------------------*/ +void DrucDelLayer ( DrucFigureRds, + DeleteLayer + ) + rdsfig_list *DrucFigureRds; + int DeleteLayer; +{ +rdsrec_list *TmpRectangle; + + while ( DrucFigureRds->LAYERTAB [ DeleteLayer ] != ( rdsrec_list *)NULL + ) + { + TmpRectangle = DrucFigureRds->LAYERTAB [ DeleteLayer ]; + DrucFigureRds->LAYERTAB [ DeleteLayer ] = TmpRectangle->NEXT; + freerdsrec ( TmpRectangle, + MACRO_PLUS_TAILLE + ); + } +} +/*------------------------------------------------------------\ +| | +| DrucModifieBboxInstance | +| | +\------------------------------------------------------------*/ +void DrucModifieBboxInstance ( RectangleCourant, + PositionBboxX, + PositionBboxY, + PositionBboxDX, + PositionBboxDY + ) +rdsrec_list *RectangleCourant; +long *PositionBboxX; +long *PositionBboxY; +long *PositionBboxDX; +long *PositionBboxDY; + +{ + *PositionBboxX = ( *PositionBboxX < RectangleCourant->X ? + *PositionBboxX : + RectangleCourant->X + ); + *PositionBboxY = ( *PositionBboxY < RectangleCourant->Y ? + *PositionBboxY : + RectangleCourant->Y + ); + *PositionBboxDX = ( *PositionBboxDX > ( RectangleCourant->X + + RectangleCourant->DX ) ? + *PositionBboxDX : + ( RectangleCourant->X + + RectangleCourant->DX ) + ); + *PositionBboxDY = ( *PositionBboxDY > ( RectangleCourant->Y + + RectangleCourant->DY ) ? + *PositionBboxDY : + ( RectangleCourant->Y + + RectangleCourant->DY ) + ); +} +/*------------------------------------------------------------\ +| | +| DrucFlattenInstanceRings | +| | +\------------------------------------------------------------*/ +void DrucFlattenInstanceRings ( DrucFigureRds + ) + rdsfig_list *DrucFigureRds; +{ +rdsfig_list *InstanceModele; +rdsins_list *InstanceCourante; +long PositionBboxX; +long PositionBboxY; +long PositionBboxDX; +long PositionBboxDY; +int IndexLayer; +char *TmpName; +char *savName; +char *brico = "a"; +rdsrec_list *RectangleCourant; +rdsrec_list *NouveauRectangle; + +DrucViewString ("Flatten Instance Rings:"); + for ( InstanceCourante = DrucFigureRds->INSTANCE; + InstanceCourante != (rdsins_list *)NULL; + InstanceCourante = InstanceCourante->NEXT + ) + { +/*\ + * pour toutes les instances de la figure inserer les rectangles + * du modele de l'instance dans le bloc +\*/ + TmpName = DrucAddSuffixeName ( InstanceCourante->FIGNAME, + DRUC_COURONNE_EXTEND + ); +DrucViewString ("\r"); +DrucViewString (TmpName); +DrucViewString (" "); + InstanceModele = searchrdsfig( TmpName + ); +/*\ +DrucViewString ("\nFIN_FLATTEN_INSTANCE:\n"); +\*/ + for ( IndexLayer = 0; + IndexLayer < RDS_MAX_LAYER; + IndexLayer ++ + ) + { + if ( ( IndexLayer == DRUC_BBOX ) || + ( IndexLayer == RDS_ABOX ) || + ( IndexLayer == RDS_USER0 ) || + ( IndexLayer == RDS_USER1 ) || + ( IndexLayer == RDS_USER2 ) || + ( IndexLayer == RDS_USER3 ) || + ( IndexLayer == RDS_USER4 ) || + ( IndexLayer == RDS_USER5 ) || + ( IndexLayer == RDS_USER6 ) || + ( IndexLayer == RDS_USER7 ) || + ( IndexLayer == RDS_USER8 ) || + ( IndexLayer == RDS_USER9 ) + ) + { + continue; + } + for ( RectangleCourant = InstanceModele->LAYERTAB [ IndexLayer ]; + RectangleCourant != (rdsrec_list *)NULL; + RectangleCourant = RectangleCourant->NEXT + ) + { + NouveauRectangle = addrdsfigrec ( DrucFigureRds, + RectangleCourant->NAME, + IndexLayer, + RectangleCourant->X, + RectangleCourant->Y, + RectangleCourant->DX, + RectangleCourant->DY + ); + applyrdssym ( & (NouveauRectangle->X), + & (NouveauRectangle->Y), + & (NouveauRectangle->DX), + & (NouveauRectangle->DY), + InstanceCourante->X, + InstanceCourante->Y, + InstanceCourante->TRANSF + ); + MACRO_INSTANCE_NUM ( NouveauRectangle ) = InstanceCourante; +/*\ +DrucViewRectangle ( &NouveauRectangle ); +\*/ + } + }/* for tous les layers */ +/*\ +DrucViewString ("\nFIN_FLATTEN_INSTANCE:\n"); +\*/ + + for ( RectangleCourant = InstanceModele->LAYERTAB [ RDS_ABOX ]; + RectangleCourant != (rdsrec_list *)NULL; + RectangleCourant = RectangleCourant->NEXT + ) + { + NouveauRectangle = addrdsfigrec ( DrucFigureRds, + RectangleCourant->NAME, + DRUC_BBOX, + RectangleCourant->X, + RectangleCourant->Y, + RectangleCourant->DX, + RectangleCourant->DY + ); + applyrdssym ( & (NouveauRectangle->X), + & (NouveauRectangle->Y), + & (NouveauRectangle->DX), + & (NouveauRectangle->DY), + InstanceCourante->X, + InstanceCourante->Y, + InstanceCourante->TRANSF + ); + MACRO_INSTANCE_NUM ( NouveauRectangle ) = InstanceCourante; + } /* for le ABOX de la figure */ + }/* for toutes les instances */ +DrucViewString ("\n"); +} +/*------------------------------------------------------------\ +| | +| DrucIsLayerTransparence | +| | +\------------------------------------------------------------*/ +boolean DrucIsLayerTransparence ( IndexLayer + ) + int IndexLayer; +{ +int IndexTableau; + + for ( IndexTableau = 0; + IndexTableau < DRUC_MAX_TRANSPARENCES; + IndexTableau ++ + ) + { + if ( IndexLayer == ( TabTransEquivalence [ IndexTableau ] ).LAYER_TRANSPARENCE + ) + { + return DRUC_TRUE; + } + } + return DRUC_FALSE; +} +/*------------------------------------------------------------\ +| | +| DrucIsLayerVirtuel | +| | +\------------------------------------------------------------*/ +boolean DrucIsLayerVirtuel ( IndexLayer + ) + int IndexLayer; +{ +int Index; + + for ( Index = 0; + Index < DRUC_MAX_VIRTUELS; + Index ++ + ) + { + if ( IndexLayer == ( TabVirtuEquivalence [ Index ] ).LAYER_VIRTUEL + ) + { + return DRUC_TRUE; + } + } + return DRUC_FALSE; +} +/*------------------------------------------------------------\ +| | +| DrucCreateRectangleInCouronne | +| | +\------------------------------------------------------------*/ +void DrucCreateRectangleInCouronne ( DrucCouronneRds, + IndexLayer, + RectangleCourant, + PositionInterneCouronneX, + PositionInterneCouronneY, + PositionInterneCouronneDX, + PositionInterneCouronneDY + ) + rdsfig_list *DrucCouronneRds; + int IndexLayer; + rdsrec_list *RectangleCourant; + long PositionInterneCouronneX; + long PositionInterneCouronneY; + long PositionInterneCouronneDX; + long PositionInterneCouronneDY; + +{ +rdsrec_list *RectangleDest; + /*\ + * si le rectangle est en contact avec la couronne + \*/ + if ( ( RectangleCourant->X <= + PositionInterneCouronneX ) || + ( RectangleCourant->Y <= + PositionInterneCouronneY ) || + ( RectangleCourant->X + RectangleCourant->DX >= + PositionInterneCouronneDX ) || + ( RectangleCourant->Y + RectangleCourant->DY >= + PositionInterneCouronneDY ) + ) + { + /*\ + * creer un nouveau rectangle, + * l'inserer dans la figure couronne sur son layer + \*/ + RectangleDest = addrdsfigrec ( DrucCouronneRds, + RectangleCourant->NAME, + IndexLayer, + RectangleCourant->X, + RectangleCourant->Y, + RectangleCourant->DX, + RectangleCourant->DY + ); + } +} + +/*------------------------------------------------------------\ +| | +| DrucCreateCouron | +| | +\------------------------------------------------------------*/ +void DrucCreateCouron ( DrucFigureRds, + DrucRdsWindow, + DrucCouronneName + ) +rdsfig_list *DrucFigureRds; +rdswindow *DrucRdsWindow; +char *DrucCouronneName; +{ +rdsfig_list *DrucCouronneRds; +rdsrec_list *RectangleCourant; +rdsrec_list *RectangleABox; +long IndexLayer; +long IndexVirtuel; +long DemiConnecteur; +long PositionInterneCouronneX; +long PositionInterneCouronneY; +long PositionInterneCouronneDX; +long PositionInterneCouronneDY; +long CouroneRefX; +long CouroneRefY; +long CouroneRefDX; +long CouroneRefDY; + + /*\ + * calculer les positions de la couronne interne + \*/ + DrucCouronneRds = addrdsfig ( DrucCouronneName, + MACRO_PLUS_TAILLE + ); + DemiConnecteur = DRUC_DEMI_CONNECTEUR; + RectangleABox = DrucFigureRds->LAYERTAB [ RDS_ABOX ]; + + /*\ + * calcul des limites de la couronne + \*/ + if ( RectangleABox != (rdsrec_list*)NULL ) + { + CouroneRefX = RectangleABox->X + DemiConnecteur; + CouroneRefY = RectangleABox->Y + DemiConnecteur; + CouroneRefDX = RectangleABox->X + RectangleABox->DX - DemiConnecteur; + CouroneRefDY = RectangleABox->Y + RectangleABox->DY - DemiConnecteur; + } + else + { + CouroneRefX = DrucRdsWindow->XMIN + DrucCtmMax; + CouroneRefY = DrucRdsWindow->YMIN + DrucCtmMax; + CouroneRefDX = DrucRdsWindow->XMAX - DrucCtmMax; + CouroneRefDY = DrucRdsWindow->YMAX - DrucCtmMax; + } + + for ( IndexLayer = 0; + IndexLayer < RDS_MAX_LAYER; + IndexLayer ++ + ) + { + /*\ + * on ne remonte pas les layers user ni les BBOX des instances ni les ABOX + \*/ + if ( ( IndexLayer == DRUC_BBOX ) || + ( IndexLayer == RDS_ABOX ) || + ( IndexLayer == RDS_USER0 ) || + ( IndexLayer == RDS_USER1 ) || + ( IndexLayer == RDS_USER2 ) || + ( IndexLayer == RDS_USER3 ) || + ( IndexLayer == RDS_USER4 ) || + ( IndexLayer == RDS_USER5 ) || + ( IndexLayer == RDS_USER6 ) || + ( IndexLayer == RDS_USER7 ) || + ( IndexLayer == RDS_USER8 ) || + ( IndexLayer == RDS_USER9 ) + ) + { + continue; + } + /*\ + * La position de la couronne est l'ABOX erodee de 1/2 connecteur et de + * 1 ctm du niveau + \*/ + PositionInterneCouronneX = ( CouroneRefX + + DrucStructRdsLayer[ IndexLayer ].CTM + ); + PositionInterneCouronneDX = ( CouroneRefDX - + DrucStructRdsLayer[ IndexLayer ].CTM + ); + PositionInterneCouronneY = ( CouroneRefY + + DrucStructRdsLayer[ IndexLayer ].CTM + ); + PositionInterneCouronneDY = ( CouroneRefDY - + DrucStructRdsLayer[ IndexLayer ].CTM + ); + + if ( DrucIsLayerTransparence ( IndexLayer ) == DRUC_TRUE + ) + { + /*\ + * on ne garde que les transparences du bloc (pere) + \*/ + for ( RectangleCourant = DrucFigureRds->LAYERTAB [ IndexLayer ]; + RectangleCourant != (rdsrec_list *)NULL; + RectangleCourant = RectangleCourant->NEXT + ) + { + if ( MACRO_INSTANCE_NUM ( RectangleCourant ) == DRUC_BLOC_PERE + ) + { + DrucCreateRectangleInCouronne ( DrucCouronneRds, + IndexLayer, + RectangleCourant, + PositionInterneCouronneX, + PositionInterneCouronneY, + PositionInterneCouronneDX, + PositionInterneCouronneDY + ); + } + } + continue; + } + + if ( DrucIsLayerVirtuel ( IndexLayer ) == DRUC_TRUE + ) + { + /*\ + * on ne garde que les virtuels du bloc (pere) et on les transforme en transparence + \*/ + IndexVirtuel = DrucAsTransparenceEquivalent ( IndexLayer ); + if ( IndexVirtuel != DRUC_UNDEFINED_LAYER ) + { + for ( RectangleCourant = DrucFigureRds->LAYERTAB [ IndexLayer ]; + RectangleCourant != (rdsrec_list *)NULL; + RectangleCourant = RectangleCourant->NEXT + ) + { + if ( MACRO_INSTANCE_NUM ( RectangleCourant ) == DRUC_BLOC_PERE + ) + { + DrucCreateRectangleInCouronne ( DrucCouronneRds, + IndexVirtuel, + RectangleCourant, + PositionInterneCouronneX, + PositionInterneCouronneY, + PositionInterneCouronneDX, + PositionInterneCouronneDY + ); + } + } + } + continue; + } + for ( RectangleCourant = DrucFigureRds->LAYERTAB [ IndexLayer ]; + RectangleCourant != (rdsrec_list *)NULL; + RectangleCourant = RectangleCourant->NEXT + ) + { + DrucCreateRectangleInCouronne ( DrucCouronneRds, + IndexLayer, + RectangleCourant, + PositionInterneCouronneX, + PositionInterneCouronneY, + PositionInterneCouronneDX, + PositionInterneCouronneDY + ); + } + } + + /*\ + * sauver l'ABOX du pere seulement + \*/ + for ( RectangleCourant = DrucFigureRds->LAYERTAB [ RDS_ABOX ]; + RectangleCourant != (rdsrec_list *)NULL; + RectangleCourant = RectangleCourant->NEXT + ) + { + if ( MACRO_INSTANCE_NUM ( RectangleCourant ) == DRUC_BLOC_PERE + ) + { + DrucCreateRectangleInCouronne ( DrucCouronneRds, + RDS_ABOX, + RectangleCourant, + PositionInterneCouronneX, + PositionInterneCouronneY, + PositionInterneCouronneDX, + PositionInterneCouronneDY + ); + } + } + + /*\ + * sauver la couronne sur disque +viewrdsfig ( DrucCouronneRds ); + \*/ + saverdsfig ( DrucCouronneRds ); +} diff --git a/alliance/src/druc/src/drucring.h b/alliance/src/druc/src/drucring.h new file mode 100644 index 00000000..2516b180 --- /dev/null +++ b/alliance/src/druc/src/drucring.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DRUCRING.H | +| | +| Authors : Patrick Renaud | +| | +| Date : 03/07/95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DrucRing Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DrucRing Defines | +| | +\------------------------------------------------------------*/ +#define DRUC_BLOC_PERE (rdsins_list *)NULL +#define DRUC_DEMI_CONNECTEUR 4 +#define DRUC_COURONNE_EXTEND "_RNG" diff --git a/alliance/src/druc/src/drucutil.c b/alliance/src/druc/src/drucutil.c new file mode 100644 index 00000000..bd51c130 --- /dev/null +++ b/alliance/src/druc/src/drucutil.c @@ -0,0 +1,231 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DRUCUTIL.C | +| | +| Authors : Patrick Renaud | +| | +| Date : 11/01/94 | +| | +\------------------------------------------------------------*/ + +#include +#include "mph.h" +#include "mut.h" +#include "rds.h" +#include "rwi.h" +#include "rut.h" +#include "rtl.h" +#include "rfm.h" +#include "rpr.h" +#include "drucutil.h" + +/*------------------------------------------------------------\ +| | +| DRUCSTAT variables | +| | +\------------------------------------------------------------*/ +DrucTypeStructStat DrucStructStat; + +/*------------------------------------------------------------\ +| | +| DRUCUTIL variables | +| | +\------------------------------------------------------------*/ + +DrucTypeStructRuleComment *DrucRuleCommentList = NULL; +DrucTypeStructRdsLayer DrucStructRdsLayer [ RDS_ALL_LAYER ]; +long DrucCtmMax; + +int DrucNombreInstructions; + +char *DrucCompilErrorMessage [] = + { + "\nDRUC Compiler terminated :OK \n", + "\nDRUC ERR: undefined user layer \n", + "\nDRUC ERR: Undefined RDS LAYER \n", + "\nDRUC ERR: Missing Out Name \n", + "\nDRUC ERR: Can't open Rules File \n", + "\nDRUC ERR: Rules File not found \n", + "\nDRUC ERR: Can't open Input Rules File \n", + "\nDRUC ERR: checksumm absent in compiled rules table \n", + "\nDRUC ERR: Input Rules File does'nt contain Rules Table \n", + "\nDRUC ERR: Rule Number \n", + "\nDRUC ERR: Invalid User Layer \n", + "\nDRUC ERR: memory allocation error\n", + "\nDRUC ERR: checksumm error in compiled rules \n", + "\nDRUC ERR: too much rules in relation \n", + "\nDRUC ERR: invalid arguments \n", + "\nDRUC ERR: il manque les commentaires dans le fichier technologique \n", + "\nDRUC ERR: unable to close outfile rules\n", + "\nDRUC ERR: Can't parse rules: I/O error during reading Techno File\n", + "\nDRUC ERR: bad read param in compiled rules \n", + "\nDRUC ERR: Destination RDS layer not empty \n", + "\nDRUC ERR: Destination layer empty \n", + "\nDRUC ERR: Destination RDS layer not declared \n", + "\n \n" + }; + static char *DrucNoComment = "No comment"; + +/*------------------------------------------------------------\ +| | +| DRUCUTIL Fonctions | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| DrucViewString | +| | +\------------------------------------------------------------*/ + +void DrucViewString ( String + ) + char *String; + +{ + + if ( DrucStructStat.FLAG_VERBOSE_MODE == DRUC_VERBOSE + ) + { + fprintf ( stdout, + "%s", + String + ); + fflush ( stdout + ); + } +} + +/*------------------------------------------------------------\ +| | +| DrucViewNumber | +| | +\------------------------------------------------------------*/ + +void DrucViewNumber ( Number + ) + long Number; + +{ + + if ( DrucStructStat.FLAG_VERBOSE_MODE == DRUC_VERBOSE + ) + { + fprintf ( stdout, + "%3ld", + Number + ); + } +} + +/*------------------------------------------------------------\ +| | +| DrucComputeCheckSumm | +| | +| Calcule et met a jour le checksumm des instructions | +| assembleur ecrites dans le fichier DRUC_OUTPUT_NAME; | + +void DrucComputeCheckSumm ( Value + ) + int Value; + +{ + +unsigned int TmpCheckSumm; + + TmpCheckSumm = DrucCheckSumm << 1; + TmpCheckSumm = TmpCheckSumm & -1; + TmpCheckSumm = TmpCheckSumm ^ Value; + DrucCheckSumm = TmpCheckSumm; +} +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| DrucGetRuleComment | +| | +\------------------------------------------------------------*/ + +char *DrucGetRuleComment ( Rule + ) + long Rule; + +{ + +DrucTypeStructRuleComment *Scan; + + for ( Scan = DrucRuleCommentList; + Scan != (DrucTypeStructRuleComment *)NULL; + Scan = Scan->NEXT + ) + { + if ( Scan->RULE == Rule + ) + { + return ( Scan->COMMENT + ); + } + } + + return ( DrucNoComment + ); +} + +/*------------------------------------------------------------\ +| | +| DrucViewRuleComment | +| | +\------------------------------------------------------------*/ + +void DrucViewRuleComment() + +{ + +DrucTypeStructRuleComment *Scan; + + for ( Scan = DrucRuleCommentList; + Scan != (DrucTypeStructRuleComment *)NULL; + Scan = Scan->NEXT + ) + { + DrucViewNumber ( Scan->RULE + ); + DrucViewString ( " : " + ); + DrucViewString ( Scan->COMMENT + ); + } +} + +/*------------------------------------------------------------\ +| | +| DRUCSTAT Fonctions | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| DrucInitStructStat | +| | +\------------------------------------------------------------*/ + +void DrucStatInit ( Flatten, + Verbose, + View_Rules, + FileType + ) + boolean Flatten; + boolean Verbose; + boolean FileType; + + { + + DrucStructStat.ERROR_NUMBER = 0; + DrucStructStat.FLAG_FLATTEN_MODE = Flatten; + DrucStructStat.FLAG_VERBOSE_MODE = Verbose; + DrucStructStat.FLAG_VIEW_RULE_MODE = View_Rules; + DrucStructStat.FILE_ERROR = FileType; + } + diff --git a/alliance/src/druc/src/drucutil.h b/alliance/src/druc/src/drucutil.h new file mode 100644 index 00000000..b04d9b5e --- /dev/null +++ b/alliance/src/druc/src/drucutil.h @@ -0,0 +1,290 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : Drucutil.h | +| | +| Authors : Patrick Renaud | +| | +| Date : 03/07/95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Druc Defines | +| | +| Defines pour le code | +| | +\------------------------------------------------------------*/ +#define DRUC_FALSE 0 +#define DRUC_TRUE 1 + +#define DRUC_MAX_FILE_BUFFER 127 +#define DRUC_MAX_STRING_BUFFER 80 + +#define DRUC_DRC_RULES "DRC_RULES" +#define DRUC_END_DRC_RULES "END_DRC_RULES" + +#define DRUC_DRC_COMMENT "DRC_COMMENT" +#define DRUC_DRC_END_COMMENT "END_DRC_COMMENT" +/*------------------------------------------------------------\ +| | +| Druc Default Names | +| | +\------------------------------------------------------------*/ +#define DRUC_ERROR_FILE_NAME "DRUC_ERROR" +#define DRUC_ERROR_FILE_SUFFIXE ".DRC" +#define DRUC_ERROR_FIGURE_SUFFIXE "_ERR" +#define DRUC_ERROR_EXTEND "_DRC" + +/*------------------------------------------------------------\ +| | +| Druc Compiler Defines | +| | +| Defines pour les erreurs | +| | +\------------------------------------------------------------*/ +#define DRUC_ERROR_NOT_DECLARED_LAYER 21 +#define DRUC_ERROR_EMPTY_LAYER 20 +#define DRUC_ERROR_NOT_EMPTY_LAYER 19 +#define DRUC_ERROR_FILE_PARAM 18 +#define DRUC_ERROR_READ_PARAM 17 +#define DRUC_ERROR_CLOSE_DRC_FILE 16 +#define DRUC_ERROR_COMMENT_FILE 15 +#define DRUC_ERROR_BAD_COMMENT 14 +#define DRUC_ERROR_MAX_OPERATOR 13 +#define DRUC_ERROR_CHECKSUMM 12 +#define DRUC_ERROR_MEMOIRE 11 +#define DRUC_ERROR_DEFINE_USER_LAYER 10 +#define DRUC_ERROR_RULE_NUMBER 9 +#define DRUC_ERROR_IN_FILE 8 +#define DRUC_ERROR_NO_CHECKSUM 7 +#define DRUC_ERROR_NO_RULE_IN_FILE 6 +#define DRUC_ERROR_NO_RULE_FILE 5 +#define DRUC_ERROR_OUT_FILE 4 +#define DRUC_ERROR_OUT_NAME 3 +#define DRUC_ERROR_UNDEFINED_LAYER 2 +#define DRUC_ERROR_UNDEFINED 1 +#define DRUC_GOOD 0 + +/*------------------------------------------------------------\ +| | +| Druc Defines | +| | +| Defines pour les structures | +| | +\------------------------------------------------------------*/ +#define DRUC_UNDEFINED_CHECKSUMM -1 +#define DRUC_UNDEFINED_CTM -1 +#define DRUC_UNDEFINED_FLAGS -1 +#define DRUC_FLAG_LAYER_INTERDIT 1 +#define DRUC_FLAG_LAYER_LIBRE 2 +#define DRUC_FLAG_LAYER_OCCUPE 3 + +#define DRUC_UNDEFINED_LAYER -1 +#define DRUC_UNDEFINED_WIDTH -1 +#define DRUC_UNDEFINED_OP_COMPOSE -1 +#define DRUC_UNDEFINED_REGLE -1 +#define DRUC_UNDEFINED_INSTRUCTION -1 +#define DRUC_UNDEFINED_RELATION -1 +#define DRUC_UNDEFINED_MESURE -1 +#define DRUC_UNDEFINED_OPERATEUR -1 +#define DRUC_UNDEFINED_VALEUR -1 + +#define DRUC_MAX_USER_LAYER 3 +#define DRUC_USER_LAYER_0 RDS_MAX_LAYER - 4 +#define DRUC_USER_LAYER_1 RDS_MAX_LAYER - 3 +#define DRUC_USER_LAYER_2 RDS_MAX_LAYER - 2 +/*\ + * RDS_MAX_LAYER -1 correspond a RDS_ABOX +\*/ + +#define DRUC_NO_ERROR_FILE 0 +#define DRUC_ERROR_FILE 1 +#define DRUC_FLATTEN 0 +#define DRUC_HIERARCHIE 1 +#define DRUC_SILENT 0 +#define DRUC_VERBOSE 1 + +/*------------------------------------------------------------\ +| | +| Druc Maximum de mesures | +| | +\------------------------------------------------------------*/ +#define DRUC_MAX_MESURES 8 +#define DRUC_UN_CORPS_TRANS_METAL 1000 +#define DRUC_UN_CORPS_VIRT_METAL 2000 +#define DRUC_DEUX_CORPS_TRANS_METAL 3000 +#define DRUC_DEUX_CORPS_VIRT_METAL 4000 +#define DRUC_DEUX_CORPS_METAL_TRANS 5000 +#define DRUC_DEUX_CORPS_TRANS_TRANS 6000 +#define DRUC_DEUX_CORPS_VIRT_TRANS 7000 +#define DRUC_DEUX_CORPS_METAL_VIRT 8000 +#define DRUC_DEUX_CORPS_TRANS_VIRT 9000 +#define DRUC_DEUX_CORPS_VIRT_VIRT 10000 +#define DRUC_RULES_BASE_ABOX 11000 + +/*------------------------------------------------------------\ +| | +| Druc Language | +| | +\------------------------------------------------------------*/ +#define DRUC_ASM_BEGIN_LAYER 128 +#define DRUC_ASM_END_LAYER 129 +#define DRUC_ASM_BEGIN_DEFINE 130 +#define DRUC_ASM_END_DEFINE 131 +#define DRUC_ASM_BEGIN_UNDEFINE 132 +#define DRUC_ASM_END_UNDEFINE 133 +#define DRUC_ASM_BEGIN_REGLE 134 +#define DRUC_ASM_END_REGLE 135 +#define DRUC_ASM_BEGIN_CHECKSUMM 136 +#define DRUC_ASM_END_CHECKSUMM 137 + +#define DRUC_COMPOSE_UNION 8 +#define DRUC_COMPOSE_INTERSECT 9 +#define DRUC_COMPOSE_EXCLUSION 10 +#define DRUC_COMPOSE_INCLUSION 11 + +#define DRUC_COMPOSE_RESIZE 12 + +#define DRUC_INSTR_CARACTERISE 1 +#define DRUC_INSTR_RELATION 2 + +#define DRUC_RELATION_DISTANCE 16 +#define DRUC_RELATION_ENVELOPPE 17 +#define DRUC_RELATION_MARGE 18 +#define DRUC_RELATION_CROIX 19 +#define DRUC_RELATION_INTERSECTION 20 +#define DRUC_RELATION_EXTENSION 21 +#define DRUC_RELATION_INCLUSION 22 + +#define DRUC_MESURE_SURFACE_INTER 30 +#define DRUC_MESURE_LONGUEUR_INTER 31 +#define DRUC_MESURE_LARGEUR_INTER 32 +#define DRUC_MESURE_PENETRE_INTER 33 +#define DRUC_MESURE_PARALEL_INTER 34 +#define DRUC_MESURE_PERPEND_INTER 35 +#define DRUC_MESURE_LONGUEUR_MIN 36 +#define DRUC_MESURE_LONGUEUR_MAX 37 +#define DRUC_MESURE_LARGEUR_MIN 38 +#define DRUC_MESURE_LARGEUR_MAX 39 +#define DRUC_MESURE_LATERALE_MIN 40 +#define DRUC_MESURE_LATERALE_MAX 41 +#define DRUC_MESURE_FRONTALE 42 +#define DRUC_MESURE_INF 43 +#define DRUC_MESURE_SUP 44 +#define DRUC_MESURE_AXIALE 45 +#define DRUC_MESURE_GEODESIQUE 46 + +#define DRUC_MESURE_SURFACE 48 +#define DRUC_MESURE_LONGUEUR 49 +#define DRUC_MESURE_LARGEUR 50 +#define DRUC_MESURE_NOTCH 51 + +#define DRUC_OPERATION_MIN 64 +#define DRUC_OPERATION_MAX 65 +#define DRUC_OPERATION_INFEQ 66 +#define DRUC_OPERATION_SUPEQ 67 +#define DRUC_OPERATION_EQUAL 68 +#define DRUC_OPERATION_DIFF 69 +#define DRUC_OPERATION_INF 70 +#define DRUC_OPERATION_SUP 71 + +/*------------------------------------------------------------\ +| | +| Druc Types | +| | +\------------------------------------------------------------*/ +typedef char boolean; + +typedef struct struct_instruction + { + struct struct_instruction *NEXT; + int INSTRUCTION; + int LAYER_DEST; + int LAYER_1; + int LAYER_2; + int OP_COMPOSE; + int OP_UNAIRE; + long DEF_VALEUR; + int REGLE_NUM [ DRUC_MAX_MESURES ]; + int RELATION [ DRUC_MAX_MESURES ]; + int MESURE [ DRUC_MAX_MESURES ]; + int OP_COMPARE [ DRUC_MAX_MESURES ]; + int VALEUR [ DRUC_MAX_MESURES ]; + } DrucTypeStructInstruction; + +typedef struct struct_rdslayer + { + int RDS_INDEX; + int WIDTH; + int CTM; + int FLAGS; + } DrucTypeStructRdsLayer; + +typedef struct struct_stat + { + unsigned long ERROR_NUMBER; + boolean FLAG_FLATTEN_MODE; + boolean FLAG_VERBOSE_MODE; + boolean FLAG_VIEW_RULE_MODE; + boolean FILE_ERROR; + } DrucTypeStructStat; + +typedef struct struct_comment + { + struct struct_comment *NEXT; + long RULE; + char *COMMENT; + } DrucTypeStructRuleComment; + +/*------------------------------------------------------------\ +| | +| Druc variables | +| | +\------------------------------------------------------------*/ +extern DrucTypeStructRdsLayer DrucStructRdsLayer[]; +extern char *DrucCompilErrorMessage[]; +extern DrucTypeStructInstruction *DrucTabInstruction; +extern int DrucNombreInstructions; +extern long DrucCtmMax; +extern DrucTypeStructRuleComment *DrucRuleCommentList; + +extern char *DrucErrorMessage []; + +extern DrucTypeStructStat DrucStructStat; + +/*------------------------------------------------------------\ +| | +| Druc Variables RDS | +| | +\------------------------------------------------------------*/ +/* + extern char RDS_LAYER_NAME [] []; +*/ +/*------------------------------------------------------------\ +| | +| Druc Macros | +| | +\------------------------------------------------------------*/ + +#define DRUC_EXIT(Entier) \ + do{ \ + extern int vrd_y_lineno; \ + fprintf ( stdout, \ + "\nline %d DRUC ERROR %d : %s\n", \ + vrd_y_lineno, Entier, \ + DrucCompilErrorMessage [ Entier ]); \ + EXIT( Entier ); \ + } while (0) + +/*------------------------------------------------------------\ +| | +| Druc Fonctions | +| | +\------------------------------------------------------------*/ +extern void DrucComputeCheckSumm(); +extern char *DrucGetRuleComment (); +extern void DrucViewRuleComment (); +extern chain_list *getrdswindow (); +extern void DrucStatInit (); diff --git a/alliance/src/druc/src/vmcaract.c b/alliance/src/druc/src/vmcaract.c new file mode 100644 index 00000000..dbb3dce3 --- /dev/null +++ b/alliance/src/druc/src/vmcaract.c @@ -0,0 +1,785 @@ +/*------------------------------------------------------------\ +| | +| Tool : | +| | +| File : VMCARACT.C | +| | +| Authors : Renaud Patrick | +| | +| Date : 11/01/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +#include +#include +#include +#include "mph.h" +#include "mut.h" +#include "rds.h" +#include "rwi.h" +#include "rut.h" +#include "rtl.h" +#include "rfm.h" +#include "rpr.h" + +#include "drucutil.h" +#include "vmctools.h" +#include "vmcerror.h" +#include "vmcmesur.h" +#include "vmcaract.h" +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DrucNotchTeste | +| | +\------------------------------------------------------------*/ +boolean DrucNotchTeste ( DrucInstructionCourante, + IndexMesure, + Mesure + ) + DrucTypeStructInstruction *DrucInstructionCourante; + int IndexMesure; + long Mesure; +{ + + switch ( DrucInstructionCourante->OP_COMPARE [ IndexMesure ] ) + { + case DRUC_OPERATION_INF : + { + if ( Mesure >= DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + return ( DRUC_FALSE ); + } + break; + } + case DRUC_OPERATION_INFEQ : + { + if ( Mesure > DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + return ( DRUC_FALSE ); + } + break; + } + case DRUC_OPERATION_SUP : + { + if ( Mesure <= DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + return ( DRUC_FALSE ); + } + break; + } + case DRUC_OPERATION_SUPEQ : + { + if ( Mesure < DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + return ( DRUC_FALSE ); + } + break; + } + case DRUC_OPERATION_DIFF : + { + if ( Mesure == DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + return ( DRUC_FALSE ); + } + break; + } + default : + { +/* + * printf (" DrucNotchTeste merde\n"); + */ + } + } /* switch */ + return ( DRUC_TRUE ); +} +/*------------------------------------------------------------\ +| | +| DrucCaracteriseNotch | +| | +\------------------------------------------------------------*/ +void DrucCaracteriseNotch ( TmpRectangle, + DrucInstructionCourante, + IndexMesure + ) + rdsrec_list *TmpRectangle; + DrucTypeStructInstruction *DrucInstructionCourante; + int IndexMesure; +{ +DrucTypeStructPlusRect *PlusRec; +DrucTypeStructMesure DrucStructMesure; +rdsrec_list *RectangleCourant; +long PositionX1; +long PositionX2; +long PositionY1; +long PositionY2; +long PositionDX1; +long PositionDX2; +long PositionDY1; +long PositionDY2; +long DistanceX1DX2; +long DistanceX2DX1; +long DistanceY1DY2; +long DistanceY2DY1; +long Mesure; +int TmpCas; +boolean PerimetreInEqui; + + DrucStructMesure.LAYER_1 = DrucInstructionCourante->LAYER_1; + DrucStructMesure.LAYER_2 = DrucInstructionCourante->LAYER_1; + DrucStructMesure.RECTANGLE1 = TmpRectangle; + PositionX1 = TmpRectangle->X; + PositionY1 = TmpRectangle->Y; + PositionDX1 = PositionX1 + TmpRectangle->DX; + PositionDY1 = PositionY1 + TmpRectangle->DY; + PlusRec = (DrucTypeStructPlusRect *) + ((char *)(TmpRectangle)+sizeof(rdsrec_list)); + RectangleCourant = PlusRec->NEXT_EQUI; + PlusRec = (DrucTypeStructPlusRect *) + ((char *)(RectangleCourant)+sizeof(rdsrec_list)); + while ( TmpRectangle != RectangleCourant ) + { + + PositionX2 = RectangleCourant->X; + PositionY2 = RectangleCourant->Y; + PositionDX2 = PositionX2 + RectangleCourant->DX; + PositionDY2 = PositionY2 + RectangleCourant->DY; + if ( PositionDX1 < PositionX2 || + PositionDX2 < PositionX1 || + PositionDY1 < PositionY2 || + PositionDY2 < PositionY1 + ) + { + DrucStructMesure.BOOLEEN_DISTANCE = DRUC_TRUE; + DrucStructMesure.RECTANGLE2 = RectangleCourant; + DistanceX2DX1 = PositionX2 - PositionDX1; + DistanceY2DY1 = PositionY2 - PositionDY1; + DistanceX1DX2 = PositionX1 - PositionDX2; + DistanceY1DY2 = PositionY1 - PositionDY2; + Mesure = MACRO_MAX ( MACRO_MAX ( DistanceX1DX2 , DistanceX2DX1 ) , + MACRO_MAX ( DistanceY1DY2 , DistanceY2DY1 ) + ); + if ( DrucNotchTeste ( DrucInstructionCourante, + IndexMesure, + Mesure + ) + == DRUC_FALSE + ) + { + TmpCas = 0; + if ( PositionX1 >= PositionX2 ) + { + TmpCas |= 1; + } + if ( PositionDX1 <= PositionDX2 ) + { + TmpCas |= 2; + } + if ( PositionY1 >= PositionY2 ) + { + TmpCas |= 4; + } + if ( PositionDY1 <= PositionDY2 ) + { + TmpCas |= 8; + } + DrucStructMesure.TOPOLOGIE = TmpCas; +/*\ + * Pour les cas d'intersection : TmpCas =5 6 9 ou 10 + * il faut tester si les 2 rectangles ont un vis a vis ou si ils sont + * en coin; dans le cas de vis a vis il faut un rectangle qui recouvre le notch + * dans le cas de coin il faut soit un rectangle qui recouvre le notch soit 2 rectangles pour recouvrir 2 cotes + * du perimetre de la surface en erreur +\*/ + switch ( TmpCas ) + { + case 1: + { + DrucIsPositionInclusInEqui ( &DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + PositionDX2, + PositionY2, + PositionX1, + PositionDY2 + ); + break; + } + case 2: + { + DrucIsPositionInclusInEqui ( &DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + PositionDX1, + PositionY2, + PositionX2, + PositionDY2 + ); + break; + } + case 4: + { + DrucIsPositionInclusInEqui ( &DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + PositionX2, + PositionDY2, + PositionDX2, + PositionY1 + ); + break; + } + case 5: + { + if ( ( PositionDY2 < PositionY1) && + ( PositionDX2 < PositionX1) + ) + { + PerimetreInEqui = DrucIsPerimetreInclusInEqui ( &DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_MIN ( PositionDX2 , PositionX1 ), + MACRO_MIN ( PositionDY2 , PositionY1 ), + MACRO_MAX ( PositionDX2 , PositionX1 ), + MACRO_MAX ( PositionDY2 , PositionY1 ) + ); + if ( PerimetreInEqui == DRUC_FALSE ) + { + DrucIsPositionInclusInEqui ( &DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_MIN ( PositionDX2 , PositionX1 ), + MACRO_MIN ( PositionDY2 , PositionY1 ), + MACRO_MAX ( PositionDX2 , PositionX1 ), + MACRO_MAX ( PositionDY2 , PositionY1 ) + ); + } + } + else + { + DrucIsPositionInclusInEqui ( &DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_MIN ( PositionDX2 , PositionX1 ), + MACRO_MIN ( PositionDY2 , PositionY1 ), + MACRO_MAX ( PositionDX2 , PositionX1 ), + MACRO_MAX ( PositionDY2 , PositionY1 ) + ); + } + break; + } + case 6: + { + if ( ( PositionDY2 < PositionY1) && + ( PositionDX1 < PositionX2) + ) + { + PerimetreInEqui = DrucIsPerimetreInclusInEqui ( &DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_MIN ( PositionDX1 , PositionX2 ), + MACRO_MIN ( PositionDY2 , PositionY1 ), + MACRO_MAX ( PositionDX1 , PositionX2 ), + MACRO_MAX ( PositionDY2 , PositionY1 ) + ); + if ( PerimetreInEqui == DRUC_FALSE ) + { + DrucIsPositionInclusInEqui ( &DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_MIN ( PositionDX1 , PositionX2 ), + MACRO_MIN ( PositionDY2 , PositionY1 ), + MACRO_MAX ( PositionDX1 , PositionX2 ), + MACRO_MAX ( PositionDY2 , PositionY1 ) + ); + } + } + else + { + DrucIsPositionInclusInEqui ( &DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_MIN ( PositionDX1 , PositionX2 ), + MACRO_MIN ( PositionDY2 , PositionY1 ), + MACRO_MAX ( PositionDX1 , PositionX2 ), + MACRO_MAX ( PositionDY2 , PositionY1 ) + ); + } + break; + } + case 7: + { + DrucIsPositionInclusInEqui ( &DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + PositionX1, + PositionDY2, + PositionDX1, + PositionY1 + ); + break; + } + case 8: + { + DrucIsPositionInclusInEqui ( &DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + PositionX2, + PositionDY1, + PositionDX2, + PositionY2 + ); + break; + } + case 9: + { + if ( ( PositionDY1 < PositionY2) && + ( PositionDX2 < PositionX1) + ) + { + PerimetreInEqui = DrucIsPerimetreInclusInEqui ( &DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_MIN ( PositionDX2 , PositionX1 ), + MACRO_MIN ( PositionDY1 , PositionY2 ), + MACRO_MAX ( PositionDX2 , PositionX1 ), + MACRO_MAX ( PositionDY1 , PositionY2 ) + ); + if ( PerimetreInEqui == DRUC_FALSE ) + { + DrucIsPositionInclusInEqui ( &DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_MIN ( PositionDX2 , PositionX1 ), + MACRO_MIN ( PositionDY1 , PositionY2 ), + MACRO_MAX ( PositionDX2 , PositionX1 ), + MACRO_MAX ( PositionDY1 , PositionY2 ) + ); + } + } + else + { + DrucIsPositionInclusInEqui ( &DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_MIN ( PositionDX2 , PositionX1 ), + MACRO_MIN ( PositionDY1 , PositionY2 ), + MACRO_MAX ( PositionDX2 , PositionX1 ), + MACRO_MAX ( PositionDY1 , PositionY2 ) + ); + } + break; + } + case 10: + { + if ( ( PositionDY1 < PositionY2) && + ( PositionDX1 < PositionX2) + ) + { + PerimetreInEqui = DrucIsPerimetreInclusInEqui ( &DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_MIN ( PositionDX1 , PositionX2 ), + MACRO_MIN ( PositionDY1 , PositionY2 ), + MACRO_MAX ( PositionDX1 , PositionX2 ), + MACRO_MAX ( PositionDY1 , PositionY2 ) + ); + if ( PerimetreInEqui == DRUC_FALSE ) + { + DrucIsPositionInclusInEqui ( &DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_MIN ( PositionDX1 , PositionX2 ), + MACRO_MIN ( PositionDY1 , PositionY2 ), + MACRO_MAX ( PositionDX1 , PositionX2 ), + MACRO_MAX ( PositionDY1 , PositionY2 ) + ); + } + } + else + { + DrucIsPositionInclusInEqui ( &DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_MIN ( PositionDX1 , PositionX2 ), + MACRO_MIN ( PositionDY1 , PositionY2 ), + MACRO_MAX ( PositionDX1 , PositionX2 ), + MACRO_MAX ( PositionDY1 , PositionY2 ) + ); + } + break; + } + case 11: + { + DrucIsPositionInclusInEqui ( &DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + PositionX1, + PositionDY1, + PositionDX1, + PositionY2 + ); + break; + } + case 13: + { + DrucIsPositionInclusInEqui ( &DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + PositionDX2, + PositionY1, + PositionX1, + PositionDY1 + ); + break; + } + case 14: + { + DrucIsPositionInclusInEqui ( &DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + PositionDX1, + PositionY1, + PositionX2, + PositionDY1 + ); + break; + } + } + } + } + RectangleCourant = PlusRec->NEXT_EQUI; + PlusRec = (DrucTypeStructPlusRect *) + ((char *)(RectangleCourant)+sizeof(rdsrec_list)); + } +} +/*------------------------------------------------------------\ +| | +| DrucCaracteriseTeste | +| | +\------------------------------------------------------------*/ +void DrucCaracteriseTeste ( TmpRectangle, + DrucInstructionCourante, + IndexMesure, + Mesure + ) + rdsrec_list *TmpRectangle; + DrucTypeStructInstruction *DrucInstructionCourante; + int IndexMesure; + long Mesure; +{ + + switch ( DrucInstructionCourante->OP_COMPARE [ IndexMesure ] ) + { + case DRUC_OPERATION_INF : + { + if ( Mesure >= DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + DrucErreurUnCorps ( TmpRectangle, + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + case DRUC_OPERATION_INFEQ : + case DRUC_OPERATION_MAX : +/*\ + * a cause de l'unification les 2 sont identiques ici +\*/ + { + if ( Mesure > DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + DrucErreurUnCorps ( TmpRectangle, + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + case DRUC_OPERATION_SUP : + { + if ( Mesure <= DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + DrucErreurUnCorps ( TmpRectangle, + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + case DRUC_OPERATION_SUPEQ : + case DRUC_OPERATION_MIN : +/*\ + * a cause de l'unification les 2 sont identiques ici +\*/ + { + if ( Mesure < DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + DrucErreurUnCorps ( TmpRectangle, + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + case DRUC_OPERATION_DIFF : + { + if ( Mesure == DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + DrucErreurUnCorps ( TmpRectangle, + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + } +} +/*------------------------------------------------------------\ +| | +| DrucCaracteriseTesteInter | +| | +\------------------------------------------------------------*/ +void DrucCaracteriseTesteSurface ( TmpRectangle, + DrucInstructionCourante, + IndexMesure + ) +rdsrec_list *TmpRectangle; +DrucTypeStructInstruction *DrucInstructionCourante; +int IndexMesure; + +{ +DrucTypeStructPlusRect *PlusRec; +DrucTypeStructMesure DrucStructMesure; +rdsrec_list *RectangleCourant; + + DrucStructMesure.LAYER_1 = DrucInstructionCourante->LAYER_1; + DrucStructMesure.LAYER_2 = DrucInstructionCourante->LAYER_1; + DrucStructMesure.RECTANGLE1 = TmpRectangle; + PlusRec = (DrucTypeStructPlusRect *)((char *)(TmpRectangle)+sizeof(rdsrec_list)); + RectangleCourant = PlusRec->NEXT_EQUI; + PlusRec = (DrucTypeStructPlusRect *)((char *)(RectangleCourant)+sizeof(rdsrec_list)); + while ( TmpRectangle != RectangleCourant ) + { + if ( DrucIsRectanglesContact ( TmpRectangle, + RectangleCourant + ) + == DRUC_TRUE + ) + { + DrucStructMesure.RECTANGLE2 = RectangleCourant; + DrucRelationMesure ( &DrucStructMesure + ); + DrucMesureInter ( &DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_SURFACE_INTER_1 + ); + } + RectangleCourant = PlusRec->NEXT_EQUI; + PlusRec = (DrucTypeStructPlusRect *)((char *)(RectangleCourant)+sizeof(rdsrec_list)); + } +} +/*------------------------------------------------------------\ +| | +| DrucCaracteriseTesteLargeur | +| | +\------------------------------------------------------------*/ +void DrucCaracteriseTesteLargeur ( TmpRectangle, + DrucInstructionCourante, + IndexMesure + ) +rdsrec_list *TmpRectangle; +DrucTypeStructInstruction *DrucInstructionCourante; +int IndexMesure; + +{ +DrucTypeStructPlusRect *PlusRec; +DrucTypeStructMesure DrucStructMesure; +rdsrec_list *RectangleCourant; + + DrucStructMesure.LAYER_1 = DrucInstructionCourante->LAYER_1; + DrucStructMesure.LAYER_2 = DrucInstructionCourante->LAYER_1; + DrucStructMesure.RECTANGLE1 = TmpRectangle; + PlusRec = (DrucTypeStructPlusRect *)((char *)(TmpRectangle)+sizeof(rdsrec_list)); + RectangleCourant = PlusRec->NEXT_EQUI; + PlusRec = (DrucTypeStructPlusRect *)((char *)(RectangleCourant)+sizeof(rdsrec_list)); + while ( TmpRectangle != RectangleCourant ) + { + if ( DrucIsRectanglesContact ( TmpRectangle, + RectangleCourant + ) + == DRUC_TRUE + ) + { + DrucStructMesure.RECTANGLE2 = RectangleCourant; + DrucRelationMesure ( &DrucStructMesure + ); + DrucMesureInter ( &DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LARGE_INTER_1 + ); + } + RectangleCourant = PlusRec->NEXT_EQUI; + PlusRec = (DrucTypeStructPlusRect *)((char *)(RectangleCourant)+sizeof(rdsrec_list)); + } +} +/*------------------------------------------------------------\ +| | +| DrucCaracteriseTesteLongueur | +| | +\------------------------------------------------------------*/ +void DrucCaracteriseTesteLongueur ( TmpRectangle, + DrucInstructionCourante, + IndexMesure + ) +rdsrec_list *TmpRectangle; +DrucTypeStructInstruction *DrucInstructionCourante; +int IndexMesure; + +{ +DrucTypeStructPlusRect *PlusRec; +DrucTypeStructMesure DrucStructMesure; +rdsrec_list *RectangleCourant; + + DrucStructMesure.LAYER_1 = DrucInstructionCourante->LAYER_1; + DrucStructMesure.LAYER_2 = DrucInstructionCourante->LAYER_1; + DrucStructMesure.RECTANGLE1 = TmpRectangle; + PlusRec = (DrucTypeStructPlusRect *)((char *)(TmpRectangle)+sizeof(rdsrec_list)); + RectangleCourant = PlusRec->NEXT_EQUI; + PlusRec = (DrucTypeStructPlusRect *)((char *)(RectangleCourant)+sizeof(rdsrec_list)); + while ( TmpRectangle != RectangleCourant ) + { + if ( DrucIsRectanglesContact ( TmpRectangle, + RectangleCourant + ) + == DRUC_TRUE + ) + { + DrucStructMesure.RECTANGLE2 = RectangleCourant; + DrucRelationMesure ( &DrucStructMesure + ); + DrucMesureInter ( &DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LONG_INTER_1 + ); + } + RectangleCourant = PlusRec->NEXT_EQUI; + PlusRec = (DrucTypeStructPlusRect *)((char *)(RectangleCourant)+sizeof(rdsrec_list)); + } +} +/*------------------------------------------------------------\ +| | +| DrucCaracterise | +| | +\------------------------------------------------------------*/ +void DrucCaracterise ( DrucFigureRds, + DrucInstructionCourante + ) + rdsfig_list *DrucFigureRds; + DrucTypeStructInstruction *DrucInstructionCourante; +{ +rdsrec_list *TmpRectangle; +int IndexMesure; +long MesureMax; +long MesureMin; + + + for ( TmpRectangle = DrucFigureRds->LAYERTAB[ DrucInstructionCourante->LAYER_1 ]; + TmpRectangle != (rdsrec_list *)NULL; + TmpRectangle = TmpRectangle->NEXT + ) + { + MesureMax = ( TmpRectangle->DX > TmpRectangle->DY ? + TmpRectangle->DX : + TmpRectangle->DY + ); + MesureMin = ( TmpRectangle->DX < TmpRectangle->DY ? + TmpRectangle->DX : + TmpRectangle->DY + ); + IndexMesure = 0; + while ( ( DrucInstructionCourante->MESURE [ IndexMesure ] != + DRUC_UNDEFINED_MESURE + ) && + ( IndexMesure != DRUC_MAX_MESURES + ) + ) + { + switch ( DrucInstructionCourante->MESURE [ IndexMesure ] ) + { + case DRUC_MESURE_SURFACE_INTER : + { + DrucCaracteriseTesteSurface ( TmpRectangle, + DrucInstructionCourante, + IndexMesure + ); + break; + } + case DRUC_MESURE_LONGUEUR_INTER : + { + DrucCaracteriseTesteLongueur ( TmpRectangle, + DrucInstructionCourante, + IndexMesure + ); + break; + } + case DRUC_MESURE_LARGEUR_INTER : + { + DrucCaracteriseTesteLargeur ( TmpRectangle, + DrucInstructionCourante, + IndexMesure + ); + break; + } + case DRUC_MESURE_LARGEUR : + { + DrucCaracteriseTeste ( TmpRectangle, + DrucInstructionCourante, + IndexMesure, + MesureMin + ); + break; + } + case DRUC_MESURE_LONGUEUR : + { + DrucCaracteriseTeste ( TmpRectangle, + DrucInstructionCourante, + IndexMesure, + MesureMax + ); + break; + } + case DRUC_MESURE_SURFACE : + { + DrucCaracteriseTeste ( TmpRectangle, + DrucInstructionCourante, + IndexMesure, + MesureMin * MesureMax + ); + break; + } + case DRUC_MESURE_NOTCH : + { + DrucCaracteriseNotch ( TmpRectangle, + DrucInstructionCourante, + IndexMesure + ); + break; + } + } /* switch */ + IndexMesure ++; + } /* while IndexMesure */ + } /* for TmpRectangle */ +} diff --git a/alliance/src/druc/src/vmcaract.h b/alliance/src/druc/src/vmcaract.h new file mode 100644 index 00000000..05c4a85f --- /dev/null +++ b/alliance/src/druc/src/vmcaract.h @@ -0,0 +1,52 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : VMCARACT.H | +| | +| Authors : Patrick Renaud | +| | +| Date : 11/01/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Druc VmCaract Defines | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Druc VmCaract Macros | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Druc VmCaract variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Druc VmCaract Fonctions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DrucErreurUnCorps | +| | +\------------------------------------------------------------*/ +extern void DrucErreurUnCorps (); +extern void DrucCaractLargeurInf (); +extern void DrucCaractLargeurSup (); +extern void DrucCaractLargeurSupEq (); +extern void DrucCaractLargeurInfEq (); +extern void DrucCaractLongueurInf (); +extern void DrucCaractLongueurSup (); +extern void DrucCaractLongueurSupEq (); +extern void DrucCaractLongueurInfEq (); +extern void DrucCaractLargeurMin (); +extern void DrucCaractLargeurMax (); +extern void DrucCaractLongueurMin (); +extern void DrucCaractLongueurMax (); +extern void DrucCaracteriseRectangle (); +extern void DrucCaracteriseEquipot (); +extern void DrucCaracterise (); diff --git a/alliance/src/druc/src/vmcasmld.c b/alliance/src/druc/src/vmcasmld.c new file mode 100644 index 00000000..593fd14b --- /dev/null +++ b/alliance/src/druc/src/vmcasmld.c @@ -0,0 +1,329 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : VMCASMLD.C | +| | +| Authors : Patrick Renaud | +| | +| Date : 11/01/94 | +| | +\------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "mph.h" +#include "mut.h" +#include "rds.h" +#include "rwi.h" +#include "rut.h" +#include "rtl.h" +#include "rfm.h" +#include "rpr.h" + +#include "drucompi_y.h" +#include "drucutil.h" +#include "vmctools.h" +#include "drucompi.h" +#include "druchier.h" +#include "vmcasmld.h" + +/*------------------------------------------------------------\ +| | +| DRUCVMC variables | +| | +\------------------------------------------------------------*/ + +extern long DrucCtmMax; +extern DrucTypeStructRuleComment *DrucRuleCommentList; + + +static char DrucFileBuffer [ DRUC_MAX_FILE_BUFFER + 1 ]; + +/*------------------------------------------------------------\ +| | +| DRUVMC Fonctions | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| DrucComputeCtm | +| | +\------------------------------------------------------------*/ + +void DrucComputeCtm ( DrucInstructionCourante + ) + +DrucTypeStructInstruction *DrucInstructionCourante; + +{ + +int IndexInstruction; +long Value; +int IndexMesure = 0; + + while ( DrucInstructionCourante->RELATION [ IndexMesure ] + != DRUC_UNDEFINED_RELATION + ) + { + if ( ( DrucInstructionCourante->MESURE [ IndexMesure ] + == DRUC_MESURE_AXIALE ) + || + ( DrucInstructionCourante->MESURE [ IndexMesure ] + == DRUC_MESURE_GEODESIQUE ) + ) + { + Value = DrucInstructionCourante->VALEUR [ IndexMesure ]; + + DrucCtmMax = ( DrucCtmMax > Value ? + DrucCtmMax : + Value + ); + + DrucStructRdsLayer [ DrucInstructionCourante->LAYER_1 ].CTM = + ( Value > DrucStructRdsLayer [ DrucInstructionCourante->LAYER_1 ].CTM ? + Value : + DrucStructRdsLayer [ DrucInstructionCourante->LAYER_1 ].CTM + ); + + DrucStructRdsLayer [ DrucInstructionCourante->LAYER_2 ].CTM = + ( Value > DrucStructRdsLayer [ DrucInstructionCourante->LAYER_2 ].CTM ? + Value : + DrucStructRdsLayer [ DrucInstructionCourante->LAYER_2 ].CTM + ); + } + + IndexMesure ++; + } +} + +/*------------------------------------------------------------\ +| | +| DrucReadRulesComment | +| | +\------------------------------------------------------------*/ + +void DrucReadRulesComment ( + ) + +{ + +long Rule; +DrucTypeStructRuleComment *Comment; +char *Flag; +char *TmpBuffer; + + while ( 1 + ) + { + Flag = fgets( DrucFileBuffer, DRUC_MAX_FILE_BUFFER, vrd_y_in ); + + if ( Flag != (char *)NULL + ) + { + if ( strstr( DrucFileBuffer, DRUC_DRC_END_COMMENT ) != (char *)NULL + ) + { + return; + } + + if ( sscanf ( DrucFileBuffer, "%ld\n", &Rule ) == EOF + ) + { + DRUC_EXIT( DRUC_ERROR_BAD_COMMENT ); + } + TmpBuffer = strchr ( DrucFileBuffer, ' ' + ); + TmpBuffer ++; + Comment = (DrucTypeStructRuleComment *) + rdsalloc( sizeof( DrucTypeStructRuleComment ), + 1 + ); + + Comment->NEXT = DrucRuleCommentList; + DrucRuleCommentList = Comment; + Comment->RULE = Rule; + Comment->COMMENT = (char *)rdsalloc( strlen( DrucFileBuffer ) + 1, 0 ); + + strcpy ( Comment->COMMENT, TmpBuffer + ); + } + } +} + +/*------------------------------------------------------------\ +| | +| DrucInitInstruction | +| | +| Ouvre le fichier contenant le code assembleur de DRUC | +| Lit et charge le code dans la pile d'execution | +| Initialise la structure DrucStructRdsLayer | +| Initialise la structure DrucStructDefine | +| Initialise la structure DrucStructRegle | +\------------------------------------------------------------*/ + +int DrucInitInstruction ( DrucTabInstruction + ) + +DrucTypeStructInstruction **DrucTabInstruction; + +{ + +int TmpIndexMesure; +int TmpResultat; +int IndexLayer; +boolean FlagBegin; +char *FlagBuffer; +DrucTypeStructInstruction *TmpStructInstruction; + + DrucInitStructLayers ( + ); + + vrd_y_in = fopen ( RDS_TECHNO_NAME , + "r" + ); + + if ( vrd_y_in == (FILE *)NULL + ) + { + DRUC_EXIT ( DRUC_ERROR_NO_RULE_FILE + ); + } + + FlagBegin = DRUC_FALSE; + FlagBuffer = (char *)NULL; + + while ( FlagBegin != DRUC_TRUE + ) + { + FlagBuffer = fgets ( DrucFileBuffer, + DRUC_MAX_FILE_BUFFER, + vrd_y_in + ); + + if ( FlagBuffer != (char *)NULL + ) + { + + if ( strstr ( DrucFileBuffer, DRUC_DRC_RULES ) != (char *)NULL + ) + { + FlagBegin = DRUC_TRUE; + } + } + else + { + DRUC_EXIT ( DRUC_ERROR_NO_RULE_IN_FILE + ); + } + } + + DrucStructInstruction = ( DrucTypeStructInstruction *)NULL; + + TmpResultat = vrd_y_parse(); + DrucViewString ("\n"); + + if ( DrucStructStat.FLAG_FLATTEN_MODE == DRUC_HIERARCHIE + ) + { + DrucAddABoxRules ( & DrucStructInstruction, + & DrucNombreInstructions + ); + } + + *DrucTabInstruction = + ( DrucTypeStructInstruction *)malloc + (sizeof ( DrucTypeStructInstruction ) * DrucNombreInstructions ); + + for ( IndexLayer = DrucNombreInstructions - 1; + IndexLayer >= 0; + IndexLayer -- + ) + { + (*DrucTabInstruction) [ IndexLayer ].NEXT = (DrucTypeStructInstruction *)NULL; + (*DrucTabInstruction) [ IndexLayer ].INSTRUCTION = DrucStructInstruction->INSTRUCTION; + (*DrucTabInstruction) [ IndexLayer ].LAYER_DEST = DrucStructInstruction->LAYER_DEST; + (*DrucTabInstruction) [ IndexLayer ].OP_COMPOSE = DrucStructInstruction->OP_COMPOSE; + (*DrucTabInstruction) [ IndexLayer ].LAYER_1 = DrucStructInstruction->LAYER_1; + (*DrucTabInstruction) [ IndexLayer ].LAYER_2 = DrucStructInstruction->LAYER_2; + (*DrucTabInstruction) [ IndexLayer ].OP_UNAIRE = DrucStructInstruction->OP_UNAIRE ; + (*DrucTabInstruction) [ IndexLayer ].DEF_VALEUR = DrucStructInstruction->DEF_VALEUR; + + for ( TmpIndexMesure = 0; + TmpIndexMesure < DRUC_MAX_MESURES; + TmpIndexMesure ++ + ) + { + (*DrucTabInstruction) [ IndexLayer ].REGLE_NUM [ TmpIndexMesure ] = + DrucStructInstruction->REGLE_NUM [ TmpIndexMesure ] ; + + (*DrucTabInstruction) [ IndexLayer ].RELATION [ TmpIndexMesure ] = + DrucStructInstruction->RELATION [ TmpIndexMesure ] ; + + (*DrucTabInstruction) [ IndexLayer ].MESURE [ TmpIndexMesure ] = + DrucStructInstruction->MESURE [ TmpIndexMesure ] ; + + (*DrucTabInstruction) [ IndexLayer ].OP_COMPARE [ TmpIndexMesure ] = + DrucStructInstruction->OP_COMPARE [ TmpIndexMesure ] ; + + (*DrucTabInstruction) [ IndexLayer ].VALEUR [ TmpIndexMesure ] = + DrucStructInstruction->VALEUR [ TmpIndexMesure ] ; + } + TmpStructInstruction = DrucStructInstruction; + DrucStructInstruction = DrucStructInstruction->NEXT; + + free ( TmpStructInstruction + ); + } + + for ( IndexLayer = 0; + IndexLayer < DrucNombreInstructions -1; + IndexLayer ++ + ) + { + (*DrucTabInstruction)[ IndexLayer ].NEXT = (*DrucTabInstruction) +1; + } + +/*\ + * DrucNombreInstructions = DrucReadAsm ( & DrucTabInstruction + * ); +\*/ + + FlagBegin = DRUC_FALSE; + FlagBuffer = (char *)NULL; + + while ( FlagBegin != DRUC_TRUE + ) + { + FlagBuffer = fgets ( DrucFileBuffer, + DRUC_MAX_FILE_BUFFER, + vrd_y_in + ); + + if ( FlagBuffer != (char *)NULL + ) + { + if ( strstr ( DrucFileBuffer, DRUC_DRC_COMMENT ) != (char *)NULL + ) + { + FlagBegin = DRUC_TRUE; + } + } + else + { + DRUC_EXIT ( DRUC_ERROR_COMMENT_FILE + ); + } + } + + DrucReadRulesComment ( + ); + fclose ( vrd_y_in + ); + return ( DrucNombreInstructions + ); +} diff --git a/alliance/src/druc/src/vmcasmld.h b/alliance/src/druc/src/vmcasmld.h new file mode 100644 index 00000000..95d970fe --- /dev/null +++ b/alliance/src/druc/src/vmcasmld.h @@ -0,0 +1,27 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : VMCASMLD.H | +| | +| Authors : Patrick Renaud | +| | +| Date : 11/01/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Druc VmcAsmLd variables | +| | +\------------------------------------------------------------*/ +#define DRUC_FLATTEN_RULES 0 +#define DRUC_HIERARCHICAL_RULES 1 + +/*------------------------------------------------------------\ +| | +| Druc VmcAsmLd Fonctions | +| | +\------------------------------------------------------------*/ +extern int DrucReadNextCodeAsm (); +extern int DrucInitInstruction (); +extern int DrucReadAsm (); diff --git a/alliance/src/druc/src/vmcerror.c b/alliance/src/druc/src/vmcerror.c new file mode 100644 index 00000000..2898177e --- /dev/null +++ b/alliance/src/druc/src/vmcerror.c @@ -0,0 +1,478 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : VMCERROR.C | +| | +| Authors : Renaud Patrick | +| | +| Date : 25/01/94 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Modifs | +| 25/01/94: ligne 407 rajoutee (elle etait oubliee) | +| char *DrucFigureRdsErrorName; | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +#include +#include +#include +#include "mph.h" +#include "mut.h" +#include "rds.h" +#include "rwi.h" +#include "rut.h" +#include "rtl.h" +#include "rfm.h" +#include "rpr.h" + +#include "drucutil.h" +#include "vmctools.h" +#include "vmcasmld.h" +#include "vmcaract.h" +#include "defdefin.h" +#include "vmcmesur.h" +#include "vmcrelat.h" + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +rdsfig_list *DrucFigureRdsErreur; +FILE *DrucErrorFile; + + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| DrucOpenErrorFile | +| | +\------------------------------------------------------------*/ + +void DrucOpenErrorFile ( DrucErrorFileName, + Mode + ) +char *DrucErrorFileName; +char *Mode; + +{ + if ( DrucStructStat.FILE_ERROR == DRUC_ERROR_FILE + ) + { + DrucErrorFile = fopen ( DrucErrorFileName, + Mode + ); + } +} + +/*------------------------------------------------------------\ +| | +| DrucCloseErrorFile | +| | +\------------------------------------------------------------*/ + +void DrucCloseErrorFile ( + ) +{ + + if ( DrucStructStat.FILE_ERROR == DRUC_ERROR_FILE + ) + { + fclose ( DrucErrorFile + ); + } +} + +/*------------------------------------------------------------\ +| | +| DrucErreurOutFileRectangle | +| | +\------------------------------------------------------------*/ + +void DrucErreurOutFileRectangle ( RectangleErreur + ) + rdsrec_list *RectangleErreur; + +{ + if ( DrucStructStat.FILE_ERROR == DRUC_ERROR_FILE + ) + { + fprintf ( DrucErrorFile , + "\tX = %.1f \t" , + RectangleErreur->X / (float)RDS_LAMBDA ); + fprintf ( DrucErrorFile , + "Y = %.1f \t" , + RectangleErreur->Y / (float)RDS_LAMBDA ); + fprintf ( DrucErrorFile , + "DX = %.1f \t" , + RectangleErreur->DX / (float)RDS_LAMBDA); + fprintf ( DrucErrorFile , + "DY = %.1f \t\n" , + RectangleErreur->DY / (float)RDS_LAMBDA); + fflush (DrucErrorFile); + } +} +/*------------------------------------------------------------\ +| | +| DrucErreurOutFileRegle | +| | +\------------------------------------------------------------*/ + +void DrucErreurOutFileRegle ( Regle + ) + int Regle; + +{ + extern DrucTypeStructRuleComment *DrucRuleCommentList; + DrucTypeStructRuleComment *Comment; + + if ( DrucStructStat.FILE_ERROR == DRUC_ERROR_FILE + ) + { + fprintf ( DrucErrorFile , + "\nERROR Code %4d: ", + Regle + ); + for (Comment = DrucRuleCommentList; + Comment && (Comment->RULE != Regle); + Comment = Comment->NEXT); + if (Comment) + fprintf ( DrucErrorFile , + "%s\n", + Comment->COMMENT + ); + else + fprintf ( DrucErrorFile , + "NO MESSAGE\n" + ); + + } +} + +/*------------------------------------------------------------\ +| | +| DrucErreurOutFileMesure | +| | +\------------------------------------------------------------*/ + +void DrucErreurOutFileMesure ( Mesure + ) + float Mesure; + +{ + + if ( DrucStructStat.FILE_ERROR == DRUC_ERROR_FILE + ) + { + fprintf ( DrucErrorFile , + "Mesure Effectuee :%.1f\n", + Mesure + ); + } +} + +/*------------------------------------------------------------\ +| | +| DrucErreurOutFileLayer | +| | +\------------------------------------------------------------*/ + +void DrucErreurOutFileLayer ( IndexLayer + ) + int IndexLayer; + +{ + + if ( DrucStructStat.FILE_ERROR == DRUC_ERROR_FILE + ) + { + fprintf ( DrucErrorFile , + "\tLayer %s :", + ( RDS_LAYER_NAME [ IndexLayer ]) + 4 + ); + } +} + +/*------------------------------------------------------------\ +| | +| DrucErreurUnRectangle | +| si on a une composition se composition il faut | +| re une boucle qui balaye toutes les compositions | +| | +\------------------------------------------------------------*/ + +rdsrec_list * DrucErreurUnRectangle ( DrucRectangle, + DrucInstructionCourante, + IndexMesure, + IndexLayer + ) + rdsrec_list *DrucRectangle; + DrucTypeStructInstruction *DrucInstructionCourante; + int IndexMesure; + int IndexLayer; + +{ + +register rdsrec_list *RectangleOrigine; +register rdsrec_list *RectangleErreurPrec; +register rdsrec_list *RectangleErreur; +register DrucTypeStructPlusRect *TmpPlusRec; + +/*\ +DrucViewString ("\nDrucErreurUnRectangle\n"); +DrucViewRectangle (&DrucRectangle); +\*/ + + TmpPlusRec = MACRO_NEXT_DEFINE ( DrucRectangle ); + + if ( TmpPlusRec != ( DrucTypeStructPlusRect *)NULL + ) + { + RectangleErreur = allocrdsrec ( sizeof ( DrucTypeStructPlusRect ) + ); + + RectangleOrigine = TmpPlusRec->NEXT_EQUI; + RectangleErreur->X = RectangleOrigine->X; + RectangleErreur->Y = RectangleOrigine->Y; + RectangleErreur->DX = RectangleOrigine->DX; + RectangleErreur->DY = RectangleOrigine->DY; + + SetRdsLayer ( RectangleErreur, + GetRdsLayer ( RectangleOrigine ) + ); + + MACRO_REGLE_NUM (RectangleErreur ) = DrucInstructionCourante->REGLE_NUM [ IndexMesure ]; + MACRO_NEXT_EQUI (RectangleErreur ) = RectangleErreur; + +/*\ + * ca fait voir et mettre dans la figure des erreurs le rectangle + * user ce qui n'est pas utile + * + DrucErreurOutFileRectangle ( RectangleErreur + ); +\*/ + DrucAddRecFigure ( RectangleErreur, + DrucFigureRdsErreur, + TmpPlusRec->NOMBRE + ); + /*\ + * recopie de la liste des rectangles origines dans la rdsErreur + \*/ +/*\ + modif 08 03 94 : la ligne est reportee dans la boucle while + TmpPlusRec = TmpPlusRec->NEXT_DEFINE; +\*/ + + while ( TmpPlusRec != ( DrucTypeStructPlusRect *)NULL + ) + { + /*\ + * chainage circulaire des rectangles composant le RECTANGLE1 + \*/ + RectangleErreurPrec = RectangleErreur; + RectangleErreur = allocrdsrec ( sizeof + ( DrucTypeStructPlusRect + ) + ); + + MACRO_NEXT_EQUI (RectangleErreur ) = MACRO_NEXT_EQUI ( RectangleErreurPrec ); + MACRO_NEXT_EQUI (RectangleErreurPrec ) = RectangleErreur; + RectangleOrigine = TmpPlusRec->NEXT_EQUI; + RectangleErreur->X = RectangleOrigine->X; + RectangleErreur->Y = RectangleOrigine->Y; + RectangleErreur->DX = RectangleOrigine->DX; + RectangleErreur->DY = RectangleOrigine->DY; + + SetRdsLayer ( RectangleErreur, + TmpPlusRec->NOMBRE + ); + + MACRO_REGLE_NUM (RectangleErreur ) = DrucInstructionCourante->REGLE_NUM [ IndexMesure ]; + + DrucErreurOutFileLayer ( TmpPlusRec->NOMBRE + ); + + DrucErreurOutFileRectangle ( RectangleErreur + ); + DrucAddRecFigure ( RectangleErreur, + DrucFigureRdsErreur, + TmpPlusRec->NOMBRE + ); +/*\ + modif 08 03 94 : la ligne suivante est rajoutee +\*/ + TmpPlusRec = TmpPlusRec->NEXT_DEFINE; + } + } + + else + { + /*\ + * recopie des infos du rectangle origine dans la rdsErreur + \*/ + RectangleErreur = allocrdsrec ( sizeof ( DrucTypeStructPlusRect ) + ); + + RectangleErreur->X = DrucRectangle->X; + RectangleErreur->Y = DrucRectangle->Y; + RectangleErreur->DX = DrucRectangle->DX; + RectangleErreur->DY = DrucRectangle->DY; + + SetRdsLayer ( RectangleErreur, + IndexLayer + ); + + MACRO_REGLE_NUM (RectangleErreur ) = + DrucInstructionCourante->REGLE_NUM [ IndexMesure ]; + + MACRO_NEXT_EQUI ( RectangleErreur ) = RectangleErreur; + + DrucErreurOutFileLayer ( IndexLayer + ); + + DrucErreurOutFileRectangle ( RectangleErreur + ); + DrucAddRecFigure ( RectangleErreur, + DrucFigureRdsErreur, + IndexLayer + ); + } + + return ( RectangleErreur + ); +} + +/*------------------------------------------------------------\ +| | +| DrucErreurUnCorps | +| | +\------------------------------------------------------------*/ + +void DrucErreurUnCorps ( DrucRectangle, + DrucInstructionCourante, + IndexMesure + ) + rdsrec_list *DrucRectangle; + DrucTypeStructInstruction *DrucInstructionCourante; + int IndexMesure; + +{ + + DrucStructStat.ERROR_NUMBER ++; + + DrucErreurOutFileRegle ( DrucInstructionCourante->REGLE_NUM[IndexMesure] + ); +/*\ + * l'instruction est reportee dans l'affichage des rectangles + DrucErreurOutFileLayer ( DrucInstructionCourante->LAYER_1 + ); +\*/ + + DrucErreurUnRectangle ( DrucRectangle, + DrucInstructionCourante, + IndexMesure, + DrucInstructionCourante->LAYER_1 + ); +} + +/*------------------------------------------------------------\ +| | +| DrucErreurDeuxCorps | +| | +\------------------------------------------------------------*/ + +void DrucErreurDeuxCorps ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ) + DrucTypeStructInstruction *DrucInstructionCourante; + DrucTypeStructMesure *DrucStructMesure; + int IndexMesure; + +{ + +rdsrec_list *First; +rdsrec_list *Second; +rdsrec_list *Link; + + DrucStructStat.ERROR_NUMBER ++; + + DrucErreurOutFileRegle ( DrucInstructionCourante->REGLE_NUM[IndexMesure] + ); +/*\ +modif 21/01/94 a la demande d'alain: +suppression de la mesure + DrucErreurOutFileMesure ( DrucStructMesure->MESURE_EFFECTIVE / (float)RDS_LAMBDA + ); + +suppression de l'affichage du layer user +la fonction est reportee dans l'affichage d'un rectangle + DrucErreurOutFileLayer ( DrucStructMesure->LAYER_1 + ); +\*/ + + First = DrucErreurUnRectangle ( DrucStructMesure->RECTANGLE1, + DrucInstructionCourante, + IndexMesure, + DrucStructMesure->LAYER_1 + ); + +/*\ +suppression de l'affichage du layer user +la fonction est reportee dans l'affichage d'un rectangle + DrucErreurOutFileLayer ( DrucStructMesure->LAYER_2 + ); +\*/ + + Second = DrucErreurUnRectangle ( DrucStructMesure->RECTANGLE2, + DrucInstructionCourante, + IndexMesure, + DrucStructMesure->LAYER_2 + ); + + Link = MACRO_NEXT_EQUI ( First ); + MACRO_NEXT_EQUI ( First ) = MACRO_NEXT_EQUI ( Second ); + MACRO_NEXT_EQUI ( Second ) = Link; +} + +/*------------------------------------------------------------\ +| | +| DrucErreurCleanFigureErreur | +| | +\------------------------------------------------------------*/ + +void DrucErreurCleanFigureErreur ( DrucFigureRdsErreur, + DrucFigureRdsErrorName + ) + rdsfig_list *DrucFigureRdsErreur; + char *DrucFigureRdsErrorName; + +{ + + if ( DrucFigureRdsErreur != ( rdsfig_list *)NULL + ) + { + delrdsfig ( DrucFigureRdsErrorName + ); + + DrucFigureRdsErreur = ( rdsfig_list *)NULL; + } +} + + + diff --git a/alliance/src/druc/src/vmcerror.h b/alliance/src/druc/src/vmcerror.h new file mode 100644 index 00000000..bcf709b4 --- /dev/null +++ b/alliance/src/druc/src/vmcerror.h @@ -0,0 +1,40 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : VMCERROR.H | +| | +| Authors : Patrick Renaud | +| | +| Date : 11/01/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Druc VmcError Defines | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Druc VmcError Macros | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Druc VmcError variables | +| | +\------------------------------------------------------------*/ +extern rdsfig_list *DrucFigureRdsErreur; +extern FILE *DrucErrorFile; +/*------------------------------------------------------------\ +| | +| Druc VmcError Fonctions | +| | +\------------------------------------------------------------*/ +extern void DrucErreurUnCorps (); +extern void DrucErreurDeuxCorps (); +extern void DrucErreurOutFileRectangle (); +extern void DrucErreurOutFileRegle (); +extern void DrucErreurOutFileLayer (); +extern void DrucErreurUnRectangle (); +extern void DrucErreurCleanFigureErreur (); diff --git a/alliance/src/druc/src/vmcmesur.c b/alliance/src/druc/src/vmcmesur.c new file mode 100644 index 00000000..596e9daa --- /dev/null +++ b/alliance/src/druc/src/vmcmesur.c @@ -0,0 +1,1732 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : VMCMESUR.C | +| | +| Authors : Renaud Patrick | +| | +| Date : 11/01/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +#include +#include +#include +#include "mph.h" +#include "mut.h" +#include "rds.h" +#include "rwi.h" +#include "rut.h" +#include "rtl.h" +#include "rfm.h" +#include "rpr.h" + +#include "drucutil.h" +#include "vmctools.h" +#include "vmcerror.h" +#include "vmcmesur.h" +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Fonctions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DrucRelationSetDistance | +| | +\------------------------------------------------------------*/ +void DrucRelationSetDistance ( DrucStructMesure, + Mesure1, + Mesure2 + ) + DrucTypeStructMesure *DrucStructMesure; + long Mesure1; + long Mesure2; +{ + if ( Mesure1 > Mesure2 ) + { + MACRO_LONG_DISTANCE = Mesure1; + if ( Mesure2 >= 0 ) + { + MACRO_LARGE_DISTANCE = Mesure2; + } + else + { + MACRO_LARGE_DISTANCE = Mesure1; + } + } + else + { + MACRO_LONG_DISTANCE = Mesure2; + if ( Mesure1 >= 0 ) + { + MACRO_LARGE_DISTANCE = Mesure1; + } + else + { + MACRO_LARGE_DISTANCE = Mesure2; + } + } +} +/*------------------------------------------------------------\ +| | +| | +| +--+ +--------+ +--------+ +--------+ | +| |A | |B | |B | | B| | +| +--|..|--+ | +------+ | +--+ | +-------+ | | +| | | | | | | . A| | | | | |A . | | | +| | +--+ | | +------+ +--|..|--+ +-------+ | | +| |B | | | | A| | | | +| +--------+ +--------+ +--+ +--------+ | +| cas 7 cas 13 cas 11 cas 14 | +| | +| +---+ +-----+ +----+ +-----+ | +| |A | | A| |B | | B| | +| | ..|--+ +--|... | | +-----+ +-----+ | | +| | . | | | | . | | | . | | . | | | +| +---+ | | +-----+ +-|... | | ..|---+ | +| | B| |B | | A| |A | | +| +----+ +-----+ +-----+ +-----+ | +| cas 6 cas 5 cas 9 cas 10 | +| | +| | +| +--+ +--------+ +--------+ +--------+ | +| |B | |A | |A | | A| | +| +--|..|--+ | +------+ | +--+ | +-------+ | | +| | | | | | | . B| | | | | |B . | | | +| | +--+ | | +------+ +--|..|--+ +-------+ | | +| |A | | | | B| | | | +| +--------+ +--------+ +--+ +--------+ | +| cas 8 cas 2 cas 4 cas 1 | +| | +| +---+ +---+ +---------+ +---------+ | +| | | | | | | | | | +| +---------+ +--------+ | +-----+ | | +---+ | | +| | . . A | |B . . | | | | | | | | | | +| +---------+ +--------+ | |B | | | |A | | | +| | | | | | +-----+ | | +---+ | | +| | B | |A | | A | |B | | +| +---+ +---+ +---------+ +---------+ | +| cas 12 cas 3 cas 0 cas 15 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DrucRelationMesure | +| | +\------------------------------------------------------------*/ +void DrucRelationMesure ( DrucStructMesure + ) + DrucTypeStructMesure *DrucStructMesure; +{ +long XA = MACRO_RECTANGLE1->X; +long YA = MACRO_RECTANGLE1->Y; +long XB = MACRO_RECTANGLE2->X; +long YB = MACRO_RECTANGLE2->Y; +long DXA = MACRO_RECTANGLE1->DX; +long DYA = MACRO_RECTANGLE1->DY; +long DXB = MACRO_RECTANGLE2->DX; +long DYB = MACRO_RECTANGLE2->DY; +long FinXA = XA + DXA; +long FinXB = XB + DXB; +long FinYA = YA + DYA; +long FinYB = YB + DYB; +long ExtenXAXB = XA - XB; +long ExtenDXAXB = FinXA - XB; +long ExtenDXADXB = FinXA - FinXB; +long ExtenYAYB = YA - YB; +long ExtenDYAYB = FinYA - YB; +long ExtenDYADYB = FinYA - FinYB; +long ExtenXBXA = XB - XA; +long ExtenDXBXA = FinXB - XA; +long ExtenYBYA = YB - YA; +long ExtenDYBYA = FinYB - YA; +long ExtenXADXB = XA - FinXB; +long ExtenYADYB = YA - FinYB; +long ExtenXBDXA = XB - FinXA; +long ExtenYBDYA = YB - FinYA; +int TmpCas; + + TmpCas = 0; + if ( XA >= XB ) + { + TmpCas |= 1; + } + if ( FinXA <= FinXB ) + { + TmpCas |= 2; + } + if ( YA >= YB ) + { + TmpCas |= 4; + } + if ( FinYA <= FinYB ) + { + TmpCas |= 8; + } + MACRO_TOPOLOGIE = TmpCas; +/*\ +printf ("\nRECT: %d\n",TmpCas); +viewrdsrec (MACRO_RECTANGLE1); +viewrdsrec (MACRO_RECTANGLE2); +printf ("\nRECT\n"); +\*/ + switch ( TmpCas ) + { + case 0 : + { /* B inclus dans A */ + MACRO_POSX_RECT_UP = XB; + MACRO_POSY_RECT_UP = FinYB; + MACRO_POSDX_RECT_UP = FinXB; + MACRO_POSDY_RECT_UP = FinYA; + + MACRO_POSX_RECT_DO = XB; + MACRO_POSY_RECT_DO = YA; + MACRO_POSDX_RECT_DO = FinXB; + MACRO_POSDY_RECT_DO = YB; + + MACRO_POSX_RECT_LE = XA; + MACRO_POSY_RECT_LE = YB; + MACRO_POSDX_RECT_LE = XB; + MACRO_POSDY_RECT_LE = FinYB; + + MACRO_POSX_RECT_RI = FinXB; + MACRO_POSY_RECT_RI = YB; + MACRO_POSDX_RECT_RI = FinXA; + MACRO_POSDY_RECT_RI = FinYB; + + MACRO_ORIENTATION = DRUC_ORIENTATION_ENVELOPPE; + MACRO_SURFACE_INTER = DXB * DYB; + if ( DXB > DYB ) + { + MACRO_LONG_INTER = DXB; + MACRO_LARGE_INTER = DYB; + if ( ExtenDYADYB > ExtenYBYA ) + { + MACRO_LONG_MAX = ExtenDYADYB; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_UP; + MACRO_LONG_MIN = ExtenYBYA; + MACRO_RECT_LONG_MIN = DRUC_RECTANGLE_DO; + } + else + { + MACRO_LONG_MIN = ExtenDYADYB; + MACRO_RECT_LONG_MIN = DRUC_RECTANGLE_UP; + MACRO_LONG_MAX = ExtenYBYA; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_DO; + } + if ( ExtenDXADXB > ExtenXBXA ) + { + MACRO_LARGE_MAX = ExtenDXADXB; + MACRO_RECT_LARGE_MAX = DRUC_RECTANGLE_RI; + MACRO_LARGE_MIN = ExtenXBXA; + MACRO_RECT_LARGE_MIN = DRUC_RECTANGLE_LE; + } + else + { + MACRO_LARGE_MIN = ExtenDXADXB; + MACRO_RECT_LARGE_MIN = DRUC_RECTANGLE_RI; + MACRO_LARGE_MAX = ExtenXBXA; + MACRO_RECT_LARGE_MAX = DRUC_RECTANGLE_LE; + } + } + else + { + MACRO_LONG_INTER = DYB; + MACRO_LARGE_INTER = DXB; + if ( ExtenDXADXB > ExtenXBXA ) + { + MACRO_LONG_MAX = ExtenDXADXB; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_RI; + MACRO_LONG_MIN = ExtenXBXA; + MACRO_RECT_LONG_MIN = DRUC_RECTANGLE_LE; + } + else + { + MACRO_LONG_MIN = ExtenDXADXB; + MACRO_RECT_LONG_MIN = DRUC_RECTANGLE_RI; + MACRO_LONG_MAX = ExtenXBXA; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_LE; + } + if ( ExtenDYADYB > ExtenYBYA ) + { + MACRO_LARGE_MAX = ExtenDYADYB; + MACRO_RECT_LARGE_MAX = DRUC_RECTANGLE_UP; + MACRO_LARGE_MIN = ExtenYBYA; + MACRO_RECT_LARGE_MIN = DRUC_RECTANGLE_DO; + } + else + { + MACRO_LARGE_MIN = ExtenDYADYB; + MACRO_RECT_LARGE_MIN = DRUC_RECTANGLE_UP; + MACRO_LARGE_MAX = ExtenYBYA; + MACRO_RECT_LARGE_MAX = DRUC_RECTANGLE_DO; + } + } + + if ( MACRO_LONG_MAX > MACRO_LARGE_MAX + ) + { + MACRO_SUP = MACRO_LONG_MAX; + MACRO_RECT_SUP = MACRO_RECT_LONG_MAX; + } + else + { + MACRO_SUP = MACRO_LARGE_MAX; + MACRO_RECT_SUP = MACRO_RECT_LARGE_MAX; + } + + if ( MACRO_LONG_MIN < MACRO_LARGE_MIN + ) + { + MACRO_INF = MACRO_LONG_MIN; + MACRO_RECT_INF = MACRO_RECT_LONG_MIN; + } + else + { + MACRO_INF = MACRO_LARGE_MIN; + MACRO_RECT_INF = MACRO_RECT_LARGE_MIN; + } + break; + } + + case 1 : + { /* B penetre A par X */ + MACRO_POSX_RECT_UP = XA; + MACRO_POSY_RECT_UP = FinYB; + MACRO_POSDX_RECT_UP = FinXB; + MACRO_POSDY_RECT_UP = FinYA; + + MACRO_POSX_RECT_DO = XA; + MACRO_POSY_RECT_DO = YA; + MACRO_POSDX_RECT_DO = FinXB; + MACRO_POSDY_RECT_DO = YB; + + MACRO_POSX_RECT_RI = FinXB; + MACRO_POSY_RECT_RI = YB; + MACRO_POSDX_RECT_RI = FinXA; + MACRO_POSDY_RECT_RI = FinYB; + + MACRO_ORIENTATION = DRUC_ORIENTATION_MARGE; + MACRO_SURFACE_INTER = ExtenDXBXA * DYB; + MACRO_LONG_DISTANCE = ExtenXADXB; + MACRO_PENETRE_INTER = ExtenDXBXA; + MACRO_FRONT = ExtenDXADXB; + MACRO_RECT_FRONT = DRUC_RECTANGLE_RI; + if ( ExtenDXBXA > DYB ) + { + MACRO_LONG_INTER = ExtenDXBXA; + MACRO_LARGE_INTER = DYB; + MACRO_LARGE_MIN = ExtenDXADXB; + MACRO_LARGE_MAX = ExtenDXADXB; + MACRO_RECT_LARGE_MIN = DRUC_RECTANGLE_RI; + MACRO_RECT_LARGE_MAX = DRUC_RECTANGLE_RI; + if ( ExtenDYADYB > ExtenYBYA ) + { + MACRO_LATER_MAX = ExtenDYADYB; + MACRO_LATER_MIN = ExtenYBYA; + MACRO_RECT_LATER_MAX = DRUC_RECTANGLE_UP; + MACRO_RECT_LATER_MIN = DRUC_RECTANGLE_DO; + MACRO_LONG_MAX = ExtenDYADYB; + MACRO_LONG_MIN = ExtenYBYA; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_UP; + MACRO_RECT_LONG_MIN = DRUC_RECTANGLE_DO; + } + else + { + MACRO_LATER_MIN = ExtenDYADYB; + MACRO_LATER_MAX = ExtenYBYA; + MACRO_RECT_LATER_MIN = DRUC_RECTANGLE_UP; + MACRO_RECT_LATER_MAX = DRUC_RECTANGLE_DO; + MACRO_LONG_MIN = ExtenDYADYB; + MACRO_LONG_MAX = ExtenYBYA; + MACRO_RECT_LONG_MIN = DRUC_RECTANGLE_UP; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_DO; + } + } + else + { + MACRO_LARGE_INTER = ExtenDXBXA; + MACRO_LONG_INTER = DYB; + MACRO_LONG_MIN = ExtenDXADXB; + MACRO_LONG_MAX = ExtenDXADXB; + MACRO_RECT_LONG_MIN = DRUC_RECTANGLE_RI; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_RI; + if ( ExtenDYADYB > ExtenYBYA ) + { + MACRO_LATER_MAX = ExtenDYADYB; + MACRO_LATER_MIN = ExtenYBYA; + MACRO_RECT_LATER_MAX = DRUC_RECTANGLE_UP; + MACRO_RECT_LATER_MIN = DRUC_RECTANGLE_DO; + MACRO_LARGE_MAX = ExtenDYADYB; + MACRO_LARGE_MIN = ExtenYBYA; + MACRO_RECT_LARGE_MAX = DRUC_RECTANGLE_UP; + MACRO_RECT_LARGE_MIN = DRUC_RECTANGLE_DO; + } + else + { + MACRO_LATER_MIN = ExtenDYADYB; + MACRO_LATER_MAX = ExtenYBYA; + MACRO_RECT_LATER_MIN = DRUC_RECTANGLE_UP; + MACRO_RECT_LATER_MAX = DRUC_RECTANGLE_DO; + MACRO_LARGE_MIN = ExtenDYADYB; + MACRO_LARGE_MAX = ExtenYBYA; + MACRO_RECT_LARGE_MIN = DRUC_RECTANGLE_UP; + MACRO_RECT_LARGE_MAX = DRUC_RECTANGLE_DO; + } + } + if ( MACRO_FRONT > MACRO_LATER_MAX + ) + { + MACRO_SUP = MACRO_FRONT; + MACRO_RECT_SUP = MACRO_RECT_FRONT; + } + else + { + MACRO_SUP = MACRO_LATER_MAX; + MACRO_RECT_SUP = MACRO_RECT_LATER_MAX; + } + + if ( MACRO_FRONT < MACRO_LATER_MIN + ) + { + MACRO_INF = MACRO_FRONT; + MACRO_RECT_INF = MACRO_RECT_FRONT; + } + else + { + MACRO_INF = MACRO_LATER_MIN; + MACRO_RECT_INF = MACRO_RECT_LATER_MIN; + } + break; + } + case 2 : + { /* B penetre A par DX */ + MACRO_POSX_RECT_UP = XB; + MACRO_POSY_RECT_UP = FinYB; + MACRO_POSDX_RECT_UP = FinXA; + MACRO_POSDY_RECT_UP = FinYA; + + MACRO_POSX_RECT_DO = XB; + MACRO_POSY_RECT_DO = YA; + MACRO_POSDX_RECT_DO = FinXA; + MACRO_POSDY_RECT_DO = YB; + + MACRO_POSX_RECT_LE = XA; + MACRO_POSY_RECT_LE = YB; + MACRO_POSDX_RECT_LE = XB; + MACRO_POSDY_RECT_LE = FinYB; + + MACRO_ORIENTATION = DRUC_ORIENTATION_MARGE; + MACRO_SURFACE_INTER = ExtenDXAXB * DYB; + MACRO_LONG_DISTANCE = ExtenXBDXA; + MACRO_PENETRE_INTER = ExtenDXAXB; + MACRO_FRONT = ExtenXBXA; + MACRO_RECT_FRONT = DRUC_RECTANGLE_LE; + if ( ExtenDXAXB > DYB ) + { + MACRO_LONG_INTER = ExtenDXAXB; + MACRO_LARGE_INTER = DYB; + MACRO_LARGE_MIN = ExtenXBXA; + MACRO_LARGE_MAX = ExtenXBXA; + MACRO_RECT_LARGE_MIN = DRUC_RECTANGLE_LE; + MACRO_RECT_LARGE_MAX = DRUC_RECTANGLE_LE; + if ( ExtenDYADYB > ExtenYBYA ) + { + MACRO_LATER_MAX = ExtenDYADYB; + MACRO_LATER_MIN = ExtenYBYA; + MACRO_RECT_LATER_MAX = DRUC_RECTANGLE_UP; + MACRO_RECT_LATER_MIN = DRUC_RECTANGLE_DO; + MACRO_LONG_MAX = ExtenDYADYB; + MACRO_LONG_MIN = ExtenYBYA; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_UP; + MACRO_RECT_LONG_MIN = DRUC_RECTANGLE_UP; + } + else + { + MACRO_LATER_MIN = ExtenDYADYB; + MACRO_LATER_MAX = ExtenYBYA; + MACRO_RECT_LATER_MIN = DRUC_RECTANGLE_UP; + MACRO_RECT_LATER_MAX = DRUC_RECTANGLE_DO; + MACRO_LONG_MIN = ExtenDYADYB; + MACRO_LONG_MAX = ExtenYBYA; + MACRO_RECT_LONG_MIN = DRUC_RECTANGLE_UP; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_UP; + } + } + else + { + MACRO_LARGE_INTER = ExtenDXAXB; + MACRO_LONG_INTER = DYB; + MACRO_LONG_MIN = ExtenXBXA; + MACRO_LONG_MAX = ExtenXBXA; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_LE; + MACRO_RECT_LONG_MIN = DRUC_RECTANGLE_LE; + if ( ExtenDYADYB > ExtenYBYA ) + { + MACRO_LATER_MAX = ExtenDYADYB; + MACRO_LATER_MIN = ExtenYBYA; + MACRO_RECT_LATER_MAX = DRUC_RECTANGLE_UP; + MACRO_RECT_LATER_MIN = DRUC_RECTANGLE_DO; + MACRO_LARGE_MAX = ExtenDYADYB; + MACRO_LARGE_MIN = ExtenYBYA; + MACRO_RECT_LARGE_MAX = DRUC_RECTANGLE_UP; + MACRO_RECT_LARGE_MIN = DRUC_RECTANGLE_DO; + } + else + { + MACRO_LATER_MIN = ExtenDYADYB; + MACRO_LATER_MAX = ExtenYBYA; + MACRO_RECT_LATER_MIN = DRUC_RECTANGLE_UP; + MACRO_RECT_LATER_MAX = DRUC_RECTANGLE_DO; + MACRO_LARGE_MIN = ExtenDYADYB; + MACRO_LARGE_MAX = ExtenYBYA; + MACRO_RECT_LARGE_MIN = DRUC_RECTANGLE_UP; + MACRO_RECT_LARGE_MAX = DRUC_RECTANGLE_DO; + } + } + if ( MACRO_FRONT > MACRO_LATER_MAX + ) + { + MACRO_SUP = MACRO_FRONT; + MACRO_RECT_SUP = MACRO_RECT_FRONT; + } + else + { + MACRO_SUP = MACRO_LATER_MAX; + MACRO_RECT_SUP = MACRO_RECT_LATER_MAX; + } + + if ( MACRO_FRONT < MACRO_LATER_MIN + ) + { + MACRO_INF = MACRO_FRONT; + MACRO_RECT_INF = MACRO_RECT_FRONT; + } + else + { + MACRO_INF = MACRO_LATER_MIN; + MACRO_RECT_INF = MACRO_RECT_LATER_MIN; + } + break; + } + + case 3 : + { /* B penetre et ressort de A par X */ + MACRO_POSX_RECT_UP = XA; + MACRO_POSY_RECT_UP = FinYB; + MACRO_POSDX_RECT_UP = FinXA; + MACRO_POSDY_RECT_UP = FinYA; + + MACRO_POSX_RECT_DO = XA; + MACRO_POSY_RECT_DO = YA; + MACRO_POSDX_RECT_DO = FinXA; + MACRO_POSDY_RECT_DO = YB; + + MACRO_ORIENTATION = DRUC_ORIENTATION_CROIX; + MACRO_SURFACE_INTER = DXA * DYB; + MACRO_PARAL_INTER = DYB; + MACRO_PERPEN_INTER = DXA; + if ( ExtenDYADYB > ExtenYBYA ) + { + MACRO_LONG_MAX = ExtenDYADYB; + MACRO_LONG_MIN = ExtenYBYA; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_UP; + MACRO_RECT_LONG_MIN = DRUC_RECTANGLE_DO; + } + else + { + MACRO_LONG_MIN = ExtenDYADYB; + MACRO_LONG_MAX = ExtenYBYA; + MACRO_RECT_LONG_MIN = DRUC_RECTANGLE_UP; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_DO; + } + if ( DXA > DYB ) + { + MACRO_LONG_INTER = DXA; + MACRO_LARGE_INTER = DYB; + } + else + { + MACRO_LARGE_INTER = DXA; + MACRO_LONG_INTER = DYB; + } + break; + } + case 4 : + { /* B penetre A par Y */ + MACRO_POSX_RECT_UP = XB; + MACRO_POSY_RECT_UP = FinYB; + MACRO_POSDX_RECT_UP = FinXB; + MACRO_POSDY_RECT_UP = FinYA; + + MACRO_POSX_RECT_LE = XA; + MACRO_POSY_RECT_LE = YA; + MACRO_POSDX_RECT_LE = XB; + MACRO_POSDY_RECT_LE = FinYB; + + MACRO_POSX_RECT_RI = FinXB; + MACRO_POSY_RECT_RI = YA; + MACRO_POSDX_RECT_RI = FinXA; + MACRO_POSDY_RECT_RI = FinYB; + + MACRO_ORIENTATION = DRUC_ORIENTATION_MARGE; + MACRO_SURFACE_INTER = ExtenDYBYA * DXB; + MACRO_LONG_DISTANCE = ExtenYADYB; + MACRO_PENETRE_INTER = ExtenDYBYA; + MACRO_FRONT = ExtenDYADYB; + MACRO_RECT_FRONT = DRUC_RECTANGLE_UP; + if ( ExtenDYBYA > DXB ) + { + MACRO_LONG_INTER = ExtenDYBYA; + MACRO_LARGE_INTER = DXB; + MACRO_LARGE_MIN = ExtenDYADYB; + MACRO_LARGE_MAX = ExtenDYADYB; + MACRO_RECT_LARGE_MIN = DRUC_RECTANGLE_UP; + MACRO_RECT_LARGE_MAX = DRUC_RECTANGLE_UP; + if ( ExtenDXADXB > ExtenXBXA ) + { + MACRO_LATER_MAX = ExtenDXADXB; + MACRO_LATER_MIN = ExtenXBXA; + MACRO_RECT_LATER_MAX = DRUC_RECTANGLE_RI; + MACRO_RECT_LATER_MIN = DRUC_RECTANGLE_LE; + MACRO_LONG_MAX = ExtenDXADXB; + MACRO_LONG_MIN = ExtenXBXA; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_RI; + MACRO_RECT_LONG_MIN = DRUC_RECTANGLE_LE; + } + else + { + MACRO_LATER_MIN = ExtenDXADXB; + MACRO_LATER_MAX = ExtenXBXA; + MACRO_RECT_LATER_MIN = DRUC_RECTANGLE_RI; + MACRO_RECT_LATER_MAX = DRUC_RECTANGLE_LE; + MACRO_LONG_MIN = ExtenDXADXB; + MACRO_LONG_MAX = ExtenXBXA; + MACRO_RECT_LONG_MIN = DRUC_RECTANGLE_RI; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_LE; + } + } + else + { + MACRO_LARGE_INTER = ExtenDYBYA; + MACRO_LONG_INTER = DXB; + MACRO_LONG_MIN = ExtenDYADYB; + MACRO_LONG_MAX = ExtenDYADYB; + MACRO_RECT_LONG_MIN = DRUC_RECTANGLE_UP; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_UP; + if ( ExtenDXADXB > ExtenXBXA ) + { + MACRO_LATER_MAX = ExtenDXADXB; + MACRO_LATER_MIN = ExtenXBXA; + MACRO_RECT_LATER_MAX = DRUC_RECTANGLE_RI; + MACRO_RECT_LATER_MIN = DRUC_RECTANGLE_LE; + MACRO_LARGE_MAX = ExtenDXADXB; + MACRO_LARGE_MIN = ExtenXBXA; + MACRO_RECT_LARGE_MAX = DRUC_RECTANGLE_RI; + MACRO_RECT_LARGE_MIN = DRUC_RECTANGLE_LE; + } + else + { + MACRO_LATER_MIN = ExtenDXADXB; + MACRO_LATER_MAX = ExtenXBXA; + MACRO_RECT_LATER_MIN = DRUC_RECTANGLE_RI; + MACRO_RECT_LATER_MAX = DRUC_RECTANGLE_LE; + MACRO_LARGE_MIN = ExtenDXADXB; + MACRO_LARGE_MAX = ExtenXBXA; + MACRO_RECT_LARGE_MIN = DRUC_RECTANGLE_RI; + MACRO_RECT_LARGE_MAX = DRUC_RECTANGLE_LE; + } + } + if ( MACRO_FRONT > MACRO_LATER_MAX + ) + { + MACRO_SUP = MACRO_FRONT; + MACRO_RECT_SUP = MACRO_RECT_FRONT; + } + else + { + MACRO_SUP = MACRO_LATER_MAX; + MACRO_RECT_SUP = MACRO_RECT_LATER_MAX; + } + + if ( MACRO_FRONT < MACRO_LATER_MIN + ) + { + MACRO_INF = MACRO_FRONT; + MACRO_RECT_INF = MACRO_RECT_FRONT; + } + else + { + MACRO_INF = MACRO_LATER_MIN; + MACRO_RECT_INF = MACRO_RECT_LATER_MIN; + } + break; + } + case 5 : + { /* B penetre A par XY */ + MACRO_POSX_RECT_UP = XA; + MACRO_POSY_RECT_UP = FinYB; + MACRO_POSDX_RECT_UP = FinXB; + MACRO_POSDY_RECT_UP = FinYA; + + MACRO_POSX_RECT_RI = FinXB; + MACRO_POSY_RECT_RI = YA; + MACRO_POSDX_RECT_RI = FinXA; + MACRO_POSDY_RECT_RI = FinYB; + + MACRO_ORIENTATION = DRUC_ORIENTATION_INTERSECTION; + MACRO_SURFACE_INTER = ExtenDXBXA * ExtenDYBYA; + if ( ExtenDXBXA > ExtenDYBYA ) + { + MACRO_LONG_INTER = ExtenDXBXA; + MACRO_LARGE_INTER = ExtenDYBYA; + MACRO_LONG_MAX = ExtenDYADYB; + MACRO_LARGE_MAX = ExtenDXADXB; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_UP; + MACRO_RECT_LARGE_MAX = DRUC_RECTANGLE_RI; + } + else + { + MACRO_LARGE_INTER = ExtenDXBXA; + MACRO_LONG_INTER = ExtenDYBYA; + MACRO_LONG_MAX = ExtenDXADXB; + MACRO_LARGE_MAX = ExtenDYADYB; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_RI; + MACRO_RECT_LARGE_MAX = DRUC_RECTANGLE_UP; + } + if ( ExtenDXADXB > ExtenDYADYB + ) + { + MACRO_SUP = ExtenDXADXB; + MACRO_INF = ExtenDYADYB; + MACRO_RECT_SUP = DRUC_RECTANGLE_RI; + MACRO_RECT_INF = DRUC_RECTANGLE_UP; + } + else + { + MACRO_SUP = ExtenDYADYB; + MACRO_INF = ExtenDXADXB; + MACRO_RECT_SUP = DRUC_RECTANGLE_UP; + MACRO_RECT_INF = DRUC_RECTANGLE_RI; + } + DrucRelationSetDistance ( DrucStructMesure, + ExtenXADXB, + ExtenYADYB + ); + break; + } + case 6 : + { /* B penetre A par DXY */ + MACRO_POSX_RECT_UP = XB; + MACRO_POSY_RECT_UP = FinYB; + MACRO_POSDX_RECT_UP = FinXA; + MACRO_POSDY_RECT_UP = FinYA; + + MACRO_POSX_RECT_LE = XA; + MACRO_POSY_RECT_LE = YA; + MACRO_POSDX_RECT_LE = XB; + MACRO_POSDY_RECT_LE = FinYB; + + MACRO_ORIENTATION = DRUC_ORIENTATION_INTERSECTION; + MACRO_SURFACE_INTER = ExtenDXAXB * ExtenDYBYA; + if ( ExtenDXAXB > ExtenDYBYA ) + { + MACRO_LONG_INTER = ExtenDXAXB; + MACRO_LARGE_INTER = ExtenDYBYA; + MACRO_LONG_MAX = ExtenDYADYB; + MACRO_LARGE_MAX = ExtenXBXA; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_UP; + MACRO_RECT_LARGE_MAX = DRUC_RECTANGLE_LE; + } + else + { + MACRO_LARGE_INTER = ExtenDXAXB; + MACRO_LONG_INTER = ExtenDYBYA; + MACRO_LONG_MAX = ExtenXBXA; + MACRO_LARGE_MAX = ExtenDYADYB; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_LE; + MACRO_RECT_LARGE_MAX = DRUC_RECTANGLE_UP; + } + if ( ExtenXBXA > ExtenDYADYB + ) + { + MACRO_SUP = ExtenXBXA; + MACRO_INF = ExtenDYADYB; + MACRO_RECT_SUP = DRUC_RECTANGLE_LE; + MACRO_RECT_INF = DRUC_RECTANGLE_UP; + } + else + { + MACRO_SUP = ExtenDYADYB; + MACRO_INF = ExtenXBXA; + MACRO_RECT_SUP = DRUC_RECTANGLE_UP; + MACRO_RECT_INF = DRUC_RECTANGLE_LE; + } + DrucRelationSetDistance ( DrucStructMesure, + ExtenXBDXA, + ExtenYADYB + ); + break; + } + case 7 : + { /* A penetre B par DY */ + MACRO_POSX_RECT_UP = XA; + MACRO_POSY_RECT_UP = FinYB; + MACRO_POSDX_RECT_UP = FinXA; + MACRO_POSDY_RECT_UP = FinYA; + + MACRO_ORIENTATION = DRUC_ORIENTATION_EXTENSION; + MACRO_SURFACE_INTER = ExtenDYBYA * DXA; + MACRO_LONG_DISTANCE = ExtenYADYB; + MACRO_PENETRE_INTER = ExtenDYBYA; + MACRO_LONG_MAX = ExtenDYADYB; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_UP; + if ( ExtenDYBYA > DXA ) + { + MACRO_LONG_INTER = ExtenDYBYA; + MACRO_LARGE_INTER = DXA; + } + else + { + MACRO_LARGE_INTER = ExtenDYBYA; + MACRO_LONG_INTER = DXA; + } + break; + } + case 8 : + { /* B penetre A par DY */ + MACRO_POSX_RECT_DO = XB; + MACRO_POSY_RECT_DO = YA; + MACRO_POSDX_RECT_DO = FinXB; + MACRO_POSDY_RECT_DO = YB; + + MACRO_POSX_RECT_LE = XA; + MACRO_POSY_RECT_LE = YB; + MACRO_POSDX_RECT_LE = XB; + MACRO_POSDY_RECT_LE = FinYA; + + MACRO_POSX_RECT_RI = FinXB; + MACRO_POSY_RECT_RI = YB; + MACRO_POSDX_RECT_RI = FinXA; + MACRO_POSDY_RECT_RI = FinYA; + + MACRO_ORIENTATION = DRUC_ORIENTATION_MARGE; + MACRO_SURFACE_INTER = ExtenDYAYB * DXB; + MACRO_LONG_DISTANCE = ExtenYBDYA; + MACRO_PENETRE_INTER = ExtenDYAYB; + MACRO_FRONT = ExtenYBYA; + MACRO_RECT_FRONT = DRUC_RECTANGLE_DO; + if ( ExtenDYAYB > DXB ) + { + MACRO_LONG_INTER = ExtenDYAYB; + MACRO_LARGE_INTER = DXB; + MACRO_LARGE_MIN = ExtenYBYA; + MACRO_LARGE_MAX = ExtenYBYA; + MACRO_RECT_LARGE_MIN = DRUC_RECTANGLE_DO; + MACRO_RECT_LARGE_MAX = DRUC_RECTANGLE_DO; + if ( ExtenDXADXB > ExtenXBXA ) + { + MACRO_LATER_MAX = ExtenDXADXB; + MACRO_LATER_MIN = ExtenXBXA; + MACRO_RECT_LATER_MAX = DRUC_RECTANGLE_RI; + MACRO_RECT_LATER_MIN = DRUC_RECTANGLE_LE; + MACRO_LONG_MAX = ExtenDXADXB; + MACRO_LONG_MIN = ExtenXBXA; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_RI; + MACRO_RECT_LONG_MIN = DRUC_RECTANGLE_LE; + } + else + { + MACRO_LATER_MIN = ExtenDXADXB; + MACRO_LATER_MAX = ExtenXBXA; + MACRO_RECT_LATER_MIN = DRUC_RECTANGLE_RI; + MACRO_RECT_LATER_MAX = DRUC_RECTANGLE_LE; + MACRO_LONG_MIN = ExtenDXADXB; + MACRO_LONG_MAX = ExtenXBXA; + MACRO_RECT_LONG_MIN = DRUC_RECTANGLE_RI; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_LE; + } + } + else + { + MACRO_LARGE_INTER = ExtenDYAYB; + MACRO_LONG_INTER = DXB; + MACRO_LONG_MIN = ExtenYBYA; + MACRO_LONG_MAX = ExtenYBYA; + MACRO_RECT_LONG_MIN = DRUC_RECTANGLE_DO; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_DO; + if ( ExtenDXADXB > ExtenXBXA ) + { + MACRO_LATER_MAX = ExtenDXADXB; + MACRO_LATER_MIN = ExtenXBXA; + MACRO_RECT_LATER_MAX = DRUC_RECTANGLE_RI; + MACRO_RECT_LATER_MIN = DRUC_RECTANGLE_LE; + MACRO_LARGE_MAX = ExtenDXADXB; + MACRO_LARGE_MIN = ExtenXBXA; + MACRO_RECT_LARGE_MAX = DRUC_RECTANGLE_RI; + MACRO_RECT_LARGE_MIN = DRUC_RECTANGLE_LE; + } + else + { + MACRO_LATER_MIN = ExtenDXADXB; + MACRO_LATER_MAX = ExtenXBXA; + MACRO_RECT_LATER_MIN = DRUC_RECTANGLE_RI; + MACRO_RECT_LATER_MAX = DRUC_RECTANGLE_LE; + MACRO_LARGE_MIN = ExtenDXADXB; + MACRO_LARGE_MAX = ExtenXBXA; + MACRO_RECT_LARGE_MIN = DRUC_RECTANGLE_RI; + MACRO_RECT_LARGE_MAX = DRUC_RECTANGLE_LE; + } + } + if ( MACRO_FRONT > MACRO_LATER_MAX + ) + { + MACRO_SUP = MACRO_FRONT; + MACRO_RECT_SUP = MACRO_RECT_FRONT; + } + else + { + MACRO_SUP = MACRO_LATER_MAX; + MACRO_RECT_SUP = MACRO_RECT_LATER_MAX; + } + + if ( MACRO_FRONT < MACRO_LATER_MIN + ) + { + MACRO_INF = MACRO_FRONT; + MACRO_RECT_INF = MACRO_RECT_FRONT; + } + else + { + MACRO_INF = MACRO_LATER_MIN; + MACRO_RECT_INF = MACRO_RECT_LATER_MIN; + } + break; + } + case 9 : + { /* B penetre A par XDY */ + MACRO_POSX_RECT_DO = XA; + MACRO_POSY_RECT_DO = YA; + MACRO_POSDX_RECT_DO = FinXB; + MACRO_POSDY_RECT_DO = YB; + + MACRO_POSX_RECT_RI = FinXB; + MACRO_POSY_RECT_RI = YB; + MACRO_POSDX_RECT_RI = FinXA; + MACRO_POSDY_RECT_RI = FinYA; + + MACRO_ORIENTATION = DRUC_ORIENTATION_INTERSECTION; + MACRO_SURFACE_INTER = ExtenDXBXA * ExtenDYAYB; + if ( ExtenDXBXA > ExtenDYAYB ) + { + MACRO_LONG_INTER = ExtenDXBXA; + MACRO_LARGE_INTER = ExtenDYAYB; + MACRO_LONG_MAX = ExtenYBYA; + MACRO_LARGE_MAX = ExtenDXADXB; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_DO; + MACRO_RECT_LARGE_MAX = DRUC_RECTANGLE_RI; + } + else + { + MACRO_LARGE_INTER = ExtenDXBXA; + MACRO_LONG_INTER = ExtenDYAYB; + MACRO_LONG_MAX = ExtenDXADXB; + MACRO_LARGE_MAX = ExtenYBYA; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_RI; + MACRO_RECT_LARGE_MAX = DRUC_RECTANGLE_DO; + } + + if ( ExtenDXADXB > ExtenYBYA + ) + { + MACRO_SUP = ExtenDXADXB; + MACRO_INF = ExtenYBYA; + MACRO_RECT_SUP = DRUC_RECTANGLE_RI; + MACRO_RECT_INF = DRUC_RECTANGLE_DO; + } + else + { + MACRO_SUP = ExtenYBYA; + MACRO_INF = ExtenDXADXB; + MACRO_RECT_SUP = DRUC_RECTANGLE_DO; + MACRO_RECT_INF = DRUC_RECTANGLE_RI; + } + DrucRelationSetDistance ( DrucStructMesure, + ExtenXADXB, + ExtenYBDYA + ); + break; + } + case 10 : + { /* B penetre A par DXDY */ + MACRO_POSX_RECT_DO = XB; + MACRO_POSY_RECT_DO = YA; + MACRO_POSDX_RECT_DO = FinXA; + MACRO_POSDY_RECT_DO = YB; + + MACRO_POSX_RECT_LE = XA; + MACRO_POSY_RECT_LE = YB; + MACRO_POSDX_RECT_LE = XB; + MACRO_POSDY_RECT_LE = FinYA; + + MACRO_ORIENTATION = DRUC_ORIENTATION_INTERSECTION; + MACRO_SURFACE_INTER = ExtenDXAXB * ExtenDYAYB; + if ( ExtenDXAXB > ExtenDYAYB ) + { + MACRO_LONG_INTER = ExtenDXAXB; + MACRO_LARGE_INTER = ExtenDYAYB; + MACRO_LARGE_MAX = ExtenXBXA; + MACRO_LONG_MAX = ExtenYBYA; + MACRO_RECT_LARGE_MAX = DRUC_RECTANGLE_LE; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_DO; + } + else + { + MACRO_LARGE_INTER = ExtenDXAXB; + MACRO_LONG_INTER = ExtenDYAYB; + MACRO_LONG_MAX = ExtenXBXA; + MACRO_LARGE_MAX = ExtenYBYA; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_LE; + MACRO_RECT_LARGE_MAX = DRUC_RECTANGLE_DO; + } + if ( ExtenXBXA > ExtenYBYA + ) + { + MACRO_SUP = ExtenXBXA; + MACRO_INF = ExtenYBYA; + MACRO_RECT_SUP = DRUC_RECTANGLE_LE; + MACRO_RECT_INF = DRUC_RECTANGLE_DO; + } + else + { + MACRO_SUP = ExtenYBYA; + MACRO_INF = ExtenXBXA; + MACRO_RECT_SUP = DRUC_RECTANGLE_DO; + MACRO_RECT_INF = DRUC_RECTANGLE_LE; + } + DrucRelationSetDistance ( DrucStructMesure, + ExtenYBDYA, + ExtenXBDXA + ); + break; + } + case 11 : + { /* A penetre B par Y */ + MACRO_POSX_RECT_DO = XA; + MACRO_POSY_RECT_DO = YA; + MACRO_POSDX_RECT_DO = FinXA; + MACRO_POSDY_RECT_DO = YB; + + MACRO_ORIENTATION = DRUC_ORIENTATION_EXTENSION; + MACRO_SURFACE_INTER = ExtenDYAYB * DXA; + MACRO_LONG_DISTANCE = ExtenYBDYA; + MACRO_PENETRE_INTER = ExtenDYAYB; + MACRO_LONG_MAX = ExtenYBYA; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_DO; + if ( ExtenDYAYB > DXA ) + { + MACRO_LONG_INTER = ExtenDYAYB; + MACRO_LARGE_INTER = DXA; + } + else + { + MACRO_LARGE_INTER = ExtenDYAYB; + MACRO_LONG_INTER = DXA; + } + break; + } + case 12 : + { /* B penetre et ressort de A par Y */ + MACRO_POSX_RECT_LE = XA; + MACRO_POSY_RECT_LE = YA; + MACRO_POSDX_RECT_LE = XB; + MACRO_POSDY_RECT_LE = FinYA; + + MACRO_POSX_RECT_RI = FinXB; + MACRO_POSY_RECT_RI = YA; + MACRO_POSDX_RECT_RI = FinXA; + MACRO_POSDY_RECT_RI = FinYA; + + MACRO_ORIENTATION = DRUC_ORIENTATION_CROIX; + MACRO_SURFACE_INTER = DYA * DXB; + MACRO_PARAL_INTER = DXB; + MACRO_PERPEN_INTER = DYA; + if ( DYA > DXB ) + { + MACRO_LONG_INTER = DYA; + MACRO_LARGE_INTER = DXB; + } + else + { + MACRO_LARGE_INTER = DYA; + MACRO_LONG_INTER = DXB; + } + if ( ExtenDXADXB > ExtenXBXA ) + { + MACRO_LONG_MAX = ExtenDXADXB; + MACRO_LONG_MIN = ExtenXBXA; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_RI; + MACRO_RECT_LONG_MIN = DRUC_RECTANGLE_LE; + } + else + { + MACRO_LONG_MIN = ExtenDXADXB; + MACRO_LONG_MAX = ExtenXBXA; + MACRO_RECT_LONG_MIN = DRUC_RECTANGLE_RI; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_LE; + } + break; + } + case 13 : + { /* B penetre A par XYDY */ + MACRO_POSX_RECT_RI = FinXB; + MACRO_POSY_RECT_RI = YA; + MACRO_POSDX_RECT_RI = FinXA; + MACRO_POSDY_RECT_RI = FinYA; + + MACRO_ORIENTATION = DRUC_ORIENTATION_EXTENSION; + MACRO_SURFACE_INTER = ExtenDXBXA * DYA; + MACRO_LONG_DISTANCE = ExtenXADXB; + MACRO_PENETRE_INTER = ExtenDXBXA; + MACRO_LONG_MAX = ExtenDXADXB; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_RI; + if ( ExtenDXBXA > DYA ) + { + MACRO_LONG_INTER = ExtenDXBXA; + MACRO_LARGE_INTER = DYA; + } + else + { + MACRO_LARGE_INTER = ExtenDXBXA; + MACRO_LONG_INTER = DYA; + } + break; + } + case 14 : + { /* A penetre B par X */ + MACRO_POSX_RECT_LE = XA; + MACRO_POSY_RECT_LE = YA; + MACRO_POSDX_RECT_LE = XB; + MACRO_POSDY_RECT_LE = FinYA; + + MACRO_ORIENTATION = DRUC_ORIENTATION_EXTENSION; + MACRO_SURFACE_INTER = ExtenDXAXB * DYA; + MACRO_LONG_DISTANCE = ExtenXBDXA; + MACRO_PENETRE_INTER = ExtenDXAXB; + MACRO_LONG_MAX = ExtenXBXA; + MACRO_RECT_LONG_MAX = DRUC_RECTANGLE_LE; + if ( ExtenDXAXB > DYA ) + { + MACRO_LONG_INTER = ExtenDXAXB; + MACRO_LARGE_INTER = DYA; + } + else + { + MACRO_LARGE_INTER = ExtenDXAXB; + MACRO_LONG_INTER = DYA; + } + break; + } + case 15 : + { /* A penetre B par X */ + MACRO_ORIENTATION = DRUC_ORIENTATION_INCLUSION; + MACRO_SURFACE_INTER = DXA * DYA; + if ( DXA > DYA ) + { + MACRO_LONG_INTER = DXA; + MACRO_LARGE_INTER = DYA; + } + else + { + MACRO_LARGE_INTER = DXA; + MACRO_LONG_INTER = DYA; + } + } + }/* switch */ +} +/*------------------------------------------------------------\ +| | +| DrucRelationTeste | +| | +\------------------------------------------------------------*/ +void DrucRelationTeste ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + Mesure, + RectangleOrientation + ) + DrucTypeStructMesure *DrucStructMesure; + DrucTypeStructInstruction *DrucInstructionCourante; + int IndexMesure; + long Mesure; + int RectangleOrientation; +{ +long PositionX; +long PositionY; +long PositionDX; +long PositionDY; + + DrucStructMesure->MESURE_EFFECTIVE = Mesure; + switch ( DrucInstructionCourante->OP_COMPARE [ IndexMesure ] ) + { + case DRUC_OPERATION_INF : + { + if ( Mesure >= DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + DrucErreurDeuxCorps ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + case DRUC_OPERATION_INFEQ : + { + if ( Mesure > DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + DrucErreurDeuxCorps ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + case DRUC_OPERATION_SUP : + { + if ( Mesure <= DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + DrucErreurDeuxCorps ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + case DRUC_OPERATION_SUPEQ : + { + if ( Mesure < DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + DrucErreurDeuxCorps ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + case DRUC_OPERATION_DIFF : + { + if ( Mesure == DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + DrucErreurDeuxCorps ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + case DRUC_OPERATION_MIN : + { +/*\ +viewrdsrec (MACRO_RECTANGLE1); +viewrdsrec (MACRO_RECTANGLE2); +printf ("\nPOSITIONS %d %d %d\n",DrucInstructionCourante->REGLE_NUM [ IndexMesure ], Mesure,DrucInstructionCourante->VALEUR [ IndexMesure ]); +\*/ + if ( Mesure < DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + switch ( RectangleOrientation + ) + { + case DRUC_RECTANGLE_UP: + { + PositionX = MACRO_POSX_RECT_UP; + PositionY = MACRO_POSY_RECT_UP; + PositionDX = MACRO_POSDX_RECT_UP; + PositionDY = MACRO_POSDY_RECT_UP; + break; + } + case DRUC_RECTANGLE_DO: + { + PositionX = MACRO_POSX_RECT_DO; + PositionY = MACRO_POSY_RECT_DO; + PositionDX = MACRO_POSDX_RECT_DO; + PositionDY = MACRO_POSDY_RECT_DO; + break; + } + case DRUC_RECTANGLE_LE: + { + PositionX = MACRO_POSX_RECT_LE; + PositionY = MACRO_POSY_RECT_LE; + PositionDX = MACRO_POSDX_RECT_LE; + PositionDY = MACRO_POSDY_RECT_LE; + break; + } + case DRUC_RECTANGLE_RI: + { + PositionX = MACRO_POSX_RECT_RI; + PositionY = MACRO_POSY_RECT_RI; + PositionDX = MACRO_POSDX_RECT_RI; + PositionDY = MACRO_POSDY_RECT_RI; + break; + } + }/* switch */ +/*\ +viewrdsrec (MACRO_RECTANGLE1); +viewrdsrec (MACRO_RECTANGLE2); +printf ("\nPOSITIONS %d %d %d %d %d\n",DrucInstructionCourante->REGLE_NUM [ IndexMesure ], PositionX,PositionY,PositionDX,PositionDY); +\*/ + DrucIsPositionInclusInEqui ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + PositionX, + PositionY, + PositionDX, + PositionDY + ); + } + break; + } + case DRUC_OPERATION_MAX : + { + if (( Mesure > DrucInstructionCourante->VALEUR [ IndexMesure ] ) + || (( Mesure == 0 ) + && (DrucInstructionCourante->VALEUR [ IndexMesure ] == 0))) + { + switch ( RectangleOrientation + ) + { + case DRUC_RECTANGLE_UP: + { + PositionX = MACRO_POSX_RECT_UP; + PositionY = MACRO_POSY_RECT_UP; + PositionDX = MACRO_POSDX_RECT_UP; + PositionDY = MACRO_POSDY_RECT_UP; + break; + } + case DRUC_RECTANGLE_DO: + { + PositionX = MACRO_POSX_RECT_DO; + PositionY = MACRO_POSY_RECT_DO; + PositionDX = MACRO_POSDX_RECT_DO; + PositionDY = MACRO_POSDY_RECT_DO; + break; + } + case DRUC_RECTANGLE_LE: + { + PositionX = MACRO_POSX_RECT_LE; + PositionY = MACRO_POSY_RECT_LE; + PositionDX = MACRO_POSDX_RECT_LE; + PositionDY = MACRO_POSDY_RECT_LE; + break; + } + case DRUC_RECTANGLE_RI: + { + PositionX = MACRO_POSX_RECT_RI; + PositionY = MACRO_POSY_RECT_RI; + PositionDX = MACRO_POSDX_RECT_RI; + PositionDY = MACRO_POSDY_RECT_RI; + break; + } + }/* switch */ +/*\ +viewrdsrec (MACRO_RECTANGLE1); +viewrdsrec (MACRO_RECTANGLE2); +printf ("\nDrucInstructionCourante->OP_COMPARE %d ",DrucInstructionCourante->OP_COMPARE[ IndexMesure ]); +printf ("\nPOSITIONS %d %d %d %d %d\n",DrucInstructionCourante->REGLE_NUM [ IndexMesure ], PositionX,PositionY,PositionDX,PositionDY); +\*/ + DrucIsPositionInclusInEqui ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + PositionX, + PositionY, + PositionDX, + PositionDY + ); + } + break; + } + } /* switch */ +} + +/*------------------------------------------------------------\ +| | +| DrucRelationTesteDistance | +| | +\------------------------------------------------------------*/ +void DrucRelationTesteDistance ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + Mesure + ) + DrucTypeStructMesure *DrucStructMesure; + DrucTypeStructInstruction *DrucInstructionCourante; + int IndexMesure; + long Mesure; +{ + + DrucStructMesure->MESURE_EFFECTIVE = Mesure; + switch ( DrucInstructionCourante->OP_COMPARE [ IndexMesure ] ) + { + case DRUC_OPERATION_INF : + { + if ( Mesure >= DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + DrucErreurDeuxCorps ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + case DRUC_OPERATION_INFEQ : + { + if ( Mesure > DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + DrucErreurDeuxCorps ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + case DRUC_OPERATION_SUP : + { + if ( Mesure <= DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + DrucErreurDeuxCorps ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + case DRUC_OPERATION_SUPEQ : + { + if ( Mesure < DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + DrucErreurDeuxCorps ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + case DRUC_OPERATION_DIFF : + { + if ( Mesure == DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + DrucErreurDeuxCorps ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + case DRUC_OPERATION_MIN : + { +/*\ +printf ("\nDRUC_OPERATION_MIN: %d %d\n",Mesure,DrucInstructionCourante->VALEUR [ IndexMesure ]); +\*/ + if ( Mesure < DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + DrucIsPositionInclusInEqui ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_RECTANGLE2->X, + MACRO_RECTANGLE2->Y, + MACRO_RECTANGLE2->X + MACRO_RECTANGLE2->DX, + MACRO_RECTANGLE2->Y + MACRO_RECTANGLE2->DY + ); + } + break; + } + case DRUC_OPERATION_MAX : + { + if (( Mesure > DrucInstructionCourante->VALEUR [ IndexMesure ] ) + || (( Mesure == 0 ) + && (DrucInstructionCourante->VALEUR [ IndexMesure ] == 0))) + { + DrucIsPositionInclusInEqui ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_RECTANGLE2->X, + MACRO_RECTANGLE2->Y, + MACRO_RECTANGLE2->X + MACRO_RECTANGLE2->DX, + MACRO_RECTANGLE2->Y + MACRO_RECTANGLE2->DY + ); + } + break; + } + } /* switch */ +} + +/*------------------------------------------------------------\ +| | +| DrucRelationTesteInter | +| | +\------------------------------------------------------------*/ +void DrucMesureTesteInter ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ) + DrucTypeStructMesure *DrucStructMesure; + DrucTypeStructInstruction *DrucInstructionCourante; + int IndexMesure; +{ +rdsrec_list *RectangleSource; +long PositionX; +long PositionY; +long PositionDX; +long PositionDY; + + RectangleSource = DrucStructMesure->RECTANGLE1; + switch ( MACRO_TOPOLOGIE ) + { + case 0: + { + PositionX = MACRO_RECTANGLE2->X; + PositionY = MACRO_RECTANGLE2->Y; + PositionDX = PositionX + MACRO_RECTANGLE2->DX; + PositionDY = PositionY + MACRO_RECTANGLE2->DY; + break; + } + case 1: + { + PositionX = RectangleSource->X; + PositionY = MACRO_RECTANGLE2->Y; + PositionDX = MACRO_RECTANGLE2->X + MACRO_RECTANGLE2->DX; + PositionDY = PositionY + MACRO_RECTANGLE2->DY; + break; + } + case 2: + { + PositionX = MACRO_RECTANGLE2->X; + PositionY = MACRO_RECTANGLE2->Y; + PositionDX = RectangleSource->X + RectangleSource->DX; + PositionDY = PositionY + MACRO_RECTANGLE2->DY; + break; + } + case 3: + { + PositionX = RectangleSource->X; + PositionY = MACRO_RECTANGLE2->Y; + PositionDX = RectangleSource->X + RectangleSource->DX; + PositionDY = PositionY + MACRO_RECTANGLE2->DY; + break; + } + case 4: + { + PositionX = MACRO_RECTANGLE2->X; + PositionY = RectangleSource->Y; + PositionDX = PositionX + MACRO_RECTANGLE2->DX; + PositionDY = MACRO_RECTANGLE2->Y + MACRO_RECTANGLE2->DY; + break; + } + case 5: + { + PositionX = RectangleSource->X; + PositionY = RectangleSource->Y; + PositionDX = MACRO_RECTANGLE2->X + MACRO_RECTANGLE2->DX; + PositionDY = MACRO_RECTANGLE2->Y + MACRO_RECTANGLE2->DY; + break; + } + case 6: + { + PositionX = MACRO_RECTANGLE2->X; + PositionY = RectangleSource->Y; + PositionDX = RectangleSource->X + RectangleSource->DX; + PositionDY = MACRO_RECTANGLE2->Y + MACRO_RECTANGLE2->DY; + break; + } + case 7: + { + PositionX = RectangleSource->X; + PositionY = RectangleSource->Y; + PositionDX = PositionX + RectangleSource->DX; + PositionDY = MACRO_RECTANGLE2->Y + MACRO_RECTANGLE2->DY; + break; + } + case 8: + { + PositionX = MACRO_RECTANGLE2->X; + PositionY = MACRO_RECTANGLE2->Y; + PositionDX = PositionX + MACRO_RECTANGLE2->DX; + PositionDY = RectangleSource->Y + RectangleSource->DY; + break; + } + case 9: + { + PositionX = RectangleSource->X; + PositionY = MACRO_RECTANGLE2->Y; + PositionDX = MACRO_RECTANGLE2->X + MACRO_RECTANGLE2->DX; + PositionDY = RectangleSource->Y + RectangleSource->DY; + break; + } + case 10: + { + PositionX = MACRO_RECTANGLE2->X; + PositionY = MACRO_RECTANGLE2->Y; + PositionDX = RectangleSource->X + RectangleSource->DX; + PositionDY = RectangleSource->Y + RectangleSource->DY; + break; + } + case 11: + { + PositionX = RectangleSource->X; + PositionY = MACRO_RECTANGLE2->Y; + PositionDX = PositionX + RectangleSource->DX; + PositionDY = RectangleSource->Y + RectangleSource->DY; + break; + } + case 12: + { + PositionX = MACRO_RECTANGLE2->X; + PositionY = RectangleSource->Y; + PositionDX = PositionX + MACRO_RECTANGLE2->DX; + PositionDY = PositionY + RectangleSource->DY; + break; + } + case 13: + { + PositionX = RectangleSource->X; + PositionY = RectangleSource->Y; + PositionDX = MACRO_RECTANGLE2->X + MACRO_RECTANGLE2->DX; + PositionDY = PositionY + RectangleSource->DY; + break; + } + case 14: + { + PositionX = MACRO_RECTANGLE2->X; + PositionY = RectangleSource->Y; + PositionDX = RectangleSource->X + RectangleSource->DX; + PositionDY = PositionY + RectangleSource->DY; + break; + } + case 15: + { + PositionX = RectangleSource->X; + PositionY = RectangleSource->Y; + PositionDX = RectangleSource->X + RectangleSource->DX; + PositionDY = PositionY + RectangleSource->DY; + break; + } + } + DrucIsPositionInclusInEqui ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + PositionX, + PositionY, + PositionDX, + PositionDY + ); +} +/*------------------------------------------------------------\ +| | +| DrucRelationSurfaceInter | +| | +\------------------------------------------------------------*/ +void DrucMesureInter ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + Mesure + ) + DrucTypeStructMesure *DrucStructMesure; + DrucTypeStructInstruction *DrucInstructionCourante; + int IndexMesure; + long Mesure; +{ + + DrucStructMesure->MESURE_EFFECTIVE = Mesure; + switch ( DrucInstructionCourante->OP_COMPARE [ IndexMesure ] ) + { + case DRUC_OPERATION_INF : + { + if ( Mesure >= DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + DrucErreurDeuxCorps ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + case DRUC_OPERATION_INFEQ : + { + if ( Mesure > DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + DrucErreurDeuxCorps ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + case DRUC_OPERATION_SUP : + { + if ( Mesure <= DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + DrucErreurDeuxCorps ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + case DRUC_OPERATION_SUPEQ : + { + if ( Mesure < DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + DrucErreurDeuxCorps ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + case DRUC_OPERATION_DIFF : + { + if ( Mesure == DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + DrucErreurDeuxCorps ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + case DRUC_OPERATION_MIN : + { + if ( Mesure < DrucInstructionCourante->VALEUR [ IndexMesure ] ) + { + DrucMesureTesteInter ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + case DRUC_OPERATION_MAX : + { + if (( Mesure > DrucInstructionCourante->VALEUR [ IndexMesure ] ) + || (( Mesure == 0 ) + && (DrucInstructionCourante->VALEUR [ IndexMesure ] == 0))) + { + DrucMesureTesteInter ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + } /* switch */ +} diff --git a/alliance/src/druc/src/vmcmesur.h b/alliance/src/druc/src/vmcmesur.h new file mode 100644 index 00000000..85b2a815 --- /dev/null +++ b/alliance/src/druc/src/vmcmesur.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : VMCMESUR.H | +| | +| Authors : Patrick Renaud | +| | +| Date : 11/01/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Druc VmcMesur Macros | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Druc VmcMesur Fonctions | +| | +\------------------------------------------------------------*/ +extern void DrucRelationSetDistance (); +extern void DrucRelationMesure (); +extern void DrucRelationTeste (); diff --git a/alliance/src/druc/src/vmcrelat.c b/alliance/src/druc/src/vmcrelat.c new file mode 100644 index 00000000..ac25b27b --- /dev/null +++ b/alliance/src/druc/src/vmcrelat.c @@ -0,0 +1,986 @@ +/*-----------------------------------------------------------*\ +| | +| Tool : DRUC | +| | +| File : VMCRELAT.C | +| | +| Authors : Renaud Patrick | +| | +| Date : 11/01/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +#include +#include +#include +#include +#include "mph.h" +#include "mut.h" +#include "rds.h" +#include "rwi.h" +#include "rut.h" +#include "rtl.h" +#include "rfm.h" +#include "rpr.h" + +#include "drucutil.h" +#include "vmctools.h" +#include "vmcerror.h" +#include "druchier.h" +#include "vmcasmld.h" +#include "vmcmesur.h" +#include "vmcrelat.h" +/*------------------------------------------------------------\ +| | +| Fonctions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DrucRelationDilateRectangle | +| | +\------------------------------------------------------------*/ +void DrucRelationDilateRectangle ( DrucRdsWindow, + DrucInstructionCourante, + RectangleOrigine, + DilateX, + DilateY, + DilateDX, + DilateDY + ) + rdswindow *DrucRdsWindow; + DrucTypeStructInstruction *DrucInstructionCourante; + rdsrec_list *RectangleOrigine; + long *DilateX; + long *DilateY; + long *DilateDX; + long *DilateDY; +{ +int IndexMesure; +long DistanceInfluence; +long Ctm1; +long Ctm2; +long PositionDx = RectangleOrigine->X + RectangleOrigine->DX; +long PositionDy = RectangleOrigine->Y + RectangleOrigine->DY; + + IndexMesure = 0; + while ( ( DrucInstructionCourante->RELATION [ IndexMesure ] != + DRUC_UNDEFINED_MESURE + ) && + ( IndexMesure != DRUC_MAX_MESURES + ) + ) + { + if ( DrucInstructionCourante->RELATION [ IndexMesure ] == + DRUC_RELATION_DISTANCE + ) + { + Ctm1 = DrucStructRdsLayer [ DrucInstructionCourante->LAYER_1 ].CTM; + Ctm2 = DrucStructRdsLayer [ DrucInstructionCourante->LAYER_2 ].CTM; + DistanceInfluence = ( Ctm1 > Ctm2 ? + Ctm1 : + Ctm2 + ); + *DilateX = ( ( RectangleOrigine->X - DistanceInfluence ) < + DrucRdsWindow->XMIN ? + DrucRdsWindow->XMIN : + RectangleOrigine->X - DistanceInfluence + ); + *DilateY = ( ( RectangleOrigine->Y - DistanceInfluence ) < + DrucRdsWindow->YMIN ? + DrucRdsWindow->YMIN : + RectangleOrigine->Y - DistanceInfluence + ); + *DilateDX = ( ( PositionDx + DistanceInfluence ) > + DrucRdsWindow->XMAX ? + DrucRdsWindow->XMAX - *DilateX : + PositionDx + DistanceInfluence - *DilateX + ); + *DilateDY = ( ( PositionDy + DistanceInfluence ) > + DrucRdsWindow->YMAX ? + DrucRdsWindow->YMAX - *DilateY : + PositionDy + DistanceInfluence - *DilateY + ); + return; + } + IndexMesure ++; + } + *DilateX = RectangleOrigine->X; + *DilateY = RectangleOrigine->Y; + *DilateDX = RectangleOrigine->DX; + *DilateDY = RectangleOrigine->DY; +} +/*------------------------------------------------------------\ +| | +| DrucCompareDistance | +| | +\------------------------------------------------------------*/ +void DrucRelationCompareDistance ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ) + register DrucTypeStructMesure *DrucStructMesure; + DrucTypeStructInstruction *DrucInstructionCourante; + int IndexMesure; +{ +long TmpHypotenuse; + + if ( ( DrucStructMesure->ORIENTATION == DRUC_ORIENTATION_MARGE ) || + ( DrucStructMesure->ORIENTATION == DRUC_ORIENTATION_EXTENSION ) + ) + { + switch ( ( DrucInstructionCourante->MESURE ) [ IndexMesure ] ) + { + case DRUC_MESURE_AXIALE : + case DRUC_MESURE_GEODESIQUE : + { + DrucRelationTesteDistance ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LONG_DISTANCE + ); + break; + } + } /* switch */ + } /* if orientation */ + if ( DrucStructMesure->ORIENTATION == DRUC_ORIENTATION_INTERSECTION + ) + { + switch ( ( DrucInstructionCourante->MESURE ) [ IndexMesure ] ) + { + case DRUC_MESURE_AXIALE : + { + DrucRelationTesteDistance ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LONG_DISTANCE + ); + break; + } + case DRUC_MESURE_GEODESIQUE : + { + TmpHypotenuse = (long) sqrt ( ( MACRO_LONG_DISTANCE * MACRO_LONG_DISTANCE ) + + ( MACRO_LARGE_DISTANCE * MACRO_LARGE_DISTANCE ) + ); + DrucRelationTesteDistance ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + TmpHypotenuse + ); + break; + } + } /* while */ + } /* if orientation */ +} +/*------------------------------------------------------------\ +| | +| DrucCompareEnveloppe | +| | +\------------------------------------------------------------*/ +void DrucRelationCompareEnveloppe ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ) + register DrucTypeStructMesure *DrucStructMesure; + DrucTypeStructInstruction *DrucInstructionCourante; + int IndexMesure; +{ + if ( DrucStructMesure->ORIENTATION == DRUC_ORIENTATION_ENVELOPPE ) + { + switch ( ( DrucInstructionCourante->MESURE ) [ IndexMesure ] ) + { + case DRUC_MESURE_SURFACE_INTER : + { + DrucMesureInter ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_SURFACE_INTER + ); + break; + } + case DRUC_MESURE_LONGUEUR_INTER : + { + DrucMesureInter ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LONG_INTER + ); + break; + } + case DRUC_MESURE_LARGEUR_INTER : + { + DrucMesureInter ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LARGE_INTER + ); + break; + } + case DRUC_MESURE_LONGUEUR_MIN : + { + DrucRelationTeste ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LONG_MIN, + MACRO_RECT_LONG_MIN + ); + break; + } + case DRUC_MESURE_LONGUEUR_MAX : + { + DrucRelationTeste ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LONG_MAX, + MACRO_RECT_LONG_MAX + ); + break; + } + case DRUC_MESURE_LARGEUR_MAX : + { + DrucRelationTeste ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LARGE_MAX, + MACRO_RECT_LARGE_MAX + ); + break; + } + case DRUC_MESURE_LARGEUR_MIN : + { + DrucRelationTeste ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LARGE_MIN, + MACRO_RECT_LARGE_MIN + ); + break; + } + case DRUC_MESURE_SUP : + { + DrucRelationTeste ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_SUP, + MACRO_RECT_SUP + ); + break; + } + case DRUC_MESURE_INF : + { + DrucRelationTeste ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_INF, + MACRO_RECT_INF + ); + break; + } + } /* while */ + } /* if orientation */ +} +/*------------------------------------------------------------\ +| | +| DrucRelationCompareMarge | +| | +\------------------------------------------------------------*/ +void DrucRelationCompareMarge ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ) + register DrucTypeStructMesure *DrucStructMesure; + DrucTypeStructInstruction *DrucInstructionCourante; + int IndexMesure; +{ + if ( DrucStructMesure->ORIENTATION == DRUC_ORIENTATION_MARGE ) + { + switch ( ( DrucInstructionCourante->MESURE ) [ IndexMesure ] ) + { + case DRUC_MESURE_SURFACE_INTER : + { + DrucMesureInter ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_SURFACE_INTER + ); + break; + } + case DRUC_MESURE_LONGUEUR_INTER : + { + DrucMesureInter ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LONG_INTER + ); + break; + } + case DRUC_MESURE_LARGEUR_INTER : + { + DrucMesureInter ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LARGE_INTER + ); + break; + } + case DRUC_MESURE_PENETRE_INTER : + { + DrucMesureInter ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_PENETRE_INTER + ); + break; + } + case DRUC_MESURE_LONGUEUR_MAX : + { + DrucRelationTeste ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LONG_MAX, + MACRO_RECT_LONG_MAX + ); + break; + } + case DRUC_MESURE_LONGUEUR_MIN : + { + DrucRelationTeste ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LONG_MIN, + MACRO_RECT_LONG_MIN + ); + break; + } + case DRUC_MESURE_LARGEUR_MIN : + { + DrucRelationTeste ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LARGE_MIN, + MACRO_RECT_LARGE_MIN + ); + break; + } + case DRUC_MESURE_LARGEUR_MAX : + { + DrucRelationTeste ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LARGE_MAX, + MACRO_RECT_LARGE_MAX + ); + break; + } + case DRUC_MESURE_LATERALE_MIN : + { + DrucRelationTeste ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LATER_MIN, + MACRO_RECT_LATER_MIN + ); + break; + } + case DRUC_MESURE_LATERALE_MAX : + { + DrucRelationTeste ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LATER_MAX, + MACRO_RECT_LATER_MAX + ); + break; + } + case DRUC_MESURE_FRONTALE : + { + DrucRelationTeste ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_FRONT, + MACRO_RECT_FRONT + ); + break; + } + case DRUC_MESURE_SUP : + { + DrucRelationTeste ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_SUP, + MACRO_RECT_SUP + ); + break; + } + case DRUC_MESURE_INF : + { +/*\ +printf ("\nDRUC_MESURE_SUP %d \n",(DrucInstructionCourante->MESURE) [ IndexMesure ]); +\*/ + DrucRelationTeste ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_INF, + MACRO_RECT_INF + ); + break; + } + } /* while */ + } /* if orientation */ +} +/*------------------------------------------------------------\ +| | +| DrucRelationCompareCroix | +| | +\------------------------------------------------------------*/ +void DrucRelationCompareCroix ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ) + register DrucTypeStructMesure *DrucStructMesure; + DrucTypeStructInstruction *DrucInstructionCourante; + int IndexMesure; +{ + if ( DrucStructMesure->ORIENTATION == DRUC_ORIENTATION_CROIX ) + { + switch ( ( DrucInstructionCourante->MESURE ) [ IndexMesure ] ) + { + case DRUC_MESURE_SURFACE_INTER : + { + DrucMesureInter ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_SURFACE_INTER + ); + break; + } + case DRUC_MESURE_LONGUEUR_INTER : + { + DrucMesureInter ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LONG_INTER + ); + break; + } + case DRUC_MESURE_LARGEUR_INTER : + { + DrucMesureInter ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LARGE_INTER + ); + break; + } + case DRUC_MESURE_PARALEL_INTER : + { + DrucMesureInter ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_PARAL_INTER + ); + break; + } + case DRUC_MESURE_PERPEND_INTER : + { + DrucMesureInter ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_PERPEN_INTER + ); + break; + } + case DRUC_MESURE_LONGUEUR_MIN : + { + DrucRelationTeste ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LONG_MIN, + MACRO_RECT_LONG_MIN + ); + break; + } + case DRUC_MESURE_LONGUEUR_MAX : + { + DrucRelationTeste ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LONG_MAX, + MACRO_RECT_LONG_MAX + ); + break; + } + } /* while */ + } /* if orientation */ +} +/*------------------------------------------------------------\ +| | +| DrucRelationCompareIntersection | +| | +\------------------------------------------------------------*/ +void DrucRelationCompareIntersection ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ) + register DrucTypeStructMesure *DrucStructMesure; + DrucTypeStructInstruction *DrucInstructionCourante; + int IndexMesure; +{ + if ( DrucStructMesure->ORIENTATION == DRUC_ORIENTATION_INTERSECTION ) + { + switch ( ( DrucInstructionCourante->MESURE ) [ IndexMesure ] ) + { + case DRUC_MESURE_SURFACE_INTER : + { + DrucMesureInter ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_SURFACE_INTER + ); + break; + } + case DRUC_MESURE_LONGUEUR_INTER : + { + DrucMesureInter ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LONG_INTER + ); + break; + } + case DRUC_MESURE_LARGEUR_INTER : + { + DrucMesureInter ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LARGE_INTER + ); + break; + } + case DRUC_MESURE_LONGUEUR_MAX : + case DRUC_MESURE_LONGUEUR_MIN : + { + DrucRelationTeste ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LONG_MAX, + MACRO_RECT_LONG_MAX + ); + break; + } + case DRUC_MESURE_LARGEUR_MAX : + case DRUC_MESURE_LARGEUR_MIN : + { + DrucRelationTeste ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LARGE_MAX, + MACRO_RECT_LARGE_MAX + ); + break; + } + case DRUC_MESURE_SUP : + { + DrucRelationTeste ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_SUP, + MACRO_RECT_SUP + ); + break; + } + case DRUC_MESURE_INF : + { + DrucRelationTeste ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_INF, + MACRO_RECT_INF + ); + break; + } + } /* while */ + } /* if orientation */ +} +/*------------------------------------------------------------\ +| | +| DrucRelationCompareExtension | +| | +\------------------------------------------------------------*/ +void DrucRelationCompareExtension ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ) + register DrucTypeStructMesure *DrucStructMesure; + DrucTypeStructInstruction *DrucInstructionCourante; + int IndexMesure; +{ + if ( DrucStructMesure->ORIENTATION == DRUC_ORIENTATION_EXTENSION ) + { + switch ( ( DrucInstructionCourante->MESURE ) [ IndexMesure ] ) + { + case DRUC_MESURE_SURFACE_INTER : + { + DrucMesureInter ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_SURFACE_INTER + ); + break; + } + case DRUC_MESURE_LONGUEUR_INTER : + { + DrucMesureInter ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LONG_INTER + ); + break; + } + case DRUC_MESURE_LARGEUR_INTER : + { + DrucMesureInter ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LARGE_INTER + ); + break; + } + case DRUC_MESURE_PENETRE_INTER : + { + DrucMesureInter ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_PENETRE_INTER + ); + break; + } + case DRUC_MESURE_LONGUEUR_MIN : + case DRUC_MESURE_LONGUEUR_MAX : + { + DrucRelationTeste ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LONG_MAX, + MACRO_RECT_LONG_MAX + ); + break; + } + } /* while */ + } /* if orientation */ +} +/*------------------------------------------------------------\ +| | +| DrucRelationCompareInclusion | +| | +\------------------------------------------------------------*/ +void DrucRelationCompareInclusion ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ) + register DrucTypeStructMesure *DrucStructMesure; + DrucTypeStructInstruction *DrucInstructionCourante; + int IndexMesure; +{ + if ( DrucStructMesure->ORIENTATION == DRUC_ORIENTATION_INCLUSION ) + { + switch ( ( DrucInstructionCourante->MESURE ) [ IndexMesure ] ) + { + case DRUC_MESURE_SURFACE_INTER : + { + DrucMesureInter ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_SURFACE_INTER + ); + break; + } + case DRUC_MESURE_LONGUEUR_INTER : + { + DrucMesureInter ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LONG_INTER + ); + break; + } + case DRUC_MESURE_LARGEUR_INTER : + { + DrucMesureInter ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + MACRO_LARGE_INTER + ); + break; + } + } /* while */ + } /* if orientation */ +} +/*------------------------------------------------------------\ +| | +| DrucRelationCompare | +| | +\------------------------------------------------------------*/ +void DrucRelationCompare ( DrucStructMesure, + DrucInstructionCourante + ) + register DrucTypeStructMesure *DrucStructMesure; + DrucTypeStructInstruction *DrucInstructionCourante; +{ +int IndexMesure; + + if ( DrucIsRectanglesValides ( DrucStructMesure, + DrucInstructionCourante + ) + ) + { + DrucRelationMesure ( DrucStructMesure + ); + IndexMesure = 0; + while ( ( DrucInstructionCourante->RELATION [ IndexMesure ] != + DRUC_UNDEFINED_MESURE + ) && + ( IndexMesure != DRUC_MAX_MESURES + ) + ) + { + switch ( DrucInstructionCourante->RELATION [ IndexMesure ] ) + { + case DRUC_RELATION_DISTANCE : + { + if ( DrucInstructionCourante->LAYER_1 == DrucInstructionCourante->LAYER_2 ) + { + if ( DrucIsRectangleEquipot ( DrucStructMesure + ) + ) + { + break; + } + } + if ( MACRO_BOOL_DISTANCE == DRUC_TRUE ) + { + DrucRelationCompareDistance ( DrucStructMesure , + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + case DRUC_RELATION_ENVELOPPE : + { + if ( MACRO_BOOL_DISTANCE == DRUC_FALSE ) + { + DrucRelationCompareEnveloppe ( DrucStructMesure , + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + case DRUC_RELATION_MARGE : + { + if ( MACRO_BOOL_DISTANCE == DRUC_FALSE ) + { + DrucRelationCompareMarge ( DrucStructMesure , + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + case DRUC_RELATION_CROIX : + { + if ( MACRO_BOOL_DISTANCE == DRUC_FALSE ) + { + DrucRelationCompareCroix ( DrucStructMesure , + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + case DRUC_RELATION_INTERSECTION : + { + if ( MACRO_BOOL_DISTANCE == DRUC_FALSE ) + { + DrucRelationCompareIntersection( DrucStructMesure , + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + case DRUC_RELATION_EXTENSION : + { + if ( MACRO_BOOL_DISTANCE == DRUC_FALSE ) + { + DrucRelationCompareExtension ( DrucStructMesure , + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + case DRUC_RELATION_INCLUSION : + { + if ( MACRO_BOOL_DISTANCE == DRUC_FALSE ) + { + DrucRelationCompareInclusion ( DrucStructMesure , + DrucInstructionCourante, + IndexMesure + ); + } + break; + } + } /* switch */ + IndexMesure ++; + } /* while */ + } /* if */ +} +/*------------------------------------------------------------\ +| | +| DrucRelation | +| | +\------------------------------------------------------------*/ +void DrucRelation ( DrucFigureRds, + DrucRdsWindow, + DrucInstructionCourante + ) + rdsfig_list *DrucFigureRds; + rdswindow *DrucRdsWindow; + DrucTypeStructInstruction *DrucInstructionCourante; +{ + rdsrec_list *TmpRectangleSource2; + rdswin_list *TmpWindowSource; +register int TabIndex; +register rdswinrec_list *TabRectangleSource = NULL; + DrucTypeStructMesure DrucStructMesure; +chain_list *PtChaine; +chain_list *HeadChaine; +long DilateX; +long DilateY; +long DilateDX; +long DilateDY; + + + DrucStructMesure.LAYER_2 = DrucInstructionCourante->LAYER_2; + DrucStructMesure.LAYER_1 = DrucInstructionCourante->LAYER_1; + for ( TmpRectangleSource2 = DrucFigureRds->LAYERTAB + [ DrucInstructionCourante->LAYER_2 ]; + TmpRectangleSource2 != (rdsrec_list *)NULL; + TmpRectangleSource2 = TmpRectangleSource2->NEXT + ) + { + DrucStructMesure.RECTANGLE2 = TmpRectangleSource2; + +/*\ +DrucViewString ("\nBOUCLE" + ); +DrucViewNumber ( DrucStructMesure.LAYER_1 + ); +DrucViewNumber ( DrucStructMesure.LAYER_2 + ); +viewrdsrec ( TmpRectangleSource2 + ); +DrucVerifEquiLayer ( DrucFigureRds, + DrucStructMesure.LAYER_1 + ); +printf ("\n fin de viewrdsfig\n"); +viewrdsfig (DrucFigureRds); +\*/ + + DrucRelationDilateRectangle ( DrucRdsWindow, + DrucInstructionCourante, + TmpRectangleSource2, + & DilateX, + & DilateY, + & DilateDX, + & DilateDY + ); + PtChaine = getrdswindow ( DilateX, + DilateY, + DilateDX, + DilateDY, + DrucRdsWindow + ); + HeadChaine = PtChaine; + + while ( PtChaine != (chain_list *)NULL + ) + { + + TmpWindowSource = ( rdswin_list *) PtChaine->DATA; + PtChaine = PtChaine ->NEXT; + TabRectangleSource = TmpWindowSource->LAYERTAB + [ DrucInstructionCourante->LAYER_1 ]; + + while ( TabRectangleSource != (rdswinrec_list *)NULL + ) + { + + TabIndex = 0; + + while ( TabIndex < RWI_MAX_REC ) + { + if ( ( TabRectangleSource->RECTAB [ TabIndex ] != + ( rdsrec_list *)NULL + ) && + ( ! ( TabRectangleSource->RECTAB [ TabIndex ]->FLAGS & + DRUC_FLAG_REC_VERIFIE + ) + ) ) + { + DrucStructMesure.RECTANGLE1 = + TabRectangleSource->RECTAB [ TabIndex ]; + +/*\ +viewrdsrec ( TabRectangleSource->RECTAB [ TabIndex ] + ); +DrucViewString ("FIN BOUCLE"); +\*/ + + DrucStructMesure.RECTANGLE1->FLAGS |= DRUC_FLAG_REC_VERIFIE; + DrucRelationCompare ( &DrucStructMesure , + DrucInstructionCourante + ); + } + + TabIndex ++; + + } /* while les rectangles d'un tableau du layer A */ + TabRectangleSource = TabRectangleSource->NEXT; + } /* while les tableaux du layer A */ + } /* while les fenetres du layer A */ + PtChaine = HeadChaine; + while ( PtChaine != (chain_list *)NULL + ) + { + TmpWindowSource = ( rdswin_list *) PtChaine->DATA; + PtChaine = PtChaine ->NEXT; + TabRectangleSource = TmpWindowSource->LAYERTAB + [ DrucInstructionCourante->LAYER_1 ]; + while ( TabRectangleSource != (rdswinrec_list *)NULL + ) + { + TabIndex = 0; + while ( TabIndex < RWI_MAX_REC + ) + { + if ( TabRectangleSource->RECTAB [ TabIndex ] != + ( rdsrec_list *)NULL ) + { + TabRectangleSource->RECTAB [ TabIndex ]->FLAGS &= + ~DRUC_FLAG_REC_VERIFIE; + } + + TabIndex ++; + } /* while les rectangles d'un tableau du layer A */ + TabRectangleSource = TabRectangleSource->NEXT; + } /* while les tableaux du layer A */ + } /* while les fenetres du layer A */ + } /* for le parcours des rectangles du layer B */ +} diff --git a/alliance/src/druc/src/vmcrelat.h b/alliance/src/druc/src/vmcrelat.h new file mode 100644 index 00000000..e4cd5a7b --- /dev/null +++ b/alliance/src/druc/src/vmcrelat.h @@ -0,0 +1,29 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : VMCRELAT.H | +| | +| Authors : Patrick Renaud | +| | +| Date : 11/01/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Druc VmcRelat Macros | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Druc VmcRelat Fonctions | +| | +\------------------------------------------------------------*/ +extern void DrucRelationDistance (); +extern void DrucRelationEnveloppe (); +extern void DrucRelationMarge (); +extern void DrucRelationCroix (); +extern void DrucRecationIntersection (); +extern void DrucRelationExtension (); +extern void DrucRelationInclusion (); +extern void DrucRelation (); diff --git a/alliance/src/druc/src/vmctools.c b/alliance/src/druc/src/vmctools.c new file mode 100644 index 00000000..208ff5da --- /dev/null +++ b/alliance/src/druc/src/vmctools.c @@ -0,0 +1,926 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : VMCTOOLS.C | +| | +| Authors : Renaud Patrick | +| | +| Date : 25/01/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Modifs | +| 25/01/94: DrucIsPerimetreInclusInEqui retourne boolean | +| ne fait pas de traitement d'erreur | +| retourne vrai ou faux | +| lignes 310 a 317 | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +#include +#include +#include +#include +#include "mph.h" +#include "mut.h" +#include "rds.h" +#include "rwi.h" +#include "rut.h" +#include "rtl.h" +#include "rfm.h" +#include "rpr.h" + +#include "drucutil.h" +#include "vmctools.h" +#include "vmcerror.h" +/*------------------------------------------------------------\ +| | +| Druc Fonctions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DrucAddSuffixeName | +| | +\------------------------------------------------------------*/ +char *DrucAddSuffixeName ( Name, + Suffixe + ) + char *Name; + char *Suffixe; +{ +char TmpName [DRUC_MAX_STRING_BUFFER]; + + strcpy ( (char *)TmpName , + Name + ); + strcat ( (char *)TmpName, + Suffixe + ); +return ( namealloc ( TmpName )); +} +/*------------------------------------------------------------\ +| | +| DrucViewLayers | +| | +\------------------------------------------------------------*/ +void DrucViewLayers () +{ +int IndexLayer; + + for ( IndexLayer = 0; + IndexLayer < RDS_MAX_LAYER; + IndexLayer ++ + ) + { + fprintf ( stdout ,"LAYER %d\tWIDTH %d\tCTM %d\n", + DrucStructRdsLayer [ IndexLayer ].RDS_INDEX, + DrucStructRdsLayer [ IndexLayer ].WIDTH, + DrucStructRdsLayer [ IndexLayer ].CTM + ); + } + fflush ( stdout ); +} +/*------------------------------------------------------------\ +| | +| DrucInitStructLayers | +| | +\------------------------------------------------------------*/ +void DrucInitStructLayers () +{ +int IndexLayer; + + for ( IndexLayer = 0; + IndexLayer != RDS_MAX_LAYER; + IndexLayer ++ + ) + { + DrucStructRdsLayer [ IndexLayer ].RDS_INDEX = DRUC_UNDEFINED_LAYER; + DrucStructRdsLayer [ IndexLayer ].WIDTH = DRUC_UNDEFINED_WIDTH; + DrucStructRdsLayer [ IndexLayer ].CTM = DRUC_UNDEFINED_CTM; + DrucStructRdsLayer [ IndexLayer ].FLAGS = DRUC_UNDEFINED_FLAGS; + } +} +/*------------------------------------------------------------\ +| | +| DrucViewInstruction | +| | +\------------------------------------------------------------*/ +void DrucViewInstruction ( DrucInstructionCourante + ) + DrucTypeStructInstruction *DrucInstructionCourante; +{ +int IndexMesure; + + fprintf ( stdout , "INSTRUCTION \t%d\n", + DrucInstructionCourante->INSTRUCTION ); + fprintf ( stdout , "LAYER DESTINATION \t%s %d\n", + RDS_LAYER_NAME[ DrucInstructionCourante->LAYER_DEST ], + DrucInstructionCourante->LAYER_DEST ); + fprintf ( stdout , "LAYER SOURCE 1 \t%s %d\n", + RDS_LAYER_NAME[ DrucInstructionCourante->LAYER_1 ], + DrucInstructionCourante->LAYER_1 ); + fprintf ( stdout , "LAYER SOURCE 2 \t%s %d\n", + RDS_LAYER_NAME[ DrucInstructionCourante->LAYER_2 ], + DrucInstructionCourante->LAYER_2 ); +/*\ + fprintf ( stdout , "LAYER DESTINATION \t%d\n", + DrucInstructionCourante->LAYER_DEST ); + fprintf ( stdout , "lAYER SOURCE 1 \t%d\n", + DrucInstructionCourante->LAYER_1 ); + fprintf ( stdout , "LAYER SOURCE 2 \t%d\n", + DrucInstructionCourante->LAYER_2 ); +\*/ + fprintf ( stdout , "REL du CONSTRUCTEUR\t%d\n", + DrucInstructionCourante->OP_COMPOSE ); + fprintf ( stdout , "OPERATION UNAIRE \t%d\n", + DrucInstructionCourante->OP_UNAIRE ); + fprintf ( stdout , "VALEUR UNAIRE \t%ld\n", + DrucInstructionCourante->DEF_VALEUR ); + for ( IndexMesure = 0; + IndexMesure < DRUC_MAX_MESURES; + IndexMesure ++ + ) + { + if ( ( ( DrucInstructionCourante->REGLE_NUM ) [ IndexMesure ] ) + != DRUC_UNDEFINED_REGLE + ) + { + fprintf ( stdout , "REGLE NUMERO %d\t", + ( DrucInstructionCourante->REGLE_NUM ) [ IndexMesure ] ); + fprintf ( stdout , "OPERATEUR %d\t", + ( DrucInstructionCourante->RELATION ) [ IndexMesure ] ); + fprintf ( stdout , "MESURE %d\t", + ( DrucInstructionCourante->MESURE ) [ IndexMesure ] ); + fprintf ( stdout , "COMPARATEUR %d\t", + ( DrucInstructionCourante->OP_COMPARE ) [ IndexMesure ] ); + fprintf ( stdout , "VALEUR %d\n", + ( DrucInstructionCourante->VALEUR ) [ IndexMesure ] ); + } + } +DrucViewString (""); +} +/*------------------------------------------------------------\ +| | +| DrucViewRectangle | +| | +\------------------------------------------------------------*/ +void DrucViewRectangle ( Rectangle + ) + rdsrec_list **Rectangle; +{ +DrucTypeStructPlusRect *PlusRec; + + PlusRec = (DrucTypeStructPlusRect *) + ((char*)(*Rectangle)+sizeof(rdsrec_list)); + printf ( "RECTANGLE \n"); + printf ( "%p\t" , + *Rectangle); + printf ( "%p " , + (*Rectangle)->NEXT); + printf ( "\t%.1f\t" , + (*Rectangle)->X / (float)RDS_LAMBDA ); + printf ( "%.1f\t" , + (*Rectangle)->Y / (float)RDS_LAMBDA ); + printf ( "%.1f\t" , + (*Rectangle)->DX / (float)RDS_LAMBDA); + printf ( "%.1f\t" , + (*Rectangle)->DY / (float)RDS_LAMBDA); + printf ( "INSTANCE %p\t", + PlusRec->INSTANCE_NUM); + printf ( "EQUI %p\t", + PlusRec->NEXT_EQUI); + printf ( "%p\t" , + (*Rectangle)->USER ); + printf ( "%lx\t\n" , + (*Rectangle)->FLAGS ); + fflush (stdout); +} +/*------------------------------------------------------------\ +| | +| DrucViewEqui | +| | +\------------------------------------------------------------*/ +void DrucViewEqui ( Rectangle ) + rdsrec_list **Rectangle; +{ +DrucTypeStructPlusRect *PlusRec1; +rdsrec_list *RectangleCourant; + + RectangleCourant = *Rectangle; + PlusRec1 = (DrucTypeStructPlusRect *) + ((char *)(RectangleCourant)+sizeof(rdsrec_list)); +fprintf ( stdout, + "\nEqui:\n" + ); + while ( PlusRec1->NEXT_EQUI != *Rectangle + ) + { + RectangleCourant->FLAGS |= DRUC_FLAG_REC_VISITE; + + DrucViewRectangle ( & RectangleCourant + ); + RectangleCourant = PlusRec1->NEXT_EQUI; + PlusRec1 = (DrucTypeStructPlusRect *) + ((char *)(RectangleCourant)+sizeof(rdsrec_list)); + } + RectangleCourant->FLAGS |= DRUC_FLAG_REC_VISITE; + DrucViewRectangle ( & RectangleCourant + ); +fprintf ( stdout, + "\nFin Equi:\n" + ); +} +/*------------------------------------------------------------\ +| | +| DrucIsPerimetreInclusInEqui | +| pour bien faire il faudrait calculer le vecteur separant | +| les deux rectangles en faute puis couvrir ce vecteur par | +| le balayage de l'equi et eliminer par morceaux ce vecteur | +| avec chaque rectangle de l'equi qui recouvre ces morceaux | +| | +\------------------------------------------------------------*/ +boolean DrucIsPerimetreInclusInEqui ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + PositionX, + PositionY, + PositionDX, + PositionDY + ) +DrucTypeStructMesure *DrucStructMesure; +DrucTypeStructInstruction *DrucInstructionCourante; +int IndexMesure; +long PositionX; +long PositionY; +long PositionDX; +long PositionDY; +{ +DrucTypeStructPlusRect *PlusRec; +rdsrec_list *RectangleTete; +rdsrec_list *RectangleCourant; +boolean PerimetreXCouvert = DRUC_FALSE; +boolean PerimetreYCouvert = DRUC_FALSE; + +/* +printf ("NOTCH %d %d %d %d \n",PositionX,PositionY,PositionDX,PositionDY); +*/ + RectangleTete = DrucStructMesure->RECTANGLE1; + PlusRec = (DrucTypeStructPlusRect *)((char *)(RectangleTete)+sizeof(rdsrec_list)); + RectangleCourant = PlusRec->NEXT_EQUI; + PlusRec = (DrucTypeStructPlusRect *)((char *)(RectangleCourant)+sizeof(rdsrec_list)); + while ( RectangleCourant != RectangleTete ) + { + if ( RectangleCourant == DrucStructMesure->RECTANGLE2 ) + { + RectangleCourant = PlusRec->NEXT_EQUI; + PlusRec = (DrucTypeStructPlusRect *)((char *)(RectangleCourant)+sizeof(rdsrec_list)); + continue; + } + /*\ + * couverture du perimetre vertical gauche avec un rectangle a gauche droit avec un rectangle a droite + * il faut qu'un cote vertical et un cote horizontal soient recouverts par un rectangle du polygone + \*/ + if ( ( RectangleCourant->Y <= PositionY ) && + ( RectangleCourant->Y + RectangleCourant->DY >= PositionDY ) + ) + { + if ( ( ( RectangleCourant->X <= PositionDX ) && + ( RectangleCourant->X + RectangleCourant->DX >= PositionDX ) + ) || + ( ( RectangleCourant->X <= PositionX ) && + ( RectangleCourant->X + RectangleCourant->DX >= PositionX ) + ) + ) + { + PerimetreYCouvert = DRUC_TRUE; + } + } + /*\ + * couverture du perimetre horizontal + * haut avec un rectangle en haut + * bas avec un rectangle en bas + \*/ + if ( ( RectangleCourant->X <= PositionX ) && + ( RectangleCourant->X + RectangleCourant->DX >= PositionDX ) + ) + { + if ( ( ( RectangleCourant->Y <= PositionDY ) && + ( RectangleCourant->Y + RectangleCourant->DY >= PositionDY ) + ) || + ( ( RectangleCourant->Y <= PositionY ) && + ( RectangleCourant->Y + RectangleCourant->DY >= PositionY ) + ) + ) + { + PerimetreXCouvert = DRUC_TRUE; + } + } + if ( ( PerimetreXCouvert == DRUC_TRUE ) && + ( PerimetreYCouvert == DRUC_TRUE ) + ) + { + return ( DRUC_TRUE + ); + } + RectangleCourant = PlusRec->NEXT_EQUI; + PlusRec = (DrucTypeStructPlusRect *)((char *)(RectangleCourant)+sizeof(rdsrec_list)); + } + return ( DRUC_FALSE + ); +} +/*------------------------------------------------------------\ +| | +| DrucIsPositionInclusInEqui | +| | +\------------------------------------------------------------*/ +void DrucIsPositionInclusInEqui ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure, + PositionX, + PositionY, + PositionDX, + PositionDY + ) +DrucTypeStructMesure *DrucStructMesure; +DrucTypeStructInstruction *DrucInstructionCourante; +int IndexMesure; +long PositionX; +long PositionY; +long PositionDX; +long PositionDY; +{ +DrucTypeStructPlusRect *PlusRec; +rdsrec_list *RectangleTete; +rdsrec_list *RectangleCourant; + +/* +printf ("NOTCH %d %d %d %d \n",PositionX,PositionY,PositionDX,PositionDY); +*/ + RectangleTete = DrucStructMesure->RECTANGLE1; + PlusRec = (DrucTypeStructPlusRect *)((char *)(RectangleTete)+sizeof(rdsrec_list)); + RectangleCourant = PlusRec->NEXT_EQUI; + PlusRec = (DrucTypeStructPlusRect *)((char *)(RectangleCourant)+sizeof(rdsrec_list)); + while ( RectangleCourant != RectangleTete ) + { + if ( RectangleCourant == DrucStructMesure->RECTANGLE2 ) + { + RectangleCourant = PlusRec->NEXT_EQUI; + PlusRec = (DrucTypeStructPlusRect *)((char *)(RectangleCourant)+sizeof(rdsrec_list)); + continue; + } + if ( ( RectangleCourant->X <= PositionX ) && + ( RectangleCourant->Y <= PositionY ) && + ( RectangleCourant->X + RectangleCourant->DX >= PositionDX ) && + ( RectangleCourant->Y + RectangleCourant->DY >= PositionDY ) + ) + { + return; + } + RectangleCourant = PlusRec->NEXT_EQUI; + PlusRec = (DrucTypeStructPlusRect *)((char *)(RectangleCourant)+sizeof(rdsrec_list)); + } + DrucErreurDeuxCorps ( DrucStructMesure, + DrucInstructionCourante, + IndexMesure + ); +} +/*------------------------------------------------------------\ +| | +| DrucIsRectanglesContact | +| | +\------------------------------------------------------------*/ +boolean DrucIsRectanglesContact ( Rectangle1, + Rectangle2 + ) + rdsrec_list *Rectangle1; + rdsrec_list *Rectangle2; +{ +long PositionX1; +long PositionX2; +long PositionY1; +long PositionY2; +long PositionDX1; +long PositionDX2; +long PositionDY1; +long PositionDY2; + + PositionX1 = Rectangle1->X; + PositionX2 = Rectangle2->X; + PositionY1 = Rectangle1->Y; + PositionY2 = Rectangle2->Y; + PositionDX1 = PositionX1 + Rectangle1->DX; + PositionDX2 = PositionX2 + Rectangle2->DX; + PositionDY1 = PositionY1 + Rectangle1->DY; + PositionDY2 = PositionY2 + Rectangle2->DY; + if ( PositionDX1 < PositionX2 || + PositionDX2 < PositionX1 || + PositionDY1 < PositionY2 || + PositionDY2 < PositionY1 + ) + { + return ( DRUC_FALSE ); + } + else + { + return ( DRUC_TRUE ); + } +} +/*------------------------------------------------------------\ +| | +| DrucChercheWindow | +|A partir d'un rectangle retourne la liste des fenetres | +| qui embrasse ce rectangle | +\------------------------------------------------------------*/ +rdsrecwin_list *DrucChercheWindow ( TmpRectangleSource + ) + rdsrec_list *TmpRectangleSource; +{ +static rdsrecwin_list StaticWindowSource2; + + if ( IsRdsOneWindow( TmpRectangleSource ) ) + { + StaticWindowSource2.WINDOW = (rdswin_list *)TmpRectangleSource->USER; + StaticWindowSource2.NEXT = (rdsrecwin_list *) NULL; + return ( & StaticWindowSource2 ); + } + else + { + return (rdsrecwin_list *)TmpRectangleSource->USER; + } +} +/*------------------------------------------------------------\ +| | +| DrucComputeEquiRectangle | +| cree les equipotentielles du layer courant | +\------------------------------------------------------------*/ +void DrucComputeEquiRectangle ( DrucRectangle, + LayerCourant + ) + register rdsrec_list *DrucRectangle; + register int LayerCourant; +{ +register int TabIndex; +register rdsrec_list *TmpRectangleCourant; +register rdsrecwin_list *TmpWindowCourante; +register rdswinrec_list *TabRectangleCourant; + + /*\ + * recuperer toutes les fenetres liees au rectangle + \*/ + TmpWindowCourante = DrucChercheWindow ( DrucRectangle + ); + /*\ + * parcours de chaque fenetre + \*/ + while ( TmpWindowCourante != (rdsrecwin_list *)NULL ) + { + TabRectangleCourant = ( TmpWindowCourante->WINDOW )->LAYERTAB [ LayerCourant ]; + /*\ + * parcours des tableaux de la fenetre courante + \*/ + while ( TabRectangleCourant != (rdswinrec_list *)NULL ) + { + /*\ + * parcourir tous les rectangles tableau courant + \*/ + TabIndex = 0; + while ( TabIndex < RWI_MAX_REC + ) + { + if ( ( TabRectangleCourant->RECTAB) [ TabIndex ] != + ( rdsrec_list *)NULL ) + { + TmpRectangleCourant = TabRectangleCourant->RECTAB [ TabIndex ]; + if ( ( TmpRectangleCourant != (rdsrec_list*) NULL ) && + ( (TmpRectangleCourant->FLAGS & DRUC_FLAG_REC_VISITE ) != + DRUC_FLAG_REC_VISITE ) + ) + { + /*\ + * si les rectangles sont en intersection on les chaine par les equi + \*/ + if ( DrucIsRectanglesContact ( DrucRectangle, + TmpRectangleCourant + ) + == DRUC_TRUE + ) + { + TmpRectangleCourant->FLAGS |= DRUC_FLAG_REC_VISITE; + MACRO_NEXT_EQUI ( TmpRectangleCourant ) = MACRO_NEXT_EQUI ( DrucRectangle ); + MACRO_NEXT_EQUI ( DrucRectangle ) = TmpRectangleCourant; + } /* if intersection */ + } /* if TmpRectangle */ + } + + TabIndex ++; + } /* while les rectangles du tableau courant */ + TabRectangleCourant = TabRectangleCourant->NEXT; + } /* while les tableaux */ + TmpWindowCourante = TmpWindowCourante->NEXT; + } /* while les fenetres */ +} +/*------------------------------------------------------------\ +| | +| DrucComputeEqui | +| cree les equipotentielles du layer courant | +\------------------------------------------------------------*/ +void DrucComputeEquiLayer ( DrucFigureRds , + LayerCourant + ) + rdsfig_list *DrucFigureRds; + int LayerCourant; +{ +register rdsrec_list *TmpRectangleCourant; +register rdsrec_list *TmpRectangleEqui; + + for ( TmpRectangleCourant = DrucFigureRds->LAYERTAB [ LayerCourant ]; + TmpRectangleCourant != (rdsrec_list *)NULL; + TmpRectangleCourant = TmpRectangleCourant->NEXT + ) + { + if ( (TmpRectangleCourant->FLAGS & DRUC_FLAG_REC_VISITE ) == + DRUC_FLAG_REC_VISITE + ) + { + continue; + } + TmpRectangleCourant->FLAGS |= DRUC_FLAG_REC_VISITE; + MACRO_NEXT_EQUI ( TmpRectangleCourant ) = TmpRectangleCourant; + DrucComputeEquiRectangle ( TmpRectangleCourant, + LayerCourant + ); + /*\ + * pour tous les rectangles de l'equi en cours chercher la suite de l'equi + \*/ + TmpRectangleEqui = MACRO_NEXT_EQUI ( TmpRectangleCourant ); + while ( TmpRectangleEqui != TmpRectangleCourant ) + { + DrucComputeEquiRectangle ( TmpRectangleEqui, + LayerCourant + ); + TmpRectangleEqui = MACRO_NEXT_EQUI ( TmpRectangleEqui ); + } /* while les rectangles de l'equi en cours */ + TmpRectangleEqui = MACRO_NEXT_EQUI ( TmpRectangleCourant ); + } /* for le parcours des rectangles du layer */ + DrucClearFlag ( DrucFigureRds->LAYERTAB [ LayerCourant ], + DRUC_FLAG_REC_VISITE + ); +} +/*------------------------------------------------------------\ +| | +| DrucComputeEquiFigure | +| | +\------------------------------------------------------------*/ +void DrucComputeEquiFigure ( DrucFigureRds + ) + rdsfig_list *DrucFigureRds; +{ +int IndexLayer; +int LayerCourant; + + for ( IndexLayer = 0; + IndexLayer < RDS_MAX_LAYER ; + IndexLayer ++ + ) + { + LayerCourant = DrucStructRdsLayer [ IndexLayer ].RDS_INDEX ; + if ( LayerCourant != DRUC_UNDEFINED_LAYER + ) + { + if ( DrucFigureRds->LAYERTAB [ LayerCourant ] != ( rdsrec_list * ) NULL + ) + { + DrucComputeEquiLayer ( DrucFigureRds , + LayerCourant + ); + } + } + } +} +/*------------------------------------------------------------\ +| | +| DrucIsRectangleEquipot | +| | +\------------------------------------------------------------*/ +boolean DrucIsRectangleEquipot ( DrucStructMesure + ) + DrucTypeStructMesure *DrucStructMesure; +{ +rdsrec_list *RectangleTete; +rdsrec_list *RectangleCourant; +DrucTypeStructPlusRect *PlusRec; + + if ( DrucStructMesure->RECTANGLE1 == DrucStructMesure->RECTANGLE2 ) + { + return ( DRUC_TRUE ); + } + RectangleTete = DrucStructMesure->RECTANGLE1; + PlusRec = (DrucTypeStructPlusRect *)((char *)(RectangleTete)+sizeof(rdsrec_list)); + RectangleCourant = PlusRec->NEXT_EQUI; + PlusRec = (DrucTypeStructPlusRect *)((char *)(RectangleCourant)+sizeof(rdsrec_list)); + while ( RectangleCourant != RectangleTete ) + { + if ( RectangleCourant == DrucStructMesure->RECTANGLE2 ) + { + return ( DRUC_TRUE ); + } + RectangleCourant = PlusRec->NEXT_EQUI; + PlusRec = (DrucTypeStructPlusRect *)((char *)(RectangleCourant)+sizeof(rdsrec_list)); + } + return ( DRUC_FALSE ); +} +/*------------------------------------------------------------\ +| | +| DrucIsRectanglesValides | +| si les deux rectangles appartiennent a des couronnes | +| alors tester si ils appartiennent a la meme couronne | +| si ils appartiennent a la meme couronne | +| alors inutile de verifier la regle courante | +\------------------------------------------------------------*/ +boolean DrucIsRectanglesValides ( DrucStructMesure, + DrucInstructionCourante + ) + DrucTypeStructMesure *DrucStructMesure; + DrucTypeStructInstruction *DrucInstructionCourante; +{ + /*\ + * doit aussi mesurer la ctm en fonction des l'operations courantes + * contenues dans les tableaux de DrucStructMesure + * si c'est une relation de superposition + * les deux rectangles qui ne se touchent pas ne sont pas valides + * si c'est la relation distance tenir compte de la ctm max des deux rectangles + * et tenir compte de l'appartenance des @ rectangles a la meme composition de layers + * en cas de layer user + if ( ( (DrucStructMesure->RECTANGLE1)->FLAGS & + (DrucStructMesure->RECTANGLE2)->FLAGS & + DRUC_FLAG_INSTANCE_RECTANGLE ) == + DRUC_FLAG_INSTANCE_RECTANGLE + ) + \*/ + { +/*\ +DrucViewRectangle ( &(DrucStructMesure->RECTANGLE1) ); +viewrdsrec (DrucStructMesure->RECTANGLE1); +viewrdsrec (DrucStructMesure->RECTANGLE2); +DrucViewRectangle ( &(DrucStructMesure->RECTANGLE2) ); +\*/ + if ( ( MACRO_INSTANCE_NUM ( DrucStructMesure->RECTANGLE1 ) != + (rdsins_list *)NULL + ) && + ( ( MACRO_INSTANCE_NUM ( DrucStructMesure->RECTANGLE1 ) ) == + ( MACRO_INSTANCE_NUM ( DrucStructMesure->RECTANGLE2 ) ) + ) + ) + { + return ( DRUC_FALSE ); + } + } + DrucStructMesure->BOOLEEN_DISTANCE = !( DrucIsRectanglesContact + ( + DrucStructMesure->RECTANGLE1, + DrucStructMesure->RECTANGLE2 + ) + ); + return ( DRUC_TRUE ); +} +/*------------------------------------------------------------\ +| | +| DrucSetEquiFlag | +| positionne le bit du champ FLAG de tous les rectangles | +| de l'equi du rectangle | +| le bit a positionner est indique par le parametre flag | +\------------------------------------------------------------*/ +void DrucSetEquiFlag ( Rectangle, + Flag + ) + register rdsrec_list *Rectangle; + register long Flag; +{ +register rdsrec_list *TmpEqui = Rectangle; + + do + { + TmpEqui->FLAGS |= Flag; + TmpEqui = MACRO_NEXT_EQUI ( TmpEqui ); + } + while ( Rectangle != TmpEqui ); +} +/*------------------------------------------------------------\ +| | +| DrucClearEquiFlag | +| efface le bit du champ FLAG de tous les rectangles | +| de l'equi du rectangle | +| le bit a effacer est indique par le parametre flag | +\------------------------------------------------------------*/ +void DrucClearEquiFlag ( Rectangle, + Flag + ) + register rdsrec_list *Rectangle; + register long Flag; +{ +register rdsrec_list *TmpEqui = Rectangle; + + do + { + TmpEqui->FLAGS &= ~( Flag ); + TmpEqui = MACRO_NEXT_EQUI ( TmpEqui ); + } + while ( Rectangle != TmpEqui ); +} +/*------------------------------------------------------------\ +| | +| DrucClearFlag | +| met a zero le bit du champ FLAG de tous les rectangles | +| le bit a mettre a zero est indique par le parametre flag | +\------------------------------------------------------------*/ +void DrucClearFlag ( RectangleListe, + Flag + ) + register rdsrec_list *RectangleListe; + register long Flag; +{ +register rdsrec_list *TmpRectangle; + + for ( TmpRectangle = RectangleListe; + TmpRectangle != (rdsrec_list *)NULL; + TmpRectangle = TmpRectangle->NEXT + ) + { + TmpRectangle->FLAGS &= ~( Flag ); + } +} +/*------------------------------------------------------------\ +| | +| DrucAddRecFigure | +| insert le rectangle (initialise) dans la liste des | +| rectangles du layer donne | +\------------------------------------------------------------*/ +void DrucAddRecFigure ( RectangleDest , + DrucFigureRds , + LayerDest + ) + rdsrec_list *RectangleDest; + rdsfig_list *DrucFigureRds; + int LayerDest; +{ + RectangleDest->NEXT = DrucFigureRds->LAYERTAB [ LayerDest ]; + DrucFigureRds->LAYERTAB [ LayerDest ] = RectangleDest; +} +/*------------------------------------------------------------\ +| | +| DrucDestroyLayerWindow | +| | +\------------------------------------------------------------*/ +void DrucDestroyLayerWindow ( DrucFigureRds, + DrucRdsWindow, + LayerCourant + ) + rdsfig_list *DrucFigureRds; + rdswindow *DrucRdsWindow; + int LayerCourant; +{ +rdsrec_list *RectangleCourant; + +/*\ +DrucViewString ("\nDESTRUCTION DES FENETRES DU LAYER DEST\n" + ); +viewrdsfig ( DrucFigureRds + ); +\*/ + + RectangleCourant = DrucFigureRds->LAYERTAB[ LayerCourant ]; + while ( RectangleCourant != ( rdsrec_list * )NULL ) + { + delrdsrecwindow ( RectangleCourant, + DrucRdsWindow + ); + RectangleCourant = RectangleCourant->NEXT; + } +/*\ +DrucViewString ("\nFIN DESTRUCTION DES FENETRES DU LAYER DEST\n" + ); +\*/ +} +/*------------------------------------------------------------\ +| | +| DrucBuiltLayerWindow | +| | +\------------------------------------------------------------*/ +void DrucBuiltLayerWindow ( DrucFigureRds, + DrucRdsWindow, + LayerCourant + ) + + rdsfig_list *DrucFigureRds; + rdswindow *DrucRdsWindow; + int LayerCourant; +{ +rdsrec_list *RectangleCourant; + +/*\ +DrucViewString ("\nCONSTRUCTION DES FENETRES DU LAYER DEST\n" + ); +viewrdsfig ( DrucFigureRds + ); +\*/ + for ( RectangleCourant = DrucFigureRds->LAYERTAB[ LayerCourant ]; + RectangleCourant != (rdsrec_list *)NULL; + RectangleCourant = RectangleCourant->NEXT + ) + { + addrdsrecwindow( RectangleCourant, DrucRdsWindow ); + +/*\ +DrucViewString ("\nCONSTRUCTION EN COURS DES FENETRES DU LAYER DEST\n" + ); +\*/ + } +/*\ +DrucViewString ("\nFIN CONSTRUCTION DES FENETRES DU LAYER DEST\n" + ); +\*/ +} +/*------------------------------------------------------------\ +| | +| DrucVerifEquiLayer | +| | +\------------------------------------------------------------*/ +void DrucVerifEquiLayer ( DrucFigureRds, + Layer + ) + rdsfig_list *DrucFigureRds; + int Layer; +{ +rdsrec_list *TmpRectangle; + + DrucViewString ( "\n" + ); + DrucViewString ( RDS_LAYER_NAME[Layer] + ); + DrucViewString ( "\n" + ); + + TmpRectangle = DrucFigureRds->LAYERTAB[Layer]; + while ( TmpRectangle != (rdsrec_list *)NULL + ) + { + DrucViewString ("RECTANGLE COURANT PARCOURU PAR NEXT "); + DrucViewRectangle ( & TmpRectangle + ); + if ( ( TmpRectangle->FLAGS & DRUC_FLAG_REC_VISITE ) == + DRUC_FLAG_REC_VISITE + ) + { + TmpRectangle = TmpRectangle->NEXT; + continue; + } + if ( MACRO_NEXT_EQUI ( TmpRectangle ) == (rdsrec_list *)NULL + ) + { + DrucViewRectangle ( & TmpRectangle ); + DrucViewString (" et un rectangle qui n'est pas chaine!"); + DrucViewRectangle ( & TmpRectangle ); + } + else + { + DrucViewEqui ( & TmpRectangle + ); + } + TmpRectangle = TmpRectangle->NEXT; + } + DrucClearFlag ( DrucFigureRds->LAYERTAB [ Layer ], + DRUC_FLAG_REC_VISITE + ); + +printf ("\n layer verifie\n"); +} +/*------------------------------------------------------------\ +| | +| DrucVerifEquiFigure | +| | +\------------------------------------------------------------*/ +void DrucVerifEquiFigure ( DrucFigureRds + ) + rdsfig_list *DrucFigureRds; +{ +int Layer; + + DrucViewString ("Verif de la figure "); + DrucViewString (DrucFigureRds->NAME); + for ( Layer = 0; + Layer < RDS_MAX_LAYER; + Layer ++ + ) + { + DrucViewString ("Verif des chainages du layer "); + DrucVerifEquiLayer ( DrucFigureRds, + Layer + ); + } +} diff --git a/alliance/src/druc/src/vmctools.h b/alliance/src/druc/src/vmctools.h new file mode 100644 index 00000000..19078635 --- /dev/null +++ b/alliance/src/druc/src/vmctools.h @@ -0,0 +1,339 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : VMCTOOLS.H | +| | +| Authors : Patrick Renaud | +| | +| Date : 11/01/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Druc VmcTools Defines | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Druc VmcTools Defines | +| Definition des champs de flags utilises par DRUC | +| c'est les bits a 1 +\------------------------------------------------------------*/ +/*\ + * DRUC_ALL_FLAGS (long)0x0FF00000l +\*/ +/*------------------------------------------------------------\ +| | +| Druc VmcTools Defines | +| Definition des flags des rectangles pour l'unification | +\------------------------------------------------------------*/ +#define DRUC_FLAG_SHORT_RECTANGLE (long)0x00400000l +#define DRUC_FLAG_INCLUSION_RECTANGLE (long)0x00200000l +#define DRUC_FLAG_INTERSECT_RECTANGLE (long)0x00100000l +/*------------------------------------------------------------\ +| | +| Druc VmcTools Defines | +| Definition des flags des rectangles pour leur origine | +\------------------------------------------------------------*/ +#define DRUC_FLAG_INSTANCE_RECTANGLE (long)0x00800000l +#define DRUC_FLAG_FIGURE_RECTANGLE (long)0x00000000l +#define DRUC_MASK_FIGURE_RECTANGLE (long)0x00700000l +/*------------------------------------------------------------\ +| | +| Druc VmcTools Defines | +| Definition des flags des rectangles pour leur composition | +\------------------------------------------------------------*/ +#define DRUC_FLAG_REC_INCLUS (long)0x02000000l +#define DRUC_FLAG_REMOVE (long)0x08000000l +#define DRUC_FLAG_REC_UNIFIE (long)0x01000000l +/*------------------------------------------------------------\ +| | +| Druc VmcTools Defines | +| Definition des flags des rectangles pour leurs parcours | +\------------------------------------------------------------*/ +#define DRUC_FLAG_REC_VISITE (long)0x10000000l +/*------------------------------------------------------------\ +| | +| Druc VmcTools Defines | +| Definition des flags des rectangles pour leurs parcours | +\------------------------------------------------------------*/ +#define DRUC_FLAG_REC_VERIFIE (long)0x20000000l +/*------------------------------------------------------------\ +| | +| Druc VmcTools Defines | +| Definition des flags des rectangles equipotentiels | +\------------------------------------------------------------*/ +#define DRUC_FLAG_REC_ISEQUI (long)0x04000000l +/*------------------------------------------------------------\ +| | +| Druc VmcTools Defines | +\------------------------------------------------------------*/ +#define DRUC_NOFLAGS (long)0x00000000l +/*------------------------------------------------------------\ +| | +| Druc VmcTools MACROS | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Druc VmcMesure Orientations | +| | +\------------------------------------------------------------*/ +#define DRUC_ORIENTATION_ENVELOPPE 0 +#define DRUC_ORIENTATION_MARGE 1 +#define DRUC_ORIENTATION_CROIX 2 +#define DRUC_ORIENTATION_INTERSECTION 3 +#define DRUC_ORIENTATION_EXTENSION 4 +#define DRUC_ORIENTATION_INCLUSION 5 + +/*------------------------------------------------------------\ +| | +| Druc VmcMesure Position de Rectangles | +| | +\------------------------------------------------------------*/ +#define DRUC_RECTANGLE_UP 0 +#define DRUC_RECTANGLE_DO 1 +#define DRUC_RECTANGLE_LE 2 +#define DRUC_RECTANGLE_RI 3 +/*------------------------------------------------------------\ +| | +| Druc VmcRelat Macros des mesures | +| | +\------------------------------------------------------------*/ +#define DRUC_RELATION_UNDEF_MESURE 0xffffffffl +/*------------------------------------------------------------\ +| | +| Druc VmcMesur Macros | +| d'acces a la structure DrucStructMesure | +| | +\------------------------------------------------------------*/ +#define MACRO_RECTANGLE1 (DrucStructMesure->RECTANGLE1) +#define MACRO_RECTANGLE2 (DrucStructMesure->RECTANGLE2) +#define MACRO_ORIENTATION (DrucStructMesure->ORIENTATION) +#define MACRO_TOPOLOGIE (DrucStructMesure->TOPOLOGIE) + +#define MACRO_BOOL_DISTANCE (DrucStructMesure->BOOLEEN_DISTANCE) + +#define MACRO_SURFACE_INTER_1 (DrucStructMesure.DIMENSION_A) +#define MACRO_LONG_INTER_1 (DrucStructMesure.DIMENSION_B) +#define MACRO_LARGE_INTER_1 (DrucStructMesure.DIMENSION_C) +#define MACRO_SURFACE_INTER (DrucStructMesure->DIMENSION_A) +#define MACRO_LONG_INTER (DrucStructMesure->DIMENSION_B) +#define MACRO_LARGE_INTER (DrucStructMesure->DIMENSION_C) +#define MACRO_PENETRE_INTER (DrucStructMesure->DIMENSION_D) +#define MACRO_PARAL_INTER (DrucStructMesure->DIMENSION_G) +#define MACRO_PERPEN_INTER (DrucStructMesure->DIMENSION_H) + +#define MACRO_LONG_MAX (DrucStructMesure->DIMENSION_E) +#define MACRO_LONG_MIN (DrucStructMesure->DIMENSION_F) + +#define MACRO_RECT_LONG_MAX (DrucStructMesure->NUM_RECT_E) +#define MACRO_RECT_LONG_MIN (DrucStructMesure->NUM_RECT_F) + +#define MACRO_LARGE_MAX (DrucStructMesure->DIMENSION_G) +#define MACRO_LARGE_MIN (DrucStructMesure->DIMENSION_H) + +#define MACRO_RECT_LARGE_MAX (DrucStructMesure->NUM_RECT_G) +#define MACRO_RECT_LARGE_MIN (DrucStructMesure->NUM_RECT_H) + +#define MACRO_FRONT (DrucStructMesure->DIMENSION_I) +#define MACRO_LATER_MIN (DrucStructMesure->DIMENSION_J) +#define MACRO_LATER_MAX (DrucStructMesure->DIMENSION_K) + +#define MACRO_RECT_FRONT (DrucStructMesure->NUM_RECT_I) +#define MACRO_RECT_LATER_MIN (DrucStructMesure->NUM_RECT_J) +#define MACRO_RECT_LATER_MAX (DrucStructMesure->NUM_RECT_K) + +#define MACRO_SUP (DrucStructMesure->DIMENSION_L) +#define MACRO_INF (DrucStructMesure->DIMENSION_M) + +#define MACRO_RECT_SUP (DrucStructMesure->NUM_RECT_L) +#define MACRO_RECT_INF (DrucStructMesure->NUM_RECT_M) + +#define MACRO_LONG_DISTANCE (DrucStructMesure->DIMENSION_N) +#define MACRO_LARGE_DISTANCE (DrucStructMesure->DIMENSION_O) + +#define MACRO_POSX_DISTANCE (DrucStructMesure->DIMENSION_P) +#define MACRO_POSY_DISTANCE (DrucStructMesure->DIMENSION_Q) +#define MACRO_POSDX_DISTANCE (DrucStructMesure->DIMENSION_R) +#define MACRO_POSDY_DISTANCE (DrucStructMesure->DIMENSION_S) + +#define MACRO_POSX_RECT_UP (DrucStructMesure->POSX_RECT_UP) +#define MACRO_POSY_RECT_UP (DrucStructMesure->POSY_RECT_UP) +#define MACRO_POSDX_RECT_UP (DrucStructMesure->POSDX_RECT_UP) +#define MACRO_POSDY_RECT_UP (DrucStructMesure->POSDY_RECT_UP) + +#define MACRO_POSX_RECT_DO (DrucStructMesure->POSX_RECT_DO) +#define MACRO_POSY_RECT_DO (DrucStructMesure->POSY_RECT_DO) +#define MACRO_POSDX_RECT_DO (DrucStructMesure->POSDX_RECT_DO) +#define MACRO_POSDY_RECT_DO (DrucStructMesure->POSDY_RECT_DO) + +#define MACRO_POSX_RECT_LE (DrucStructMesure->POSX_RECT_LE) +#define MACRO_POSY_RECT_LE (DrucStructMesure->POSY_RECT_LE) +#define MACRO_POSDX_RECT_LE (DrucStructMesure->POSDX_RECT_LE) +#define MACRO_POSDY_RECT_LE (DrucStructMesure->POSDY_RECT_LE) + +#define MACRO_POSX_RECT_RI (DrucStructMesure->POSX_RECT_RI) +#define MACRO_POSY_RECT_RI (DrucStructMesure->POSY_RECT_RI) +#define MACRO_POSDX_RECT_RI (DrucStructMesure->POSDX_RECT_RI) +#define MACRO_POSDY_RECT_RI (DrucStructMesure->POSDY_RECT_RI) + +/*------------------------------------------------------------\ +| | +| Druc VmcTools MACROS | +| liees a rds | +\------------------------------------------------------------*/ +#define DRUC_ON_HEAP 1 +/*------------------------------------------------------------\ +| | +| Min et Max de 3 valeurs | +| | +\------------------------------------------------------------*/ +#define MACRO_MAX( Valeur1 , Valeur2 ) \ + (( Valeur1 < Valeur2 ) ? Valeur2 : Valeur1 ) +#define MACRO_MIN( Valeur1 , Valeur2 ) \ + (( Valeur2 < Valeur1 ) ? Valeur2 : Valeur1 ) + +/*------------------------------------------------------------\ +| | +| Druc VmcTools MACROS | +| manipulation de la structure complementaire de rectangle | +\------------------------------------------------------------*/ +#define MACRO_PLUS_TAILLE (sizeof( DrucTypeStructPlusRect )) + +#define MACRO_REGLE_NUM( Rectangle ) \ + (((DrucTypeStructPlusRect *)((char *)(Rectangle)+sizeof(rdsrec_list)))->NOMBRE) +#define MACRO_LAYER_NUM( Rectangle ) \ + (((DrucTypeStructPlusRect *)((char *)(Rectangle)+sizeof(rdsrec_list)))->NOMBRE) + +#define MACRO_INSTANCE_NUM( Rectangle ) \ + (((DrucTypeStructPlusRect *)((char *)(Rectangle)+sizeof(rdsrec_list)))->INSTANCE_NUM) + +#define MACRO_NEXT_EQUI( Rectangle ) \ + (((DrucTypeStructPlusRect *)((char *)(Rectangle)+sizeof(rdsrec_list)))->NEXT_EQUI) + +#define MACRO_NEXT_DEFINE( Rectangle ) \ + (((DrucTypeStructPlusRect *)((char *)(Rectangle)+sizeof(rdsrec_list)))->NEXT_DEFINE) +/*------------------------------------------------------------\ +| | +| Druc VmcTools MACROS | +| manipulation de la structure des recles de verif | +\------------------------------------------------------------*/ +#define MACRO_REGLE_COURANTE (DrucTabInstruction [ InstructionCourante ]) +#define MACRO_REGLE_VALEUR (DrucInstructionCourante->VALEUR) +#define MACRO_REGLE_COMPARE (DrucInstructionCourante->OP_COMPARE) +#define MACRO_REGLE_COMPOSE (DrucInstructionCourante->OP_COMPOSE) +/*------------------------------------------------------------\ +| | +| Druc VmcTools MACROS | +| manipulation des rectangles de la structure de fenetre | +\------------------------------------------------------------*/ +#define MACRO_RECT_DEST (TabRectangleDest->RECTAB) +#define MACRO_RECT_SOURCE (TabRectangleSource->RECTAB) +#define MACRO_RECT_SOURCE2 (TabRectangleSource2->RECTAB) +/*------------------------------------------------------------\ +| | +| Druc VmcTools Types | +| | +\------------------------------------------------------------*/ +typedef struct struct_plusrect + { + int NOMBRE; + rdsins_list *INSTANCE_NUM; + rdsrec_list *NEXT_EQUI; + struct struct_plusrect *NEXT_DEFINE; + } DrucTypeStructPlusRect; +/*------------------------------------------------------------\ +| | +| Druc VmcTools variables | +| | +\------------------------------------------------------------*/ +extern rdsfig_list *DrucFigureRdsErreur; +/*------------------------------------------------------------\ +| | +| Druc Regles a 2 Corps TYPE | +| | +\------------------------------------------------------------*/ +typedef struct struct_mesure + { + boolean BOOLEEN_DISTANCE; + long LAYER_1; + long LAYER_2; + rdsrec_list *RECTANGLE1; + rdsrec_list *RECTANGLE2; + int ORIENTATION; + int TOPOLOGIE; + long DIMENSION_A; + long DIMENSION_B; + long DIMENSION_C; + long DIMENSION_D; + long DIMENSION_E; + long DIMENSION_F; + long DIMENSION_G; + long DIMENSION_H; + long DIMENSION_I; + long DIMENSION_J; + long DIMENSION_K; + long DIMENSION_L; + long DIMENSION_M; + long DIMENSION_N; + long DIMENSION_O; + long DIMENSION_P; + long DIMENSION_Q; + long DIMENSION_R; + long DIMENSION_S; + int NUM_RECT_A; + int NUM_RECT_B; + int NUM_RECT_C; + int NUM_RECT_D; + int NUM_RECT_E; + int NUM_RECT_F; + int NUM_RECT_G; + int NUM_RECT_H; + int NUM_RECT_I; + int NUM_RECT_J; + int NUM_RECT_K; + int NUM_RECT_L; + int NUM_RECT_M; + int NUM_RECT_N; + int NUM_RECT_O; + int NUM_RECT_P; + int NUM_RECT_Q; + int NUM_RECT_R; + int NUM_RECT_S; + long MESURE_EFFECTIVE; + long POSX_RECT_UP; + long POSY_RECT_UP; + long POSDX_RECT_UP; + long POSDY_RECT_UP; + long POSX_RECT_DO; + long POSY_RECT_DO; + long POSDX_RECT_DO; + long POSDY_RECT_DO; + long POSX_RECT_LE; + long POSY_RECT_LE; + long POSDX_RECT_LE; + long POSDY_RECT_LE; + long POSX_RECT_RI; + long POSY_RECT_RI; + long POSDX_RECT_RI; + long POSDY_RECT_RI; + } DrucTypeStructMesure; +/*------------------------------------------------------------\ +| | +| Druc VmcTools Fonctions | +| | +\------------------------------------------------------------*/ +extern void DrucClearFlag (); +extern void DrucComputeEqui (); +extern rdsrecwin_list *DrucChercheWindow (); +extern boolean DrucIsRectangleEquipot (); +extern boolean DrucIsRectanglesValides (); +extern void DrucSetEquiFlag (); +extern void DrucClearEquiFlag (); +extern void DrucAddRecFigure (); +extern void DrucViewString (); +extern char *DrucAddSuffixeName (); +extern void DrucVerifyEqui (); +extern void DrucVerifyEquiLayer (); diff --git a/alliance/src/druc/src/vmcunify.c b/alliance/src/druc/src/vmcunify.c new file mode 100644 index 00000000..b73b387d --- /dev/null +++ b/alliance/src/druc/src/vmcunify.c @@ -0,0 +1,1367 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : VMCUNIFY.C | +| | +| Authors : Renaud Patrick | +| | +| Date : 11/01/94 | +| | +| evolutions : see at the end of the file | +| | +| | +| | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +#include +#include +#include +#include "mph.h" +#include "mut.h" +#include "rds.h" +#include "rwi.h" +#include "rut.h" +#include "rtl.h" +#include "rfm.h" +#include "rpr.h" + +#include "drucutil.h" +#include "vmctools.h" +#include "vmcerror.h" +#include "vmcunify.h" + +/*------------------------------------------------------------\ +| | +| Fonctions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| DrucUnifyDeleteEqui | +| | +\------------------------------------------------------------*/ + +void DrucUnifyDeleteEqui ( RectangleSource + ) + rdsrec_list *RectangleSource; + +{ + + while ( RectangleSource != ( rdsrec_list *)NULL + ) + { + MACRO_NEXT_EQUI ( RectangleSource ) = ( rdsrec_list *)NULL; + RectangleSource = RectangleSource->NEXT; + } +} + +/*------------------------------------------------------------\ +| | +| DrucChaineEquiRectqngle | +| | +\------------------------------------------------------------*/ + +void DrucChaineEquiRectangle ( DrucNouveauRectangle, + Rectangle1 + ) + rdsrec_list *DrucNouveauRectangle; + rdsrec_list *Rectangle1; + +{ + + MACRO_NEXT_EQUI (DrucNouveauRectangle ) = MACRO_NEXT_EQUI ( Rectangle1 ); + MACRO_NEXT_EQUI (Rectangle1 ) = DrucNouveauRectangle; +} + +/*------------------------------------------------------------\ +| | +| DrucUnifyRemoveRectanglesEqui | +| | +\------------------------------------------------------------*/ + +void DrucUnifyRemoveRectanglesEqui ( RectangleSource, + DrucRdsWindow, + Width + ) + rdsrec_list **RectangleSource; + rdswindow *DrucRdsWindow; + long Width; + + +{ + +rdsrec_list *RectanglePrecedant; +rdsrec_list *RectangleSuivant; +rdsrec_list *RectangleOrigine; + + RectangleOrigine = *RectangleSource; + /*\ + * supprimer tous les rectangles de tete de liste qui sont a detruire + \*/ + while ( ( RectangleOrigine != (rdsrec_list *)NULL + ) && + ( ( ( RectangleOrigine->FLAGS & + DRUC_FLAG_REMOVE + ) == + DRUC_FLAG_REMOVE + ) || + ( ( RectangleOrigine->DX < Width + ) || + ( RectangleOrigine->DY < Width + ) + ) + ) + ) + { + *RectangleSource = RectangleOrigine->NEXT; + + delrdsrecwindow ( RectangleOrigine, + DrucRdsWindow + ); + + rdsfreeheap ( RectangleOrigine , + ( sizeof ( rdsrec_list ) + MACRO_PLUS_TAILLE ) + ); + + RectangleOrigine = *RectangleSource; + } + + RectanglePrecedant = *RectangleSource; + /*\ + * puis tous les rectangles apres la tete de liste qui sont a detruire + \*/ + + if ( RectanglePrecedant != (rdsrec_list *)NULL + ) + { + do + { + RectangleSuivant = RectanglePrecedant->NEXT; + + if ( RectangleSuivant != (rdsrec_list *)NULL + ) + { + if ( ( ( RectangleSuivant->FLAGS & DRUC_FLAG_REMOVE + ) == + DRUC_FLAG_REMOVE + ) || + ( ( RectangleSuivant->DX < Width + ) || + ( RectangleSuivant->DY < Width + ) + ) + ) + { + RectanglePrecedant->NEXT = RectangleSuivant->NEXT; + + + delrdsrecwindow ( RectangleSuivant, + DrucRdsWindow + ); + rdsfreeheap ( RectangleSuivant , + sizeof ( rdsrec_list ) + MACRO_PLUS_TAILLE + ); + + RectangleSuivant = RectanglePrecedant->NEXT; + } + else + { + RectanglePrecedant = RectangleSuivant; + } + } + } + while ( RectanglePrecedant->NEXT != (rdsrec_list *)NULL ); + } +} + +/*------------------------------------------------------------\ +| | +| DrucCreateRectangle | +| | +\------------------------------------------------------------*/ + +rdsrec_list *DrucCreateRectangle ( X, + Y, + DX, + DY, + Flag + ) + long X; + long Y; + long DX; + long DY; + int Flag; + +{ + +rdsrec_list * TmpRectangleDest; + + TmpRectangleDest = allocrdsrec( sizeof ( DrucTypeStructPlusRect )); + TmpRectangleDest->X = X ; + TmpRectangleDest->Y = Y ; + TmpRectangleDest->DX = DX ; + TmpRectangleDest->DY = DY ; + TmpRectangleDest->FLAGS |=Flag; + + return ( TmpRectangleDest + ); +} + +/*------------------------------------------------------------\ +| | +| DrucUnifyTransfertInfo | +| recopie les infos a garder du rectangle1 sur le rectangle 2 | +\------------------------------------------------------------*/ + +void DrucUnifyTransfertInfo ( TmpRectangle1, + TmpRectangle2 + ) + rdsrec_list *TmpRectangle1; + rdsrec_list *TmpRectangle2; + +{ + + if ( TmpRectangle2->NAME == (char *)NULL + ) + { + if ( TmpRectangle1->NAME != (char *)NULL + ) + { + TmpRectangle2->NAME = namealloc ( TmpRectangle1->NAME + ); + } + } +} + +/*------------------------------------------------------------\ +| | +| DrucRelationOrientation | +| | +\------------------------------------------------------------*/ + +boolean DrucUnifyOrientation ( DrucFigureRds, + LayerCourant, + Rectangle1, + Rectangle2, + FlagNextRectangle1, + FlagCreateRectangle + ) + rdsfig_list *DrucFigureRds; + int LayerCourant; + rdsrec_list *Rectangle1; + rdsrec_list *Rectangle2; + boolean *FlagNextRectangle1; + boolean *FlagCreateRectangle; + +{ + +rdsrec_list *DrucNouveauRectangle; +long XA = Rectangle1->X; +long YA = Rectangle1->Y; +long XB = Rectangle2->X; +long YB = Rectangle2->Y; +long DXA = Rectangle1->DX; +long DYA = Rectangle1->DY; +long DXB = Rectangle2->DX; +long DYB = Rectangle2->DY; +long FinXA = XA + DXA; +long FinXB = XB + DXB; +long FinYA = YA + DYA; +long FinYB = YB + DYB; +long ExtenXAXB = XA - XB; +long ExtenDXAXB = FinXA - XB; +long ExtenDXADXB = FinXA - FinXB; +long ExtenYAYB = YA - YB; +long ExtenDYAYB = FinYA - YB; +long ExtenDYADYB = FinYA - FinYB; +long ExtenDXBXA = FinXB - XA; +long ExtenDXBDXA = - ExtenDXADXB; +long ExtenDYBYA = FinYB - YA; +long ExtenDYBDYA = - ExtenDYADYB; +int TmpCas; +boolean FlagIsEquiModified = DRUC_FALSE; + + TmpCas = 0; + if ( XA >= XB ) + { + TmpCas |= 1; + } + if ( FinXA <= FinXB ) + { + TmpCas |= 2; + } + if ( YA >= YB ) + { + TmpCas |= 4; + } + if ( FinYA <= FinYB ) + { + TmpCas |= 8; + } + switch ( TmpCas + ) + { + case 0 : + { /* A enveloppe B */ + FlagIsEquiModified = DRUC_TRUE; + Rectangle2->FLAGS |= DRUC_FLAG_REMOVE; + + DrucUnifyTransfertInfo ( Rectangle2, + Rectangle1 + ); + break; + } + case 1 : + { /* A marge B */ + FlagIsEquiModified = DRUC_TRUE; + + if ( XA == XB + ) + { + /* A enveloppe B */ + Rectangle2->FLAGS |= DRUC_FLAG_REMOVE; + + DrucUnifyTransfertInfo ( Rectangle2, + Rectangle1 + ); + break; + } + Rectangle2->DX = ExtenDXAXB; + break; + } + case 2 : + { /* A Marge B */ + FlagIsEquiModified = DRUC_TRUE; + + if ( FinXB == FinXA + ) + { + /* A enveloppe B */ + Rectangle2->FLAGS |= DRUC_FLAG_REMOVE; + + DrucUnifyTransfertInfo ( Rectangle2, + Rectangle1 + ); + break; + } + Rectangle2->X = XA; + Rectangle2->DX = ExtenDXBXA; + break; + } + case 3 : + { /* A croix B */ + if ( ( XA == XB ) && ( FinXB == FinXA ) + ) + { /* A enveloppe B */ + FlagIsEquiModified = DRUC_TRUE; + Rectangle2->FLAGS |= DRUC_FLAG_REMOVE; + + DrucUnifyTransfertInfo ( Rectangle2, + Rectangle1 + ); + } + break; + } + case 4 : + { /* A Marge B */ + FlagIsEquiModified = DRUC_TRUE; + + if ( YA == YB + ) + { + /* A enveloppe B */ + Rectangle2->FLAGS |= DRUC_FLAG_REMOVE; + + DrucUnifyTransfertInfo ( Rectangle2, + Rectangle1 + ); + break; + } + Rectangle2->DY = ExtenDYAYB; + break; + } + case 5 : + { /* A intersection B */ + if ( ( XA == XB ) && ( YA == YB ) + ) + { /* A enveloppe B */ + FlagIsEquiModified = DRUC_TRUE; + Rectangle2->FLAGS |= DRUC_FLAG_REMOVE; + + DrucUnifyTransfertInfo ( Rectangle2, + Rectangle1 + ); + break; + } + if ( XA == XB + ) + { /* A marge B */ + FlagIsEquiModified = DRUC_TRUE; + Rectangle2->DY = ExtenDYAYB; + break; + } + if ( YA == YB + ) + { /* A marge B */ + FlagIsEquiModified = DRUC_TRUE; + Rectangle2->DX = ExtenDXAXB; + break; + } + break; + } + case 6 : + { /* A intersection B */ + if ( ( FinXA == FinXB ) && ( YA == YB ) + ) + { /* A enveloppe B */ + FlagIsEquiModified = DRUC_TRUE; + Rectangle2->FLAGS |= DRUC_FLAG_REMOVE; + + DrucUnifyTransfertInfo ( Rectangle2, + Rectangle1 + ); + break; + } + if ( FinXA == FinXB + ) + { /* A marge B */ + FlagIsEquiModified = DRUC_TRUE; + Rectangle2->DY = ExtenDYAYB; + break; + } + if ( YA == YB + ) + { /* A marge B */ + FlagIsEquiModified = DRUC_TRUE; + Rectangle2->X = XA; + Rectangle2->DX = ExtenDXBXA; + break; + } + break; + } + case 7 : + { + if ( ( XA == XB ) && + ( FinXA == FinXB ) + ) + { + FlagIsEquiModified = DRUC_TRUE; + Rectangle2->FLAGS |= DRUC_FLAG_REMOVE; + + DrucUnifyTransfertInfo ( Rectangle2, + Rectangle1 + ); + } + if ( YA != YB + ) + { + FlagIsEquiModified = DRUC_TRUE; + Rectangle1->Y = YB; + Rectangle1->DY = ExtenDYAYB; + } + break; + } + case 8 : + { /* A marge B */ + FlagIsEquiModified = DRUC_TRUE; + if ( FinYA == FinYB + ) + { + /* A enveloppe B */ + Rectangle2->FLAGS |= DRUC_FLAG_REMOVE; + + DrucUnifyTransfertInfo ( Rectangle2, + Rectangle1 + ); + break; + } + Rectangle2->Y = YA; + Rectangle2->DY = ExtenDYBYA; + break; + } + case 9 : + { /* A intersection B */ + if ( ( XA == XB ) && ( FinYA == FinYB ) + ) + { /* A enveloppe B */ + FlagIsEquiModified = DRUC_TRUE; + Rectangle2->FLAGS |= DRUC_FLAG_REMOVE; + + DrucUnifyTransfertInfo ( Rectangle2, + Rectangle1 + ); + break; + } + if ( XA == XB + ) + { /* A marge B */ + FlagIsEquiModified = DRUC_TRUE; + Rectangle2->Y = YA; + Rectangle2->DY = ExtenDYBYA; + break; + } + if ( FinYA == FinYB + ) + { /* A marge B */ + FlagIsEquiModified = DRUC_TRUE; + Rectangle2->DX = ExtenDXAXB; + break; + } + break; + } + case 10 : + { /* A intersection B */ + if ( ( FinXA == FinXB ) && + ( FinYA == FinYB ) + ) + { /* A enveloppe B */ + FlagIsEquiModified = DRUC_TRUE; + Rectangle2->FLAGS |= DRUC_FLAG_REMOVE; + + DrucUnifyTransfertInfo ( Rectangle2, + Rectangle1 + ); + break; + } + if ( FinXA == FinXB + ) + { /* A marge B */ + FlagIsEquiModified = DRUC_TRUE; + Rectangle2->Y = YA; + Rectangle2->DY = ExtenDYBYA; + break; + } + if ( FinYA == FinYB + ) + { /* A marge B */ + FlagIsEquiModified = DRUC_TRUE; + Rectangle2->X = XA; + Rectangle2->DX = ExtenDXBXA; + break; + } + break; + } + case 11 : + { + if ( ( XA == XB ) && + ( FinXA == FinXB ) + ) + { + FlagIsEquiModified = DRUC_TRUE; + Rectangle2->FLAGS |= DRUC_FLAG_REMOVE; + + DrucUnifyTransfertInfo ( Rectangle2, + Rectangle1 + ); + } + if ( FinYA != FinYB + ) + { + FlagIsEquiModified = DRUC_TRUE; + Rectangle1->DY = ExtenDYBYA; + } + break; + } + case 12 : + { /* A croix B */ + if ( ( YA == YB ) && + ( FinYB == FinYA ) + ) + { /* A enveloppe B */ + FlagIsEquiModified = DRUC_TRUE; + Rectangle2->FLAGS |= DRUC_FLAG_REMOVE; + + DrucUnifyTransfertInfo ( Rectangle2, + Rectangle1 + ); + } + break; + } + case 13 : + { + if ( ( YA == YB ) && + ( FinYB == FinYA ) + ) + { + FlagIsEquiModified = DRUC_TRUE; + Rectangle2->FLAGS |= DRUC_FLAG_REMOVE; + + DrucUnifyTransfertInfo ( Rectangle2, + Rectangle1 + ); + } + if ( XA != XB + ) + { + FlagIsEquiModified = DRUC_TRUE; + Rectangle1->X = XB; + Rectangle1->DX = ExtenDXAXB; + } + break; + } + case 14 : + { + if ( ( YA == YB ) && + ( FinYB == FinYA ) + ) + { + FlagIsEquiModified = DRUC_TRUE; + Rectangle2->FLAGS |= DRUC_FLAG_REMOVE; + + DrucUnifyTransfertInfo ( Rectangle2, + Rectangle1 + ); + } + if ( FinXA != FinXB + ) + { + FlagIsEquiModified = DRUC_TRUE; + Rectangle1->DX = ExtenDXBXA; + } + break; + } + case 15 : + { /* A inclus dans B */ + *FlagNextRectangle1 = DRUC_TRUE; + FlagIsEquiModified = DRUC_TRUE; + Rectangle1->FLAGS |= DRUC_FLAG_REMOVE; + + DrucUnifyTransfertInfo ( Rectangle1, + Rectangle2 + ); + break; + } + }/* switch */ + + return ( FlagIsEquiModified + ); +} +/*------------------------------------------------------------\ +| | +| DrucUnifyCreate | +| | +\------------------------------------------------------------*/ +boolean DrucUnifyCreate ( DrucFigureRds, + LayerCourant, + Rectangle1, + Rectangle2, + FlagNextRectangle1, + FlagCreateRectangle + ) + rdsfig_list *DrucFigureRds; + int LayerCourant; + rdsrec_list *Rectangle1; + rdsrec_list *Rectangle2; + boolean *FlagNextRectangle1; + boolean *FlagCreateRectangle; + +{ + +rdsrec_list *DrucNouveauRectangle; +long XA = Rectangle1->X; +long YA = Rectangle1->Y; +long XB = Rectangle2->X; +long YB = Rectangle2->Y; +long DXA = Rectangle1->DX; +long DYA = Rectangle1->DY; +long DXB = Rectangle2->DX; +long DYB = Rectangle2->DY; +long FinXA = XA + DXA; +long FinXB = XB + DXB; +long FinYA = YA + DYA; +long FinYB = YB + DYB; +long ExtenXAXB = XA - XB; +long ExtenDXAXB = FinXA - XB; +long ExtenDXADXB = FinXA - FinXB; +long ExtenYAYB = YA - YB; +long ExtenDYAYB = FinYA - YB; +long ExtenDYADYB = FinYA - FinYB; +long ExtenDXBXA = FinXB - XA; +long ExtenDXBDXA = - ExtenDXADXB; +long ExtenDYBYA = FinYB - YA; +long ExtenDYBDYA = - ExtenDYADYB; +int TmpCas; +boolean FlagIsEquiModified = DRUC_FALSE; + + TmpCas = 0; + + if ( XA >= XB + ) + { + TmpCas |= 1; + } + + if ( FinXA <= FinXB ) + { + TmpCas |= 2; + } + + if ( YA >= YB ) + { + TmpCas |= 4; + } + + if ( FinYA <= FinYB ) + { + TmpCas |= 8; + } + + switch ( TmpCas + ) + { + case 5 : + { /* A intersection B */ + if ( ( XA > XB ) && + ( YA > YB ) + ) + { + if ( ( ExtenDXAXB >= 0 ) && + ( ExtenDYBYA >= 0 ) + ) + { + DrucNouveauRectangle = DrucCreateRectangle ( XB, + YA, + ExtenDXAXB, + ExtenDYBYA, + DRUC_FLAG_INCLUSION_RECTANGLE + ); + + DrucChaineEquiRectangle ( DrucNouveauRectangle, + Rectangle1 + ); + SetRdsLayer ( DrucNouveauRectangle , + LayerCourant + ); + DrucAddRecFigure ( DrucNouveauRectangle, + DrucFigureRds , + LayerCourant + ); + } + + if ( ( ExtenDXBXA >= 0 ) && + ( ExtenDYAYB >= 0 ) + ) + { + DrucNouveauRectangle = DrucCreateRectangle ( XA, + YB, + ExtenDXBXA, + ExtenDYAYB, + DRUC_FLAG_INCLUSION_RECTANGLE + ); + DrucChaineEquiRectangle ( DrucNouveauRectangle, + Rectangle1 + ); + SetRdsLayer ( DrucNouveauRectangle , + LayerCourant + ); + DrucAddRecFigure ( DrucNouveauRectangle, + DrucFigureRds , + LayerCourant + ); + } + } + break; + } + case 6 : + { /* A intersection B */ + if ( ( FinXA < FinXB ) && + ( YA > YB ) + ) + { + if ( ( ExtenDXBXA >= 0 ) && + ( ExtenDYBYA >= 0 ) + ) + { + DrucNouveauRectangle = DrucCreateRectangle ( XA, + YA, + ExtenDXBXA, + ExtenDYBYA, + DRUC_FLAG_INCLUSION_RECTANGLE + ); + DrucChaineEquiRectangle ( DrucNouveauRectangle, + Rectangle1 + ); + SetRdsLayer ( DrucNouveauRectangle , + LayerCourant + ); + DrucAddRecFigure ( DrucNouveauRectangle, + DrucFigureRds , + LayerCourant + ); + } + if ( ( ExtenDXAXB >= 0 ) && + ( ExtenDYAYB >= 0 ) + ) + { + DrucNouveauRectangle = DrucCreateRectangle ( XB, + YB, + ExtenDXAXB, + ExtenDYAYB, + DRUC_FLAG_INCLUSION_RECTANGLE + ); + DrucChaineEquiRectangle ( DrucNouveauRectangle, + Rectangle1 + ); + SetRdsLayer ( DrucNouveauRectangle , + LayerCourant + ); + DrucAddRecFigure ( DrucNouveauRectangle, + DrucFigureRds , + LayerCourant + ); + } + } + break; + } + case 9 : + { /* A intersection B */ + if ( ( XA > XB ) && ( FinYA < FinYB ) + ) + { + if ( ( ExtenDXAXB >= 0 ) && + ( ExtenDYAYB >= 0 ) + ) + { + DrucNouveauRectangle = DrucCreateRectangle ( XB, + YB, + ExtenDXAXB, + ExtenDYAYB, + DRUC_FLAG_INCLUSION_RECTANGLE + ); + DrucChaineEquiRectangle ( DrucNouveauRectangle, + Rectangle1 + ); + SetRdsLayer ( DrucNouveauRectangle , + LayerCourant + ); + DrucAddRecFigure ( DrucNouveauRectangle, + DrucFigureRds , + LayerCourant + ); + } + if ( ( ExtenDXBXA >= 0 ) && + ( ExtenDYBYA >= 0 ) + ) + { + DrucNouveauRectangle = DrucCreateRectangle ( XA, + YA, + ExtenDXBXA, + ExtenDYBYA, + DRUC_FLAG_INCLUSION_RECTANGLE + ); + DrucChaineEquiRectangle ( DrucNouveauRectangle, + Rectangle1 + ); + SetRdsLayer ( DrucNouveauRectangle , + LayerCourant + ); + DrucAddRecFigure ( DrucNouveauRectangle, + DrucFigureRds , + LayerCourant + ); + } + } + break; + } + case 10 : + { /* A intersection B */ + if ( ( FinXA < FinXB ) && + ( FinYA < FinYB ) + ) + { + if ( ( ExtenDXBXA >= 0 ) && + ( ExtenDYAYB >= 0 ) + ) + { + DrucNouveauRectangle = DrucCreateRectangle ( XA, + YB, + ExtenDXBXA, + ExtenDYAYB, + DRUC_FLAG_INCLUSION_RECTANGLE + ); + DrucChaineEquiRectangle ( DrucNouveauRectangle, + Rectangle1 + ); + SetRdsLayer ( DrucNouveauRectangle , + LayerCourant + ); + DrucAddRecFigure ( DrucNouveauRectangle, + DrucFigureRds , + LayerCourant + ); + } + if ( ( ExtenDXAXB >= 0 ) && + ( ExtenDYBYA >= 0 ) + ) + { + DrucNouveauRectangle = DrucCreateRectangle ( XB, + YA, + ExtenDXAXB, + ExtenDYBYA, + DRUC_FLAG_INCLUSION_RECTANGLE + ); + DrucChaineEquiRectangle ( DrucNouveauRectangle, + Rectangle1 + ); + SetRdsLayer ( DrucNouveauRectangle , + LayerCourant + ); + DrucAddRecFigure ( DrucNouveauRectangle, + DrucFigureRds , + LayerCourant + ); + } + } + break; + } + }/* switch */ + + return ( FlagIsEquiModified + ); +} + +/*------------------------------------------------------------\ +| | +| DrucUnifyRectangle | +| | +\------------------------------------------------------------*/ + +void DrucUnifyRectangle ( DrucFigureRds, + LayerCourant, + RectangleSource + ) + rdsfig_list *DrucFigureRds; + int LayerCourant; + rdsrec_list *RectangleSource; + +{ + +rdsrec_list *TmpRectangle1; +rdsrec_list *TmpRectangle2; +boolean FlagNextRectangle1; +boolean FlagIsEquiModified; +boolean FlagCreateRectangle = DRUC_TRUE; +DrucTypeStructPlusRect *PlusRec1; +DrucTypeStructPlusRect *PlusRec2; + + FlagCreateRectangle = DRUC_FALSE; + do + { + FlagIsEquiModified = DRUC_FALSE; + TmpRectangle1 = RectangleSource; + PlusRec1 = (DrucTypeStructPlusRect *) + ((char *)(TmpRectangle1)+sizeof(rdsrec_list)); + + while ( PlusRec1->NEXT_EQUI != RectangleSource + ) + { + if ( ( TmpRectangle1->FLAGS & DRUC_FLAG_REMOVE ) == DRUC_FLAG_REMOVE + ) + { + TmpRectangle1 = PlusRec1->NEXT_EQUI; + PlusRec1 = (DrucTypeStructPlusRect *) + ((char *)(TmpRectangle1)+sizeof(rdsrec_list)); + continue; + } + TmpRectangle2 = PlusRec1->NEXT_EQUI; + PlusRec2 = (DrucTypeStructPlusRect *) + ((char *)(TmpRectangle2)+sizeof(rdsrec_list)); + + while ( TmpRectangle2 != RectangleSource + ) + { + if ( ( TmpRectangle2->FLAGS & DRUC_FLAG_REMOVE ) == DRUC_FLAG_REMOVE + ) + { + TmpRectangle2 = PlusRec2->NEXT_EQUI; + PlusRec2 = (DrucTypeStructPlusRect *) + ((char *)(TmpRectangle2)+sizeof(rdsrec_list)); + continue; + } + FlagNextRectangle1 = DRUC_FALSE; + + if ( ( DrucIsRectanglesContact ( TmpRectangle1, + TmpRectangle2 + ) + ) == DRUC_TRUE + ) + { + FlagIsEquiModified |= DrucUnifyOrientation ( DrucFigureRds, + LayerCourant, + TmpRectangle1, + TmpRectangle2, + &FlagNextRectangle1, + &FlagCreateRectangle + ); + } + + if ( FlagNextRectangle1 == DRUC_TRUE ) + { + /*\ + * pour passer au rectangle1 suivant car le rectangle1 courant + * est a detruire + \*/ + FlagNextRectangle1 = DRUC_FALSE; + break; + } + + TmpRectangle2 = PlusRec2->NEXT_EQUI; + PlusRec2 = (DrucTypeStructPlusRect *) + ((char *)(TmpRectangle2)+sizeof(rdsrec_list)); + } /* while TmpRectangle2 */ + + TmpRectangle1 = PlusRec1->NEXT_EQUI; + PlusRec1 = (DrucTypeStructPlusRect *) + ((char *)(TmpRectangle1)+sizeof(rdsrec_list)); + } /* while TmpRectangle1 */ + } + + while ( FlagIsEquiModified != DRUC_FALSE + ); +/*\ + * phase de creation des rectangles sur les configurations de croix +\*/ + FlagIsEquiModified = DRUC_FALSE; + TmpRectangle1 = RectangleSource; + PlusRec1 = (DrucTypeStructPlusRect *) + ((char *)(TmpRectangle1)+sizeof(rdsrec_list)); + + while ( PlusRec1->NEXT_EQUI != RectangleSource + ) + { + if ( ( TmpRectangle1->FLAGS & DRUC_FLAG_REMOVE ) == DRUC_FLAG_REMOVE + ) + { + TmpRectangle1 = PlusRec1->NEXT_EQUI; + PlusRec1 = (DrucTypeStructPlusRect *) + ((char *)(TmpRectangle1)+sizeof(rdsrec_list)); + continue; + } + + TmpRectangle2 = PlusRec1->NEXT_EQUI; + PlusRec2 = (DrucTypeStructPlusRect *) + ((char *)(TmpRectangle2)+sizeof(rdsrec_list)); + + while ( TmpRectangle2 != RectangleSource + ) + { + if ( ( TmpRectangle2->FLAGS & DRUC_FLAG_REMOVE ) == DRUC_FLAG_REMOVE + ) + { + TmpRectangle2 = PlusRec2->NEXT_EQUI; + PlusRec2 = (DrucTypeStructPlusRect *) + ((char *)(TmpRectangle2)+sizeof(rdsrec_list)); + continue; + } + FlagNextRectangle1 = DRUC_FALSE; + + if ( ( DrucIsRectanglesContact ( TmpRectangle1, + TmpRectangle2 + ) + ) == DRUC_TRUE + ) + { + if ( ( ( TmpRectangle1->FLAGS & + DRUC_FLAG_INCLUSION_RECTANGLE + ) != + DRUC_FLAG_INCLUSION_RECTANGLE + ) && + ( ( TmpRectangle2->FLAGS & + DRUC_FLAG_INCLUSION_RECTANGLE + ) != + DRUC_FLAG_INCLUSION_RECTANGLE + ) + ) + { + FlagIsEquiModified |= DrucUnifyCreate ( DrucFigureRds, + LayerCourant, + TmpRectangle1, + TmpRectangle2, + &FlagNextRectangle1, + &FlagCreateRectangle + ); + } + } + TmpRectangle2 = PlusRec2->NEXT_EQUI; + PlusRec2 = (DrucTypeStructPlusRect *) + ((char *)(TmpRectangle2)+sizeof(rdsrec_list)); + } /* while TmpRectangle2 */ + + TmpRectangle1 = PlusRec1->NEXT_EQUI; + PlusRec1 = (DrucTypeStructPlusRect *) + ((char *)(TmpRectangle1)+sizeof(rdsrec_list)); + } /* while TmpRectangle1 */ + +/*\ + * dilatation apres creation +\*/ + FlagCreateRectangle = DRUC_FALSE; + + do + { + FlagIsEquiModified = DRUC_FALSE; + TmpRectangle1 = RectangleSource; + PlusRec1 = (DrucTypeStructPlusRect *)((char *)(TmpRectangle1)+sizeof(rdsrec_list)); + while ( PlusRec1->NEXT_EQUI != RectangleSource + ) + { + if ( ( TmpRectangle1->FLAGS & DRUC_FLAG_REMOVE ) == DRUC_FLAG_REMOVE + ) + { + TmpRectangle1 = PlusRec1->NEXT_EQUI; + PlusRec1 = (DrucTypeStructPlusRect *) + ((char *)(TmpRectangle1)+sizeof(rdsrec_list)); + continue; + } + TmpRectangle2 = PlusRec1->NEXT_EQUI; + PlusRec2 = (DrucTypeStructPlusRect *) + ((char *)(TmpRectangle2)+sizeof(rdsrec_list)); + + while ( TmpRectangle2 != RectangleSource + ) + { + if ( ( TmpRectangle2->FLAGS & DRUC_FLAG_REMOVE ) == + DRUC_FLAG_REMOVE + ) + { + TmpRectangle2 = PlusRec2->NEXT_EQUI; + PlusRec2 = (DrucTypeStructPlusRect *) + ((char *)(TmpRectangle2)+sizeof(rdsrec_list)); + continue; + } + + FlagNextRectangle1 = DRUC_FALSE; + + if ( ( DrucIsRectanglesContact ( TmpRectangle1, + TmpRectangle2 + ) + ) == DRUC_TRUE + ) + { + FlagIsEquiModified |= DrucUnifyOrientation ( DrucFigureRds, + LayerCourant, + TmpRectangle1, + TmpRectangle2, + &FlagNextRectangle1, + &FlagCreateRectangle + ); + } + + if ( FlagNextRectangle1 == DRUC_TRUE + ) + { /* pour passer au rectangle1 suivant car le rectangle1 courant est a detruire */ + FlagNextRectangle1 = DRUC_FALSE; + break; + } + + TmpRectangle2 = PlusRec2->NEXT_EQUI; + PlusRec2 = (DrucTypeStructPlusRect *)((char *) + (TmpRectangle2)+sizeof(rdsrec_list)); + } /* while TmpRectangle2 */ + + TmpRectangle1 = PlusRec1->NEXT_EQUI; + PlusRec1 = (DrucTypeStructPlusRect *) + ((char *)(TmpRectangle1)+sizeof(rdsrec_list)); + } /* while TmpRectangle1 */ + } + + while ( FlagIsEquiModified != DRUC_FALSE + ); + TmpRectangle2 = RectangleSource; + + do + { + TmpRectangle2->FLAGS |= DRUC_FLAG_REC_UNIFIE; + TmpRectangle2 = MACRO_NEXT_EQUI ( TmpRectangle2 ); + PlusRec2 = (DrucTypeStructPlusRect *)((char *)(TmpRectangle2)+sizeof(rdsrec_list)); + } + while ( TmpRectangle2 != RectangleSource + ); +} + +/*------------------------------------------------------------\ +| | +| DrucUnifyLayer | +| | +\------------------------------------------------------------*/ + +void DrucUnifyLayer ( DrucFigureRds , + DrucRdsWindow, + LayerCourant + ) + rdsfig_list *DrucFigureRds; + rdswindow *DrucRdsWindow; + int LayerCourant; + +{ + +rdsrec_list *RectangleSource; + +/*\ +DrucViewString ("\nUNIFY LAYER\n" + ); +viewrdsfig ( DrucFigureRds + ); +\*/ + + for ( RectangleSource = DrucFigureRds->LAYERTAB [ LayerCourant ]; + RectangleSource != ( rdsrec_list *)NULL; + RectangleSource = RectangleSource->NEXT + ) + { + +/*\ +DrucViewString ("\nUNIFY layer\n" + ); +viewrdsrec ( RectangleSource + ); +\*/ + + if ( ( ( RectangleSource->FLAGS & DRUC_FLAG_REMOVE ) != DRUC_FLAG_REMOVE ) && + ( ( RectangleSource->FLAGS & DRUC_FLAG_REC_UNIFIE ) != DRUC_FLAG_REC_UNIFIE ) + ) + { + DrucUnifyRectangle ( DrucFigureRds, + LayerCourant, + RectangleSource + ); + } + } + + if ( ( DrucFigureRds->LAYERTAB [ LayerCourant ] ) != (rdsrec_list *)NULL + ) + { +/*\ +DrucViewString ("\nFIN UNIFY layer\n" + ); +viewrdsfig ( DrucFigureRds + ); +\*/ + DrucUnifyRemoveRectanglesEqui ( &(DrucFigureRds->LAYERTAB [ LayerCourant ]), + DrucRdsWindow, + DrucStructRdsLayer [ LayerCourant ].WIDTH + ); + } + + DrucUnifyDeleteEqui ( DrucFigureRds->LAYERTAB [ LayerCourant ] + ); + + DrucClearFlag ( DrucFigureRds->LAYERTAB [ LayerCourant ], + DRUC_FLAG_REC_UNIFIE + ); +/*\ +DrucViewString ("\nFIN UNIFY LAYER\n" + ); +\*/ +} + +/*------------------------------------------------------------\ +| | +| DrucUnify | +| | +\------------------------------------------------------------*/ + +void DrucUnify ( DrucFigureRds, + DrucRdsWindow + ) + rdsfig_list *DrucFigureRds; + rdswindow *DrucRdsWindow; + + +{ + +int IndexLayer; +int LayerCourant; + + for ( IndexLayer = 0; + IndexLayer < RDS_MAX_LAYER ; + IndexLayer ++ + ) + { + LayerCourant = DrucStructRdsLayer [ IndexLayer ].RDS_INDEX ; + if ( LayerCourant != DRUC_UNDEFINED_LAYER + ) + { + if ( ( ( DrucFigureRds->LAYERTAB ) [ LayerCourant ] ) != ( rdsrec_list * ) NULL + ) + { +/*\ +DrucViewString ( "DrucUnify " + ); +DrucViewNumber ( LayerCourant + ); +DrucViewString ( "\n" + ); +\*/ + DrucUnifyLayer ( DrucFigureRds, + DrucRdsWindow, + LayerCourant + ); + } + } + } +} + +/*------------------------------------------------------------\ +| | +| DrucUnifyFigure | +| | +\------------------------------------------------------------*/ + +void DrucUnifyFigure ( DrucFigureRds, + DrucStructRdsLayer + ) + rdsfig_list *DrucFigureRds; + DrucTypeStructRdsLayer *DrucStructRdsLayer; + +{ + +rdswindow *DrucRdsWindow; +rdsins_list *InstanceCourante; +int IndexLayer; +int LayerCourant; + + InstanceCourante = DrucFigureRds->INSTANCE; + DrucFigureRds->INSTANCE = (rdsins_list *)NULL; + + DrucRdsWindow = buildrdswindow ( DrucFigureRds + ); + + if ( DrucRdsWindow->MASK != 0 + ) + { + DrucComputeEquiFigure ( DrucFigureRds + ); +/*\ + DrucVerifEquiFigure ( DrucFigureRds + ); +\*/ + DrucUnify ( DrucFigureRds, + DrucRdsWindow + ); + destroyrdswindow ( DrucFigureRds, + DrucRdsWindow + ); + } + + DrucFigureRds->INSTANCE = InstanceCourante; +} + +/*------------------------------------------------------------\ +| | +| vmcunify Evolutions | +| | +| Patrick 08/03/94: | +| ligne 109 ajouter le test du pointeur null | +| ligne 142 ajouter le test du pointeur null | +| | +| | +\------------------------------------------------------------*/ diff --git a/alliance/src/druc/src/vmcunify.h b/alliance/src/druc/src/vmcunify.h new file mode 100644 index 00000000..a689a396 --- /dev/null +++ b/alliance/src/druc/src/vmcunify.h @@ -0,0 +1,25 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : VMCDEFINE.H | +| | +| Authors : Patrick Renaud | +| | +| Date : 11/01/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Druc VmcUnify Fonctions | +| | +\------------------------------------------------------------*/ +extern void DrucUnifyRemoveRectanglesEqui (); +extern rdsrec_list *DrucCreateRectangle (); +extern void DrucUnifyTransfertInfo (); +extern boolean DrucUnifyOrientation (); +extern void DrucUnifyRectangle (); +extern void DrucUnifyLayer (); +extern void DrucUnify (); +extern void DrucUnifyFigure (); + diff --git a/alliance/src/druc/src/vrd.h b/alliance/src/druc/src/vrd.h new file mode 100644 index 00000000..8b6c7a7f --- /dev/null +++ b/alliance/src/druc/src/vrd.h @@ -0,0 +1,66 @@ +/*------------------------------------------------------------\ +| | +| Tool : DRUC | +| | +| File : DRUCGRAL.H | +| | +| Authors : Renaud Patrick | +| | +| Date : 11/01/94 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef DRUC_104 +# define DRUC_104 + +/*------------------------------------------------------------\ +| | +| Macros | +| | +\------------------------------------------------------------*/ + +#define MACRO_PLUS_TAILLE (sizeof( DrucTypeStructPlusRect )) + +#define MACRO_REGLE_NUM( Rectangle ) \ + (((DrucTypeStructPlusRect *)((char *)(Rectangle)+sizeof(rdsrec_list)))->NOMBRE) +#define MACRO_LAYER_NUM( Rectangle ) \ + (((DrucTypeStructPlusRect *)((char *)(Rectangle)+sizeof(rdsrec_list)))->NOMBRE) + +#define MACRO_INSTANCE_NUM( Rectangle ) \ + (((DrucTypeStructPlusRect *)((char *)(Rectangle)+sizeof(rdsrec_list)))->INSTANCE_NUM) + +#define MACRO_NEXT_EQUI( Rectangle ) \ + (((DrucTypeStructPlusRect *)((char *)(Rectangle)+sizeof(rdsrec_list)))->NEXT_EQUI) + +#define MACRO_NEXT_DEFINE( Rectangle ) \ + (((DrucTypeStructPlusRect *)((char *)(Rectangle)+sizeof(rdsrec_list)))->NEXT_DEFINE) + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct struct_plusrect + { + int NOMBRE; + rdsins_list *INSTANCE_NUM; + rdsrec_list *NEXT_EQUI; + struct struct_plusrect *NEXT_DEFINE; + } DrucTypeStructPlusRect; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern rdsfig_list *drucrdsfig(); + extern char *drucgeterror(); + +# endif diff --git a/alliance/src/gcp/Makefile.am b/alliance/src/gcp/Makefile.am new file mode 100644 index 00000000..af437a64 --- /dev/null +++ b/alliance/src/gcp/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src diff --git a/alliance/src/gcp/configure.in b/alliance/src/gcp/configure.in new file mode 100644 index 00000000..a3a503d8 --- /dev/null +++ b/alliance/src/gcp/configure.in @@ -0,0 +1,47 @@ +dnl +/* +dnl This file is part of the Alliance CAD System +dnl Copyright (C) Laboratoire LIP6 - Département ASIM +dnl Universite Pierre et Marie Curie +dnl +dnl Home page : http://www-asim.lip6.fr/alliance/ +dnl E-mail support : mailto:alliance-support@asim.lip6.fr +dnl +dnl This library is free software; you can redistribute it and/or modify it +dnl under the terms of the GNU Library General Public License as published +dnl by the Free Software Foundation; either version 2 of the License, or (at +dnl your option) any later version. +dnl +dnl Alliance VLSI CAD System is distributed in the hope that it will be +dnl useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +dnl Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License along +dnl with the GNU C Library; see the file COPYING. If not, write to the Free +dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +dnl +dnl Purpose : Auto stuffing Alliance +dnl Almost ten years since I wrote this stuff, I just can't +dnl believe it +dnl Date : 01/02/2002 +dnl Author : Frederic Petrot +dnl $Id: configure.in,v 1.1 2002/03/29 17:39:11 ludo Exp $ +dnl +dnl +AC_INIT(src/gcp.h) +AM_INIT_AUTOMAKE(gcp, 1.1) +AC_PROG_INSTALL +AC_PROG_CC +AC_PROG_YACC +AM_PROG_LEX +AC_HEADER_STDC +AC_C_CONST +AC_PROG_RANLIB + +AM_ALLIANCE + +AC_OUTPUT([ +Makefile +src/Makefile +]) diff --git a/alliance/src/gcp/src/Makefile.am b/alliance/src/gcp/src/Makefile.am new file mode 100644 index 00000000..9a0935d7 --- /dev/null +++ b/alliance/src/gcp/src/Makefile.am @@ -0,0 +1,12 @@ +lib_LIBRARIES = libGcp.a +include_HEADERS = gcp.h +libGcp_a_SOURCES = c_ccomp.y \ +c_cdecl.c c_cdecl.h c_clex.c c_clex.h c_common.c c_common.h c_convert.c \ +c_convert.h c_ctypeck.c c_ctypeck.h c_debug.c c_debug.h c_expand.c c_expand.h \ +c_flags.c c_flags.h c_foldconst.c c_foldconst.h c_gperf.h c_parse.c c_parse.h \ +c_stmt.c c_stmt.h c_tree.c c_treecompat.h c_tree.h gcp.h + +CLEANFILES = c_ccomp.c c_ccomp.h vbl_bcomp_l.c + +c_ccomp.c c_ccomp.h : $(srcdir)/c_ccomp.y + $(YACC) -d $(YFLAGS) $(srcdir)/c_ccomp.y && sed -e "s/yy/c_y_/g" -e "s/YY/C_Y_/g" y.tab.c > c_ccomp.c && sed -e "s/yy/c_y_/g" -e "s/YY/C_Y_/g" y.tab.h > c_ccomp.h diff --git a/alliance/src/gcp/src/c_ccomp.y b/alliance/src/gcp/src/c_ccomp.y new file mode 100644 index 00000000..16380299 --- /dev/null +++ b/alliance/src/gcp/src/c_ccomp.y @@ -0,0 +1,3182 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*WARNING: This file is automatically generated!*/ +/* YACC parser for C syntax and for Objective C. -*-c-*- + Copyright(C) 1987, 88, 89, 92-97, 1998 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or(at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* This file defines the grammar of C and that of Objective C. + ifobjc ... end ifobjc conditionals contain code for Objective C only. + ifc ... end ifc conditionals contain code for C only. + Sed commands in Makefile.in are used to convert this file into + c-parse.y and into objc-parse.y. */ + +/* To whomever it may concern: I have heard that such a thing was once + written by AT&T, but I have never seen it. */ + +%expect 46 + +/* These are the 23 conflicts you should get in parse.output; + the state numbers may vary if minor changes in the grammar are made. + +State 42 contains 1 shift/reduce conflict. (Two ways to parse ATTRIBUTE.) +State 44 contains 1 shift/reduce conflict. (Two ways to recover from error.) +State 103 contains 1 shift/reduce conflict. (Two ways to recover from error.) +State 110 contains 1 shift/reduce conflict. (Two ways to parse ATTRIBUTE.) +State 111 contains 1 shift/reduce conflict. (Two ways to recover from error.) +State 115 contains 1 shift/reduce conflict. (Two ways to recover from error.) +State 132 contains 1 shift/reduce conflict. (See comment at component_decl.) +State 180 contains 1 shift/reduce conflict. (Two ways to parse ATTRIBUTE.) +State 194 contains 2 shift/reduce conflict. (Four ways to parse this.) +State 202 contains 1 shift/reduce conflict. (Two ways to recover from error.) +State 214 contains 1 shift/reduce conflict. (Two ways to recover from error.) +State 220 contains 1 shift/reduce conflict. (Two ways to recover from error.) +State 304 contains 2 shift/reduce conflicts. (Four ways to parse this.) +State 335 contains 2 shift/reduce conflicts. (Four ways to parse this.) +State 347 contains 1 shift/reduce conflict. (Two ways to parse ATTRIBUTES.) +State 352 contains 1 shift/reduce conflict. (Two ways to parse ATTRIBUTES.) +State 383 contains 2 shift/reduce conflicts. (Four ways to parse this.) +State 434 contains 2 shift/reduce conflicts. (Four ways to parse this.) */ + + +%{ + +#include +#include +#include + +# include "mut.h" +# include "aut.h" +# include "gcp.h" + +# include "c_flags.h" +# include "c_tree.h" +# include "c_treecompat.h" +# include "c_cdecl.h" +# include "c_clex.h" +# include "c_convert.h" +# include "c_ctypeck.h" +# include "c_expand.h" +# include "c_stmt.h" +# include "c_common.h" +# include "c_debug.h" + +#ifdef MULTIBYTE_CHARS +#include +#include +#endif + + +#ifndef errno +extern int errno; +#endif + +void yyerror(); + +/* Like YYERROR but do call yyerror. */ +#define YYERROR1 { yyerror("syntax error"); YYERROR; } + +/* Cause the `yydebug' variable to be defined. */ +#define YYDEBUG 1 +%} + +%start program + +/* %union {long itype; tree ttype; enum tree_code code; + char *filename; int lineno; int ends_in_label; } */ + +%union {long itype; + c_tree_node *ttype; + int code; + char *filename; + int lineno; + c_stmt_or_label stmt_or_label; } + +/* All identifiers that are not reserved words + and are not declared typedefs in the current block */ +%token tok_IDENTIFIER + +/* All identifiers that are declared typedefs in the current block. + In some contexts, they are treated just like IDENTIFIER, + but they can also serve as typespecs in declarations. */ +%token tok_TYPENAME + +/* Reserved words that specify storage class. + yylval contains an IDENTIFIER_NODE which indicates which one. */ +%token tok_SCSPEC + +/* Reserved words that specify type. + yylval contains an IDENTIFIER_NODE which indicates which one. */ +%token tok_TYPESPEC + +/* Reserved words that qualify type: "const" or "volatile". + yylval contains an IDENTIFIER_NODE which indicates which one. */ +%token tok_TYPE_QUAL + +/* Character or numeric constants. + yylval is the node for the constant. */ +%token tok_CONSTANT + +/* String constants in raw form. + yylval is a STRING_CST node. */ +%token tok_STRING + +/* "...", used for functions with variable arglists. */ +%token tok_ELLIPSIS + +/* the reserved words */ +/* SCO include files test "ASM", so use something else. */ +%token tok_SIZEOF tok_ENUM tok_STRUCT tok_UNION tok_IF tok_ELSE tok_WHILE tok_DO tok_FOR +%token tok_SWITCH tok_CASE tok_DEFAULT +%token tok_BREAK tok_CONTINUE tok_RETURN tok_GOTO tok_ASM_KEYWORD tok_TYPEOF tok_ALIGNOF +%token tok_ATTRIBUTE tok_EXTENSION tok_LABEL +%token tok_REALPART tok_IMAGPART + +/* Add precedence rules to solve dangling else s/r conflict */ +%nonassoc tok_IF +%nonassoc tok_ELSE + +/* Define the operator tokens and their precedences. + The value is an integer because, if used, it is the tree code + to use in the expression made from the operator. */ + +%right tok_ASSIGN '=' +%right '?' ':' +%left tok_OROR +%left tok_ANDAND +%left '|' +%left '^' +%left '&' +%left tok_EQCOMPARE +%left tok_ARITHCOMPARE +%left tok_LSHIFT tok_RSHIFT +%left '+' '-' +%left '*' '/' '%' +%right tok_UNARY tok_PLUSPLUS tok_MINUSMINUS +%left tok_HYPERUNARY +%left tok_POINTSAT '.' '(' '[' + +/* The Objective-C keywords. These are included in C and in + Objective C, so that the token codes are the same in both. */ +%token tok_INTERFACE tok_IMPLEMENTATION tok_END tok_SELECTOR tok_DEFS tok_ENCODE +%token tok_CLASSNAME tok_PUBLIC tok_PRIVATE tok_PROTECTED +%token tok_PROTOCOL tok_OBJECTNAME tok_CLASS tok_ALIAS + +/* Objective-C string constants in raw form. + yylval is an OBJC_STRING_CST node. */ +%token tok_OBJC_STRING + + +%type unop + +%type identifier tok_IDENTIFIER tok_TYPENAME tok_CONSTANT +%type expr nonnull_exprlist exprlist +%type expr_no_commas cast_expr unary_expr primary string tok_STRING +%type typed_declspecs reserved_declspecs +%type typed_typespecs reserved_typespecquals +%type declmods typespec typespecqual_reserved +%type typed_declspecs_no_prefix_attr reserved_declspecs_no_prefix_attr +%type declmods_no_prefix_attr +%type tok_SCSPEC tok_TYPESPEC tok_TYPE_QUAL nonempty_type_quals maybe_type_qual +%type initdecls notype_initdecls initdcl notype_initdcl +%type init maybeasm +%type asm_operands nonnull_asm_operands asm_operand asm_clobbers +%type maybe_attribute attributes attribute attribute_list attrib +%type any_word + +%type fndef datadef extdefs extdef + +%type compstmt + +%type declarator +%type notype_declarator after_type_declarator +%type parm_declarator + +%type structsp component_decl_list component_decl_list2 +%type component_decl components component_declarator +%type enumlist enumerator +%type typename absdcl absdcl1 type_quals +%type xexpr parms parm identifiers + +%type parmlist parmlist_1 parmlist_2 +%type parmlist_or_identifiers parmlist_or_identifiers_1 +%type identifiers_or_typenames + +%type setspecs +%type setspecs_ludo + +%type lineno_labeled_stmt + +%type lineno_stmt_or_label lineno_stmt_or_labels stmt_or_label stmts xstmts +%type stmt all_iter_stmt all_iter_stmt_simple compstmt_or_error +%type do_stmt_start +%type label + +%type simple_if if_prefix + +%type save_filename +%type save_lineno + + + +%{ +/* Number of statements(loosely speaking) and compound statements + seen so far. */ +static int stmt_count; +static int compstmt_count; + +/* Input file and line number of the end of the body of last simple_if; + used by the stmt-rule immediately after simple_if returns. */ +static char *if_stmt_file; +static int if_stmt_line; + +/* List of types and structure classes of the current declaration. */ +static c_tree_node *current_declspecs =(c_tree_node *)0; +static c_tree_node *prefix_attributes =(c_tree_node *)0; + +/* Stack of saved values of current_declspecs and prefix_attributes. */ +static c_tree_node *declspec_stack; + +/* 1 if we explained undeclared var errors. */ +static int undeclared_variable_notice; + +/* Tell yyparse how to print a token's value, if yydebug is set. */ + +#define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL) +extern void yyprint(); +%} + +%% +program: /* empty */ + { + if (c_pedantic) + { + pedwarn("ANSI C forbids an empty source file"); + } + + c_finish_file( (c_tree_node *)0 ); + } + | extdefs + { + /* In case there were missing closebraces, + get us back to the global binding level. */ + + while(! c_global_bindings_p()) + { + c_pop_level(0, 0, 0); + } + + c_finish_file( c_tree_reverse_list( $1 ) ); + /* LUDO + c_view_bindings(); + */ + } + ; + +/* the reason for the strange actions in this rule + is so that notype_initdecls when reached via datadef + can find a valid list of type and sc specs in $0. */ + +extdefs: + extdef + { + $$ = c_tree_add_head_list( (c_tree_node *)0, $1, (c_tree_node *)0 ); + } + | extdefs + extdef + { + $$ = c_tree_add_head_list( (c_tree_node *)0, $2, $1 ); + } + ; + +extdef: + fndef + { + $$ = $1; + } + | datadef + { + $$ = $1; + } + | tok_ASM_KEYWORD '(' expr ')' ';' + { + CStripNops($3); + + if ( ((CTreeNodeFirstCode($3) == C_EXPR_NODE) && + (CTreeExprCode($3) == C_ADDR_EXPR) && + (CTreeNodeFirstCode(CTreeExprOperand($3,0))== C_STRING_NODE)) || + (CTreeNodeFirstCode($3) == C_STRING_NODE )) + { +# ifdef LUDO_DONE + assemble_asm($3); +# endif + } + else + { + error("argument of `asm' is not a constant string"); + } + + $$ = (c_tree_node *)0; + } + | extension extdef + { + c_pedantic = $1; + $$ = $2; + } + ; + +datadef: + setspecs_ludo notype_initdecls ';' + { + if ( c_pedantic) + { + error("ANSI C forbids data definition with no type or storage class"); + } + else if (!c_flag_traditional) + { + warning("data definition has no type or storage class"); + } + + current_declspecs = CTreeListValue(declspec_stack); + prefix_attributes = CTreeListPurpose(declspec_stack); + declspec_stack = CTreeChain(declspec_stack); + c_resume_momentary($1); + + $$ = $2; + } + | declmods setspecs notype_initdecls ';' + { + current_declspecs = CTreeListValue(declspec_stack); + prefix_attributes = CTreeListPurpose(declspec_stack); + declspec_stack = CTreeChain(declspec_stack); + c_resume_momentary($2); + + $$ = $3; + } + | typed_declspecs setspecs initdecls ';' + { + current_declspecs = CTreeListValue(declspec_stack); + prefix_attributes = CTreeListPurpose(declspec_stack); + declspec_stack = CTreeChain(declspec_stack); + c_resume_momentary($2); + + $$ = $3; + } + | declmods ';' + { + pedwarn("empty declaration"); + + $$ = (c_tree_node *)0; + } + | typed_declspecs ';' + { + c_shadow_tag($1); + + $$ = $1; + } + | error ';' + { + $$ = (c_tree_node *)0; + } + | error '}' + { + $$ = (c_tree_node *)0; + } + | ';' + { + if (c_pedantic) + { + pedwarn("ANSI C does not allow extra `;' outside of a function"); + } + + $$ = (c_tree_node *)0; + } + ; + +fndef: + typed_declspecs setspecs declarator + { + if (! c_start_function(current_declspecs, $3, + prefix_attributes,(c_tree_node *)0, 0)) + { + YYERROR1; + } + c_reinit_parse_for_function(); + } + old_style_parm_decls + { + c_store_parm_decls(); + } + compstmt_or_error + { + $$ = c_finish_function(0,$7); + current_declspecs = CTreeListValue(declspec_stack); + prefix_attributes = CTreeListPurpose(declspec_stack); + declspec_stack = CTreeChain(declspec_stack); + c_resume_momentary($2); + } + | typed_declspecs setspecs declarator error + { + current_declspecs = CTreeListValue(declspec_stack); + prefix_attributes = CTreeListPurpose(declspec_stack); + declspec_stack = CTreeChain(declspec_stack); + c_resume_momentary($2); + + $$ = $3; + } + | declmods setspecs notype_declarator + { + if (! c_start_function(current_declspecs, $3, + prefix_attributes,(c_tree_node *)0, 0)) + { + YYERROR1; + } + c_reinit_parse_for_function(); + } + old_style_parm_decls + { + c_store_parm_decls(); + } + compstmt_or_error + { + $$ = c_finish_function(0,$7); + current_declspecs = CTreeListValue(declspec_stack); + prefix_attributes = CTreeListPurpose(declspec_stack); + declspec_stack = CTreeChain(declspec_stack); + c_resume_momentary($2); + } + | declmods setspecs notype_declarator error + { + current_declspecs = CTreeListValue(declspec_stack); + prefix_attributes = CTreeListPurpose(declspec_stack); + declspec_stack = CTreeChain(declspec_stack); + c_resume_momentary($2); + + $$ = $3; + } + | setspecs_ludo notype_declarator + { + if (! c_start_function((c_tree_node *)0, $2, + prefix_attributes,(c_tree_node *)0, 0)) + { + YYERROR1; + } + c_reinit_parse_for_function(); + } + old_style_parm_decls + { + c_store_parm_decls(); + } + compstmt_or_error + { + $$ = c_finish_function(0,$6); + current_declspecs = CTreeListValue(declspec_stack); + prefix_attributes = CTreeListPurpose(declspec_stack); + declspec_stack = CTreeChain(declspec_stack); + c_resume_momentary($1); + } + | setspecs_ludo notype_declarator error + { + current_declspecs = CTreeListValue(declspec_stack); + prefix_attributes = CTreeListPurpose(declspec_stack); + declspec_stack = CTreeChain(declspec_stack); + c_resume_momentary($1); + + $$ = $2; + } + ; + +identifier: + tok_IDENTIFIER + | tok_TYPENAME + ; + +unop: '&' + { + $$ = C_ADDR_EXPR; + } + | '-' + { + $$ = C_NEGATE_EXPR; + } + | '+' + { + $$ = C_CONVERT_EXPR; + } + | tok_PLUSPLUS + { + $$ = C_PREINCREMENT_EXPR; + } + | tok_MINUSMINUS + { + $$ = C_PREDECREMENT_EXPR; + } + | '~' + { + $$ = C_BIT_NOT_EXPR; + } + | '!' + { + $$ = C_TRUTH_NOT_EXPR; + } + ; + +expr: nonnull_exprlist + { + $$ = c_parser_build_compound_expr($1); + } + ; + +exprlist: + /* empty */ + { + $$ =(c_tree_node *)0; + } + | nonnull_exprlist + ; + +nonnull_exprlist: + expr_no_commas + { + $$ = c_tree_build_list((c_tree_node *)0, $1); + } + | nonnull_exprlist ',' expr_no_commas + { + c_tree_concat_list($1, c_tree_build_list((c_tree_node *)0, $3)); + } + ; + +unary_expr: + primary + | '*' cast_expr %prec tok_UNARY + { + $$ = c_parser_build_indirect_ref( $2, "unary *"); + } + /* __extension__ turns off -c_pedantic for following primary. */ + | extension cast_expr %prec tok_UNARY + { + $$ = $2; + c_pedantic = $1; + } + | unop cast_expr %prec tok_UNARY + { + $$ = c_parser_build_unary_op($1, $2, 0); +# ifdef LUDO_NO_SKIP + overflow_warning($$); +# endif + } + /* Refer to the address of a label as a pointer. */ + | tok_ANDAND identifier + { + c_tree_node *label = c_lookup_label($2); + if (c_pedantic) + { + pedwarn("ANSI C forbids `&&'"); + } + if (label == 0) + { + $$ = c_null_pointer_node; + } + else + { + CSetTreeNodeUsed(label); + $$ = c_tree_build_unary_expr( C_ADDR_EXPR, label); + CTreeType( $$ ) = c_ptr_type_node; + CSetTreeNodeConstant($$); + } + } + | sizeof unary_expr %prec tok_UNARY + { + c_skip_evaluation--; + if ( CTreeExprCode($2) == C_COMPONENT_REF + && CTreeExprCode( CTreeExprOperand($2, 1))) + { + error("`sizeof' applied to a bit-field"); + } + $$ = c_get_c_sizeof(CTreeType($2)); + } + | sizeof '(' typename ')' %prec tok_HYPERUNARY + { + c_skip_evaluation--; + $$ = c_get_c_sizeof(c_groktypename($3)); + } + | alignof unary_expr %prec tok_UNARY + { + c_skip_evaluation--; + $$ = c_get_c_alignof_expr($2); + } + | alignof '(' typename ')' %prec tok_HYPERUNARY + { + c_skip_evaluation--; + $$ = c_get_c_alignof(c_groktypename($3)); + } + | tok_REALPART cast_expr %prec tok_UNARY + { + $$ = c_parser_build_unary_op(C_REALPART_EXPR, $2, 0); + } + | tok_IMAGPART cast_expr %prec tok_UNARY + { + $$ = c_parser_build_unary_op(C_IMAGPART_EXPR, $2, 0); + } + ; + +sizeof: + tok_SIZEOF + { + c_skip_evaluation++; + } + ; + +alignof: + tok_ALIGNOF + { + c_skip_evaluation++; + } + ; + +cast_expr: + unary_expr + | '(' typename ')' cast_expr %prec tok_UNARY + { + c_tree_node *type = c_groktypename($2); + $$ = c_build_c_cast(type, $4); + } + | '(' typename ')' '{' + { + c_start_init((c_tree_node *)0, NULL, 0); + $2 = c_groktypename($2); + c_really_start_incremental_init($2); + } + initlist_maybe_comma '}' %prec tok_UNARY + { + c_tree_node *tmp_node; + + $$ = c_pop_init_level(0); + tmp_node = c_finish_init(); + + if (c_pedantic) + { + pedwarn("ANSI C forbids constructor expressions"); + } + + if ( CTreeTypeCode($2) == C_ARRAY_TYPE && CTreeTypeSize($2) == 0) + { + int failure = c_complete_array_type( $2, $$, 1); + if (failure) abort(); + } + + if ( CTreeDeclInitial( $$ ) == c_error_mark_node ) + CTreeDeclInitial( $$ ) = tmp_node; + } + ; + +expr_no_commas: + cast_expr + | expr_no_commas '+' expr_no_commas + { + $$ = c_parser_build_binary_op($2, $1, $3); + } + | expr_no_commas '-' expr_no_commas + { + $$ = c_parser_build_binary_op($2, $1, $3); + } + | expr_no_commas '*' expr_no_commas + { + $$ = c_parser_build_binary_op($2, $1, $3); + } + | expr_no_commas '/' expr_no_commas + { + $$ = c_parser_build_binary_op($2, $1, $3); + } + | expr_no_commas '%' expr_no_commas + { + $$ = c_parser_build_binary_op($2, $1, $3); + } + | expr_no_commas tok_LSHIFT expr_no_commas + { + $$ = c_parser_build_binary_op($2, $1, $3); + } + | expr_no_commas tok_RSHIFT expr_no_commas + { + $$ = c_parser_build_binary_op($2, $1, $3); + } + | expr_no_commas tok_ARITHCOMPARE expr_no_commas + { + $$ = c_parser_build_binary_op($2, $1, $3); + } + | expr_no_commas tok_EQCOMPARE expr_no_commas + { + $$ = c_parser_build_binary_op($2, $1, $3); + } + | expr_no_commas '&' expr_no_commas + { + $$ = c_parser_build_binary_op($2, $1, $3); + } + | expr_no_commas '|' expr_no_commas + { + $$ = c_parser_build_binary_op($2, $1, $3); + } + | expr_no_commas '^' expr_no_commas + { + $$ = c_parser_build_binary_op($2, $1, $3); + } + | expr_no_commas tok_ANDAND + { + $1 = c_truthvalue_conversion( c_default_conversion($1)); + c_skip_evaluation += $1 == c_boolean_false_node; + } + expr_no_commas + { + c_skip_evaluation -= $1 == c_boolean_false_node; + $$ = c_parser_build_binary_op(C_TRUTH_ANDIF_EXPR, $1, $4); + } + | expr_no_commas tok_OROR + { + $1 = c_truthvalue_conversion(c_default_conversion($1)); + c_skip_evaluation += $1 == c_boolean_true_node; + } + expr_no_commas + { + c_skip_evaluation -= $1 == c_boolean_true_node; + $$ = c_parser_build_binary_op(C_TRUTH_ORIF_EXPR, $1, $4); + } + | expr_no_commas '?' + { + $1 = c_truthvalue_conversion(c_default_conversion($1)); + c_skip_evaluation += $1 == c_boolean_false_node; + } + expr ':' + { + c_skip_evaluation +=(($1 == c_boolean_true_node) + -($1 == c_boolean_false_node)); + } + expr_no_commas + { + c_skip_evaluation -= $1 == c_boolean_true_node; + $$ = c_parser_build_conditional_expr($1, $4, $7); + } + | expr_no_commas '?' + { + if (c_pedantic) + { + pedwarn("ANSI C forbids omitting the middle term of a ?: expression"); + } + $2 = $1; + $1 = c_truthvalue_conversion(c_default_conversion($2)); + c_skip_evaluation += $1 == c_boolean_true_node; + } + ':' expr_no_commas + { + c_skip_evaluation -= $1 == c_boolean_true_node; + $$ = c_parser_build_conditional_expr($1, $2, $5); + } + | expr_no_commas '=' expr_no_commas + { + $$ = c_parser_build_modify_expr($1, C_NOP_EXPR, $3); + CTreeExprComplexity($$) = C_MODIFY_EXPR; + } + | expr_no_commas tok_ASSIGN expr_no_commas + { + $$ = c_parser_build_modify_expr($1, $2, $3); + /* This inhibits warnings in truthvalue_conversion. */ + CTreeExprComplexity($$) = C_UNKNOWN_EXPR; + } + ; + +primary: + tok_IDENTIFIER + { + $$ = c_lastiddecl; + + if (!$$ || $$ == c_error_mark_node) + { + if (yychar == YYEMPTY) yychar = YYLEX; + + if (yychar == '(') + { + /* Ordinary implicit function declaration. */ + $$ = c_implicitly_declare($1); +# ifdef LUDO_DONE + assemble_external($$); +# endif + CSetTreeNodeUsed($$); + } + else if (c_current_function_decl == 0) + { + error("`%s' undeclared here(not in a function)", CTreeIdentPointer($1)); + $$ = c_error_mark_node; + } + else + { + if ( CTreeIdentGlobalValue($1) != c_error_mark_node || + CTreeIdentErrorLocus($1) != c_current_function_decl) + { + error("`%s' undeclared(first use in this function)", + CTreeIdentPointer($1)); + + if (! undeclared_variable_notice) + { + error("(Each undeclared identifier is reported only once"); + error("for each function it appears in.)"); + undeclared_variable_notice = 1; + } + } + $$ = c_error_mark_node; + /* Prevent repeated error messages. */ + + CTreeIdentGlobalValue( $1) = c_error_mark_node; + CTreeIdentErrorLocus( $1 ) = c_current_function_decl; + } + } + else if (CTreeType($$) == c_error_mark_node) + { + $$ = c_error_mark_node; + } + else if (CIsTreeDeclAnticipated($$)) + { + /* The first time we see a build-in function used, + if it has not been declared. */ + CClearTreeDeclAnticipated($$); + if (yychar == YYEMPTY) yychar = YYLEX; + if (yychar == '(') + { + /* Omit the implicit declaration we + would ordinarily do, so we don't lose + the actual built in type. + But print a diagnostic for the mismatch. */ + if ( CTreeDeclCode($$) != C_FUNCTION_DECL) + { + error("`%s' implicitly declared as function", + CTreeIdentPointer(CTreeDeclName($$))); + } + else if (( CTreeTypeMode(CTreeType(CTreeType($$))) + != CTreeTypeMode(c_integer_type_node)) + &&(CTreeType(CTreeType($$)) + != c_void_type_node)) + { + pedwarn("type mismatch in implicit declaration for built-in function `%s'", + CTreeIdentPointer(CTreeDeclName($$))); + } + /* If it really returns void, change that to int. */ + if (CTreeType(CTreeType($$)) == c_void_type_node) + { + CTreeType($$) + = c_tree_build_function_type(c_integer_type_node, + CTreeTypeValues(CTreeType($$))); + } + } + else + { + pedwarn("built-in function `%s' used without declaration", + CTreeIdentPointer(CTreeDeclName($$))); + } + + /* Do what we would ordinarily do when a fn is used. */ +# ifdef LUDO_DONE + assemble_external($$); +# endif + CSetTreeNodeUsed($$); + } + else + { +# ifdef LUDO_DONE + assemble_external($$); +# endif + CSetTreeNodeUsed($$); + } + + if ( ( CTreeNodeFirstCode($$) == C_DECL_NODE ) && + ( CTreeDeclCode($$) == C_CONST_DECL ) ) + { + c_tree_node *type; + + $$ = CTreeDeclInitial( $$ ); + /* This is to prevent an enum whose value is 0 + from being considered a null pointer constant. */ + type = CTreeType( $$ ); + $$ = c_tree_build_unary_expr( C_NOP_EXPR, $$); + CTreeType( $$ ) = type; + CSetTreeNodeConstant($$); + } + } + | tok_CONSTANT + | string + { + $$ = c_tree_combine_strings($1); + } + | '(' expr ')' + { +# ifdef LUDO_NO_SKIP + char class = TREE_CODE_CLASS(TREE_CODE($2)); + if (class == 'e' || class == '1' + || class == '2' || class == '<') + C_SET_EXP_ORIGINAL_CODE($2, ERROR_MARK); +# endif + $$ = $2; + } + | '(' error ')' + { + $$ = c_error_mark_node; + } + | '(' + { + if (c_current_function_decl == 0) + { + error("braced-group within expression allowed only inside a function"); + YYERROR; + } +# ifdef LUDO_NO_SKIP + /* We must force a BLOCK for this level + so that, if it is not expanded later, + there is a way to turn off the entire subtree of blocks + that are contained in it. */ + keep_next_level(); + push_iterator_stack(); + push_label_level(); + $$ = expand_start_stmt_expr(); +# endif + } + compstmt ')' + { +# ifdef LUDO_NO_SKIP + tree rtl_exp; +# endif + if (c_pedantic) + { + pedwarn("ANSI C forbids braced-groups within expressions"); + } +# ifdef LUDO_NO_SKIP + pop_iterator_stack(); + pop_label_level(); + rtl_exp = expand_end_stmt_expr($2); + /* The statements have side effects, so the group does. */ + TREE_SIDE_EFFECTS(rtl_exp) = 1; + + if (TREE_CODE($3) == BLOCK) + { + /* Make a BIND_EXPR for the BLOCK already made. */ + $$ = build(C_BIND_EXPR, CTreeType(rtl_exp), + (c_tree_node *)0, rtl_exp, $3); + /* Remove the block from the tree at this point. + It gets put back at the proper place + when the BIND_EXPR is expanded. */ + delete_block($3); + } + else +# endif + $$ = $3; + } + | primary '(' exprlist ')' %prec '.' + { + $$ = c_parser_build_function_call($1, $3); + } + | primary '[' expr ']' %prec '.' + { + $$ = c_parser_build_array_ref($1, $3); + } + | primary '.' identifier + { + $$ = c_parser_build_component_ref($1, $3); + } + | primary tok_POINTSAT identifier + { + c_tree_node *expr = c_parser_build_indirect_ref($1, "->"); + $$ = c_parser_build_component_ref(expr, $3); + } + | primary tok_PLUSPLUS + { + $$ = c_parser_build_unary_op(C_POSTINCREMENT_EXPR, $1, 0); + } + | primary tok_MINUSMINUS + { + $$ = c_parser_build_unary_op(C_POSTDECREMENT_EXPR, $1, 0); + } + ; + +/* Produces a STRING_CST with perhaps more STRING_CSTs chained onto it. */ +string: + tok_STRING + | string tok_STRING + { + $$ = c_tree_concat_list($1, $2); + } + ; + + +old_style_parm_decls: + /* empty */ + | datadecls + | datadecls tok_ELLIPSIS + /* ... is used here to indicate a varargs function. */ + { + c_c_mark_varargs(); + if (c_pedantic) + { + pedwarn("ANSI C does not permit use of `varargs.h'"); + } + } + ; + +/* The following are analogous to lineno_decl, decls and decl + except that they do not allow nested functions. + They are used for old-style parm decls. */ +lineno_datadecl: + save_filename save_lineno datadecl + { + } + ; + +datadecls: + lineno_datadecl + | errstmt + | datadecls lineno_datadecl + | lineno_datadecl errstmt + ; + +/* We don't allow prefix attributes here because they cause reduce/reduce + conflicts: we can't know whether we're parsing a function decl with + attribute suffix, or function defn with attribute prefix on first old + style parm. */ +datadecl: + typed_declspecs_no_prefix_attr setspecs initdecls ';' + { + current_declspecs = CTreeListValue(declspec_stack); + prefix_attributes = CTreeListPurpose(declspec_stack); + declspec_stack = CTreeChain(declspec_stack); + c_resume_momentary($2); + } + | declmods_no_prefix_attr setspecs notype_initdecls ';' + { + current_declspecs = CTreeListValue(declspec_stack); + prefix_attributes = CTreeListPurpose(declspec_stack); + declspec_stack = CTreeChain(declspec_stack); + c_resume_momentary($2); + } + | typed_declspecs_no_prefix_attr ';' + { + c_shadow_tag_warned($1, 1); + pedwarn("empty declaration"); + } + | declmods_no_prefix_attr ';' + { + pedwarn("empty declaration"); + } + ; + +/* This combination which saves a lineno before a decl + is the normal thing to use, rather than decl itself. + This is to avoid shift/reduce conflicts in contexts + where statement labels are allowed. */ +lineno_decl: + save_filename save_lineno decl + { + } + ; + +decls: + lineno_decl + | errstmt + | decls lineno_decl + | lineno_decl errstmt + ; + +/* records the type and storage class specs to use for processing + the declarators that follow. + Maintains a stack of outer-level values of current_declspecs, + for the sake of parm declarations nested in function declarators. */ +setspecs: /* empty */ + { +# ifdef LUDO_NO_SKIP + $$ = suspend_momentary(); + pending_xref_error(); +# endif + declspec_stack = c_tree_add_head_list(prefix_attributes, + current_declspecs, declspec_stack); + c_split_specs_attrs($0, ¤t_declspecs, &prefix_attributes); + } + ; + +setspecs_ludo: /* empty */ + { +# ifdef LUDO_NO_SKIP + $$ = suspend_momentary(); + pending_xref_error(); +# endif + declspec_stack = c_tree_add_head_list(prefix_attributes, + current_declspecs, declspec_stack); + c_split_specs_attrs(NULL, ¤t_declspecs, &prefix_attributes); + } + ; + +/* ??? Yuck. See after_type_declarator. */ +setattrs: /* empty */ + { + prefix_attributes = c_tree_concat_list(prefix_attributes, $0); + } + ; + +decl: + typed_declspecs setspecs initdecls ';' + { + current_declspecs = CTreeListValue(declspec_stack); + prefix_attributes = CTreeListPurpose(declspec_stack); + declspec_stack = CTreeChain(declspec_stack); + c_resume_momentary($2); + } + | declmods setspecs notype_initdecls ';' + { + current_declspecs = CTreeListValue(declspec_stack); + prefix_attributes = CTreeListPurpose(declspec_stack); + declspec_stack = CTreeChain(declspec_stack); + c_resume_momentary($2); + } + | typed_declspecs ';' + { + c_shadow_tag($1); + } + | declmods ';' + { + pedwarn("empty declaration"); + } + | extension decl + { + c_pedantic = $1; + } + ; + +/* Declspecs which contain at least one type specifier or typedef name. + (Just `const' or `volatile' is not enough.) + A typedef'd name following these is taken as a name to be declared. + Declspecs have a non-NULL CTreeListValue, attributes do not. */ + +typed_declspecs: + typespec reserved_declspecs + { + $$ = c_tree_add_head_list((c_tree_node *)0, $1, $2); + } + | declmods typespec reserved_declspecs + { + $$ = c_tree_concat_list( $3, c_tree_add_head_list((c_tree_node *)0, $2, $1)); + } + ; + +reserved_declspecs: /* empty */ + { + $$ =(c_tree_node *)0; + } + | reserved_declspecs typespecqual_reserved + { + $$ = c_tree_add_head_list((c_tree_node *)0, $2, $1); + } + | reserved_declspecs tok_SCSPEC + { + if (c_extra_warnings) + { + warning("`%s' is not at beginning of declaration", CTreeIdentPointer($2)); + } + $$ = c_tree_add_head_list((c_tree_node *)0, $2, $1); + } + | reserved_declspecs attributes + { + $$ = c_tree_add_head_list($2,(c_tree_node *)0, $1); + } + ; + +typed_declspecs_no_prefix_attr: + typespec reserved_declspecs_no_prefix_attr + { + $$ = c_tree_add_head_list((c_tree_node *)0, $1, $2); + } + | declmods_no_prefix_attr typespec reserved_declspecs_no_prefix_attr + { + $$ = c_tree_concat_list($3, c_tree_add_head_list((c_tree_node *)0, $2, $1)); + } + ; + +reserved_declspecs_no_prefix_attr: + /* empty */ + { + $$ =(c_tree_node *)0; + } + | reserved_declspecs_no_prefix_attr typespecqual_reserved + { + $$ = c_tree_add_head_list((c_tree_node *)0, $2, $1); + } + | reserved_declspecs_no_prefix_attr tok_SCSPEC + { + if (c_extra_warnings) + { + warning("`%s' is not at beginning of declaration", CTreeIdentPointer($2)); + } + $$ = c_tree_add_head_list((c_tree_node *)0, $2, $1); + } + ; + +/* List of just storage classes, type modifiers, and prefix attributes. + A declaration can start with just this, but then it cannot be used + to redeclare a typedef-name. + Declspecs have a non-NULL CTreeListValue, attributes do not. */ + +declmods: + declmods_no_prefix_attr + { + $$ = $1; + } + | attributes + { + $$ = c_tree_add_head_list($1,(c_tree_node *)0,(c_tree_node *)0); + } + | declmods declmods_no_prefix_attr + { + $$ = c_tree_concat_list($2, $1); + } + | declmods attributes + { + $$ = c_tree_add_head_list($2,(c_tree_node *)0, $1); + } + ; + +declmods_no_prefix_attr: + tok_TYPE_QUAL + { + $$ = c_tree_add_head_list((c_tree_node *)0, $1,(c_tree_node *)0); + CSetTreeNodeStatic($$); + } + | tok_SCSPEC + { + $$ = c_tree_add_head_list((c_tree_node *)0, $1,(c_tree_node *)0); + } + | declmods_no_prefix_attr tok_TYPE_QUAL + { + $$ = c_tree_add_head_list((c_tree_node *)0, $2, $1); + CSetTreeNodeStatic($$); + } + | declmods_no_prefix_attr tok_SCSPEC + { + if ( ( c_extra_warnings ) && + ( CIsTreeNodeStatic($1) ) ) + { + warning("`%s' is not at beginning of declaration", CTreeIdentPointer($2)); + } + + $$ = c_tree_add_head_list((c_tree_node *)0, $2, $1); + if ( CIsTreeNodeStatic( $1 ) ) + { + CSetTreeNodeStatic( $$ ); + } + } + ; + + +/* Used instead of declspecs where storage classes are not allowed + (that is, for typenames and structure components). + Don't accept a typedef-name if anything but a modifier precedes it. */ + +typed_typespecs: + typespec reserved_typespecquals + { + $$ = c_tree_add_head_list((c_tree_node *)0, $1, $2); + } + | nonempty_type_quals typespec reserved_typespecquals + { + $$ = c_tree_concat_list($3, c_tree_add_head_list((c_tree_node *)0, $2, $1)); + } + ; + +reserved_typespecquals: /* empty */ + { + $$ =(c_tree_node *)0; + } + | reserved_typespecquals typespecqual_reserved + { + $$ = c_tree_add_head_list((c_tree_node *)0, $2, $1); + } + ; + +/* A typespec(but not a type qualifier). + Once we have seen one of these in a declaration, + if a typedef name appears then it is being redeclared. */ + +typespec: tok_TYPESPEC + | structsp + | tok_TYPENAME + { + /* For a typedef name, record the meaning, not the name. + In case of `foo foo, bar;'. */ + $$ = c_lookup_name($1); + } + | tok_TYPEOF '(' expr ')' + { + $$ = CTreeType($3); + } + | tok_TYPEOF '(' typename ')' + { + $$ = c_groktypename($3); + } + ; + +/* A typespec that is a reserved word, or a type qualifier. */ + +typespecqual_reserved: tok_TYPESPEC + | tok_TYPE_QUAL + | structsp + ; + +initdecls: + initdcl + { + $$ = c_tree_add_head_list( (c_tree_node *)0, $1, (c_tree_node *)0 ); + } + | initdecls ',' initdcl + { + $$ = c_tree_add_head_list( (c_tree_node *)0, $3, $1 ); + } + ; + +notype_initdecls: + notype_initdcl + | notype_initdecls ',' initdcl + ; + +maybeasm: + /* empty */ + { + $$ =(c_tree_node *)0; + } + | tok_ASM_KEYWORD '(' string ')' + { + if (CTreeChain($3)) + { + $3 = c_tree_combine_strings($3); + } + $$ = $3; + } + ; + +initdcl: + declarator maybeasm maybe_attribute '=' + { + $$ = c_start_decl($1, current_declspecs, 1, $3, prefix_attributes); + c_start_init( $$, $2, c_global_bindings_p()); + } + init +/* Note how the declaration of the variable is in effect while its init is parsed! */ + { + c_tree_node *tmp_node; + tmp_node = c_finish_init(); + c_finish_decl($5, $6, $2); + $$ = $5; + + if ( CTreeDeclInitial( $$ ) == c_error_mark_node ) + CTreeDeclInitial( $$ ) = tmp_node; + } + | declarator maybeasm maybe_attribute + { + c_tree_node *d = c_start_decl($1, current_declspecs, 0, $3, prefix_attributes); + c_finish_decl(d,(c_tree_node *)0, $2); + $$ = d; + } + ; + +notype_initdcl: + notype_declarator maybeasm maybe_attribute '=' + { + $$ = c_start_decl($1, current_declspecs, 1, $3, prefix_attributes); + c_start_init($$, $2, c_global_bindings_p()); + } + init +/* Note how the declaration of the variable is in effect while its init is parsed! */ + { + c_tree_node *tmp_node; + tmp_node = c_finish_init(); + + c_decl_attributes($5, $3, prefix_attributes); + c_finish_decl($5, $6, $2); + + if ( CTreeDeclInitial( $5 ) == c_error_mark_node ) + CTreeDeclInitial( $5 ) = tmp_node; + } + | notype_declarator maybeasm maybe_attribute + { + c_tree_node *d; + d = c_start_decl($1, current_declspecs, 0, $3, prefix_attributes); + c_finish_decl(d,(c_tree_node *)0, $2); + } + ; +/* the * rules are dummies to accept the Apollo extended syntax + so that the header files compile. */ +maybe_attribute: + /* empty */ + { + $$ =(c_tree_node *)0; + } + | attributes + { + $$ = $1; + } + ; + +attributes: + attribute + { + $$ = $1; + } + | attributes attribute + { + $$ = c_tree_concat_list($1, $2); + } + ; + +attribute: + tok_ATTRIBUTE '(' '(' attribute_list ')' ')' + { + $$ = $4; + } + ; + +attribute_list: + attrib + { + $$ = $1; + } + | attribute_list ',' attrib + { + $$ = c_tree_concat_list($1, $3); + } + ; + +attrib: + /* empty */ + { + $$ = (c_tree_node *)0; + } + | any_word + { + $$ = c_tree_build_list($1,(c_tree_node *)0); + } + | any_word '(' tok_IDENTIFIER ')' + { + $$ = c_tree_build_list($1, c_tree_build_list((c_tree_node *)0, $3)); + } + | any_word '(' tok_IDENTIFIER ',' nonnull_exprlist ')' + { + $$ = c_tree_build_list($1, c_tree_add_head_list((c_tree_node *)0, $3, $5)); + } + | any_word '(' exprlist ')' + { + $$ = c_tree_build_list($1, $3); + } + ; + +/* This still leaves out most reserved keywords, + shouldn't we include them? */ + +any_word: + identifier + | tok_SCSPEC + | tok_TYPESPEC + | tok_TYPE_QUAL + ; + +/* Initializers. `init' is the entry point. */ + +init: + expr_no_commas + | '{' + { + c_really_start_incremental_init((c_tree_node *)0); + /* Note that the call to clear_momentary + is in process_init_element. */ +# ifdef LUDO_NO_SKIP + push_momentary(); +# endif + } + initlist_maybe_comma '}' + { + $$ = c_pop_init_level(0); +# ifdef LUDO_NO_SKIP + if ($$ == c_error_mark_node + && !(yychar == tok_STRING || yychar == tok_CONSTANT)) + pop_momentary(); + else + pop_momentary_nofree(); +# endif + } + + | error + { + $$ = c_error_mark_node; + } + ; + +/* `initlist_maybe_comma' is the guts of an initializer in braces. */ +initlist_maybe_comma: + /* empty */ + { + if (c_pedantic) + { + pedwarn("ANSI C forbids empty initializer braces"); + } + } + | initlist1 maybecomma + ; + +initlist1: + initelt + | initlist1 ',' initelt + ; + +/* `initelt' is a single element of an initializer. + It may use braces. */ +initelt: + expr_no_commas + { + c_process_init_element($1); + } + | '{' + { + c_push_init_level(0); + } + initlist_maybe_comma '}' + { + c_process_init_element(c_pop_init_level(0)); + } + | error + /* These are for labeled elements. The syntax for an array element + initializer conflicts with the syntax for an Objective-C message, + so don't include these productions in the Objective-C grammar. */ + | '[' expr_no_commas tok_ELLIPSIS expr_no_commas ']' '=' + { + c_set_init_index($2, $4); + } + initelt + | '[' expr_no_commas ']' '=' + { + c_set_init_index($2,(c_tree_node *)0); + } + initelt + | '[' expr_no_commas ']' + { + c_set_init_index($2,(c_tree_node *)0); + } + initelt + | identifier ':' + { + c_set_init_label($1); + } + initelt + | '.' identifier '=' + { + c_set_init_label($2); + } + initelt + ; + +/* Any kind of declarator(thus, all declarators allowed + after an explicit typespec). */ + +declarator: + after_type_declarator + { + $$ = $1; + } + | notype_declarator + { + $$ = $1; + } + ; + +/* A declarator that is allowed only after an explicit typespec. */ + +after_type_declarator: + '(' after_type_declarator ')' + { + $$ = $2; + } + | after_type_declarator '(' parmlist_or_identifiers %prec '.' + { + $$ = c_tree_build_ternary_expr( C_CALL_EXPR, $1, $3, (c_tree_node *)0 ); + } + | after_type_declarator '[' expr ']' %prec '.' + { + $$ = c_tree_build_binary_expr( C_ARRAY_REF, $1, $3 ); + } + | after_type_declarator '[' ']' %prec '.' + { + $$ = c_tree_build_binary_expr( C_ARRAY_REF, $1, (c_tree_node *)0 ); + } + | '*' type_quals after_type_declarator %prec tok_UNARY + { + $$ = c_tree_build_pointer_declarator($2, $3); + } + /* ??? Yuck. setattrs is a quick hack. We can't use + prefix_attributes because $1 only applies to this + declarator. We assume setspecs has already been done. + setattrs also avoids 5 reduce/reduce conflicts(otherwise multiple + attributes could be recognized here or in `attributes'). */ + | attributes setattrs after_type_declarator + { + $$ = $3; + } + | tok_TYPENAME + ; + +/* Kinds of declarator that can appear in a parameter list + in addition to notype_declarator. This is like after_type_declarator + but does not allow a typedef name in parentheses as an identifier + (because it would conflict with a function with that typedef as arg). */ + +parm_declarator: + parm_declarator '(' parmlist_or_identifiers %prec '.' + { + $$ = c_tree_build_ternary_expr( C_CALL_EXPR, $1, $3,(c_tree_node *)0); + } + | parm_declarator '[' expr ']' %prec '.' + { + $$ = c_tree_build_binary_expr( C_ARRAY_REF, $1, $3); + } + | parm_declarator '[' ']' %prec '.' + { + $$ = c_tree_build_binary_expr( C_ARRAY_REF, $1, (c_tree_node *)0); + } + | '*' type_quals parm_declarator %prec tok_UNARY + { + $$ = c_tree_build_pointer_declarator($2, $3); + } + /* ??? Yuck. setattrs is a quick hack. We can't use + prefix_attributes because $1 only applies to this + declarator. We assume setspecs has already been done. + setattrs also avoids 5 reduce/reduce conflicts(otherwise multiple + attributes could be recognized here or in `attributes'). */ + | attributes setattrs parm_declarator + { + $$ = $3; + } + | tok_TYPENAME + ; + +/* A declarator allowed whether or not there has been + an explicit typespec. These cannot redeclare a typedef-name. */ + +notype_declarator: + notype_declarator '(' parmlist_or_identifiers %prec '.' + { + $$ = c_tree_build_ternary_expr(C_CALL_EXPR, $1, $3,(c_tree_node *)0); + } + | '(' notype_declarator ')' + { + $$ = $2; + } + | '*' type_quals notype_declarator %prec tok_UNARY + { + $$ = c_tree_build_pointer_declarator($2, $3); + } + | notype_declarator '[' expr ']' %prec '.' + { + $$ = c_tree_build_binary_expr(C_ARRAY_REF, $1, $3); + } + | notype_declarator '[' ']' %prec '.' + { + $$ = c_tree_build_binary_expr(C_ARRAY_REF, $1,(c_tree_node *)0); + } + /* ??? Yuck. setattrs is a quick hack. We can't use + prefix_attributes because $1 only applies to this + declarator. We assume setspecs has already been done. + setattrs also avoids 5 reduce/reduce conflicts(otherwise multiple + attributes could be recognized here or in `attributes'). */ + | attributes setattrs notype_declarator + { + $$ = $3; + } + | tok_IDENTIFIER + { + $$ = $1; + } + ; + +structsp: + tok_STRUCT identifier '{' + { + $$ = c_start_struct(C_RECORD_TYPE, $2); + /* Start scope of tag before parsing components. */ + } + component_decl_list '}' maybe_attribute + { + $$ = c_finish_struct($4, $5, $7); + } + | tok_STRUCT '{' component_decl_list '}' maybe_attribute + { + $$ = c_finish_struct(c_start_struct(C_RECORD_TYPE,(c_tree_node *)0), $3, $5); + } + | tok_STRUCT identifier + { + $$ = c_xref_tag(C_RECORD_TYPE, $2); + } + | tok_UNION identifier '{' + { + $$ = c_start_struct(C_UNION_TYPE, $2); + } + component_decl_list '}' maybe_attribute + { + $$ = c_finish_struct($4, $5, $7); + } + | tok_UNION '{' component_decl_list '}' maybe_attribute + { + $$ = c_finish_struct(c_start_struct(C_UNION_TYPE,(c_tree_node *)0), $3, $5); + } + | tok_UNION identifier + { + $$ = c_xref_tag(C_UNION_TYPE, $2); + } + | tok_ENUM identifier '{' + { +# ifdef LUDO_NO_SKIP + $3 = suspend_momentary(); +# endif + $$ = c_start_enum($2); + } + enumlist maybecomma_warn '}' maybe_attribute + { + $$ = c_finish_enum($4, c_tree_reverse_list($5), $8); + c_resume_momentary($3); + } + | tok_ENUM '{' + { +# ifdef LUDO_NO_SKIP + $2 = suspend_momentary(); +# endif + $$ = c_start_enum((c_tree_node *)0); + } + enumlist maybecomma_warn '}' maybe_attribute + { + $$ = c_finish_enum($3, c_tree_reverse_list($4), $7); + c_resume_momentary($2); + } + | tok_ENUM identifier + { + $$ = c_xref_tag(C_ENUMERAL_TYPE, $2); + } + ; + +maybecomma: + /* empty */ + | ',' + ; + +maybecomma_warn: + /* empty */ + | ',' + { + if (c_pedantic) + { + pedwarn("comma at end of enumerator list"); + } + } + ; + +component_decl_list: + component_decl_list2 + { + $$ = $1; + } + | component_decl_list2 component_decl + { + $$ = c_tree_concat_list($1, $2); + pedwarn("no semicolon at end of struct or union"); + } + ; + +component_decl_list2: /* empty */ + { + $$ = (c_tree_node *)0; + } + | component_decl_list2 component_decl ';' + { + $$ = c_tree_concat_list($1, $2); + } + | component_decl_list2 ';' + { + if (c_pedantic) + { + pedwarn("extra semicolon in struct or union specified"); + } + } + ; + +/* There is a shift-reduce conflict here, because `components' may + start with a `typename'. It happens that shifting(the default resolution) + does the right thing, because it treats the `typename' as part of + a `typed_typespecs'. + + It is possible that this same technique would allow the distinction + between `notype_initdecls' and `initdecls' to be eliminated. + But I am being cautious and not trying it. */ + +component_decl: + typed_typespecs setspecs components + { + $$ = $3; + current_declspecs = CTreeListValue(declspec_stack); + prefix_attributes = CTreeListPurpose(declspec_stack); + declspec_stack = CTreeChain(declspec_stack); + c_resume_momentary($2); + } + | typed_typespecs + { + if (c_pedantic) + { + pedwarn("ANSI C forbids member declarations with no members"); + } + c_shadow_tag($1); + $$ = (c_tree_node *)0; + } + | nonempty_type_quals setspecs components + { + $$ = $3; + current_declspecs = CTreeListValue(declspec_stack); + prefix_attributes = CTreeListPurpose(declspec_stack); + declspec_stack = CTreeChain(declspec_stack); + c_resume_momentary($2); + } + | nonempty_type_quals + { + if (c_pedantic) + { + pedwarn("ANSI C forbids member declarations with no members"); + } + c_shadow_tag($1); + $$ = (c_tree_node *)0; + } + | error + { + $$ =(c_tree_node *)0; + } + | extension component_decl + { + $$ = $2; + c_pedantic = $1; + } + ; + +components: + component_declarator + | components ',' component_declarator + { + $$ = c_tree_concat_list($1, $3); + } + ; + +component_declarator: + save_filename save_lineno declarator maybe_attribute + { + $$ = c_grokfield($1, $2, $3, current_declspecs,(c_tree_node *)0); + c_decl_attributes($$, $4, prefix_attributes); + } + | save_filename save_lineno + declarator ':' expr_no_commas maybe_attribute + { + $$ = c_grokfield($1, $2, $3, current_declspecs, $5); + c_decl_attributes($$, $6, prefix_attributes); + } + | save_filename save_lineno ':' expr_no_commas maybe_attribute + { + $$ = c_grokfield($1, $2,(c_tree_node *)0, current_declspecs, $4); + c_decl_attributes($$, $5, prefix_attributes); + } + ; + +/* We chain the enumerators in reverse order. + They are put in forward order where enumlist is used. + (The order used to be significant, but no longer is so. + However, we still maintain the order, just to be clean.) */ + +enumlist: + enumerator + | enumlist ',' enumerator + { + if ($1 == c_error_mark_node) + { + $$ = $1; + } + else + { + $$ = c_tree_concat_list($3, $1); + } + } + | error + { + $$ = c_error_mark_node; + } + ; + + +enumerator: + identifier + { + $$ = c_build_enumerator($1,(c_tree_node *)0); + } + | identifier '=' expr_no_commas + { + $$ = c_build_enumerator($1, $3); + } + ; + +typename: + typed_typespecs absdcl + { + $$ = c_tree_build_list($1, $2); + } + | nonempty_type_quals absdcl + { + $$ = c_tree_build_list($1, $2); + } + ; + +absdcl: /* an absolute declarator */ + /* empty */ + { + $$ = (c_tree_node *)0; + } + | absdcl1 + ; + +nonempty_type_quals: + tok_TYPE_QUAL + { + $$ = c_tree_add_head_list((c_tree_node *)0, $1,(c_tree_node *)0); + } + | nonempty_type_quals tok_TYPE_QUAL + { + $$ = c_tree_add_head_list((c_tree_node *)0, $2, $1); + } + ; + +type_quals: + /* empty */ + { + $$ = (c_tree_node *)0; + } + | type_quals tok_TYPE_QUAL + { + $$ = c_tree_add_head_list((c_tree_node *)0, $2, $1); + } + ; + +absdcl1: /* a nonempty absolute declarator */ + '(' absdcl1 ')' + { + $$ = $2; + } + /* `(typedef)1' is `int'. */ + | '*' type_quals absdcl1 %prec tok_UNARY + { + $$ = c_tree_build_pointer_declarator($2, $3); + } + | '*' type_quals %prec tok_UNARY + { + $$ = c_tree_build_pointer_declarator($2,(c_tree_node *)0); + } + | absdcl1 '(' parmlist %prec '.' + { + $$ = c_tree_build_ternary_expr(C_CALL_EXPR, $1, $3,(c_tree_node *)0); + } + | absdcl1 '[' expr ']' %prec '.' + { + $$ = c_tree_build_binary_expr(C_ARRAY_REF, $1, $3); + } + | absdcl1 '[' ']' %prec '.' + { + $$ = c_tree_build_binary_expr(C_ARRAY_REF, $1,(c_tree_node *)0); + } + | '(' parmlist %prec '.' + { + $$ = c_tree_build_ternary_expr( C_CALL_EXPR, (c_tree_node *)0, + $2,(c_tree_node *)0); + } + | '[' expr ']' %prec '.' + { + $$ = c_tree_build_binary_expr(C_ARRAY_REF,(c_tree_node *)0, $2); + } + | '[' ']' %prec '.' + { + $$ = c_tree_build_binary_expr(C_ARRAY_REF,(c_tree_node *)0,(c_tree_node *)0); + } + /* ??? It appears we have to support attributes here, however + using prefix_attributes is wrong. */ + ; + +/* at least one statement, the first of which parses without error. */ +/* stmts is used only after decls, so an invalid first statement + is actually regarded as an invalid decl and part of the decls. */ + +stmts: + lineno_stmt_or_labels + { + if (c_pedantic && $1.ends_in_label) + { + pedwarn("ANSI C forbids label at end of compound statement"); + } + + $$ = $1; + } + ; + +lineno_stmt_or_labels: + lineno_stmt_or_label + { + $$ = $1; + } + | lineno_stmt_or_labels lineno_stmt_or_label + { + $$.stmt = c_tree_concat_list( $2.stmt, $1.stmt ); + $$.ends_in_label = $2.ends_in_label; + } + | lineno_stmt_or_labels errstmt + { + $$.stmt = $1.stmt; + $$.ends_in_label = 0; + } + ; + +xstmts: + /* empty */ + { + $$.ends_in_label = 0; + $$.stmt = (c_tree_node *)0; + } + | stmts + { + $$ = $1; + } + ; + +errstmt: error ';' + ; + +pushlevel: /* empty */ + { + c_emit_line_note(c_input_filename, c_lineno); + c_push_level(0); +# ifdef LUDO_NO_SKIP + clear_last_expr(); + push_momentary(); + expand_start_bindings(0); +# endif + } + ; + +/* Read zero or more forward-declarations for labels + that nested functions can jump to. */ +maybe_label_decls: + /* empty */ + | label_decls + { + if (c_pedantic) + { + pedwarn("ANSI C forbids label declarations"); + } + } + ; + +label_decls: + label_decl + | label_decls label_decl + ; + +label_decl: + tok_LABEL identifiers_or_typenames ';' + { + c_tree_node *link; + for(link = $2; link; link = CTreeChain(link)) + { + c_tree_node *label = c_shadow_label(CTreeListValue(link)); + CSetTreeDeclDeclaredLabel(label); + /* + c_declare_nonlocal_label(label); + */ + } + } + ; + +/* This is the body of a function definition. + It causes syntax errors to ignore to the next openbrace. */ +compstmt_or_error: + compstmt + { + $$ = $1; + } + | error compstmt + { + $$ = $2; + } + ; + +compstmt_start: '{' + { + compstmt_count++; + } + +compstmt: compstmt_start '}' + { +# ifdef LUDO_NO_SKIP + $$ = c_convert_expr(c_void_type_node, c_integer_zero_node); +# else + $$ = (c_tree_node *)0; +# endif + } + | compstmt_start pushlevel maybe_label_decls decls xstmts '}' + { + c_emit_line_note(c_input_filename, c_lineno); +# ifdef LUDO_NO_SKIP + expand_end_bindings(c_get_decls(), 1, 0); +# endif + + $$ = c_pop_level(1, 1, 0); + $5.stmt = c_tree_reverse_list( $5.stmt ); + + if ( $$ != (c_tree_node *)0 ) + { + CTreeBlockBody( $$ ) = $5.stmt; + } + else + { + $$ = $5.stmt; + } + +# ifdef LUDO_NO_SKIP + if (yychar == CONSTANT || yychar == STRING) + pop_momentary_nofree(); + else + pop_momentary(); +# endif + $$ = c_tree_add_head_list( (c_tree_node *)0, $$, (c_tree_node *)0 ); + } + | compstmt_start pushlevel maybe_label_decls error '}' + { + c_emit_line_note(c_input_filename, c_lineno); +# ifdef LUDO_NO_SKIP + expand_end_bindings(getdecls(), c_kept_level_p(), 0); +# endif + + $$ = c_pop_level(c_kept_level_p(), 0, 0); + +# ifdef LUDO_NO_SKIP + if (yychar == CONSTANT || yychar == STRING) + pop_momentary_nofree(); + else + pop_momentary(); +# endif + $$ = c_tree_add_head_list( (c_tree_node *)0, $$, (c_tree_node *)0 ); + } + | compstmt_start pushlevel maybe_label_decls stmts '}' + { + c_emit_line_note(c_input_filename, c_lineno); +# ifdef LUDO_NO_SKIP + expand_end_bindings(getdecls(), c_kept_level_p(), 0); +# endif + + $$ = c_pop_level(c_kept_level_p(), 0, 0); + $4.stmt = c_tree_reverse_list( $4.stmt ); + + if ( $$ != (c_tree_node *)0 ) + { + CTreeBlockBody( $$ ) = $4.stmt; + } + else + { + $$ = $4.stmt; + } + +# ifdef LUDO_NO_SKIP + if (yychar == CONSTANT || yychar == STRING) + pop_momentary_nofree(); + else + pop_momentary(); +# endif + $$ = c_tree_add_head_list( (c_tree_node *)0, $$, (c_tree_node *)0 ); + } + ; + +/* Value is number of statements counted as of the closeparen. */ +simple_if: + if_prefix lineno_labeled_stmt + { + $$ = $1; + CTreeInstIfThen( $$ ) = c_tree_reverse_list( $2 ); + } +/* Make sure c_expand_end_cond is run once + for each call to c_expand_start_cond. + Otherwise a crash is likely. */ + | if_prefix error + { + $$ = $1; + } + ; + +if_prefix: + tok_IF '(' expr ')' + { + c_emit_line_note($-1, $0); + $3 = c_truthvalue_conversion( $3 ); +# ifdef LUDO_NO_SKIP + c_expand_start_cond($3, 0, compstmt_count); +# endif + $$ = stmt_count; + if_stmt_file = $-1; + if_stmt_line = $0; + c_position_after_white_space(); + + $$ = c_tree_build_inst( C_IF_INST ); + CTreeInstIfCond( $$ ) = $3; + } + ; + +/* This is a subroutine of stmt. + It is used twice, once for valid DO statements + and once for catching errors in parsing the end test. */ +do_stmt_start: + tok_DO + { + stmt_count++; + compstmt_count++; + c_emit_line_note($-1, $0); + /* See comment in `while' alternative, above. */ +# ifdef LUDO_NO_SKIP + emit_nop(); + expand_start_loop_continue_elsewhere(1); +# endif + c_position_after_white_space(); + } + lineno_labeled_stmt tok_WHILE + { +# ifdef LUDO_NO_SKIP + expand_loop_continue_here(); +# endif + $$ = c_tree_build_inst( C_DO_INST ); + CTreeInstDoBody( $$ ) = c_tree_reverse_list( $3 ); + } + ; + +save_filename: + { + $$ = c_input_filename; + } + ; + +save_lineno: + { + $$ = c_lineno; + } + ; + +lineno_labeled_stmt: + save_filename save_lineno stmt + { + $$ = $3; + } + | save_filename save_lineno label lineno_labeled_stmt + { + c_tree_node *label = c_tree_add_head_list( (c_tree_node *)0, $3, (c_tree_node *)0 ); + $$ = c_tree_concat_list( $4, label ); + } + ; + +lineno_stmt_or_label: + save_filename save_lineno stmt_or_label + { + $$ = $3; + } + ; + +stmt_or_label: + stmt + { + $$.stmt = $1; + $$.ends_in_label = 0; + } + | label + { + c_tree_node *label = c_tree_add_head_list( (c_tree_node *)0, $1, (c_tree_node *)0 ); + $$.stmt = label; + $$.ends_in_label = 1; + } + ; + +/* Parse a single real statement, not including any labels. */ +stmt: + compstmt + { + stmt_count++; + $$ = $1; + } + | all_iter_stmt + { + $$ = $1; + } + | expr ';' + { + stmt_count++; + c_emit_line_note($-1, $0); +/* It appears that this should not be done--that a non-lvalue array + shouldn't get an error if the value isn't used. + Section 3.2.2.1 says that an array lvalue gets converted to a pointer + if it appears as a top-level expression, + but says nothing about non-lvalue arrays. */ +# ifdef LUDO_NO_SKIP + c_iterator_expand($1); + clear_momentary(); +# endif + $$ = c_tree_add_head_list( (c_tree_node *)0, $1, (c_tree_node *)0 ); + } + | simple_if tok_ELSE + { +# ifdef LUDO_NO_SKIP + c_expand_start_else(); + $1 = stmt_count; +# endif + c_position_after_white_space(); + } + lineno_labeled_stmt + { +# ifdef LUDO_NO_SKIP + c_expand_end_cond(); + if (c_extra_warnings && stmt_count == $1) + { + warning("empty body in an else-statement"); + } +# endif + + CTreeInstIfElse( $1 ) = c_tree_reverse_list( $4 ); + $$ = c_tree_add_head_list( (c_tree_node *)0, $1, (c_tree_node *)0 ); + } + | simple_if %prec tok_IF + { +# ifdef LUDO_NO_SKIP + c_expand_end_cond(); + /* This warning is here instead of in simple_if, because we + do not want a warning if an empty if is followed by an + else statement. Increment stmt_count so we don't + give a second error if this is a nested `if'. */ + if (c_extra_warnings && stmt_count++ == $1) + { + warning_with_file_and_line(if_stmt_file, if_stmt_line, + "empty body in an if-statement"); + } +# endif + $$ = c_tree_add_head_list( (c_tree_node *)0, $1, (c_tree_node *)0 ); + } +/* Make sure c_expand_end_cond is run once + for each call to c_expand_start_cond. + Otherwise a crash is likely. */ + | simple_if tok_ELSE error + { +# ifdef LUDO_NO_SKIP + c_expand_end_cond(); +# endif + $$ = c_tree_add_head_list( (c_tree_node *)0, $1, (c_tree_node *)0 ); + } + | tok_WHILE + { + stmt_count++; + c_emit_line_note($-1, $0); +# ifdef LUDO_NO_SKIP + /* The emit_nop used to come before emit_line_note, + but that made the nop seem like part of the preceding line. + And that was confusing when the preceding line was + inside of an if statement and was not really executed. + I think it ought to work to put the nop after the line number. + We will see. --rms, July 15, 1991. */ + emit_nop(); +# endif + } + '(' expr ')' + { +# ifdef LUDO_NO_SKIP + /* Don't start the loop till we have succeeded + in parsing the end test. This is to make sure + that we end every loop we start. */ + expand_start_loop(1); +# endif + c_emit_line_note(c_input_filename, c_lineno); + $4 = c_truthvalue_conversion( $4 ); +# ifdef LUDO_NO_SKIP + expand_exit_loop_if_false(NULL_PTR, $4 ); +# endif + c_position_after_white_space(); + } + lineno_labeled_stmt + { +# ifdef LUDO_NO_SKIP + expand_end_loop(); +# endif + $$ = c_tree_build_inst( C_WHILE_INST ); + CTreeInstWhileCond( $$ ) = $4; + CTreeInstWhileBody( $$ ) = c_tree_reverse_list( $7 ); + + $$ = c_tree_add_head_list( (c_tree_node *)0, $$, (c_tree_node *)0 ); + } + | do_stmt_start + '(' expr ')' ';' + { + c_emit_line_note(c_input_filename, c_lineno); + $3 = c_truthvalue_conversion( $3 ); +# ifdef LUDO_NO_SKIP + expand_exit_loop_if_false(NULL_PTR, $3 ); + expand_end_loop(); + clear_momentary(); +# endif + $$ = $1; + CTreeInstDoCond( $$ ) = $3; + + $$ = c_tree_add_head_list( (c_tree_node *)0, $$, (c_tree_node *)0 ); + } +/* This rule is needed to make sure we end every loop we start. */ + | do_stmt_start error + { +# ifdef LUDO_NO_SKIP + expand_end_loop(); + clear_momentary(); +# endif + $$ = c_tree_add_head_list( (c_tree_node *)0, $1, (c_tree_node *)0 ); + } + | tok_FOR + '(' xexpr ';' + { + stmt_count++; + c_emit_line_note($-1, $0); +# ifdef LUDO_NO_SKIP + /* See comment in `while' alternative, above. */ + emit_nop(); + if ($3) c_expand_expr_stmt($3); + /* Next step is to call expand_start_loop_continue_elsewhere, + but wait till after we parse the entire for(...). + Otherwise, invalid input might cause us to call that + fn without calling expand_end_loop. */ +# endif + } + xexpr ';' + /* Can't emit now; wait till after expand_start_loop... */ + { + $7 = c_lineno; + $$ = c_input_filename; + } + xexpr ')' + { +# ifdef LUDO_NO_SKIP + + /* Start the loop. Doing this after parsing + all the expressions ensures we will end the loop. */ + expand_start_loop_continue_elsewhere(1); +# endif + /* Emit the end-test, with a line number. */ + c_emit_line_note($8, $7); + + if ( $6 ) + { + $6 = c_truthvalue_conversion( $6 ); +# ifdef LUDO_NO_SKIP + expand_exit_loop_if_false(NULL_PTR, $6 ); + /* Don't let the tree nodes for $9 be discarded by + clear_momentary during the parsing of the next stmt. */ + push_momentary(); +# endif + } + $7 = c_lineno; + $8 = c_input_filename; + c_position_after_white_space(); + } + lineno_labeled_stmt + { + /* Emit the increment expression, with a line number. */ + c_emit_line_note($8, $7); +# ifdef LUDO_NO_SKIP + expand_loop_continue_here(); + if ($9) + c_expand_expr_stmt($9); + if (yychar == CONSTANT || yychar == STRING) + pop_momentary_nofree(); + else + pop_momentary(); + expand_end_loop(); +# endif + $$ = c_tree_build_inst( C_FOR_INST ); + CTreeInstForStart( $$ ) = $3; + CTreeInstForCond( $$ ) = $6; + CTreeInstForInc( $$ ) = $9; + CTreeInstForBody( $$ ) = $12; + + $$ = c_tree_add_head_list( (c_tree_node *)0, $$, (c_tree_node *)0 ); + } + | tok_SWITCH '(' expr ')' + { + stmt_count++; + c_emit_line_note($-1, $0); +# ifdef LUDO_NO_SKIP + c_expand_start_case($3); + /* Don't let the tree nodes for $3 be discarded by + clear_momentary during the parsing of the next stmt. */ + push_momentary(); +# endif + c_position_after_white_space(); + } + lineno_labeled_stmt + { +# ifdef LUDO_NO_SKIP + expand_end_case($3); + if (yychar == CONSTANT || yychar == STRING) + pop_momentary_nofree(); + else + pop_momentary(); +# endif + + $$ = c_tree_build_inst( C_SWITCH_INST ); + CTreeInstSwitchOn( $$ ) = $3; + CTreeInstSwitchBody( $$ ) = $6; + } + | tok_BREAK ';' + { + stmt_count++; + c_emit_line_note($-1, $0); +# ifdef LUDO_NO_SKIP + if ( ! expand_exit_something()) + error("break statement not within loop or switch"); +# endif + $$ = c_tree_build_inst( C_BREAK_INST ); + $$ = c_tree_add_head_list( (c_tree_node *)0, $$, (c_tree_node *)0 ); + } + | tok_CONTINUE ';' + { + stmt_count++; + c_emit_line_note($-1, $0); +# ifdef LUDO_NO_SKIP + if (! expand_continue_loop(NULL_PTR)) + error("continue statement not within a loop"); +# endif + $$ = c_tree_build_inst( C_CONTINUE_INST ); + $$ = c_tree_add_head_list( (c_tree_node *)0, $$, (c_tree_node *)0 ); + } + | tok_RETURN ';' + { + stmt_count++; + c_emit_line_note($-1, $0); +# ifdef LUDO_NO_SKIP + c_expand_return((c_tree_node *)0); +# endif + $$ = c_tree_build_inst( C_RETURN_INST ); + $$ = c_tree_add_head_list( (c_tree_node *)0, $$, (c_tree_node *)0 ); + } + | tok_RETURN expr ';' + { + stmt_count++; + c_emit_line_note($-1, $0); +# ifdef LUDO_NO_SKIP + c_expand_return($2); +# endif + $$ = c_tree_build_inst( C_RETURN_INST ); + CTreeInstReturnValue( $$ ) = $2; + + $$ = c_tree_add_head_list( (c_tree_node *)0, $$, (c_tree_node *)0 ); + } + | tok_ASM_KEYWORD maybe_type_qual '(' expr ')' ';' + { + stmt_count++; + c_emit_line_note($-1, $0); + CStripNops($4); + + if (( CTreeExprCode($4) == C_ADDR_EXPR + && CTreeNodeFirstCode( CTreeExprOperand($4, 0)) == C_STRING_NODE) + || CTreeNodeFirstCode($4) == C_STRING_NODE) + { +# ifdef LUDO_NO_SKIP + expand_asm($4); +# endif + } + else + { + error("argument of `asm' is not a constant string"); + } + + $$ = (c_tree_node *)0; + } +/* This is the case with just output operands. */ + | tok_ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ')' ';' + { + stmt_count++; + c_emit_line_note($-1, $0); +# ifdef LUDO_NO_SKIP + c_expand_asm_operands($4, $6,(c_tree_node *)0,(c_tree_node *)0, + $2 == ridpointers[(int)RID_VOLATILE], + c_input_filename, c_lineno); +# endif + $$ = (c_tree_node *)0; + } +/* This is the case with input operands as well. */ + | tok_ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ':' asm_operands ')' ';' + { + stmt_count++; + c_emit_line_note($-1, $0); +# ifdef LUDO_NO_SKIP + c_expand_asm_operands($4, $6, $8,(c_tree_node *)0, + $2 == ridpointers[(int)RID_VOLATILE], + c_input_filename, c_lineno); +# endif + $$ = (c_tree_node *)0; + } +/* This is the case with clobbered registers as well. */ + | tok_ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ':' + asm_operands ':' asm_clobbers ')' ';' + { + stmt_count++; + c_emit_line_note($-1, $0); +# ifdef LUDO_NO_SKIP + c_expand_asm_operands($4, $6, $8, $10, $2 == ridpointers[(int)RID_VOLATILE], + c_input_filename, c_lineno); +# endif + $$ = (c_tree_node *)0; + } + | tok_GOTO identifier ';' + { + c_tree_node *decl; + stmt_count++; + c_emit_line_note($-1, $0); + decl = c_lookup_label($2); + + if (decl != 0) + { + CSetTreeNodeUsed(decl); +# ifdef LUDO_NO_SKIP + expand_goto(decl); +# endif + } + $$ = c_tree_build_inst( C_GOTO_INST ); + CTreeInstGotoLabel( $$ ) = decl; + $$ = c_tree_add_head_list( (c_tree_node *)0, $$, (c_tree_node *)0 ); + } + | tok_GOTO '*' expr ';' + { + if ( c_pedantic ) + { + pedwarn("ANSI C forbids `goto *expr;'"); + } + stmt_count++; + c_emit_line_note($-1, $0); + $3 = c_convert_expr(c_ptr_type_node, $3); + + $$ = c_tree_build_inst( C_GOTO_INST ); + CTreeInstGotoLabel( $$ ) = $3; + + $$ = c_tree_add_head_list( (c_tree_node *)0, $$, (c_tree_node *)0 ); + +# ifdef LUDO_NO_SKIP + expand_computed_goto($3); +# endif + } + | ';' + { + $$ = (c_tree_node *)0; + } + ; + +all_iter_stmt: + all_iter_stmt_simple +/* | all_iter_stmt_with_decl */ + ; + +all_iter_stmt_simple: + tok_FOR '(' primary ')' + { + /* The value returned by this action is */ + /* 1 if everything is OK */ + /* 0 in case of error or already bound iterator */ + + $$ = 0; + + if ( ( CTreeNodeFirstCode($3) != C_DECL_NODE ) || + ( CTreeDeclCode($3) != C_VAR_DECL ) ) + { + error("invalid `for(ITERATOR)' syntax"); + } + else if (! CIsTreeDeclIterator($3)) + { + error("`%s' is not an iterator", + CTreeIdentPointer(CTreeDeclName($3))); + } + else if ( CIsTreeNodeReadOnly($3)) + { + error("`for(%s)' inside expansion of same iterator", + CTreeIdentPointer(CTreeDeclName($3))); + } + else + { + $$ = 1; +# ifdef LUDO_NO_SKIP + iterator_for_loop_start($3); +# endif + } + } + lineno_labeled_stmt + { + $$ = (c_tree_node *)0; + + if ($5) + { +# ifdef LUDO_NO_SKIP + iterator_for_loop_end($3); +# endif + } + } + +/* Any kind of label, including jump labels and case labels. + ANSI C accepts labels only before statements, but we allow them + also at the end of a compound statement. */ + +label: tok_CASE expr_no_commas ':' + { + c_tree_node *value = c_check_case_value($2); +# ifdef LUDO_NO_SKIP + c_tree_node *label + = c_tree_build_decl(C_LABEL_DECL,(c_tree_node *)0,(c_tree_node *)0); +# endif + + stmt_count++; + + if (value != c_error_mark_node) + { +# ifdef LUDO_NO_SKIP + c_tree_node *duplicate; + int success = c_push_case(value, c_convert_and_check, label, &duplicate); + + if (success == 1) + { + error("case label not within a switch statement"); + } + else if (success == 2) + { + error("duplicate case value"); + error_with_decl(duplicate, "this is the first entry for that value"); + } + else if (success == 3) + { + warning("case value out of range"); + } + else if (success == 5) + { + error("case label within scope of cleanup or variable array"); + } +# endif + } + + $$ = c_tree_build_inst( C_CASE_INST ); + CTreeInstCaseCode( $$ ) = C_STANDARD_CASE; + CTreeInstCaseFrom( $$ ) = value; + CTreeInstCaseTo( $$ ) = value; + + c_position_after_white_space(); + } + | tok_CASE expr_no_commas tok_ELLIPSIS expr_no_commas ':' + { + c_tree_node *value1 = c_check_case_value($2); + c_tree_node *value2 = c_check_case_value($4); +# ifdef LUDO_NO_SKIP + c_tree_node *label + = c_tree_build_decl(C_LABEL_DECL,(c_tree_node *)0,(c_tree_node *)0); +# endif + + if (c_pedantic) + { + pedwarn("ANSI C forbids case ranges"); + } + stmt_count++; + + $$ = c_error_mark_node; + + if (value1 != c_error_mark_node && value2 != c_error_mark_node) + { +# ifdef LUDO_NO_SKIP + c_tree_node *duplicate; + int success = c_push_case_range(value1, value2, c_convert_and_check, label, + &duplicate); + if (success == 1) + { + error("case label not within a switch statement"); + } + else if (success == 2) + { + error("duplicate case value"); + error_with_decl(duplicate, "this is the first entry for that value"); + } + else if (success == 3) + { + warning("case value out of range"); + } + else if (success == 4) + { + warning("empty case range"); + } + else if (success == 5) + { + error("case label within scope of cleanup or variable array"); + } + else +# endif + } + + $$ = c_tree_build_inst( C_CASE_INST ); + CTreeInstCaseCode( $$ ) = C_RANGE_CASE; + CTreeInstCaseFrom( $$ ) = value1; + CTreeInstCaseTo( $$ ) = value2; + c_position_after_white_space(); + } + | tok_DEFAULT ':' + { +# ifdef LUDO_NO_SKIP + c_tree_node *duplicate; + c_tree_node *label + = c_tree_build_decl(C_LABEL_DECL,(c_tree_node *)0,(c_tree_node *)0); + int success = c_push_case((c_tree_node *)0, 0, label, &duplicate); +# endif + stmt_count++; + + $$ = c_error_mark_node; + +# ifdef LUDO_NO_SKIP + if (success == 1) + { + error("default label not within a switch statement"); + } + else if (success == 2) + { + error("multiple default labels in one switch"); + error_with_decl(duplicate, "this is the first default label"); + } + else +# endif + + $$ = c_tree_build_inst( C_CASE_INST ); + CTreeInstCaseCode( $$ ) = C_DEFAULT_CASE; + c_position_after_white_space(); + } + | identifier ':' + { + c_tree_node *label = c_define_label(c_input_filename, c_lineno, $1); + stmt_count++; + +# ifdef LUDO_NO_SKIP + emit_nop(); + if (label) + { + expand_label(label); + } +# endif + $$ = label; + c_position_after_white_space(); + } + ; + +/* Either a type-qualifier or nothing. First thing in an `asm' statement. */ + +maybe_type_qual: + /* empty */ + { + c_emit_line_note(c_input_filename, c_lineno); + $$ =(c_tree_node *)0; + } + | tok_TYPE_QUAL + { + c_emit_line_note(c_input_filename, c_lineno); + $$ =(c_tree_node *)0; + } + ; + +xexpr: + /* empty */ + { + $$ =(c_tree_node *)0; + } + | expr + ; + +/* These are the operands other than the first string and colon + in asm("addextend %2,%1": "=dm"(x), "0"(y), "g"(*x)) */ +asm_operands: /* empty */ + { + $$ = (c_tree_node *)0; + } + | nonnull_asm_operands + ; + +nonnull_asm_operands: + asm_operand + | nonnull_asm_operands ',' asm_operand + { + $$ = c_tree_concat_list($1, $3); + } + ; + +asm_operand: + tok_STRING '(' expr ')' + { + $$ = c_tree_build_list($1, $3); + } + ; + +asm_clobbers: + string + { + $$ = c_tree_add_head_list((c_tree_node *)0, + c_tree_combine_strings($1),(c_tree_node *)0); + } + | asm_clobbers ',' string + { + $$ = c_tree_add_head_list((c_tree_node *)0, + c_tree_combine_strings($3), $1); + } + ; + +/* This is what appears inside the parens in a function declarator. + Its value is a list of ..._TYPE nodes. */ +parmlist: + { + c_push_level(0); + c_clear_parm_order(); + c_declare_parm_level(0); + } + parmlist_1 + { + $$ = $2; + c_parmlist_tags_warning(); + c_pop_level(0, 0, 0); + } + ; + +parmlist_1: + parmlist_2 ')' + { + $$ = $1; + } + | parms ';' + { + c_tree_node *parm; + + if ( c_pedantic ) + { + pedwarn("ANSI C forbids forward parameter declarations"); + } + /* Mark the forward decls as such. */ + for(parm = c_get_decls(); parm; parm = CTreeChain(parm)) + { + CSetTreeNodeAsmWritten(parm); + } + c_clear_parm_order(); + } + parmlist_1 + { + $$ = $4; + } + | error ')' + { + $$ = c_tree_add_head_list((c_tree_node *)0,(c_tree_node *)0,(c_tree_node *)0); + } + ; + +/* This is what appears inside the parens in a function declarator. + Is value is represented in the format that grokdeclarator expects. */ +parmlist_2: /* empty */ + { + $$ = c_get_parm_info(0); + } + | tok_ELLIPSIS + { + $$ = c_get_parm_info(0); + /* Gcc used to allow this as an extension. However, it does + not work for all targets, and thus has been disabled. + Also, since func(...) and func() are indistinguishable, + it caused problems with the code in expand_builtin which + tries to verify that BUILT_IN_NEXT_ARG is being used + correctly. */ + error("ANSI C requires a named argument before `...'"); + } + | parms + { + $$ = c_get_parm_info(1); + } + | parms ',' tok_ELLIPSIS + { + $$ = c_get_parm_info(0); + } + ; + +parms: + parm + { + c_push_parm_decl($1); + } + | parms ',' parm + { + c_push_parm_decl($3); + } + ; + +/* A single parameter declaration or parameter type name, + as found in a parmlist. */ +parm: + typed_declspecs setspecs parm_declarator maybe_attribute + { + $$ = c_tree_build_list(c_tree_build_list(current_declspecs, $3), + c_tree_build_list(prefix_attributes, $4)); + current_declspecs = CTreeListValue(declspec_stack); + prefix_attributes = CTreeListPurpose(declspec_stack); + declspec_stack = CTreeChain(declspec_stack); + c_resume_momentary($2); + } + | typed_declspecs setspecs notype_declarator maybe_attribute + { + $$ = c_tree_build_list(c_tree_build_list(current_declspecs, $3), + c_tree_build_list(prefix_attributes, $4)); + current_declspecs = CTreeListValue(declspec_stack); + prefix_attributes = CTreeListPurpose(declspec_stack); + declspec_stack = CTreeChain(declspec_stack); + c_resume_momentary($2); + } + | typed_declspecs setspecs absdcl maybe_attribute + { + $$ = c_tree_build_list(c_tree_build_list(current_declspecs, $3), + c_tree_build_list(prefix_attributes, $4)); + current_declspecs = CTreeListValue(declspec_stack); + prefix_attributes = CTreeListPurpose(declspec_stack); + declspec_stack = CTreeChain(declspec_stack); + c_resume_momentary($2); + } + | declmods setspecs notype_declarator maybe_attribute + { + $$ = c_tree_build_list(c_tree_build_list(current_declspecs, $3), + c_tree_build_list(prefix_attributes, $4)); + current_declspecs = CTreeListValue(declspec_stack); + prefix_attributes = CTreeListPurpose(declspec_stack); + declspec_stack = CTreeChain(declspec_stack); + c_resume_momentary($2); + } + + | declmods setspecs absdcl maybe_attribute + { + $$ = c_tree_build_list( + c_tree_build_list(current_declspecs, $3), + c_tree_build_list(prefix_attributes, $4)); + + current_declspecs = CTreeListValue( declspec_stack ); + prefix_attributes = CTreeListPurpose( declspec_stack ); + declspec_stack = CTreeChain( declspec_stack ); + c_resume_momentary($2); + } + ; + +/* This is used in a function definition + where either a parmlist or an identifier list is ok. + Its value is a list of ..._TYPE nodes or a list of identifiers. */ +parmlist_or_identifiers: + { + c_push_level(0); + c_clear_parm_order(); + c_declare_parm_level(1); + } + parmlist_or_identifiers_1 + { + $$ = $2; + c_parmlist_tags_warning(); + c_pop_level(0, 0, 0); + } + ; + +parmlist_or_identifiers_1: + parmlist_1 + | identifiers ')' + { + c_tree_node *ScanTree; + + for( ScanTree = $1; + ScanTree !=(c_tree_node *)0; + ScanTree = ScanTree->COMMON.CHAIN ) + { + if ( ScanTree->LIST.VALUE ==(c_tree_node *)0 ) + { + error("`...' in old-style identifier list"); + } + } + + $$ = c_tree_add_head_list((c_tree_node *)0,(c_tree_node *)0, $1); + } + ; + +/* A nonempty list of identifiers. */ +identifiers: + tok_IDENTIFIER + { + $$ = c_tree_build_list((c_tree_node *)0, $1); + } + | identifiers ',' tok_IDENTIFIER + { + $$ = c_tree_concat_list( $1, c_tree_build_list((c_tree_node *)0, $3)); + } + ; + +/* A nonempty list of identifiers, including typenames. */ +identifiers_or_typenames: + identifier + { + $$ = c_tree_build_list((c_tree_node *)0, $1); + } + | identifiers_or_typenames ',' identifier + { + $$ = c_tree_concat_list( $1, c_tree_build_list((c_tree_node *)0, $3)); + } + ; + +extension: + tok_EXTENSION + { + $$ = c_pedantic; + c_pedantic = 0; + } + ; + +%% diff --git a/alliance/src/gcp/src/c_cdecl.c b/alliance/src/gcp/src/c_cdecl.c new file mode 100644 index 00000000..d340a28f --- /dev/null +++ b/alliance/src/gcp/src/c_cdecl.c @@ -0,0 +1,8708 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : C | +| | +| File : c_cdecl.c | +| | +| Date : 09.07.99 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "aut.h" +# include "gcp.h" + +# include "c_flags.h" +# include "c_tree.h" +# include "c_treecompat.h" +# include "c_clex.h" +# include "c_ctypeck.h" +# include "c_cdecl.h" +# include "c_convert.h" +# include "c_common.h" +# include "c_foldconst.h" +# include "c_debug.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +#define MAX(X,Y) ((X) > (Y) ? (X) : (Y)) + +#define C_PROMOTING_INTEGER_TYPE_P(t) \ + ( CTreeTypeCode((t)) == C_INTEGER_TYPE \ + && ( CTreeTypeMainVariant(t) == c_char_type_node \ + || CTreeTypeMainVariant(t) == c_signed_char_type_node \ + || CTreeTypeMainVariant(t) == c_unsigned_char_type_node \ + || CTreeTypeMainVariant(t) == c_short_integer_type_node \ + || CTreeTypeMainVariant(t) == c_short_unsigned_type_node)) + + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + c_tree_node *c_tree_program_node; + +/* Set nonzero by jump_optimize if control can fall through + to the end of the function. */ + int c_can_reach_end; + +/* The binding level currently in effect. */ +static c_binding_level *c_current_binding_level; + +/* The outermost binding level, for names of file scope. + This is created when the compiler is started and exists + through the entire run. */ +static c_binding_level *c_global_binding_level; + +/* Nonzero means unconditionally make a BLOCK for the next level pushed. */ + +static int c_keep_next_level_flag; + +/* Nonzero means make a BLOCK for the next level pushed + if it has subblocks. */ + +static int c_keep_next_if_subblocks; + +/* The chain of outer levels of label scopes. + This uses the same data structure used for binding levels, + but it works differently: each link in the chain records + saved values of named_labels and shadowed_labels for + a label binding level outside the current one. */ + +# ifdef LUDO_NO_SKIP +static struct binding_level *c_label_level_chain; +# endif + +/* a node which has tree code ERROR_MARK, and whose type is itself. + All erroneous expressions are replaced with this node. All functions + that accept nodes as arguments should avoid generating error messages + if this node is one of the arguments, since it is undesirable to get + multiple error messages from one error in the input. */ + + c_tree_node *c_error_mark_node; + + +/* Data type for the expressions representing sizes of data types. + It is the first integer type laid out. + In C, this is int. */ + c_tree_node *c_size_type; + +/* An integer constant with value 0 whose type is sizetype. */ + c_tree_node *c_size_zero_node; + +/* An integer constant with value 1 whose type is sizetype. */ + + c_tree_node *c_size_one_node; + + +/* INTEGER_TYPE and REAL_TYPE nodes for the standard data types */ + + c_tree_node *c_short_integer_type_node; + c_tree_node *c_integer_type_node; + c_tree_node *c_long_integer_type_node; + c_tree_node *c_long_long_integer_type_node; + + c_tree_node *c_short_unsigned_type_node; + c_tree_node *c_unsigned_type_node; + c_tree_node *c_long_unsigned_type_node; + c_tree_node *c_long_long_unsigned_type_node; + + c_tree_node *c_boolean_type_node; + c_tree_node *c_boolean_false_node; + c_tree_node *c_boolean_true_node; + + c_tree_node *c_ptrdiff_type_node; + + c_tree_node *c_unsigned_char_type_node; + c_tree_node *c_signed_char_type_node; + c_tree_node *c_char_type_node; + c_tree_node *c_wchar_type_node; + c_tree_node *c_signed_wchar_type_node; + c_tree_node *c_unsigned_wchar_type_node; + + c_tree_node *c_float_type_node; + c_tree_node *c_double_type_node; + c_tree_node *c_long_double_type_node; + + c_tree_node *c_complex_integer_type_node; + c_tree_node *c_complex_float_type_node; + c_tree_node *c_complex_double_type_node; + c_tree_node *c_complex_long_double_type_node; + +/*I + c_tree_node *intQI_type_node; + c_tree_node *intHI_type_node; + c_tree_node *intSI_type_node; + c_tree_node *intDI_type_node; + + c_tree_node *unsigned_intQI_type_node; + c_tree_node *unsigned_intHI_type_node; + c_tree_node *unsigned_intSI_type_node; + c_tree_node *unsigned_intDI_type_node; +*/ + +/* a VOID_TYPE node. */ + + c_tree_node *c_void_type_node; + +/* Nodes for types `void *' and `const void *'. */ + + c_tree_node *c_ptr_type_node; + c_tree_node *c_const_ptr_type_node; + +/* Nodes for types `char *' and `const char *'. */ + + c_tree_node *c_string_type_node; + c_tree_node *c_const_string_type_node; + +/* Type `char[SOMENUMBER]'. + Used when an array of char is needed and the size is irrelevant. */ + + c_tree_node *c_char_array_type_node; + +/* Type `int[SOMENUMBER]' or something like it. + Used when an array of int needed and the size is irrelevant. */ + + c_tree_node *c_int_array_type_node; + +/* Type `wchar_t[SOMENUMBER]' or something like it. + Used when a wide string literal is created. */ + + c_tree_node *c_wchar_array_type_node; + +/* type `int ()' -- used for implicit declaration of functions. */ + + c_tree_node *c_default_function_type; + +/* function types `double (double)' and `double (double, double)', etc. */ + + c_tree_node *c_double_ftype_double; + c_tree_node *c_double_ftype_double_double; + c_tree_node *c_int_ftype_int; + c_tree_node *c_long_ftype_long; + c_tree_node *c_float_ftype_float; + c_tree_node *c_ldouble_ftype_ldouble; + +/* Function type `void (void *, void *, int)' and similar ones */ + + c_tree_node *c_void_ftype_ptr_ptr_int; + c_tree_node *c_int_ftype_ptr_ptr_int; + c_tree_node *c_void_ftype_ptr_int_int; + +/* Function type `char *(char *, char *)' and similar ones */ + c_tree_node *c_string_ftype_ptr_ptr; + c_tree_node *c_int_ftype_string_string; + +/* Function type `int (const void *, const void *, size_t)' */ + c_tree_node *c_int_ftype_cptr_cptr_sizet; + +/* Two expressions that are constants with value zero. + The first is of type `int', the second of type `void *'. */ + c_tree_node *c_integer_zero_node; + c_tree_node *c_null_pointer_node; + +/* A node for the integer constant 1. */ + c_tree_node *c_integer_one_node; + +/* Nonzero if we have seen an invalid cross reference + to a struct, union, or enum, but not yet printed the message. */ + + c_tree_node *c_pending_invalid_xref; +/* File and line to appear in the eventual error message. */ +char *c_pending_invalid_xref_file; +int c_pending_invalid_xref_line; + +/* While defining an enum type, this is 1 plus the last enumerator + constant value. Note that will do not have to save this or `enum_overflow' + around nested function definition since such a definition could only + occur in an enum value expression and we don't use these variables in +c that case. */ + +static c_tree_node *c_enum_next_value; + +/* Nonzero means that there was overflow computing enum_next_value. */ + +static int c_enum_overflow; + +/* Parsing a function declarator leaves a list of parameter names + or a chain or parameter decls here. */ + +static c_tree_node *c_last_function_parms; + +/* Parsing a function declarator leaves here a chain of structure + and enum types declared in the parmlist. */ + +static c_tree_node *c_last_function_parm_tags; + +/* After parsing the declarator that starts a function definition, + `c_start_function' puts here the list of parameter names or chain of decls. + `store_parm_decls' finds it here. */ + +static c_tree_node *c_current_function_parms; + +/* Similar, for last_function_parm_tags. */ +static c_tree_node *c_current_function_parm_tags; + +/* Similar, for the file and line that the prototype came from if this is + an old-style definition. */ +static char *c_current_function_prototype_file; +static int c_current_function_prototype_line; + +/* A list (chain of TREE_LIST nodes) of all LABEL_DECLs in the function + that have names. Here so we can clear out their names' definitions + at the end of the function. */ + +static c_tree_node *c_named_labels; + +/* A list of LABEL_DECLs from outer contexts that are currently shadowed. */ + +static c_tree_node *c_shadowed_labels; + +/* Nonzero when store_parm_decls is called indicates a varargs function. + Value not meaningful after store_parm_decls. */ + +static int c_c_function_varargs; + +/* The FUNCTION_DECL for the function currently being compiled, + or 0 if between functions. */ + c_tree_node *c_current_function_decl; + +/* Set to 0 at beginning of a function definition, set to 1 if + a return statement that specifies a return value is seen. */ + +int c_current_function_returns_value; + +/* Set to 0 at beginning of a function definition, set to 1 if + a return statement with no argument is seen. */ + +int c_current_function_returns_null; + +/* Set to nonzero by `c_grokdeclarator' for a function + whose return type is defaulted, if warnings for this are desired. */ + +static int c_warn_about_return_type; + +/* Nonzero when starting a function declared `extern inline'. */ + +static int c_current_extern_inline; + +/* Nonzero means the expression being parsed will never be evaluated. + This is a count, since unevaluated expressions can nest. */ + int c_skip_evaluation; + +/* Nonzero if current function uses varargs.h or equivalent. + Zero for functions that use stdarg.h. */ + + int c_current_function_varargs; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Alloc Functions | +| | +\------------------------------------------------------------*/ + +c_binding_level *c_alloc_binding_level() +{ + return( (c_binding_level *)autallocheap( sizeof( c_binding_level ) ) ); +} + +void c_free_binding_level( Binding ) + + c_binding_level *Binding; +{ + autfreeheap( Binding, sizeof( c_binding_level ) ); +} + +/* Nonzero if we are currently in the global binding level. */ + +int c_global_bindings_p() +{ + return c_current_binding_level == c_global_binding_level; +} + +/*------------------------------------------------------------\ +| | +| View Functions | +| | +\------------------------------------------------------------*/ + +void c_view_binding( Binding ) + + c_binding_level *Binding; +{ + fprintf( stdout, "NAME LIST\n" ); + c_tree_view_node_list( Binding->NAME_LIST ); + fprintf( stdout, "TAG LIST\n" ); + c_tree_view_node_list( Binding->TAG_LIST ); + fprintf( stdout, "SHADOWED LIST\n" ); + c_tree_view_node_list( Binding->SHADOWED_LIST ); + fprintf( stdout, "BLOCK LIST\n" ); + c_tree_view_node_list( Binding->BLOCK_LIST ); + fprintf( stdout, "THIS BLOCK\n" ); + c_tree_view_node_list( Binding->THIS_BLOCK ); + fprintf( stdout, "PARAM LIST\n" ); + c_tree_view_node_list( Binding->PARAM_LIST ); +} + +void c_view_current_binding() +{ + c_view_binding( c_current_binding_level ); +} + +/*------------------------------------------------------------\ +| | +| C Clear Parameter Order | +| | +\------------------------------------------------------------*/ + +/* Clear the given order of parms in `parm_order'. + Used at start of parm list, + and also at semicolon terminating forward decls. */ + +void c_clear_parm_order() +{ + c_current_binding_level->PARAM_LIST = (c_tree_node *)0; +} + +/*------------------------------------------------------------\ +| | +| C Push Level | +| | +\------------------------------------------------------------*/ + +/* Enter a new binding level. + If TAG_TRANSPARENT is nonzero, do so only for the name space of variables, + not for that of tags. */ + +void c_push_level( tag_transparent ) + + int tag_transparent; +{ + c_binding_level *newlevel = (c_binding_level *)0; + + /* If this is the top level of a function, + just make sure that NAMED_LABELS is 0. */ + + if ( c_current_binding_level == c_global_binding_level ) + { + c_named_labels = 0; + } + + newlevel = c_alloc_binding_level(); + + /* Add this level to the front of the chain (stack) of levels that + are active. */ + + newlevel->TAG_TRANSPARENT + = (tag_transparent + || (c_current_binding_level + ? c_current_binding_level->SUBBLOCKS_TAG_TRANSPARENT + : 0)); + newlevel->LEVEL_CHAIN = c_current_binding_level; + c_current_binding_level = newlevel; + + newlevel->KEEP = c_keep_next_level_flag; + c_keep_next_level_flag = 0; + newlevel->KEEP_IF_SUBBLOCKS = c_keep_next_if_subblocks; + c_keep_next_if_subblocks = 0; +} + +/*------------------------------------------------------------\ +| | +| C Pop Level | +| | +\------------------------------------------------------------*/ + + +/* Clear the limbo values of all identifiers defined in BLOCK or a subblock. */ + +static void c_clear_limbo_values (block) + c_tree_node *block; +{ + c_tree_node *tem; + + for (tem = CTreeBlockVars(block); tem; tem = CTreeChain(tem)) + { + if (CTreeDeclName(tem) != 0) + { + CTreeIdentLimboValue( CTreeDeclName(tem)) = 0; + } + } + + for (tem = CTreeBlockSubBlocks(block); tem; tem = CTreeChain(tem)) + { + c_clear_limbo_values(tem); + } +} + +/* Exit a binding level. + Pop the level off, and restore the state of the identifier-decl mappings + that were in effect when this level was entered. + + If KEEP is nonzero, this level had explicit declarations, so + and create a "block" (a BLOCK node) for the level + to record its declarations and subblocks for symbol table output. + + If FUNCTIONBODY is nonzero, this level is the body of a function, + so create a block as if KEEP were set and also clear out all + label names. + + If REVERSE is nonzero, reverse the order of decls before putting + them into the BLOCK. */ + +c_tree_node *c_pop_level( keep, reverse, functionbody ) + int keep; + int reverse; + int functionbody; +{ + c_tree_node *link; + /* The chain of decls was accumulated in reverse order. + Put it into forward order, just for cleanliness. */ + c_tree_node *decls; + c_tree_node *tags = c_current_binding_level->TAG_LIST; + c_tree_node *subblocks = c_current_binding_level->BLOCK_LIST; + c_tree_node *block = (c_tree_node *)0; + c_tree_node *decl; + int block_previously_created; + + /* + loc_c_view_binding( c_current_binding_level ); + */ + + keep |= c_current_binding_level->KEEP; + + /* Get the decls in the order they were written. + Usually current_binding_level->names is in reverse order. + But parameter decls were previously put in forward order. */ + + if (reverse) + { + c_current_binding_level->NAME_LIST + = decls = c_tree_reverse_list(c_current_binding_level->NAME_LIST); + } + else + { + decls = c_current_binding_level->NAME_LIST; + } + + /* Output any nested inline functions within this block + if they weren't already output. */ + + for (decl = decls; decl; decl = CTreeChain(decl)) + { + if ( CTreeDeclCode(decl) == C_FUNCTION_DECL + && ! CIsTreeNodeAsmWritten(decl) + && CTreeDeclInitial(decl) != 0 + && CIsTreeNodeAddressable(decl)) + { + /* If this decl was copied from a file-scope decl + on account of a block-scope extern decl, + propagate TREE_ADDRESSABLE to the file-scope decl. + + DECL_ABSTRACT_ORIGIN can be set to itself if warn_return_type is + true, since then the decl goes through save_for_inline_copying. */ + if ( CTreeDeclAbstractOrigin(decl) != 0 + && CTreeDeclAbstractOrigin(decl) != decl) + CSetTreeNodeAddressable( CTreeDeclAbstractOrigin(decl)); +# ifdef LUDO_NO_SKIP + else if (DECL_SAVED_INSNS (decl) != 0) + { + c_push_function_context (); + c_output_inline_function (decl); + c_pop_function_context (); + } +# endif + } + } + + /* If there were any declarations or structure tags in that level, + or if this level is a function body, + create a BLOCK to record them for the life of this function. */ + + block = 0; + block_previously_created = (c_current_binding_level->THIS_BLOCK != 0); + if (block_previously_created) + { + block = c_current_binding_level->THIS_BLOCK; + } + else if (keep || functionbody + || (c_current_binding_level->KEEP_IF_SUBBLOCKS && subblocks != 0)) + { + block = c_tree_add_node( C_BLOCK_NODE ); + } + if (block != 0) + { + CTreeBlockVars(block) = decls; + CTreeBlockTypeTags(block) = tags; + CTreeBlockSubBlocks(block) = subblocks; +# ifdef LUDO_NO_SKIP + remember_end_note (block); +# endif + } + + /* In each subblock, record that this is its superior. */ + + for (link = subblocks; link; link = CTreeChain(link)) + { + CTreeBlockSuperContext(link) = block; + } + + /* Clear out the meanings of the local variables of this level. */ + + for (link = decls; link; link = CTreeChain(link)) + { + if ( CTreeDeclName(link) != 0) + { + /* If the ident. was used or addressed via a local extern decl, + don't forget that fact. */ + if ( CIsTreeDeclExternal(link)) + { + if ( CIsTreeNodeUsed(link)) + { + CSetTreeNodeUsed( CTreeDeclName(link)); + } +# ifdef LUDO_NO_SKIP + if (TREE_ADDRESSABLE (link)) + TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (link)) = 1; +# endif + } + CTreeIdentLocalValue( CTreeDeclName(link)) = 0; + } + } + + /* Restore all name-meanings of the outer levels + that were shadowed by this level. */ + + for (link = c_current_binding_level->SHADOWED_LIST; link; link = CTreeChain(link)) + { + CTreeIdentLocalValue( CTreeListPurpose(link)) = CTreeListValue(link); + } + + /* If the level being exited is the top level of a function, + check over all the labels, and clear out the current + (function local) meanings of their names. */ + + if (functionbody) + { + c_clear_limbo_values (block); + + /* If this is the top level block of a function, + the vars are the function's parameters. + Don't leave them in the BLOCK because they are + found in the FUNCTION_DECL instead. */ + + CTreeBlockVars(block) = 0; + + /* Clear out the definitions of all label names, + since their scopes end here, + and add them to BLOCK_VARS. */ + + for (link = c_named_labels; link; link = CTreeChain(link)) + { + c_tree_node *label = CTreeListValue(link); + + if ( CTreeDeclInitial(label) == 0) + { + error_with_decl (label, "label `%s' used but not defined"); + /* Avoid crashing later. */ + c_define_label(c_input_filename, c_lineno, CTreeDeclName(label)); + } + else if (c_warn_unused && ! CIsTreeNodeUsed(label)) + { + warning_with_decl(label, "label `%s' defined but not used"); + } + CTreeIdentLabelValue( CTreeDeclName(label)) = 0; + + /* Put the labels into the "variables" of the + top-level block, so debugger can see them. */ + CTreeChain(label) = CTreeBlockVars(block); + CTreeBlockVars(block) = label; + } + } + + /* Pop the current level, and free the structure for reuse. */ + + { + c_binding_level *level = c_current_binding_level; + c_current_binding_level = c_current_binding_level->LEVEL_CHAIN; + +# ifdef LUDO_DONE + level->level_chain = free_binding_level; + free_binding_level = level; +# else + c_free_binding_level( level ); +# endif + } + + /* Dispose of the block that we just made inside some higher level. */ + if (functionbody) + { + CTreeDeclInitial(c_current_function_decl) = block; + } + else if (block) + { + if (!block_previously_created) + { + c_current_binding_level->BLOCK_LIST + = c_tree_concat_list(c_current_binding_level->BLOCK_LIST, block); + } + } + /* If we did not make a block for the level just exited, + any blocks made for inner levels + (since they cannot be recorded as subblocks in that level) + must be carried forward so they will later become subblocks + of something else. */ + else if (subblocks) + { + c_current_binding_level->BLOCK_LIST + = c_tree_concat_list(c_current_binding_level->BLOCK_LIST, subblocks); + } + + /* Set the TYPE_CONTEXTs for all of the tagged types belonging to this + binding contour so that they point to the appropriate construct, i.e. + either to the current FUNCTION_DECL node, or else to the BLOCK node + we just constructed. + + Note that for tagged types whose scope is just the formal parameter + list for some function type specification, we can't properly set + their TYPE_CONTEXTs here, because we don't have a pointer to the + appropriate FUNCTION_TYPE node readily available to us. For those + cases, the TYPE_CONTEXTs of the relevant tagged type nodes get set + in `grokdeclarator' as soon as we have created the FUNCTION_TYPE + node which will represent the "scope" for these "parameter list local" + tagged types. + */ + + if (functionbody) + { + for (link = tags; link; link = CTreeChain (link)) + { + CTreeTypeContext( CTreeListValue(link)) = c_current_function_decl; + } + } + else if (block) + { + for (link = tags; link; link = CTreeChain (link)) + { + CTreeTypeContext( CTreeListValue(link)) = block; + } + } + + if (block) CSetTreeNodeUsed(block); + + return block; +} + +/*------------------------------------------------------------\ +| | +| Lookup Name | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_lookup_name( TreeName ) + + c_tree_node *TreeName; +{ + c_tree_node *TreeVal; + + if ( ( c_current_binding_level != c_global_binding_level ) && + ( CTreeIdentLocalValue( TreeName ) != (c_tree_node *)0 ) ) + { + TreeVal = CTreeIdentLocalValue( TreeName ); + } + else + { + TreeVal = CTreeIdentGlobalValue( TreeName ); + } + + return TreeVal; +} + +/*------------------------------------------------------------\ +| | +| Lookup Name Current Level | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_lookup_name_current_level( TreeName ) + + c_tree_node *TreeName; +{ + c_tree_node *ScanTree; + + if ( c_current_binding_level == c_global_binding_level ) + { + return( CTreeIdentGlobalValue( TreeName ) ); + } + + if ( CTreeIdentLocalValue( TreeName ) == (c_tree_node *)0 ) + { + return( (c_tree_node *)0 ); + } + + for ( ScanTree = c_current_binding_level->NAME_LIST; + ScanTree != (c_tree_node *)0; + ScanTree = CTreeChain( ScanTree ) ) + { + if ( CTreeDeclName( ScanTree ) == TreeName ) break; + } + + return ScanTree; +} + + +/* Return zero if the declaration NEWDECL is valid + when the declaration OLDDECL (assumed to be for the same name) + has already been seen. + Otherwise return an error message format string with a %s + where the identifier should go. */ + +static char *c_redeclaration_error_message (newdecl, olddecl) + c_tree_node *newdecl; + c_tree_node *olddecl; +{ + if ( CTreeDeclCode(newdecl) == C_TYPE_DECL) + { + if (c_flag_traditional && CTreeType(newdecl) == CTreeType(olddecl)) + return 0; + /* pushdecl creates distinct types for TYPE_DECLs by calling + build_type_copy, so the above comparison generally fails. We do + another test against the CTreeTypeMainVariantof the olddecl, which + is equivalent to what this code used to do before the build_type_copy + call. The variant type distinction should not matter for traditional + code, because it doesn't have type qualifiers. */ + if (c_flag_traditional + && CTreeTypeMainVariant(CTreeType(olddecl)) == CTreeType(newdecl)) + return 0; + if (CIsTreeDeclSystemHeader(olddecl) || CIsTreeDeclSystemHeader(newdecl)) + return 0; + return "redefinition of `%s'"; + } + else if ( CTreeDeclCode(newdecl) == C_FUNCTION_DECL) + { + /* Declarations of functions can insist on internal linkage + but they can't be inconsistent with internal linkage, + so there can be no error on that account. + However defining the same name twice is no good. */ + if (CTreeDeclInitial(olddecl) != 0 && CTreeDeclInitial(newdecl) != 0 + /* However, defining once as extern inline and a second + time in another way is ok. */ + && !( CIsTreeDeclInline (olddecl) && CIsTreeDeclExternal (olddecl) + && !( CIsTreeDeclInline (newdecl) && CIsTreeDeclExternal (newdecl))) + ) + return "redefinition of `%s'"; + return 0; + } + else if (c_current_binding_level == c_global_binding_level) + { + /* Objects declared at top level: */ + /* If at least one is a reference, it's ok. */ + if (CIsTreeDeclExternal(newdecl) || CIsTreeDeclExternal(olddecl)) + return 0; + /* Reject two definitions. */ + if (CTreeDeclInitial(olddecl) != 0 && CTreeDeclInitial(newdecl) != 0) + return "redefinition of `%s'"; + /* Now we have two tentative defs, or one tentative and one real def. */ + /* Insist that the linkage match. */ + if ( CIsTreeNodePublic(olddecl) != CIsTreeNodePublic(newdecl)) + return "conflicting declarations of `%s'"; + return 0; + } + else if (c_current_binding_level->PARAM_FLAG + && CIsTreeNodeAsmWritten(olddecl) && !CIsTreeNodeAsmWritten(newdecl)) + return 0; + else + { + /* Newdecl has block scope. If olddecl has block scope also, then + reject two definitions, and reject a definition together with an + external reference. Otherwise, it is OK, because newdecl must + be an extern reference to olddecl. */ + if (!(CIsTreeDeclExternal(newdecl) && CIsTreeDeclExternal(olddecl)) + && CTreeDeclContext(newdecl) == CTreeDeclContext(olddecl)) + return "redeclaration of `%s'"; + return 0; + } +} + +/* Return 1 if PARMS specifies a fixed number of parameters + and none of their types is affected by default promotions. */ + +int c_is_self_promoting_args_p(parms) + c_tree_node *parms; +{ + c_tree_node *t; + for (t = parms; t; t = CTreeChain(t)) + { + c_tree_node *type = CTreeListValue(t); + + if (CTreeChain(t) == 0 && type != c_void_type_node) + return 0; + + if (type == 0) + return 0; + + if (CTreeTypeMainVariant(type) == c_float_type_node) + return 0; + + if (C_PROMOTING_INTEGER_TYPE_P(type)) + return 0; + } + return 1; +} + + +/* Handle when a new declaration NEWDECL + has the same name as an old one OLDDECL + in the same binding contour. + Prints an error message if appropriate. + + If safely possible, alter OLDDECL to look like NEWDECL, and return 1. + Otherwise, return 0. + + When DIFFERENT_BINDING_LEVEL is true, NEWDECL is an external declaration, + and OLDDECL is in an outer binding level and should thus not be changed. */ + +static int +c_is_duplicate_decls(newdecl, olddecl, different_binding_level) + c_tree_node *newdecl; + c_tree_node *olddecl; + int different_binding_level; +{ + int types_match = c_is_comptypes(CTreeType(newdecl), CTreeType(olddecl)); + int new_is_definition = ( CTreeDeclCode(newdecl) == C_FUNCTION_DECL + && CTreeDeclInitial(newdecl) != 0); + c_tree_node *oldtype = CTreeType(olddecl); + c_tree_node *newtype = CTreeType(newdecl); + char *errmsg = 0; + +# ifdef LUDO_NO_SKIP + if ( CTreeNodeFirstCode(olddecl) == C_DECL_NODE ) + DECL_MACHINE_ATTRIBUTES (newdecl) = DECL_MACHINE_ATTRIBUTES (olddecl); +# endif + + if ( CTreeNodeFirstCode(newtype) == C_ERROR_NODE + || CTreeNodeFirstCode(oldtype) == C_ERROR_NODE) + types_match = 0; + + /* New decl is completely inconsistent with the old one => + tell caller to replace the old one. + This is always an error except in the case of shadowing a builtin. */ + if ( CTreeDeclCode(olddecl) != CTreeDeclCode(newdecl)) + { + if ( CTreeDeclCode(olddecl) == C_FUNCTION_DECL + && ( CIsTreeDeclBuiltIn(olddecl) + || CIsTreeNodeUnsigned(olddecl))) + { + /* If you declare a built-in or predefined function name as static, + the old definition is overridden, + but optionally warn this was a bad choice of name. */ + if (! CIsTreeNodePublic(newdecl)) + { + if (!c_warn_shadow) + ; + else if ( CIsTreeDeclBuiltIn(olddecl)) + { + warning_with_decl (newdecl, "shadowing built-in function `%s'"); + } + else + { + warning_with_decl (newdecl, "shadowing library function `%s'"); + } + } + /* Likewise, if the built-in is not ansi, then programs can + override it even globally without an error. */ + else if (! CIsTreeDeclBuiltIn(olddecl)) + { + warning_with_decl (newdecl, + "library function `%s' declared as non-function"); + } + else if ( CIsTreeNodeUnsigned(olddecl)) + { + warning_with_decl (newdecl, + "built-in function `%s' declared as non-function"); + } + else + { + warning_with_decl (newdecl, + "built-in function `%s' declared as non-function"); + } + } + else + { + error_with_decl (newdecl, "`%s' redeclared as different kind of symbol"); + error_with_decl (olddecl, "previous declaration of `%s'"); + } + + return 0; + } + + /* For real parm decl following a forward decl, + return 1 so old decl will be reused. */ + if (types_match && CTreeDeclCode(newdecl) == C_PARAM_DECL + && CIsTreeNodeAsmWritten(olddecl) && ! CIsTreeNodeAsmWritten(newdecl)) + return 1; + + /* The new declaration is the same kind of object as the old one. + The declarations may partially match. Print warnings if they don't + match enough. Ultimately, copy most of the information from the new + decl to the old one, and keep using the old one. */ + + if (c_flag_traditional && CTreeDeclCode(newdecl) == C_FUNCTION_DECL + && CTreeIdentImplicitDecl(CTreeDeclName(newdecl)) == olddecl + && CTreeDeclInitial(olddecl) == 0) + /* If -traditional, avoid error for redeclaring fcn + after implicit decl. */ + ; + else if ( CTreeDeclCode(olddecl) == C_FUNCTION_DECL + && CIsTreeDeclBuiltIn(olddecl)) + { + /* A function declaration for a built-in function. */ + if (! CIsTreeNodePublic(newdecl)) + { + /* If you declare a built-in function name as static, the + built-in definition is overridden, + but optionally warn this was a bad choice of name. */ + if (c_warn_shadow) + { + warning_with_decl (newdecl, "shadowing built-in function `%s'"); + } + /* Discard the old built-in function. */ + return 0; + } + else if (!types_match) + { + /* Accept the return type of the new declaration if same modes. */ + c_tree_node *oldreturntype = CTreeType(oldtype); + c_tree_node *newreturntype = CTreeType(newtype); + + /* Make sure we put the new type in the same obstack as the old ones. + If the old types are not both in the same obstack, use the + permanent one. */ +# ifdef LUDO_NO_SKIP + if (TYPE_OBSTACK (oldtype) == TYPE_OBSTACK (newtype)) + push_obstacks (TYPE_OBSTACK (oldtype), TYPE_OBSTACK (oldtype)); + else + { + push_obstacks_nochange (); + end_temporary_allocation (); + } +# endif + + if (CTreeTypeMode(oldreturntype) == CTreeTypeMode(newreturntype)) + { + /* Function types may be shared, so we can't just modify + the return type of olddecl's function type. */ + c_tree_node *trytype + = c_tree_build_function_type(newreturntype, CTreeTypeValues(oldtype)); + + types_match = c_is_comptypes(newtype, trytype); + if (types_match) + oldtype = trytype; + } + /* Accept harmless mismatch in first argument type also. + This is for ffs. */ + if ( CTreeTypeValues(CTreeType(newdecl)) != 0 + && CTreeTypeValues(oldtype) != 0 + && CTreeListValue( CTreeTypeValues(newtype)) != 0 + && CTreeListValue( CTreeTypeValues(oldtype)) != 0 + && (CTreeTypeMode( CTreeListValue( CTreeTypeValues(newtype))) + == CTreeTypeMode( CTreeListValue( CTreeTypeValues(oldtype))))) + { + /* Function types may be shared, so we can't just modify + the return type of olddecl's function type. */ + c_tree_node *trytype + = c_tree_build_function_type(CTreeType(oldtype), + c_tree_add_head_list( NULL, + CTreeListValue( CTreeTypeValues(newtype)), + CTreeChain( CTreeTypeValues(oldtype)))); + + types_match = c_is_comptypes(newtype, trytype); + if (types_match) + oldtype = trytype; + } + if (! different_binding_level) + CTreeType(olddecl) = oldtype; + +# ifdef LUDO_NO_SKIP + pop_obstacks (); +# endif + } + if (!types_match) + { + /* If types don't match for a built-in, throw away the built-in. */ + warning_with_decl (newdecl, "conflicting types for built-in function `%s'"); + return 0; + } + } + else if ( CTreeDeclCode(olddecl) == C_FUNCTION_DECL + && CTreeDeclLineNum(olddecl) == 0) + { + /* A function declaration for a predeclared function + that isn't actually built in. */ + if (! CIsTreeNodePublic(newdecl)) + { + /* If you declare it as static, the + default definition is overridden. */ + return 0; + } + else if (!types_match) + { + /* If the types don't match, preserve volatility indication. + Later on, we will discard everything else about the + default declaration. */ + if ( CIsTreeNodeVolatile(olddecl) ) + { + CSetTreeNodeVolatile(newdecl); + } + } + } + /* Permit char *foo () to match void *foo (...) if not pedantic, + if one of them came from a system header file. */ + else if (!types_match + && CTreeDeclCode(olddecl) == C_FUNCTION_DECL + && CTreeDeclCode(newdecl) == C_FUNCTION_DECL + && CTreeTypeCode(CTreeType(oldtype)) == C_POINTER_TYPE + && CTreeTypeCode(CTreeType(newtype)) == C_POINTER_TYPE + && (CIsTreeDeclSystemHeader(olddecl) + || CIsTreeDeclSystemHeader(newdecl)) + && ((CTreeTypeMainVariant(CTreeType(CTreeType(newtype))) == c_void_type_node + && CTreeTypeValues(oldtype) == 0 + && c_is_self_promoting_args_p( CTreeTypeValues(newtype)) + && CTreeType(CTreeType(oldtype)) == c_char_type_node) + || + (CTreeType(CTreeType(newtype)) == c_char_type_node + && CTreeTypeValues(newtype) == 0 + && c_is_self_promoting_args_p( CTreeTypeValues(oldtype)) + && CTreeTypeMainVariant(CTreeType(CTreeType(oldtype))) == c_void_type_node))) + { + if (c_pedantic) + { + pedwarn_with_decl (newdecl, "conflicting types for `%s'"); + } + /* Make sure we keep void * as ret type, not char *. */ + if (CTreeTypeMainVariant(CTreeType(CTreeType(oldtype))) == c_void_type_node) + CTreeType(newdecl) = newtype = oldtype; + + /* Set DECL_IN_SYSTEM_HEADER, so that if we see another declaration + we will come back here again. */ + CSetTreeDeclSystemHeader(newdecl); + } + else if (!types_match + /* Permit char *foo (int, ...); followed by char *foo (); + if not pedantic. */ + && ! ( CTreeDeclCode(olddecl) == C_FUNCTION_DECL + && ! c_pedantic + /* Return types must still match. */ + && c_is_comptypes (CTreeType(oldtype), CTreeType(newtype)) + && CTreeTypeValues(newtype) == 0)) + { + error_with_decl (newdecl, "conflicting types for `%s'"); + /* Check for function type mismatch + involving an empty arglist vs a nonempty one. */ + if ( CTreeDeclCode(olddecl) == C_FUNCTION_DECL + && c_is_comptypes(CTreeType(oldtype), CTreeType(newtype)) + && ((CTreeTypeValues(oldtype) == 0 + && CTreeDeclInitial(olddecl) == 0) + || + ( CTreeTypeValues(newtype) == 0 + && CTreeDeclInitial(newdecl) == 0))) + { + /* Classify the problem further. */ + c_tree_node *t = CTreeTypeValues(oldtype); + if (t == 0) + t = CTreeTypeValues(newtype); + for (; t; t = CTreeChain(t)) + { + c_tree_node *type = CTreeListValue(t); + + if (CTreeChain(t) == 0 + && CTreeTypeMainVariant(type) != c_void_type_node) + { + error ("A parameter list with an ellipsis can't match"); + error ("an empty parameter name list declaration."); + break; + } + + if (CTreeTypeMainVariant(type) == c_float_type_node + || C_PROMOTING_INTEGER_TYPE_P(type)) + { + error ("An argument type that has a default promotion"); + error ("can't match an empty parameter name list declaration."); + break; + } + } + } + error_with_decl (olddecl, "previous declaration of `%s'"); + } + else + { + errmsg = c_redeclaration_error_message (newdecl, olddecl); + if (errmsg) + { + error_with_decl (newdecl, errmsg); + error_with_decl (olddecl, + ((CTreeDeclInitial(olddecl) + && c_current_binding_level == c_global_binding_level) + ? "`%s' previously defined here" + : "`%s' previously declared here")); + } + else if ( CTreeDeclCode(newdecl) == C_TYPE_DECL + && (CIsTreeDeclSystemHeader(olddecl) + || CIsTreeDeclSystemHeader(newdecl))) + { + warning_with_decl (newdecl, "redefinition of `%s'"); + warning_with_decl + (olddecl, + ((CTreeDeclInitial(olddecl) + && c_current_binding_level == c_global_binding_level) + ? "`%s' previously defined here" + : "`%s' previously declared here")); + } + else if ( CTreeDeclCode(olddecl) == C_FUNCTION_DECL + && CTreeDeclInitial(olddecl) != 0 + && CTreeTypeValues(oldtype) == 0 + && CTreeTypeValues(newtype) != 0 + && CTreeTypeNonCopiedParts(oldtype) != 0) + { + c_tree_node *type; + c_tree_node *parm; + int nargs; + /* Prototype decl follows defn w/o prototype. */ + + for (parm = CTreeTypeNonCopiedParts(oldtype), + type = CTreeTypeValues(newtype), + nargs = 1; + (CTreeTypeMainVariant( CTreeListValue(parm)) != c_void_type_node + || CTreeTypeMainVariant( CTreeListValue(type)) != c_void_type_node); + parm = CTreeChain(parm), type = CTreeChain(type), nargs++) + { + if (CTreeTypeMainVariant( CTreeListValue(parm)) == c_void_type_node + || CTreeTypeMainVariant( CTreeListValue(type)) == c_void_type_node) + { + errmsg = "prototype for `%s' follows and number of arguments"; + break; + } + /* Type for passing arg must be consistent + with that declared for the arg. */ + if (! c_is_comptypes( CTreeListValue(parm), CTreeListValue(type)) + /* If -traditional, allow `unsigned int' instead of `int' + in the prototype. */ + && + (! (c_flag_traditional + && CTreeTypeMainVariant( CTreeListValue(parm)) == c_integer_type_node + && CTreeTypeMainVariant( CTreeListValue(type)) == c_unsigned_type_node))) + { + errmsg = "prototype for `%s' follows and argument %d"; + break; + } + } + if (errmsg) + { + error_with_decl (newdecl, errmsg, nargs); + error_with_decl (olddecl, + "doesn't match non-prototype definition here"); + } + else + { + warning_with_decl (newdecl, "prototype for `%s' follows"); + warning_with_decl (olddecl, "non-prototype definition here"); + } + } + /* Warn about mismatches in various flags. */ + else + { + /* Warn if function is now inline + but was previously declared not inline and has been called. */ + if ( CTreeDeclCode(olddecl) == C_FUNCTION_DECL + && ! CIsTreeDeclInline (olddecl) + && CIsTreeDeclInline (newdecl) + && CIsTreeNodeUsed(olddecl)) + { + warning_with_decl (newdecl, + "`%s' declared inline after being called"); + } + if ( CTreeDeclCode(olddecl) == C_FUNCTION_DECL + && ! CIsTreeDeclInline (olddecl) && CIsTreeDeclInline (newdecl) + && CTreeDeclInitial(olddecl) != 0) + { + warning_with_decl (newdecl, + "`%s' declared inline after its definition"); + } + + /* If pedantic, warn when static declaration follows a non-static + declaration. Otherwise, do so only for functions. */ + if ((c_pedantic || CTreeDeclCode(olddecl) == C_FUNCTION_DECL) + && CIsTreeNodePublic(olddecl) + && !CIsTreeNodePublic(newdecl)) + { + warning_with_decl (newdecl, "static declaration for `%s' follows non-static"); + } + + /* Warn when const declaration follows a non-const + declaration, but not for functions. */ + if ( CTreeDeclCode(olddecl) != C_FUNCTION_DECL + && ! CIsTreeNodeReadOnly(olddecl) + && CIsTreeNodeReadOnly(newdecl)) + { + warning_with_decl (newdecl, "const declaration for `%s' follows non-const"); + } + /* These bits are logically part of the type, for variables. + But not for functions + (where qualifiers are not valid ANSI anyway). */ + else if (c_pedantic && CTreeDeclCode(olddecl) != C_FUNCTION_DECL + && ( CIsTreeNodeReadOnly(newdecl) != CIsTreeNodeReadOnly(olddecl) + || CIsTreeNodeVolatile(newdecl) != CIsTreeNodeVolatile(olddecl))) + { + pedwarn_with_decl (newdecl, "type qualifiers for `%s' conflict with previous decl"); + } + } + } + + /* Optionally warn about more than one declaration for the same name. */ + if (errmsg == 0 && c_warn_redundant_decls && CTreeDeclLineNum(olddecl) != 0 + /* Don't warn about a function declaration + followed by a definition. */ + && !( CTreeDeclCode(newdecl) == C_FUNCTION_DECL && CTreeDeclInitial(newdecl) != 0 + && CTreeDeclInitial(olddecl) == 0) + /* Don't warn about extern decl followed by (tentative) definition. */ + && !(CIsTreeDeclExternal(olddecl) && ! CIsTreeDeclExternal(newdecl))) + { + warning_with_decl (newdecl, "redundant redeclaration of `%s' in same scope"); + warning_with_decl (olddecl, "previous declaration of `%s'"); + } + + /* Copy all the DECL_... slots specified in the new decl + except for any that we copy here from the old type. + + Past this point, we don't change OLDTYPE and NEWTYPE + even if we change the types of NEWDECL and OLDDECL. */ + + if (types_match) + { + /* When copying info to olddecl, we store into write_olddecl + instead. This allows us to avoid modifying olddecl when + different_binding_level is true. */ + c_tree_node *write_olddecl = different_binding_level ? newdecl : olddecl; + + /* Make sure we put the new type in the same obstack as the old ones. + If the old types are not both in the same obstack, use the permanent + one. */ +# ifdef LUDO_NO_SKIP + if (TYPE_OBSTACK (oldtype) == TYPE_OBSTACK (newtype)) + push_obstacks (TYPE_OBSTACK (oldtype), TYPE_OBSTACK (oldtype)); + else + { + push_obstacks_nochange (); + end_temporary_allocation (); + } + + /* Merge the data types specified in the two decls. */ + if ( CTreeDeclCode(newdecl) != C_FUNCTION_DECL || ! + CIsTreeDeclBuiltIn(olddecl)) + { + if (different_binding_level) + CTreeType(newdecl) + = c_tree_build_type_attribute_variant + (newtype, + merge_attributes (TYPE_ATTRIBUTES (newtype), + TYPE_ATTRIBUTES (oldtype))); + else + CTreeType(newdecl) + = CTreeType(olddecl) + = common_type (newtype, oldtype); + } +# endif + + /* Lay the type out, unless already done. */ + if (oldtype != CTreeType(newdecl)) + { + if (CTreeType(newdecl) != c_error_mark_node) + c_layout_type(CTreeType(newdecl)); + if ( CTreeDeclCode(newdecl) != C_FUNCTION_DECL + && CTreeDeclCode(newdecl) != C_TYPE_DECL + && CTreeDeclCode(newdecl) != C_CONST_DECL) + c_layout_decl(newdecl, 0); + } + else + { + /* Since the type is OLDDECL's, make OLDDECL's size go with. */ + CTreeDeclSize(newdecl) = CTreeDeclSize(olddecl); +# ifdef LUDO_NO_SKIP + if ( CTreeDeclCode(olddecl) != C_FUNCTION_DECL) + if (DECL_ALIGN (olddecl) > DECL_ALIGN (newdecl)) + DECL_ALIGN (newdecl) = DECL_ALIGN (olddecl); +# endif + } + +# ifdef LUDO_NO_SKIP + /* Keep the old rtl since we can safely use it. */ + DECL_RTL (newdecl) = DECL_RTL (olddecl); + + /* Merge the type qualifiers. */ + if (DECL_BUILT_IN_NONANSI (olddecl) && TREE_THIS_VOLATILE (olddecl) + && !TREE_THIS_VOLATILE (newdecl)) + TREE_THIS_VOLATILE (write_olddecl) = 0; +# endif + if ( CIsTreeNodeReadOnly(newdecl)) + CSetTreeNodeReadOnly(write_olddecl); +# ifdef LUDO_NO_SKIP + if (TREE_THIS_VOLATILE (newdecl)) + { + TREE_THIS_VOLATILE (write_olddecl) = 1; + if (TREE_CODE (newdecl) == VAR_DECL) + make_var_volatile (newdecl); + } +# endif + + /* Keep source location of definition rather than declaration. */ + /* When called with different_binding_level set, keep the old + information so that meaningful diagnostics can be given. */ + if (CTreeDeclInitial(newdecl) == 0 && CTreeDeclInitial(olddecl) != 0 + && ! different_binding_level) + { + CTreeDeclLineNum(newdecl) = CTreeDeclLineNum(olddecl); + CTreeDeclFileName(newdecl) = CTreeDeclFileName(olddecl); + } + + /* Merge the unused-warning information. */ + if (CIsTreeDeclSystemHeader(olddecl)) + CSetTreeDeclSystemHeader(newdecl); + else if (CIsTreeDeclSystemHeader(newdecl)) + CSetTreeDeclSystemHeader(write_olddecl); + + /* Merge the initialization information. */ + /* When called with different_binding_level set, don't copy over + DECL_INITIAL, so that we don't accidentally change function + declarations into function definitions. */ + if (CTreeDeclInitial(newdecl) == 0 && ! different_binding_level) + CTreeDeclInitial(newdecl) = CTreeDeclInitial(olddecl); + + /* Merge the section attribute. + We want to issue an error if the sections conflict but that must be + done later in decl_attributes since we are called before attributes + are assigned. */ +# ifdef LUDO_NO_SKIP + if (DECL_SECTION_NAME (newdecl) == NULL_TREE) + DECL_SECTION_NAME (newdecl) = DECL_SECTION_NAME (olddecl); + + if (CTreeDeclCode(newdecl) == C_FUNCTION_DECL) + { + DECL_STATIC_CONSTRUCTOR(newdecl) |= DECL_STATIC_CONSTRUCTOR(olddecl); + DECL_STATIC_DESTRUCTOR (newdecl) |= DECL_STATIC_DESTRUCTOR (olddecl); + } + + pop_obstacks (); +# endif + } + /* If cannot merge, then use the new type and qualifiers, + and don't preserve the old rtl. */ + else if (! different_binding_level) + { + CTreeType(olddecl) = CTreeType(newdecl); + if ( CIsTreeNodeReadOnly(newdecl) ) + { + CSetTreeNodeReadOnly(olddecl); + } + + if ( CIsTreeNodeVolatile(newdecl) ) + { + CSetTreeNodeVolatile(olddecl); + } + + if ( CIsTreeNodeSideEffect(newdecl) ) + { + CSetTreeNodeSideEffect(olddecl); + } + } + + /* Merge the storage class information. */ + if ( CIsTreeDeclWeak( olddecl ) ) CSetTreeDeclWeak( newdecl ); + + /* For functions, static overrides non-static. */ + if ( CTreeDeclCode(newdecl) == C_FUNCTION_DECL) + { + if ( ! CIsTreeNodePublic(newdecl) || + ! CIsTreeNodePublic(olddecl) ) + { + CClearTreeNodePublic(newdecl); + } + + /* This is since we don't automatically + copy the attributes of NEWDECL into OLDDECL. */ + /* No need to worry about different_binding_level here because + then TREE_PUBLIC (newdecl) was true. */ + if ( CIsTreeNodePublic(newdecl) ) CSetTreeNodePublic(olddecl); + else CClearTreeNodePublic(olddecl); + + /* If this clears `static', clear it in the identifier too. */ + if (! CIsTreeNodePublic(olddecl)) + { + CClearTreeNodePublic(CTreeDeclName(olddecl)); + } + } + if ( CIsTreeNodeExternal(newdecl)) + { + if ( CIsTreeNodeStatic(olddecl) ) CSetTreeNodeStatic(newdecl); + else CClearTreeNodeStatic(newdecl); + + if ( CIsTreeNodeExternal(olddecl) ) CSetTreeNodeExternal(newdecl); + else CClearTreeNodeExternal(newdecl); + + /* An extern decl does not override previous storage class. */ + if ( CIsTreeNodePublic(olddecl) ) CSetTreeNodePublic(newdecl); + else CClearTreeNodePublic(newdecl); + + if (! CIsTreeDeclExternal(newdecl)) + { + CTreeDeclContext(newdecl) = CTreeDeclContext(olddecl); + } + } + else + { + if ( CIsTreeNodeStatic(newdecl) ) CSetTreeNodeStatic(olddecl); + else CClearTreeNodeStatic(olddecl); + + if ( CIsTreeNodePublic(newdecl) ) CSetTreeNodePublic(olddecl); + else CClearTreeNodePublic(olddecl); + + } + + /* If either decl says `inline', this fn is inline, + unless its definition was passed already. */ + if ( CIsTreeDeclInline(newdecl) && CTreeDeclInitial(olddecl) == 0) + CSetTreeDeclInline(olddecl); + + if ( CIsTreeDeclInline(olddecl) ) CSetTreeDeclInline( newdecl ); + else CClearTreeDeclInline( newdecl ); + + if ( CTreeDeclCode(newdecl) == C_FUNCTION_DECL) + { + if ( CIsTreeDeclBuiltIn(olddecl)) + { + /* Get rid of any built-in function if new arg types don't match it + or if we have a function definition. */ + if (! types_match || new_is_definition) + { + if (! different_binding_level) + { + CTreeType(olddecl) = CTreeType(newdecl); + CClearTreeDeclBuiltIn(olddecl); + } + } + else + { + /* If redeclaring a builtin function, and not a definition, + it stays built in. */ + CSetTreeDeclBuiltIn(newdecl); +# ifdef LUDO_NO_SKIP + DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl); +# endif + } + } + /* Also preserve various other info from the definition. */ + else if (! new_is_definition) + { +# ifdef LUDO_NO_SKIP + DECL_FRAME_SIZE (newdecl) = DECL_FRAME_SIZE (olddecl); +# endif + } + if (! new_is_definition) + { + CTreeDeclResult(newdecl) = CTreeDeclResult(olddecl); + /* When called with different_binding_level set, don't copy over + DECL_INITIAL, so that we don't accidentally change function + declarations into function definitions. */ + if (! different_binding_level) + CTreeDeclInitial(newdecl) = CTreeDeclInitial(olddecl); +# ifdef LUDO_NO_SKIP + DECL_SAVED_INSNS (newdecl) = DECL_SAVED_INSNS (olddecl); +# endif + CTreeDeclArguments(newdecl) = CTreeDeclArguments(olddecl); + + if ( CIsTreeDeclInline(newdecl)) + CTreeDeclAbstractOrigin(newdecl) = olddecl; + } + } + if (different_binding_level) + { + /* Don't output a duplicate symbol or debugging information for this + declaration. */ + CSetTreeNodeAsmWritten(newdecl); + CSetTreeDeclIgnored(newdecl); + return 0; + } + + /* Copy most of the decl-specific fields of NEWDECL into OLDDECL. + But preserve OLDDECL's DECL_UID. */ + { + unsigned olddecl_uid = CTreeDeclId(olddecl); + + bcopy ((char *) newdecl + sizeof (c_tree_common), + (char *) olddecl + sizeof (c_tree_common), + sizeof (c_tree_decl) - sizeof (c_tree_common)); + + CTreeDeclId(olddecl) = olddecl_uid; + } + + return 1; +} + + +/*------------------------------------------------------------\ +| | +| Push Declaration | +| | +\------------------------------------------------------------*/ + + +/* Return nonzero if ELEM is part of the chain CHAIN. */ + +int +c_is_chain_member(elem, chain) + c_tree_node *elem; + c_tree_node *chain; +{ + while (chain) + { + if (elem == chain) + return 1; + chain = CTreeChain(chain); + } + + return 0; +} + +c_tree_node *c_push_decl( TreeDecl ) + + c_tree_node *TreeDecl; +{ + c_binding_level *Binding; + c_tree_node *TreeName; + c_tree_node *TreeNode; + + TreeName = TreeDecl->DECL.NAME; + Binding = c_current_binding_level; + + CTreeDeclContext( TreeDecl ) = c_current_function_decl; + /* A local extern declaration for a function doesn't constitute nesting. + A local auto declaration does, since it's a forward decl + for a nested function coming later. */ + if ( ( CTreeDeclCode( TreeDecl ) == C_FUNCTION_DECL ) && + ( CTreeDeclInitial( TreeDecl ) == 0 ) && + ( CIsTreeDeclExternal( TreeDecl ) ) ) + { + CTreeDeclContext( TreeDecl ) = (c_tree_node *)0; + } + + if ( c_warn_nested_externs && CIsTreeDeclExternal( TreeDecl ) && + Binding != c_global_binding_level + && TreeDecl != CTreeIdentImplicitDecl( TreeName ) + /* Don't print error messages for __FUNCTION__ and __PRETTY_FUNCTION__ */ + && !CIsTreeDeclSystemHeader( TreeDecl )) + { + warning ("nested extern declaration of `%s'", CTreeIdentPointer( TreeName )); + } + + if ( TreeName != (c_tree_node *)0 ) + { + char *file; + int line; + int different_binding_level = 0; + + TreeNode = c_lookup_name_current_level( TreeName ); + + /* Don't type check externs here when -traditional. This is so that + code with conflicting declarations inside blocks will get warnings + not errors. X11 for instance depends on this. */ + if (! TreeNode && CIsTreeDeclExternal( TreeDecl ) && + CIsTreeNodePublic( TreeDecl ) && ! c_flag_traditional) + { + TreeNode = CTreeIdentGlobalValue( TreeName ); + /* Type decls at global scope don't conflict with externs declared + inside lexical blocks. */ + if ( TreeNode && CTreeDeclCode( TreeNode ) == C_TYPE_DECL) + TreeNode = 0; + different_binding_level = 1; + } + if ( TreeNode != 0 && TreeNode == c_error_mark_node) + /* error_mark_node is 0 for a while during initialization! */ + { + TreeNode = 0; + error_with_decl ( TreeDecl, "`%s' used prior to declaration"); + } + + if (TreeNode != (c_tree_node *)0) + { + file = CTreeDeclFileName( TreeNode ); + line = CTreeDeclLineNum( TreeNode ); + } + + /* If this decl is `static' and an implicit decl was seen previously, + warn. But don't complain if -traditional, + since traditional compilers don't complain. */ + if (! c_flag_traditional && CIsTreeNodePublic( TreeName ) + /* Don't test for DECL_EXTERNAL, because grokdeclarator + sets this for all functions. */ + && ! CIsTreeNodePublic( TreeDecl ) + && ( CTreeDeclCode( TreeDecl ) == C_FUNCTION_DECL || Binding == c_global_binding_level) + /* We used to warn also for explicit extern followed by static, + but sometimes you need to do it that way. */ + && CTreeIdentImplicitDecl( TreeName ) != 0) + { + pedwarn ("`%s' was declared implicitly `extern' and later `static'", + CTreeIdentPointer( TreeName )); + pedwarn_with_file_and_line( + CTreeDeclFileName( CTreeIdentImplicitDecl( TreeName )), + CTreeDeclLineNum( CTreeIdentImplicitDecl( TreeName )), + "previous declaration of `%s'", + CTreeIdentPointer( TreeName )); + } + + if ( TreeNode != 0 && c_is_duplicate_decls( TreeDecl, TreeNode, different_binding_level)) + { + if ( CTreeDeclCode( TreeNode ) == C_PARAM_DECL) + { + /* Don't allow more than one "real" duplicate + of a forward parm decl. */ + if ( CIsTreeNodeAsmWritten( TreeDecl ) ) CSetTreeNodeAsmWritten( TreeNode ); + + return TreeNode; + } + return TreeNode; + } + + /* If we are processing a typedef statement, generate a whole new + ..._TYPE node (which will be just an variant of the existing + ..._TYPE node with identical properties) and then install the + TYPE_DECL node generated to represent the typedef name as the + TYPE_NAME of this brand new (duplicate) ..._TYPE node. + + The whole point here is to end up with a situation where each + and every ..._TYPE node the compiler creates will be uniquely + associated with AT MOST one node representing a typedef name. + This way, even though the compiler substitutes corresponding + ..._TYPE nodes for TYPE_DECL (i.e. "typedef name") nodes very + early on, later parts of the compiler can always do the reverse + translation and get back the corresponding typedef name. For + example, given: + + typedef struct S MY_TYPE; + MY_TYPE object; + + Later parts of the compiler might only know that `object' was of + type `struct S' if if were not for code just below. With this + code however, later parts of the compiler see something like: + + struct S' == struct S + typedef struct S' MY_TYPE; + struct S' object; + + And they can then deduce (from the node for type struct S') that + the original object declaration was: + + MY_TYPE object; + + Being able to do this is important for proper support of protoize, + and also for generating precise symbolic debugging information + which takes full account of the programmer's (typedef) vocabulary. + + Obviously, we don't want to generate a duplicate ..._TYPE node if + the TYPE_DECL node that we are now processing really represents a + standard built-in type. + + Since all standard types are effectively declared at line zero + in the source file, we can easily check to see if we are working + on a standard type by checking the current value of lineno. */ + + if ( CTreeDeclCode( TreeDecl ) == C_TYPE_DECL) + { + if ( CTreeDeclLineNum( TreeDecl ) == 0) + { + if ( CTreeTypeName( CTreeType( TreeDecl ) ) == (c_tree_node *)0) + { + CTreeTypeName( CTreeType( TreeDecl ) ) = TreeDecl; + } + } + else if ( CTreeType( TreeDecl ) != c_error_mark_node + && CTreeDeclResult( TreeDecl ) == NULL) + { + c_tree_node *tt = CTreeType( TreeDecl ); + CTreeDeclResult( TreeDecl ) = tt; + tt = c_tree_build_type_copy(tt); + CTreeTypeName(tt) = TreeDecl ; + CTreeType( TreeDecl ) = tt; + } + } + + /* Multiple external decls of the same identifier ought to match. + Check against both global declarations (when traditional) and out of + scope (limbo) block level declarations. + + We get warnings about inline functions where they are defined. + Avoid duplicate warnings where they are used. */ + if ( CIsTreeNodePublic( TreeDecl ) + && ! CIsTreeDeclInline( TreeDecl ) + ) + { + c_tree_node *decl; + + if (c_flag_traditional && CTreeIdentGlobalValue( TreeName ) != 0 + && ( CIsTreeDeclExternal( CTreeIdentGlobalValue( TreeName )) + || CIsTreeNodePublic( CTreeIdentGlobalValue( TreeName )))) + decl = CTreeIdentGlobalValue( TreeName ); + else if ( CTreeIdentLimboValue( TreeName ) != 0) + /* Decls in limbo are always extern, so no need to check that. */ + decl = CTreeIdentLimboValue( TreeName ); + else + decl = 0; + + if (decl && ! c_is_comptypes( CTreeType( TreeDecl ), CTreeType(decl)) + /* If old decl is built-in, we already warned if we should. */ + && ! CIsTreeDeclBuiltIn(decl)) + { + pedwarn_with_decl ( TreeDecl, + "type mismatch with previous external decl"); + pedwarn_with_decl (decl, "previous external decl of `%s'"); + } + } + + /* If a function has had an implicit declaration, and then is defined, + make sure they are compatible. */ + + if ( CTreeIdentImplicitDecl( TreeName ) != 0 + && CTreeIdentGlobalValue( TreeName ) == 0 + && CTreeDeclCode( TreeDecl ) == C_FUNCTION_DECL + && ! c_is_comptypes( CTreeType( TreeDecl ), + CTreeType( CTreeIdentImplicitDecl( TreeName )))) + { + warning_with_decl( TreeDecl, "type mismatch with previous implicit declaration"); + warning_with_decl( CTreeIdentImplicitDecl( TreeName ), + "previous implicit declaration of `%s'"); + } + + /* In PCC-compatibility mode, extern decls of vars with no current decl + take effect at top level no matter where they are. */ + if (c_flag_traditional && CIsTreeDeclExternal( TreeDecl ) + && c_lookup_name( TreeName ) == 0) + { + c_tree_node *type = CTreeType( TreeDecl ); + + /* But don't do this if the type contains temporary nodes. */ + while (type) + { + if (type == c_error_mark_node) + break; + if (! CIsTreeNodePermanent(type)) + { + warning_with_decl( TreeDecl, "type of external `%s' is not global"); + /* By exiting the loop early, we leave TYPE nonzero, + and thus prevent globalization of the decl. */ + break; + } + else if ( CTreeDeclCode(type) == C_FUNCTION_TYPE + && CTreeTypeValues(type) != 0) + /* The types might not be truly local, + but the list of arg types certainly is temporary. + Since prototypes are nontraditional, + ok not to do the traditional thing. */ + break; + type = CTreeType(type); + } + + if (type == 0) + Binding = c_global_binding_level; + } + + /* This name is new in its binding level. + Install the new declaration and return it. */ + if ( Binding == c_global_binding_level) + { + /* Install a global value. */ + + /* If the first global decl has external linkage, + warn if we later see static one. */ + if (CTreeIdentGlobalValue( TreeName ) == 0 && CIsTreeNodePublic( TreeDecl )) + CSetTreeNodePublic( TreeName ); + + CTreeIdentGlobalValue( TreeName ) = TreeDecl; + + /* We no longer care about any previous block level declarations. */ + CTreeIdentLimboValue( TreeName ) = 0; + + /* Don't forget if the function was used via an implicit decl. */ + if (CTreeIdentImplicitDecl( TreeName ) + && CIsTreeNodeUsed(CTreeIdentImplicitDecl( TreeName ))) + { + CSetTreeNodeUsed( TreeDecl ); + CSetTreeNodeUsed( TreeName ); + } + + /* Don't forget if its address was taken in that way. */ + if (CTreeIdentImplicitDecl( TreeName ) + && CIsTreeNodeAddressable(CTreeIdentImplicitDecl( TreeName ))) + { + CSetTreeNodeAddressable( TreeDecl ); + } + + /* Warn about mismatches against previous implicit decl. */ + if (CTreeIdentImplicitDecl( TreeName ) != 0 + /* If this real decl matches the implicit, don't complain. */ + && ! ( CTreeDeclCode( TreeDecl ) == C_FUNCTION_DECL + && (CTreeTypeMainVariant( CTreeType( CTreeType( TreeDecl ))) + == c_integer_type_node))) + { + pedwarn ("`%s' was previously implicitly declared to return `int'", + CTreeIdentPointer( TreeName )); + } + + /* If this decl is `static' and an `extern' was seen previously, + that is erroneous. */ + if ( CIsTreeNodePublic( TreeName ) + && ! CIsTreeNodePublic( TreeDecl ) && ! CIsTreeDeclExternal( TreeDecl )) + { + /* Okay to redeclare an ANSI built-in as static. */ + if ( TreeNode != 0 && CIsTreeDeclBuiltIn( TreeNode )) + ; + /* Okay to declare a non-ANSI built-in as anything. */ +# ifdef LUDO_NO_SKIP + else if (t != 0 && DECL_BUILT_IN_NONANSI (t)) + ; +# endif + /* Okay to have global type decl after an earlier extern + declaration inside a lexical block. */ + else if ( CTreeDeclCode( TreeDecl ) == C_TYPE_DECL) + ; + else if (CTreeIdentImplicitDecl( TreeName )) + { + pedwarn ("`%s' was declared implicitly `extern' and later `static'", + CTreeIdentPointer( TreeName )); + } + else + { + pedwarn ("`%s' was declared `extern' and later `static'", + CTreeIdentPointer( TreeName )); + } + } + } + else + { + /* Here to install a non-global value. */ + c_tree_node * oldlocal = CTreeIdentGlobalValue( TreeName ); + c_tree_node * oldglobal = CTreeIdentGlobalValue( TreeName ); + CTreeIdentLocalValue( TreeName ) = TreeDecl; + + /* If this is an extern function declaration, see if we + have a global definition or declaration for the function. */ + if (oldlocal == 0 + && CIsTreeDeclExternal( TreeDecl ) + && !CIsTreeDeclInline( TreeDecl ) + && oldglobal != 0 + && CTreeDeclCode( TreeDecl ) == C_FUNCTION_DECL + && CTreeDeclCode(oldglobal) == C_FUNCTION_DECL) + { + /* We have one. Their types must agree. */ + if (! c_is_comptypes( CTreeType( TreeDecl ), + CTreeType( CTreeIdentGlobalValue( TreeName )))) + { + pedwarn_with_decl( TreeDecl, + "extern declaration of `%s' doesn't match global one"); + } + else + { + /* Inner extern decl is inline if global one is. + Copy enough to really inline it. */ + if ( CIsTreeDeclInline(oldglobal)) + { + CSetTreeDeclInline( TreeDecl ); + CTreeDeclInitial( TreeDecl ) = (c_current_function_decl == oldglobal + ? 0 : CTreeDeclInitial(oldglobal)); +# ifdef LUDO_NO_SKIP + DECL_SAVED_INSNS ( TreeDecl ) = DECL_SAVED_INSNS (oldglobal); + DECL_FRAME_SIZE ( TreeDecl ) = DECL_FRAME_SIZE (oldglobal); +# endif + CTreeDeclArguments( TreeDecl ) = CTreeDeclArguments(oldglobal); + CTreeDeclResult( TreeDecl ) = CTreeDeclResult(oldglobal); + if ( CIsTreeNodeAsmWritten(oldglobal)) + CSetTreeNodeAsmWritten( TreeDecl ); + CTreeDeclAbstractOrigin( TreeDecl ) = oldglobal; + } + /* Inner extern decl is built-in if global one is. */ + if ( CIsTreeDeclBuiltIn(oldglobal)) + { + CSetTreeDeclBuiltIn( TreeDecl ); +# ifdef LUDO_NO_SKIP + DECL_FUNCTION_CODE ( TreeDecl ) = DECL_FUNCTION_CODE (oldglobal); +# endif + } + /* Keep the arg types from a file-scope fcn defn. */ + if ( CTreeTypeValues(CTreeType(oldglobal)) != 0 + && CTreeDeclInitial(oldglobal) + && CTreeTypeValues(CTreeType( TreeDecl )) == 0) + { + CTreeType( TreeDecl ) = CTreeType(oldglobal); + } + } + } + + /* If we have a local external declaration, + and no file-scope declaration has yet been seen, + then if we later have a file-scope decl it must not be static. */ + if (oldlocal == 0 + && CIsTreeDeclExternal( TreeDecl ) + && CIsTreeNodePublic( TreeDecl )) + { + if (oldglobal == 0) + CSetTreeNodePublic( TreeName ); + + /* Save this decl, so that we can do type checking against + other decls after it falls out of scope. + + Only save it once. This prevents temporary decls created in + expand_inline_function from being used here, since this + will have been set when the inline function was parsed. + It also helps give slightly better warnings. */ + if (CTreeIdentLimboValue( TreeName ) == 0) + CTreeIdentLimboValue( TreeName ) = TreeDecl; + } + + /* Warn if shadowing an argument at the top level of the body. */ + if (oldlocal != 0 && !CIsTreeDeclExternal( TreeDecl ) + /* This warning doesn't apply to the parms of a nested fcn. */ + && ! c_current_binding_level->PARAM_FLAG + /* Check that this is one level down from the parms. */ + && c_current_binding_level->LEVEL_CHAIN->PARAM_FLAG + /* Check that the decl being shadowed + comes from the parm level, one level up. */ + && c_is_chain_member(oldlocal, c_current_binding_level->LEVEL_CHAIN->NAME_LIST)) + { + if ( CTreeDeclCode(oldlocal) == C_PARAM_DECL) + { + pedwarn ("declaration of `%s' shadows a parameter", + CTreeIdentPointer( TreeName )); + } + else + { + pedwarn ("declaration of `%s' shadows a symbol from the parameter list", + CTreeIdentPointer( TreeName )); + } + } + + /* Maybe warn if shadowing something else. */ + else if (c_warn_shadow && !CIsTreeDeclExternal( TreeDecl ) + /* No shadow warnings for internally generated vars. */ + && CTreeDeclLineNum( TreeDecl ) != 0 + /* No shadow warnings for vars made for inlining. */ + && ! (CTreeDeclAbstractOrigin( TreeDecl ) != NULL) + ) + { + char *warnstring = 0; + + if ( CTreeDeclCode( TreeDecl ) == C_PARAM_DECL + && c_current_binding_level->LEVEL_CHAIN->PARAM_FLAG) + /* Don't warn about the parm names in function declarator + within a function declarator. + It would be nice to avoid warning in any function + declarator in a declaration, as opposed to a definition, + but there is no way to tell it's not a definition. */ + ; + else if (oldlocal != 0 && CTreeDeclCode(oldlocal) == C_PARAM_DECL) + { + warnstring = "declaration of `%s' shadows a parameter"; + } + else if (oldlocal != 0) + { + warnstring = "declaration of `%s' shadows previous local"; + } + else if ( CTreeIdentGlobalValue( TreeName ) != 0 + && CTreeIdentGlobalValue( TreeName ) != c_error_mark_node) + { + warnstring = "declaration of `%s' shadows global declaration"; + } + + if (warnstring) + { + warning (warnstring, CTreeIdentPointer( TreeName )); + } + } + + /* If storing a local value, there may already be one (inherited). + If so, record it for restoration when this binding level ends. */ + if (oldlocal != 0) + Binding->SHADOWED_LIST = + c_tree_add_head_list( TreeName , oldlocal, Binding->SHADOWED_LIST); + } + + /* Keep count of variables in this level with incomplete type. */ + if ( CTreeTypeSize(CTreeType( TreeDecl )) == 0) + ++ Binding->N_INCOMPLETE; + } + + /* Put decls on list in reverse order. + We will reverse them later if necessary. */ + + TreeDecl->COMMON.CHAIN = Binding->NAME_LIST; + Binding->NAME_LIST = TreeDecl; + + return( TreeDecl ); +} + + +/* Decode the parameter-list info for a function type or function definition. + The argument is the value returned by `get_parm_info' (or made in parse.y + if there is an identifier list instead of a parameter decl list). + These two functions are separate because when a function returns + or receives functions then each is called multiple times but the order + of calls is different. The last call to `grokparms' is always the one + that contains the formal parameter names of a function definition. + + Store in `last_function_parms' a chain of the decls of parms. + Also store in `last_function_parm_tags' a chain of the struct, union, + and enum tags declared among the parms. + + Return a list of arg types to use in the FUNCTION_TYPE for this function. + + FUNCDEF_FLAG is nonzero for a function definition, 0 for + a mere declaration. A nonempty identifier-list gets an error message + when FUNCDEF_FLAG is zero. */ + +static c_tree_node *c_grokparms(parms_info, Funcdef_flag) + c_tree_node *parms_info; + int Funcdef_flag; +{ + c_tree_node *first_parm = CTreeChain(parms_info); + + c_last_function_parms = CTreeListPurpose(parms_info); + c_last_function_parm_tags = CTreeListValue(parms_info); + + if (c_warn_strict_prototypes && first_parm == 0 && !Funcdef_flag + && !c_in_system_header) + { + warning ("function declaration isn't a prototype"); + } + + if (first_parm != 0 + && CTreeNodeFirstCode( CTreeListValue(first_parm)) == C_IDENTIFIER_NODE) + { + if (! Funcdef_flag) + { + pedwarn ("parameter names (without types) in function declaration"); + } + + c_last_function_parms = first_parm; + return 0; + } + else + { + c_tree_node *parm; + c_tree_node *typelt; + /* We no longer test FUNCDEF_FLAG. + If the arg types are incomplete in a declaration, + they must include undefined tags. + These tags can never be defined in the scope of the declaration, + so the types can never be completed, + and no call can be compiled successfully. */ + + for (parm = c_last_function_parms, typelt = first_parm; + parm; + parm = CTreeChain(parm)) + { + /* Skip over any enumeration constants declared here. */ + if ( CTreeDeclCode(parm) == C_PARAM_DECL) + { + /* Barf if the parameter itself has an incomplete type. */ + c_tree_node *type = CTreeListValue(typelt); + if (CTreeTypeSize(type) == 0) + { + if (Funcdef_flag && CTreeDeclName(parm) != 0) + { + error ("parameter `%s' has incomplete type", + CTreeIdentPointer(CTreeDeclName(parm))); + } + else + { + warning ("parameter has incomplete type"); + } + if (Funcdef_flag) + { + CTreeListValue(typelt) = c_error_mark_node; + CTreeType(parm) = c_error_mark_node; + } + } + typelt = CTreeChain(typelt); + } + } + + /* Allocate the list of types the way we allocate a type. */ + if (first_parm && ! CIsTreeNodePermanent(first_parm)) + { + /* Construct a copy of the list of types + on the saveable obstack. */ + c_tree_node *result = NULL; + + for (typelt = first_parm; typelt; typelt = CTreeChain(typelt)) + { + result = c_tree_add_head_list( NULL, CTreeListValue(typelt), result); + } + + return c_tree_reverse_list(result); + } + else + /* The list we have is permanent already. */ + { + return first_parm; + } + } +} + +/*------------------------------------------------------------\ +| | +| Grant Check Declaration | +| | +\------------------------------------------------------------*/ + +static c_tree_node *c_grokdeclarator( Declarator, Declspecs, Decl_context, Initialized ) + + c_tree_node *Declarator; + c_tree_node *Declspecs; + int Decl_context; + int Initialized; +{ + c_tree_node *TreeDecl; + c_tree_node *ScanDeclarator; + c_tree_node *ScanSpec; + c_tree_node *TreeId; + c_tree_node *TreeNode; + c_tree_node *TreeType = (c_tree_node *)0; + c_tree_node *Typedef_decl = (c_tree_node *)0; + c_tree_node *Typedef_type = (c_tree_node *)0; + + char *Name; + + int Explicit_int = 0; + int Explicit_char = 0; + int Defaulted_int = 0; + int Specbits = 0; + int Longlong = 0; + int Funcdef_flag = 0; + int Bitfield = 0; + int Size_varies = 0; + + int Constp; + int Volatilep; + int Inlinep; + int Innermost_code = C_ERROR_NODE; + int NodeType; + int ExprType; + int TreeIdType; + int Index; + +# ifdef LUDO_NO_SKIP + c_tree_node *spec; + tree typedef_type = 0; + tree decl_machine_attr = NULL; +# endif + + if ( Decl_context == C_CDECL_BIT_FIELD) + { + Bitfield = 1; Decl_context = C_CDECL_FIELD; + } + + if ( Decl_context == C_CDECL_FUNCDEF) + { + Funcdef_flag = 1; Decl_context = C_CDECL_NORMAL; + } + +# ifdef LUDO_NO_SKIP + push_obstacks_nochange (); + if (c_flag_traditional && allocation_temporary_p ()) + end_temporary_allocation (); +# endif + + /* Look inside a declarator for the name being declared + and get it as a string, for an error message. */ + + ScanDeclarator = Declarator; + Name = (char *)0; + + while ( ScanDeclarator != (c_tree_node *)0 ) + { + NodeType = CTreeNodeFirstCode( ScanDeclarator ); + + if ( NodeType == C_EXPR_NODE ) + { + ExprType = CTreeExprCode( ScanDeclarator ); + + if ( ( ExprType == C_ARRAY_REF ) || + ( ExprType == C_INDIRECT_REF ) || + ( ExprType == C_CALL_EXPR ) ) + { + Innermost_code = ExprType; + ScanDeclarator = CTreeExprOperand( ScanDeclarator, 0 ); + } + } + else + if ( NodeType == C_IDENTIFIER_NODE ) + { + Name = CTreeIdentPointer( ScanDeclarator ); + ScanDeclarator = (c_tree_node *)0; + } + else + { + abort(); + } + } + + if ( Name == (char *)0 ) + { + Name = "type name"; + } + + /* A function definition's declarator must have the form of + a function declarator. */ + + if ( Funcdef_flag && ( Innermost_code != C_CALL_EXPR ) ) + { + return( (c_tree_node *)0 ); + } + + /* Anything declared one level down from the top level + must be one of the parameters of a function + (because the body is at least two levels down). */ + + /* If this looks like a function definition, make it one, + even if it occurs where parms are expected. + Then store_parm_decls will reject it and not use it as a parm. */ + + if ( ( Decl_context == C_CDECL_NORMAL ) && + ( ! Funcdef_flag ) && + ( c_current_binding_level->PARAM_FLAG ) ) + { + Decl_context = C_CDECL_PARAM; + } + + /* Look through the decl specs and record which ones appear. + Some typespecs are defined as built-in typenames. + Others, the ones that are modifiers of other types, + are represented by bits in SPECBITS: set the bits for + the modifiers that appear. Storage class keywords are also in SPECBITS. + + If there is a typedef name or a type, store the type in TYPE. + This includes builtin typedefs such as `int'. + + Set EXPLICIT_INT or EXPLICIT_CHAR if the type is `int' or `char' + and did not come from a user typedef. + + Set LONGLONG if `long' is mentioned twice. */ + + for ( ScanSpec = Declspecs; + ScanSpec != (c_tree_node *)0; + ScanSpec = CTreeChain( ScanSpec ) ) + { + TreeId = CTreeListValue( ScanSpec ); + TreeIdType = CTreeNodeFirstCode( TreeId ); + + if ( TreeId == c_ridpointers[(int)RID_INT] ) + { + Explicit_int = 1; + } + + if ( TreeId == c_ridpointers[(int)RID_CHAR] ) + { + Explicit_char = 1; + } + + if ( TreeIdType == C_IDENTIFIER_NODE ) + { + for ( Index = (int)RID_FIRST_MODIFIER; Index < (int) RID_MAX; Index++) + { + if ( c_ridpointers[ Index ] == TreeId ) + { + if ( ( Index == (int)RID_LONG ) && + ( Specbits & (1<< Index) ) ) + { + if ( Longlong ) + { + error ("`long long long' is too long for GCC"); + } + else + { + if ( ( c_pedantic ) && ( ! c_in_system_header ) ) + { + pedwarn ("ANSI C does not support `long long'"); + } + + Longlong = 1; + } + } + else + if ( Specbits & (1 << Index) ) + { + pedwarn ("duplicate `%s'", CTreeIdentPointer( TreeId ) ); + } + + Specbits |= 1 << Index; + goto found; + } + } + } + + if ( TreeType ) + { + error("two or more data types in declaration of `%s'", Name); + } + /* Actual typedefs come to us as TYPE_DECL nodes. */ + else if ( ( TreeIdType == C_DECL_NODE ) && + ( CTreeDeclCode( TreeId ) == C_TYPE_DECL ) ) + { + TreeType = CTreeType( TreeId ); +# ifdef LUDO_NO_SKIP + Decl_machine_attr = DECL_MACHINE_ATTRIBUTES (id); +# endif + Typedef_decl = TreeId; + } + /* Built-in types come as identifiers. */ + else + if ( TreeIdType == C_IDENTIFIER_NODE ) + { + TreeNode = c_lookup_name( TreeId ); + + if ( ( TreeNode == (c_tree_node *)0 ) || + ( CTreeDeclCode( TreeNode ) != C_TYPE_DECL ) ) + { + error("`%s' fails to be a typedef or built in type", CTreeIdentPointer( TreeId )); + } + else + if ( CTreeType( TreeNode ) != c_error_mark_node ) + { + TreeType = CTreeType( TreeNode ); + Typedef_decl = TreeNode; + } + } + else + if ( TreeIdType != C_ERROR_NODE ) + { + TreeType = TreeId; + } + + found: {} + } + + Typedef_type = TreeType; + + if ( TreeType != (c_tree_node *)0 ) + { + Size_varies = CIsTreeTypeVarSize(TreeType); + } + + /* No type at all: default to `int', and set DEFAULTED_INT + because it was not a user-defined typedef. */ + + if ( TreeType == (c_tree_node *)0 ) + { + if (! (Specbits & ((1 << (int) RID_LONG) | (1 << (int) RID_SHORT) + | (1 << (int) RID_SIGNED) + | (1 << (int) RID_UNSIGNED)))) + { + /* C9x will probably require a diagnostic here. + For now, issue a warning if -Wreturn-type and this is a function, + or if -Wimplicit; prefer the former warning since it is more + explicit. */ + if ((c_warn_implicit_int || c_warn_return_type) && Funcdef_flag) + c_warn_about_return_type = 1; + else if (c_warn_implicit_int) + { + warning ("type defaults to `int' in declaration of `%s'", Name); + } + } + + Defaulted_int = 1; + TreeType = c_integer_type_node; + } + + /* Now process the modifiers that were specified and check for invalid + * combinations. */ + /* Long double is a special combination. */ + + if (( Specbits & 1 << (int) RID_LONG) && + (! Longlong) && + (CTreeTypeMainVariant( TreeType ) == c_double_type_node)) + { + Specbits &= ~(1 << (int) RID_LONG); + TreeType = c_long_double_type_node; + } + + /* Check all other uses of type modifiers. */ + + if (Specbits & ((1 << (int) RID_LONG) | (1 << (int) RID_SHORT) + | (1 << (int) RID_UNSIGNED) | (1 << (int) RID_SIGNED))) + { + int Ok = 0; + + if ((Specbits & 1 << (int) RID_LONG) + && (Specbits & 1 << (int) RID_SHORT)) + { + error ("both long and short specified for `%s'", Name); + } + else if (((Specbits & 1 << (int) RID_LONG) + || (Specbits & 1 << (int) RID_SHORT)) + && Explicit_char) + { + error ("long or short specified with char for `%s'", Name); + } + else if (((Specbits & 1 << (int) RID_LONG) + || (Specbits & 1 << (int) RID_SHORT)) + && CTreeTypeCode( TreeType ) == C_REAL_TYPE) + { + static int Already = 0; + + error ("long or short specified with floating type for `%s'", Name); + if (! Already && ! c_pedantic) + { + error ("the only valid combination is `long double'"); + Already = 1; + } + } + else if ((Specbits & 1 << (int) RID_SIGNED) + && (Specbits & 1 << (int) RID_UNSIGNED)) + { + error ("both signed and unsigned specified for `%s'", Name); + } + else if ( CTreeTypeCode( TreeType ) != C_INTEGER_TYPE) + { + error ("long, short, signed or unsigned invalid for `%s'", Name); + } + else + { + Ok = 1; + + if (!Explicit_int && !Defaulted_int && !Explicit_char && c_pedantic) + { + pedwarn ("long, short, signed or unsigned used invalidly for `%s'", Name); + + if (c_flag_pedantic_errors) Ok = 0; + } + } + + /* Discard the type modifiers if they are invalid. */ + if (! Ok) + { + Specbits &= ~((1 << (int) RID_LONG) | (1 << (int) RID_SHORT) + | (1 << (int) RID_UNSIGNED) | (1 << (int) RID_SIGNED)); + Longlong = 0; + } + } + + if ((Specbits & (1 << (int) RID_COMPLEX) ) && + (CTreeTypeCode( TreeType ) != C_INTEGER_TYPE) && + (CTreeTypeCode( TreeType ) != C_REAL_TYPE ) ) + { + error ("complex invalid for `%s'", Name); + Specbits &= ~ (1 << (int) RID_COMPLEX); + } + + /* Decide whether an integer type is signed or not. + Optionally treat bitfields as signed by default. */ + if ((Specbits & 1 << (int) RID_UNSIGNED) || + /* Traditionally, all bitfields are unsigned. */ + (Bitfield && c_flag_traditional + && (! c_explicit_flag_signed_bitfields || !c_flag_signed_bitfields)) || + (Bitfield && ! c_flag_signed_bitfields + && (Explicit_int || Defaulted_int || Explicit_char + /* A typedef for plain `int' without `signed' + can be controlled just like plain `int'. */ +# ifdef LUDO_NO_SKIP + || ! (Typedef_decl != 0 && C_TYPEDEF_EXPLICITLY_SIGNED(typedef_decl)) +# endif + ) + && CTreeTypeCode( TreeType ) != C_ENUMERAL_TYPE + && !(Specbits & 1 << (int) RID_SIGNED))) + { + if (Longlong) + { + TreeType = c_long_long_unsigned_type_node; + } + else if (Specbits & 1 << (int) RID_LONG) + { + TreeType = c_long_unsigned_type_node; + } + else if (Specbits & 1 << (int) RID_SHORT) + { + TreeType = c_short_unsigned_type_node; + } + else if (TreeType == c_char_type_node) + { + TreeType = c_unsigned_char_type_node; + } + else if ( Typedef_decl != (c_tree_node *)0 ) + { + TreeType = c_get_unsigned_type(TreeType); + } + else + { + TreeType = c_unsigned_type_node; + } + } + else if ((Specbits & 1 << (int) RID_SIGNED) && (TreeType == c_char_type_node)) + { + TreeType = c_signed_char_type_node; + } + else if (Longlong) + { + TreeType = c_long_long_integer_type_node; + } + else if (Specbits & 1 << (int) RID_LONG) + { + TreeType = c_long_integer_type_node; + } + else if (Specbits & 1 << (int) RID_SHORT) + { + TreeType = c_short_integer_type_node; + } + + if (Specbits & 1 << (int) RID_COMPLEX) + { + /* If we just have "complex", it is equivalent to + "complex double", but if any modifiers at all are specified it is + the complex form of TYPE. E.g, "complex short" is + "complex short int". */ + + if (Defaulted_int && ! Longlong + && ! (Specbits & ((1 << (int) RID_LONG) | (1 << (int) RID_SHORT) + | (1 << (int) RID_SIGNED) + | (1 << (int) RID_UNSIGNED)))) + { + TreeType = c_complex_double_type_node; + } + else if (TreeType == c_integer_type_node) + { + TreeType = c_complex_integer_type_node; + } + else if (TreeType == c_float_type_node) + { + TreeType = c_complex_float_type_node; + } + else if (TreeType == c_double_type_node) + { + TreeType = c_complex_double_type_node; + } + else if (TreeType == c_long_double_type_node) + { + TreeType = c_complex_long_double_type_node; + } + else + { + TreeType = c_tree_build_complex_type (TreeType); + } + } + + /* Set CONSTP if this declaration is `const', whether by + explicit specification or via a typedef. + Likewise for VOLATILEP. */ + + Constp = (!! (Specbits & 1 << (int) RID_CONST)) + + (!! CIsTreeNodeReadOnly(TreeType)) ; + + Volatilep = (!! (Specbits & 1 << (int) RID_VOLATILE)) + + (!! CIsTreeNodeVolatile(TreeType)); + + Inlinep = !! (Specbits & (1 << (int) RID_INLINE)); + if (Constp > 1) + { + pedwarn ("duplicate `const'"); + } + if (Volatilep > 1) + { + pedwarn ("duplicate `volatile'"); + } + + if (! c_flag_gen_aux_info && + (CIsTreeNodeReadOnly(TreeType) || CIsTreeNodeVolatile(TreeType))) + { + TreeType = CTreeTypeMainVariant(TreeType); + } + + /* Warn if two storage classes are given. Default to `auto'. */ + + { + int nclasses = 0; + + if (Specbits & 1 << (int) RID_AUTO) nclasses++; + if (Specbits & 1 << (int) RID_STATIC) nclasses++; + if (Specbits & 1 << (int) RID_EXTERN) nclasses++; + if (Specbits & 1 << (int) RID_REGISTER) nclasses++; + if (Specbits & 1 << (int) RID_TYPEDEF) nclasses++; + if (Specbits & 1 << (int) RID_ITERATOR) nclasses++; + + /* Warn about storage classes that are invalid for certain + kinds of declarations (parameters, typenames, etc.). */ + + if (nclasses > 1) + { + error ("multiple storage classes in declaration of `%s'", Name); + } + else if (Funcdef_flag + && (Specbits + & ((1 << (int) RID_REGISTER) + | (1 << (int) RID_AUTO) + | (1 << (int) RID_TYPEDEF)))) + { + if (Specbits & 1 << (int) RID_AUTO + && (c_pedantic || c_current_binding_level == c_global_binding_level)) + pedwarn ("function definition declared `auto'"); + if (Specbits & 1 << (int) RID_REGISTER) + error ("function definition declared `register'"); + if (Specbits & 1 << (int) RID_TYPEDEF) + error ("function definition declared `typedef'"); + Specbits &= ~ ((1 << (int) RID_TYPEDEF) | (1 << (int) RID_REGISTER) + | (1 << (int) RID_AUTO)); + } + else if (Decl_context != C_CDECL_NORMAL && nclasses > 0) + { + if (Decl_context == C_CDECL_PARAM && Specbits & 1 << (int) RID_REGISTER) ; + else + { + error ((Decl_context == C_CDECL_FIELD + ? "storage class specified for structure field `%s'" + : (Decl_context == C_CDECL_PARAM + ? "storage class specified for parameter `%s'" + : "storage class specified for typename")), + Name); + Specbits &= ~ ((1 << (int) RID_TYPEDEF) | (1 << (int) RID_REGISTER) + | (1 << (int) RID_AUTO) | (1 << (int) RID_STATIC) + | (1 << (int) RID_EXTERN)); + } + } + else if (Specbits & 1 << (int) RID_EXTERN && Initialized && ! Funcdef_flag) + { + /* `extern' with initialization is invalid if not at top level. */ + if (c_current_binding_level == c_global_binding_level) + { + warning ("`%s' initialized and declared `extern'", Name); + } + else + { + error ("`%s' has both `extern' and initializer", Name); + } + } + else if (Specbits & 1 << (int) RID_EXTERN && Funcdef_flag + && c_current_binding_level != c_global_binding_level) + { + error ("nested function `%s' declared `extern'", Name); + } + else if (c_current_binding_level == c_global_binding_level + && Specbits & (1 << (int) RID_AUTO)) + { + error ("top-level declaration of `%s' specifies `auto'", Name); + } + else if ((Specbits & 1 << (int) RID_ITERATOR) + && CTreeNodeFirstCode(Declarator) != C_IDENTIFIER_NODE) + { + error ("iterator `%s' has derived type", Name); + TreeType = c_error_mark_node; + } + else if ((Specbits & 1 << (int) RID_ITERATOR) + && CTreeTypeCode(TreeType) != C_INTEGER_TYPE) + { + error ("iterator `%s' has noninteger type", Name); + TreeType = c_error_mark_node; + } + } + + /* Now figure out the structure of the declarator proper. + Descend through it, creating more complex types, until we reach + the declared identifier (or NULL, in an absolute declarator). */ + + while ( ( Declarator != (c_tree_node *)0 ) && + ( CTreeNodeFirstCode( Declarator ) != C_IDENTIFIER_NODE) ) + { + if ( TreeType == c_error_mark_node ) + { + Declarator = CTreeExprOperand( Declarator, 0 ); + continue; + } + + /* Each level of DECLARATOR is either an ARRAY_REF (for ...[..]), + an INDIRECT_REF (for *...), + a CALL_EXPR (for ...(...)), + an identifier (for the name being declared) + or a null pointer (for the place in an absolute declarator + where the name was omitted). + For the last two cases, we have just exited the loop. + + At this point, TYPE is the TreeType of elements of an array, + or for a function to return, or for a pointer to point to. + After this sequence of ifs, TYPE is the TreeType of the + array or function or pointer, and DECLARATOR has had its + outermost layer removed. */ + + NodeType = CTreeNodeFirstCode( Declarator ); + + if ( ( NodeType == C_EXPR_NODE ) && + ( CTreeExprCode( Declarator) == C_ARRAY_REF ) ) + { + c_tree_node *itype = (c_tree_node *)0; + c_tree_node *size = CTreeExprOperand(Declarator, 1); + /* An uninitialized decl with `extern' is a reference. */ +# ifdef LUDO_NO_SKIP + int extern_ref = !Initialized && (Specbits & (1 << (int) RID_EXTERN)); +# endif + /* The index is a signed object `sizetype' bits wide. */ + c_tree_node *index_type = c_get_signed_type(c_size_type); + + Declarator = CTreeExprOperand(Declarator, 0); + + /* Check for some types that there cannot be arrays of. */ + + if ( CTreeTypeMainVariant(TreeType) == c_void_type_node) + { + error ("declaration of `%s' as array of voids", Name); + TreeType = c_error_mark_node; + } + + if ( CTreeTypeCode(TreeType) == C_FUNCTION_TYPE) + { + error ("declaration of `%s' as array of functions", Name); + TreeType = c_error_mark_node; + } + + if (size == c_error_mark_node) + { + TreeType = c_error_mark_node; + } + + if (TreeType == c_error_mark_node) + { + continue; + } + + /* If this is a block level extern, it must live past the end + of the function so that we can check it against other extern + declarations (IDENTIFIER_LIMBO_VALUE). */ +# ifdef LUDO_NO_SKIP + if (extern_ref && allocation_temporary_p ()) + end_temporary_allocation (); +# endif + + /* If size was specified, set ITYPE to a range-TreeType for that size. + Otherwise, ITYPE remains null. finish_decl may figure it out + from an initial value. */ + + if (size) + { + /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */ + + CStripTypeNops(size); + + if ( CTreeTypeCode( CTreeType(size)) != C_INTEGER_TYPE + && CTreeTypeCode( CTreeType(size)) != C_ENUMERAL_TYPE) + { + error ("size of array `%s' has non-integer type", Name); + size = c_integer_one_node; + } + + if (c_pedantic && c_tree_is_integer_zerop(size)) + { + pedwarn ("ANSI C forbids zero-size array `%s'", Name); + } + + if (CTreeNodeFirstCode(size) == C_INT_CST_NODE) + { + c_constant_expression_warning(size); + if (c_tree_is_int_cst_sgn(size) < 0) + { + error ("size of array `%s' is negative", Name); + size = c_integer_one_node; + } + } + else + { + /* Make sure the array size remains visibly nonconstant + even if it is (eg) a const variable with known value. */ + Size_varies = 1; + + if (c_pedantic) + { + if ( CIsTreeNodeConstant(size)) + { + pedwarn("ANSI C forbids array `%s' whose size can't be evaluated", Name); + } + else + { + pedwarn("ANSI C forbids variable-size array `%s'", Name); + } + } + } + + /* Convert size to index_type, so that if it is a variable + the computations will be done in the proper mode. */ + itype = c_fold( c_tree_build_binary_typed_expr( + C_MINUS_EXPR, index_type, + c_convert_expr(index_type, size), + c_convert_expr(index_type, c_size_one_node)) ); + + /* If that overflowed, the array is too big. + ??? While a size of INT_MAX+1 technically shouldn't cause + an overflow (because we subtract 1), the overflow is recorded + during the conversion to index_type, before the subtraction. + Handling this case seems like an unnecessary complication. */ + if ( CIsTreeNodeOverflow(itype)) + { + error ("size of array `%s' is too large", Name); + TreeType = c_error_mark_node; + continue; + } + +# ifdef LUDO_NO_SKIP + if (Size_varies) + { + itype = variable_size (itype); + } +# endif + itype = c_tree_build_index_type(itype); + } + + /* Build the array TreeType itself, then merge any constancy or + volatility into the target TreeType. We must do it in this order + to ensure that the TYPE_MAIN_VARIANT field of the array TreeType + is set correctly. */ + + TreeType = c_tree_build_array_type(TreeType, itype); + if (Constp || Volatilep) + { + TreeType = c_c_build_type_variant(TreeType, Constp, Volatilep); + } + + if (Size_varies) + { + CSetTreeTypeVarSize(TreeType); + } + } + else + if ( ( NodeType == C_EXPR_NODE ) && + ( CTreeExprCode( Declarator) == C_CALL_EXPR ) ) + { +# ifdef LUDO_NO_SKIP + int Extern_ref = (!(Specbits & (1 << (int) RID_AUTO)) + || c_current_binding_level == c_global_binding_level); +# endif + c_tree_node *arg_types; + + /* Declaring a function TreeType. + Make sure we have a valid TreeType for the function to return. */ + if (TreeType == c_error_mark_node) + continue; + + Size_varies = 0; + + /* Warn about some types functions can't return. */ + + if ( CTreeTypeCode(TreeType) == C_FUNCTION_TYPE) + { + error ("`%s' declared as function returning a function", Name); + TreeType = c_integer_type_node; + } + if ( CTreeTypeCode(TreeType) == C_ARRAY_TYPE) + { + error ("`%s' declared as function returning an array", Name); + TreeType = c_integer_type_node; + } + +#ifndef TRADITIONAL_RETURN_FLOAT + /* Traditionally, declaring return TreeType float means double. */ + + if (c_flag_traditional && CTreeTypeMainVariant(TreeType) == c_float_type_node) + { + TreeType = c_double_type_node; + } +#endif /* TRADITIONAL_RETURN_FLOAT */ + + /* If this is a block level extern, it must live past the end + of the function so that we can check it against other extern + declarations (IDENTIFIER_LIMBO_VALUE). */ +# ifdef LUDO_NO_SKIP + if (extern_ref && allocation_temporary_p ()) + end_temporary_allocation (); +# endif + + /* Construct the function TreeType and go to the next + inner layer of declarator. */ + + arg_types = c_grokparms( CTreeExprOperand( Declarator, 1), + Funcdef_flag + /* Say it's a definition only for the CALL_EXPR closest to the identifier. */ + && CTreeNodeFirstCode( CTreeExprOperand(Declarator, 0)) == C_IDENTIFIER_NODE); + /* ANSI seems to say that `const int foo ();' + does not make the function foo const. */ + if (Constp || Volatilep) + { + TreeType = c_c_build_type_variant(TreeType, Constp, Volatilep); + } + Constp = 0; + Volatilep = 0; + + TreeType = c_tree_build_function_type(TreeType, arg_types); + Declarator = CTreeExprOperand(Declarator, 0); + + /* Set the TYPE_CONTEXTs for each tagged TreeType which is local to + the formal parameter list of this FUNCTION_TYPE to point to + the FUNCTION_TYPE node itself. */ + + { + c_tree_node *link; + + for (link = c_current_function_parm_tags; + link; + link = CTreeChain (link)) + CTreeTypeContext( CTreeListValue(link)) = TreeType; + } + } + else + if ( ( NodeType == C_EXPR_NODE ) && + ( CTreeExprCode( Declarator) == C_INDIRECT_REF ) ) + { + /* Merge any constancy or volatility into the target TreeType + for the pointer. */ + + if (c_pedantic && CTreeTypeCode(TreeType) == C_FUNCTION_TYPE + && (Constp || Volatilep)) + { + pedwarn ("ANSI C forbids const or volatile function types"); + } + if (Constp || Volatilep) + { + TreeType = c_c_build_type_variant(TreeType, Constp, Volatilep); + } + + Constp = 0; + Volatilep = 0; + Size_varies = 0; + + TreeType = c_tree_build_pointer_type(TreeType); + + /* Process a list of TreeType modifier keywords + (such as const or volatile) that were given inside the `*'. */ + + if ( CTreeType(Declarator) != (c_tree_node *)0 ) + { + c_tree_node *typemodlist; + int erred = 0; + for (typemodlist = CTreeType(Declarator); typemodlist; + typemodlist = CTreeChain(typemodlist)) + { + if ( CTreeListValue(typemodlist) == c_ridpointers[(int) RID_CONST]) + { + Constp++; + } + else if ( CTreeListValue(typemodlist) == c_ridpointers[(int) RID_VOLATILE]) + { + Volatilep++; + } + else if (!erred) + { + erred = 1; + error ("invalid TreeType modifier within pointer declarator"); + } + } + if (Constp > 1) + { + pedwarn ("duplicate `const'"); + } + if (Volatilep > 1) + { + pedwarn ("duplicate `volatile'"); + } + } + + Declarator = CTreeExprOperand(Declarator, 0); + } + else abort (); + } + + /* Now TYPE has the actual TreeType. */ + + /* Did array size calculations overflow? */ + + if ( CTreeTypeCode(TreeType) == C_ARRAY_TYPE + && CTreeTypeSize(TreeType) + && CIsTreeNodeOverflow( CTreeTypeSize(TreeType))) + { + error ("size of array `%s' is too large", Name); + } + + /* If this is declaring a typedef name, return a TYPE_DECL. */ + + if (Specbits & (1 << (int) RID_TYPEDEF)) + { +# ifdef LUDO_NO_SKIP + c_tree_node *decl; +# endif + /* Note that the grammar rejects storage classes + in typenames, fields or parameters */ + if ( c_pedantic && + ( CTreeTypeCode( TreeType ) == C_FUNCTION_TYPE ) && + ( Constp || Volatilep ) ) + { + pedwarn ("ANSI C forbids const or volatile function types"); + } + if (Constp || Volatilep) + { + TreeType = c_c_build_type_variant(TreeType, Constp, Volatilep); + } + + TreeDecl = c_tree_build_decl( C_TYPE_DECL, Declarator, TreeType); + +# ifdef LUDO_NO_SKIP + if ((Specbits & (1 << (int) RID_SIGNED)) + || (typedef_decl && C_TYPEDEF_EXPLICITLY_SIGNED (typedef_decl))) + C_TYPEDEF_EXPLICITLY_SIGNED (decl) = 1; + pop_obstacks (); +# endif + + return( TreeDecl ); + } + + /* Detect the case of an array TreeType of unspecified size + which came, as such, direct from a typedef name. + We must copy the TreeType, so that each identifier gets + a distinct TreeType, so that each identifier's size can be + controlled separately by its own initializer. */ + + if ( ( TreeType != (c_tree_node *)0 ) && + ( Typedef_type != (c_tree_node *)0 ) && + ( CTreeTypeMainVariant(TreeType) == CTreeTypeMainVariant(Typedef_type) ) && + ( CTreeTypeCode(TreeType) == C_ARRAY_TYPE ) && + ( CTreeTypeValues(TreeType) == 0) ) + { + TreeType = c_tree_build_array_type( CTreeType(TreeType), 0); + if (Size_varies) + { + CSetTreeTypeVarSize(TreeType); + } + } + + /* If this is a TreeType name (such as, in a cast or sizeof), + compute the TreeType and return it now. */ + + if (Decl_context == C_CDECL_TYPENAME) + { + /* Note that the grammar rejects storage classes + in typenames, fields or parameters */ + if (c_pedantic && CTreeTypeCode(TreeType) == C_FUNCTION_TYPE + && (Constp || Volatilep)) + { + pedwarn ("ANSI C forbids const or volatile function types"); + } + + if (Constp || Volatilep) + { + TreeType = c_c_build_type_variant(TreeType, Constp, Volatilep); + } + +# ifdef LUDO_NO_SKIP + pop_obstacks (); +# endif + return TreeType; + } + + /* Aside from typedefs and TreeType names (handle above), + `void' at top level (not within pointer) + is allowed only in public variables. + We don't complain about parms either, but that is because + a better error message can be made later. */ + + if ( CTreeTypeMainVariant(TreeType) == c_void_type_node && + Decl_context != C_CDECL_PARAM + && ! ((Decl_context != C_CDECL_FIELD && + CTreeTypeCode(TreeType) != C_FUNCTION_TYPE) + && ((Specbits & (1 << (int) RID_EXTERN)) + || (c_current_binding_level == c_global_binding_level + && !(Specbits + & ((1 << (int) RID_STATIC) | (1 << (int) RID_REGISTER))))))) + { + error ("variable or field `%s' declared void", Name); + TreeType = c_integer_type_node; + } + + /* Now create the decl, which may be a VAR_DECL, a PARM_DECL + or a FUNCTION_DECL, depending on DECL_CONTEXT and TYPE. */ + + if ( Decl_context == C_CDECL_PARAM ) + { +# ifdef LUDO_NO_SKIP + c_tree_node *type_as_written = TreeType; +# endif + c_tree_node *main_type; + + /* A parameter declared as an array of T is really a pointer to T. + One declared as a function is really a pointer to a function. */ + + if ( CTreeTypeCode(TreeType) == C_ARRAY_TYPE) + { + /* Transfer const-ness of array into that of TreeType pointed to. */ + TreeType = CTreeType(TreeType); + + if (Constp || Volatilep) + { + TreeType = c_c_build_type_variant(TreeType, Constp, Volatilep); + } + TreeType = c_tree_build_pointer_type(TreeType); + Volatilep = Constp = 0; + Size_varies = 0; + } + else if ( CTreeTypeCode(TreeType) == C_FUNCTION_TYPE) + { + if (c_pedantic && (Constp || Volatilep)) + { + pedwarn ("ANSI C forbids const or volatile function types"); + } + if (Constp || Volatilep) + { + TreeType = c_c_build_type_variant(TreeType, Constp, Volatilep); + } + TreeType = c_tree_build_pointer_type(TreeType); + Volatilep = Constp = 0; + } + + TreeDecl = c_tree_build_decl( C_PARAM_DECL, Declarator, TreeType); + + if (Size_varies) + { + CSetTreeDeclVarSize( TreeDecl ); + } + + /* Compute the TreeType actually passed in the parmlist, + for the case where there is no prototype. + (For example, shorts and chars are passed as ints.) + When there is a prototype, this is overridden later. */ + + CTreeDeclInitial( TreeDecl ) = TreeType; + main_type = (TreeType == c_error_mark_node + ? c_error_mark_node : CTreeTypeMainVariant(TreeType)); + + if (main_type == c_float_type_node) + { + CTreeDeclInitial( TreeDecl ) = c_double_type_node; + } + /* Don't use TYPE_PRECISION to decide whether to promote, + because we should convert short if it's the same size as int, + but we should not convert long if it's the same size as int. */ + + else if ( CTreeNodeFirstCode(main_type) != C_ERROR_NODE + && C_PROMOTING_INTEGER_TYPE_P(main_type)) + { + if ( CTreeTypePrecision(TreeType) == CTreeTypePrecision(c_integer_type_node) + && CIsTreeNodeUnsigned(TreeType)) + { + CTreeDeclInitial( TreeDecl ) = c_unsigned_type_node; + } + else + { + CTreeDeclInitial( TreeDecl ) = c_integer_type_node; + } + } + +# ifdef LUDO_NO_SKIP + DECL_ARG_TYPE_AS_WRITTEN ( TreeDecl ) = type_as_written; +# endif + } + else if ( Decl_context == C_CDECL_FIELD) + { + /* Structure field. It may not be a function. */ + + if ( CTreeTypeCode(TreeType) == C_FUNCTION_TYPE) + { + error ("field `%s' declared as a function", Name); + TreeType = c_tree_build_pointer_type(TreeType); + } + else if ( CTreeNodeFirstCode(TreeType) != C_ERROR_NODE && CTreeTypeSize(TreeType) == 0) + { + error ("field `%s' has incomplete type", Name); + TreeType = c_error_mark_node; + } + /* Move TreeType qualifiers down to element of an array. */ + if ( CTreeTypeCode(TreeType) == C_ARRAY_TYPE && (Constp || Volatilep)) + { + TreeType = c_tree_build_array_type(c_c_build_type_variant( + CTreeType(TreeType), Constp, Volatilep), + CTreeTypeValues(TreeType)); + } + + TreeDecl = c_tree_build_decl( C_FIELD_DECL, Declarator, TreeType ); + + if (Size_varies) + { + CSetTreeDeclVarSize(TreeDecl); + } + } + else if ( CTreeTypeCode(TreeType) == C_FUNCTION_TYPE) + { + /* Every function declaration is "external" + except for those which are inside a function body + in which `auto' is used. + That is a case not specified by ANSI C, + and we use it for forward declarations for nested functions. */ + int extern_ref = (!(Specbits & (1 << (int) RID_AUTO)) + || c_current_binding_level == c_global_binding_level); + + if (Specbits & (1 << (int) RID_AUTO) + && (c_pedantic || c_current_binding_level == c_global_binding_level)) + { + pedwarn ("invalid storage class for function `%s'", Name); + } + if (Specbits & (1 << (int) RID_REGISTER)) + { + error ("invalid storage class for function `%s'", Name); + } + /* Function declaration not at top level. + Storage classes other than `extern' are not allowed + and `extern' makes no difference. */ + if (c_current_binding_level != c_global_binding_level + && (Specbits & ((1 << (int) RID_STATIC) | (1 << (int) RID_INLINE))) + && c_pedantic) + { + pedwarn ("invalid storage class for function `%s'", Name); + } + + /* If this is a block level extern, it must live past the end + of the function so that we can check it against other + extern declarations (IDENTIFIER_LIMBO_VALUE). */ +# ifdef LUDO_NO_SKIP + if (extern_ref && allocation_temporary_p ()) + end_temporary_allocation (); +# endif + + TreeDecl = c_tree_build_decl( C_FUNCTION_DECL, Declarator, TreeType ); + +# ifdef LUDO_NO_SKIP + decl = c_build_decl_attribute_variant(decl, decl_machine_attr); +# endif + + if (c_pedantic && (Constp || Volatilep) + && ! CIsTreeDeclSystemHeader( TreeDecl )) + { + pedwarn ("ANSI C forbids const or volatile functions"); + } + + if (c_pedantic + && CTreeTypeMainVariant( + CTreeType( CTreeType( TreeDecl ))) == c_void_type_node + && ( CIsTreeNodeReadOnly( CTreeType( CTreeType( TreeDecl ))) + || CIsTreeNodeVolatile( CTreeType( CTreeType( TreeDecl )))) + && ! CIsTreeDeclSystemHeader( TreeDecl )) + { + pedwarn ("ANSI C forbids const or volatile void function return type"); + } + + if (Volatilep + && CTreeType( CTreeType( TreeDecl )) != c_void_type_node) + { + warning ("`noreturn' function returns non-void value"); + } + + if (extern_ref) + { + CSetTreeDeclExternal( TreeDecl ); + } + + /* Record absence of global scope for `static' or `auto'. */ + if ( !(Specbits & ((1 << (int) RID_STATIC) | (1 << (int) RID_AUTO)))) + { + CSetTreeNodePublic( TreeDecl ); + } + + /* Record presence of `inline', if it is reasonable. */ + if (Inlinep) + { +# ifdef LUDO_NO_SKIP + c_tree_node *last = c_tree_get_last_list( CTreeTypeValues(TreeType)); +# endif + if (! strcmp( CTreeIdentPointer(Declarator), "main")) + { + warning ("cannot inline function `main'"); + } + else + /* Assume that otherwise the function can be inlined. */ + CSetTreeDeclInline( TreeDecl ); + + if (Specbits & (1 << (int) RID_EXTERN)) + { + c_current_extern_inline = 1; + } + } + } + else + { + /* It's a variable. */ + /* An uninitialized decl with `extern' is a reference. */ + int extern_ref = !Initialized && (Specbits & (1 << (int) RID_EXTERN)); + + /* Move TreeType qualifiers down to element of an array. */ + if ( CTreeTypeCode(TreeType) == C_ARRAY_TYPE && (Constp || Volatilep)) + { + TreeType = c_tree_build_array_type( + c_c_build_type_variant( CTreeType(TreeType), Constp, Volatilep), + CTreeTypeValues(TreeType)); + } + + /* If this is a block level extern, it must live past the end + of the function so that we can check it against other + extern declarations (IDENTIFIER_LIMBO_VALUE). */ +# ifdef LUDO_NO_SKIP + if (extern_ref && allocation_temporary_p ()) + end_temporary_allocation (); +# endif + + TreeDecl = c_tree_build_decl( C_VAR_DECL, Declarator, TreeType ); + + if (Size_varies) + { + CSetTreeDeclVarSize( TreeDecl ); + } + + if (Inlinep) + { + pedwarn_with_decl( TreeDecl, "variable `%s' declared `inline'"); + } + + if ( extern_ref ) + { + CSetTreeNodeExternal( TreeDecl); + } + /* At top level, the presence of a `static' or `register' storage + class specifier, or the absence of all storage class specifiers + makes this declaration a definition (perhaps tentative). Also, + the absence of both `static' and `register' makes it public. */ + if (c_current_binding_level == c_global_binding_level) + { + if ( !(Specbits + & ((1 << (int) RID_STATIC) | (1 << (int) RID_REGISTER))) ) + { + CSetTreeNodePublic( TreeDecl ); + } + + if ( ! CIsTreeNodeExternal( TreeDecl ) ) + { + CSetTreeNodeStatic( TreeDecl ); + } + } + /* Not at top level, only `static' makes a static definition. */ + else + { + if ( (Specbits & (1 << (int) RID_STATIC)) != 0 ) + { + CSetTreeNodeStatic( TreeDecl ); + } + + if ( CIsTreeNodeExternal( TreeDecl ) ) + { + CSetTreeNodePublic( TreeDecl ); + } + } + + if (Specbits & 1 << (int) RID_ITERATOR) + { + CSetTreeDeclIterator( TreeDecl ); + } + } + + /* Record `register' declaration for warnings on & + and in case doing stupid register allocation. */ + + if (Specbits & (1 << (int) RID_REGISTER)) + { + CSetTreeDeclRegister( TreeDecl ); + } + + /* Record constancy and volatility. */ + + if (Constp) + { + CSetTreeNodeReadOnly( TreeDecl ); + } + + if (Volatilep) + { + CSetTreeNodeSideEffect( TreeDecl ); + CSetTreeNodeVolatile( TreeDecl ); + } + + /* If a type has volatile components, it should be stored in memory. + Otherwise, the fact that those components are volatile + will be ignored, and would even crash the compiler. */ + if ( CIsTreeTypeFieldsVolatile( CTreeType( TreeDecl ))) + { + c_mark_addressable ( TreeDecl ); + } + + return( TreeDecl ); +} + + + +/* Given a parsed parameter declaration, + decode it into a PARM_DECL and push that on the current binding level. + Also, for the sake of forward parm decls, + record the given order of parms in `parm_order'. */ + +void c_push_parm_decl(parm) + + c_tree_node *parm; +{ + c_tree_node *decl; +# ifdef LUDO_NO_SKIP + int old_immediate_size_expand = c_immediate_size_expand; + /* Don't try computing parm sizes now -- wait till fn is called. */ + immediate_size_expand = 0; + + /* The corresponding pop_obstacks is in finish_decl. */ + push_obstacks_nochange (); +# endif + + decl = c_grokdeclarator( CTreeListValue( CTreeListPurpose(parm)), + CTreeListPurpose( CTreeListPurpose(parm)), C_CDECL_PARAM, 0); + c_decl_attributes( decl, + CTreeListValue( CTreeListValue(parm)), + CTreeListPurpose( CTreeListValue(parm))); + + decl = c_push_decl(decl); + +# ifdef LUDO_NO_SKIP + immediate_size_expand = old_immediate_size_expand; +# endif + + c_current_binding_level->PARAM_LIST + = c_tree_add_head_list( (c_tree_node *)0,decl,c_current_binding_level->PARAM_LIST ); + + /* Add this decl to the current binding level. */ + c_finish_decl(decl, (c_tree_node *)0, (c_tree_node *)0); +} + +/*------------------------------------------------------------\ +| | +| Initialize Predefined Declaration | +| | +\------------------------------------------------------------*/ + +void c_init_decl_processing() +{ + static int FirstTime = 1; + +# ifdef LUDO_NO_SKIP + int wchar_type_size; +# endif + + c_tree_node *TreeDecl; + c_tree_node *TreeIdent; + c_tree_node *EndLink; + c_tree_node *array_domain_type; + c_tree_node *void_ftype_any; + c_tree_node *ptr_ftype_void; + c_tree_node *ptr_ftype_ptr; + c_tree_node *memcpy_ftype; + c_tree_node *memset_ftype; + c_tree_node *strlen_ftype; + c_tree_node *traditional_ptr_type_node; + + + c_current_binding_level = (c_binding_level *)0; + c_current_function_decl = (c_tree_node *)0; + c_named_labels = (c_tree_node *)0; + + c_push_level( 0 ); + + c_global_binding_level = c_current_binding_level; + + c_integer_type_node = c_tree_build_signed_type( C_INT_TYPE_SIZE ); + TreeDecl = c_tree_build_decl( C_TYPE_DECL, + c_ridpointers[(int)RID_INT], + c_integer_type_node ); + c_push_decl( TreeDecl ); + + if ( FirstTime ) + { + FirstTime = 0; + /* Define `char', which is like either `signed char' or `unsigned char' + but not the same as either. */ + + if ( c_flag_signed_char ) + { + c_char_type_node = c_tree_build_signed_type( C_CHAR_TYPE_SIZE ); + } + else + { + c_char_type_node = c_tree_build_unsigned_type( C_CHAR_TYPE_SIZE ); + } + TreeDecl = c_tree_build_decl( C_TYPE_DECL, + c_tree_get_identifier("char"), + c_char_type_node ); + c_push_decl( TreeDecl ); + + c_long_integer_type_node = c_tree_build_signed_type( C_LONG_TYPE_SIZE ); + TreeDecl = c_tree_build_decl( C_TYPE_DECL, + c_tree_get_identifier("long int"), + c_long_integer_type_node ); + c_push_decl( TreeDecl ); + + c_unsigned_type_node = c_tree_build_unsigned_type( C_INT_TYPE_SIZE ); + TreeDecl = c_tree_build_decl( C_TYPE_DECL, + c_tree_get_identifier("unsigned int"), + c_unsigned_type_node ); + c_push_decl( TreeDecl ); + + c_long_unsigned_type_node = c_tree_build_unsigned_type( C_LONG_TYPE_SIZE ); + TreeDecl = c_tree_build_decl( C_TYPE_DECL, + c_tree_get_identifier("long unsigned int"), + c_long_unsigned_type_node ); + + c_push_decl( TreeDecl ); + + c_long_long_integer_type_node = c_tree_build_signed_type( C_LONG_LONG_TYPE_SIZE ); + TreeDecl = c_tree_build_decl( C_TYPE_DECL, + c_tree_get_identifier("long long int"), + c_long_long_integer_type_node ); + c_push_decl( TreeDecl ); + + c_long_long_unsigned_type_node = c_tree_build_unsigned_type( C_LONG_LONG_TYPE_SIZE ); + TreeDecl = c_tree_build_decl( C_TYPE_DECL, + c_tree_get_identifier("long long unsigned int"), + c_long_long_unsigned_type_node ); + c_push_decl( TreeDecl ); + + c_short_integer_type_node = c_tree_build_signed_type( C_SHORT_TYPE_SIZE ); + TreeDecl =c_tree_build_decl ( C_TYPE_DECL, + c_tree_get_identifier("short int"), + c_short_integer_type_node ); + c_push_decl( TreeDecl ); + + c_short_unsigned_type_node = c_tree_build_unsigned_type( C_SHORT_TYPE_SIZE ); + TreeDecl = c_tree_build_decl( C_TYPE_DECL, + c_tree_get_identifier("short unsigned int"), + c_short_unsigned_type_node ); + c_push_decl( TreeDecl ); + + /* `unsigned long' is the standard type for sizeof. + Traditionally, use a signed type. + Note that stddef.h uses `unsigned long', + and this must agree, even of long and int are the same size. */ + + TreeIdent = c_tree_get_identifier( "long unsigned int" ); + c_size_type = CTreeType( CTreeIdentGlobalValue( TreeIdent ) ); + + if ( c_flag_traditional && CIsTreeNodeUnsigned( c_size_type ) ) + { + c_size_type = c_get_signed_type( c_size_type ); + } + + TreeIdent = c_tree_get_identifier( "long int" ); + c_ptrdiff_type_node = CTreeType( CTreeIdentGlobalValue( TreeIdent ) ); + + c_integer_type_node->TYPE.SIZE->COMMON.TYPE = c_size_type; + c_char_type_node->TYPE.SIZE->COMMON.TYPE = c_size_type; + c_unsigned_type_node->TYPE.SIZE->COMMON.TYPE = c_size_type; + c_long_unsigned_type_node->TYPE.SIZE->COMMON.TYPE = c_size_type; + c_long_integer_type_node->TYPE.SIZE->COMMON.TYPE = c_size_type; + c_long_long_integer_type_node->TYPE.SIZE->COMMON.TYPE = c_size_type; + c_long_long_unsigned_type_node->TYPE.SIZE->COMMON.TYPE = c_size_type; + c_short_integer_type_node->TYPE.SIZE->COMMON.TYPE = c_size_type; + c_short_unsigned_type_node->TYPE.SIZE->COMMON.TYPE = c_size_type; + + c_error_mark_node = c_tree_add_node( C_ERROR_NODE ); + c_error_mark_node->COMMON.TYPE = c_error_mark_node; + + /* Define both `signed char' and `unsigned char'. */ + + c_signed_char_type_node = c_tree_build_signed_type( C_CHAR_TYPE_SIZE ); + TreeDecl =c_tree_build_decl( C_TYPE_DECL, + c_tree_get_identifier("signed char"), + c_signed_char_type_node ); + c_push_decl( TreeDecl ); + + c_unsigned_char_type_node = c_tree_build_unsigned_type( C_CHAR_TYPE_SIZE ); + TreeDecl = c_tree_build_decl( C_TYPE_DECL, + c_tree_get_identifier("unsigned char"), + c_unsigned_char_type_node ); + c_push_decl( TreeDecl ); + +# ifdef LUDO_NO_SKIP + intQI_type_node = c_tree_build_signed_type(GET_MODE_BITSIZE (QImode)); + c_push_decl (c_tree_build_decl ( C_TYPE_DECL, NULL, intQI_type_node)); + + intHI_type_node = c_tree_build_signed_type(GET_MODE_BITSIZE (HImode)); + c_push_decl (c_tree_build_decl ( C_TYPE_DECL, NULL, intHI_type_node)); + + intSI_type_node = c_tree_build_signed_type(GET_MODE_BITSIZE (SImode)); + c_push_decl (c_tree_build_decl ( C_TYPE_DECL, NULL, intSI_type_node)); + + intDI_type_node = c_tree_build_signed_type(GET_MODE_BITSIZE (DImode)); + c_push_decl (c_tree_build_decl ( C_TYPE_DECL, NULL, intDI_type_node)); + + unsigned_intQI_type_node = c_tree_build_unsigned_type (GET_MODE_BITSIZE (QImode)); + c_push_decl (c_tree_build_decl ( C_TYPE_DECL, NULL, unsigned_intQI_type_node)); + + unsigned_intHI_type_node = c_tree_build_unsigned_type (GET_MODE_BITSIZE (HImode)); + c_push_decl (c_tree_build_decl ( C_TYPE_DECL, NULL, unsigned_intHI_type_node)); + + unsigned_intSI_type_node = c_tree_build_unsigned_type (GET_MODE_BITSIZE (SImode)); + c_push_decl (c_tree_build_decl ( C_TYPE_DECL, NULL, unsigned_intSI_type_node)); + + unsigned_intDI_type_node = c_tree_build_unsigned_type (GET_MODE_BITSIZE (DImode)); + c_push_decl (c_tree_build_decl ( C_TYPE_DECL, NULL, unsigned_intDI_type_node)); +# endif + + c_float_type_node = c_tree_build_type( C_REAL_TYPE ); + c_float_type_node->TYPE.PRECISION = C_FLOAT_TYPE_SIZE; + TreeDecl = c_tree_build_decl( C_TYPE_DECL, + c_ridpointers[(int) RID_FLOAT], + c_float_type_node ); + c_push_decl( TreeDecl ); + c_layout_type( c_float_type_node); + + c_double_type_node = c_tree_build_type( C_REAL_TYPE); + if ( c_flag_short_double ) + { + c_double_type_node->TYPE.PRECISION = C_FLOAT_TYPE_SIZE; + } + else + { + c_double_type_node->TYPE.PRECISION = C_DOUBLE_TYPE_SIZE; + } + TreeDecl = c_tree_build_decl( C_TYPE_DECL, + c_ridpointers[(int) RID_DOUBLE], + c_double_type_node ); + c_push_decl( TreeDecl ); + c_layout_type( c_double_type_node); + + c_long_double_type_node = c_tree_build_type( C_REAL_TYPE ); + c_long_double_type_node->TYPE.PRECISION = C_LONG_DOUBLE_TYPE_SIZE; + TreeDecl = c_tree_build_decl( C_TYPE_DECL, + c_tree_get_identifier("long double"), + c_long_double_type_node ); + c_push_decl( TreeDecl ); + c_layout_type(c_long_double_type_node); + + c_complex_integer_type_node = c_tree_build_type( C_COMPLEX_TYPE ); + TreeDecl = c_tree_build_decl( C_TYPE_DECL, + c_tree_get_identifier("complex int"), + c_complex_integer_type_node ); + c_push_decl( TreeDecl ); + c_complex_integer_type_node->COMMON.TYPE = c_integer_type_node; + c_layout_type(c_complex_integer_type_node); + + c_complex_float_type_node = c_tree_build_type( C_COMPLEX_TYPE ); + TreeDecl = c_tree_build_decl( C_TYPE_DECL, + c_tree_get_identifier("complex float"), + c_complex_float_type_node ); + c_push_decl( TreeDecl ); + c_complex_float_type_node->COMMON.TYPE = c_float_type_node; + c_layout_type(c_complex_float_type_node); + + c_complex_double_type_node = c_tree_build_type( C_COMPLEX_TYPE ); + TreeDecl = c_tree_build_decl( C_TYPE_DECL, + c_tree_get_identifier("complex double"), + c_complex_double_type_node ); + c_push_decl( TreeDecl ); + c_complex_double_type_node->COMMON.TYPE = c_double_type_node; + c_layout_type(c_complex_double_type_node); + + c_complex_long_double_type_node = c_tree_build_type( C_COMPLEX_TYPE ); + TreeDecl = c_tree_build_decl( C_TYPE_DECL, + c_tree_get_identifier("complex long double"), + c_complex_long_double_type_node ); + c_push_decl( TreeDecl ); + c_complex_long_double_type_node->COMMON.TYPE = c_long_double_type_node; + c_layout_type( c_complex_long_double_type_node); + + c_wchar_type_node = CTreeType( + CTreeIdentGlobalValue( c_tree_get_identifier( "int" ))); + c_signed_wchar_type_node = c_get_signed_type( c_wchar_type_node); + c_unsigned_wchar_type_node = c_get_unsigned_type( c_wchar_type_node); + + c_integer_zero_node = c_tree_build_int_2( 0, 0 ); + c_integer_zero_node->COMMON.TYPE = c_integer_type_node; + c_integer_one_node = c_tree_build_int_2( 1, 0 ); + c_integer_one_node->COMMON.TYPE = c_integer_type_node; + + c_boolean_type_node = c_integer_type_node; + c_boolean_true_node = c_integer_one_node; + c_boolean_false_node = c_integer_zero_node; + + c_size_zero_node = c_tree_build_int_2( 0, 0 ); + c_size_zero_node->COMMON.TYPE = c_size_type; + c_size_one_node = c_tree_build_int_2( 1, 0 ); + c_size_one_node->COMMON.TYPE = c_size_type; + + c_void_type_node = c_tree_build_type( C_VOID_TYPE ); + TreeDecl = c_tree_build_decl( C_TYPE_DECL, + c_ridpointers[(int) RID_VOID], + c_void_type_node ); + c_push_decl( TreeDecl ); + /* Uses integer_zero_node */ + c_layout_type( c_void_type_node); + /* We are not going to have real types in C with less than byte alignment, + so we might as well not have any types that claim to have it. */ + CTreeTypeAlign(c_void_type_node) = C_BITS_PER_UNIT; + + c_null_pointer_node = c_tree_build_int_2( 0, 0 ); + c_null_pointer_node->COMMON.TYPE = c_tree_build_pointer_type( c_void_type_node ); + c_layout_type( CTreeType( c_null_pointer_node ) ); + + c_string_type_node = c_tree_build_pointer_type( c_char_type_node ); + + c_const_string_type_node = c_tree_build_pointer_type( + c_tree_build_type_variant( c_char_type_node, 1, 0)); + + /* Make a type to be the domain of a few array types + whose domains don't really matter. + 200 is small enough that it always fits in size_t + and large enough that it can hold most function names for the + initializations of __FUNCTION__ and __PRETTY_FUNCTION__. */ + array_domain_type = c_tree_build_index_type( c_tree_build_int_2( 200, 0 ) ); + + /* make a type for arrays of characters. + With luck nothing will ever really depend on the length of this + array type. */ + c_char_array_type_node + = c_tree_build_array_type( c_char_type_node, array_domain_type ); + /* Likewise for arrays of ints. */ + c_int_array_type_node + = c_tree_build_array_type( c_integer_type_node, array_domain_type ); + /* This is for wide string constants. */ + c_wchar_array_type_node + = c_tree_build_array_type(c_wchar_type_node, array_domain_type); + + c_default_function_type + = c_tree_build_function_type(c_integer_type_node, (c_tree_node *)0); + + c_ptr_type_node = c_tree_build_pointer_type( c_void_type_node); + c_const_ptr_type_node + = c_tree_build_pointer_type( c_tree_build_type_variant( c_void_type_node, 1, 0)); + + EndLink = c_tree_add_head_list( (c_tree_node *)0, + c_void_type_node, (c_tree_node *)0); + + void_ftype_any + = c_tree_build_function_type(c_void_type_node, NULL); + + c_float_ftype_float + = c_tree_build_function_type(c_float_type_node, + c_tree_add_head_list (NULL, c_float_type_node, EndLink)); + + c_double_ftype_double + = c_tree_build_function_type(c_double_type_node, + c_tree_add_head_list(NULL, c_double_type_node, EndLink)); + + c_ldouble_ftype_ldouble + = c_tree_build_function_type(c_long_double_type_node, + c_tree_add_head_list(NULL, c_long_double_type_node, + EndLink)); + + c_double_ftype_double_double + = c_tree_build_function_type(c_double_type_node, + c_tree_add_head_list(NULL, c_double_type_node, + c_tree_add_head_list(NULL, + c_double_type_node, EndLink))); + + c_int_ftype_int + = c_tree_build_function_type(c_integer_type_node, + c_tree_add_head_list(NULL, c_integer_type_node, EndLink)); + + c_long_ftype_long + = c_tree_build_function_type(c_long_integer_type_node, + c_tree_add_head_list(NULL, + c_long_integer_type_node, EndLink)); + + c_void_ftype_ptr_ptr_int + = c_tree_build_function_type(c_void_type_node, + c_tree_add_head_list(NULL, c_ptr_type_node, + c_tree_add_head_list(NULL, c_ptr_type_node, + c_tree_add_head_list(NULL, + c_integer_type_node, + EndLink)))); + + c_int_ftype_cptr_cptr_sizet + = c_tree_build_function_type(c_integer_type_node, + c_tree_add_head_list(NULL, c_const_ptr_type_node, + c_tree_add_head_list(NULL, c_const_ptr_type_node, + c_tree_add_head_list(NULL, + c_size_type, + EndLink)))); + + c_void_ftype_ptr_int_int + = c_tree_build_function_type(c_void_type_node, + c_tree_add_head_list(NULL, c_ptr_type_node, + c_tree_add_head_list(NULL, c_integer_type_node, + c_tree_add_head_list(NULL, + c_integer_type_node, + EndLink)))); + + c_string_ftype_ptr_ptr /* strcpy prototype */ + = c_tree_build_function_type(c_string_type_node, + c_tree_add_head_list(NULL, c_string_type_node, + c_tree_add_head_list(NULL, + c_const_string_type_node, + EndLink))); + + c_int_ftype_string_string /* strcmp prototype */ + = c_tree_build_function_type(c_integer_type_node, + c_tree_add_head_list(NULL, c_const_string_type_node, + c_tree_add_head_list(NULL, + c_const_string_type_node, + EndLink))); + + strlen_ftype /* strlen prototype */ + = c_tree_build_function_type(c_flag_traditional ? c_integer_type_node : c_size_type, + c_tree_add_head_list(NULL, c_const_string_type_node, + EndLink)); + + traditional_ptr_type_node + = (c_flag_traditional ? c_string_type_node : c_ptr_type_node); + + memcpy_ftype /* memcpy prototype */ + = c_tree_build_function_type(traditional_ptr_type_node, + c_tree_add_head_list(NULL, c_ptr_type_node, + c_tree_add_head_list(NULL, c_const_ptr_type_node, + c_tree_add_head_list(NULL, + c_size_type, + EndLink)))); + + memset_ftype /* memset prototype */ + = c_tree_build_function_type(traditional_ptr_type_node, + c_tree_add_head_list(NULL, c_ptr_type_node, + c_tree_add_head_list(NULL, c_integer_type_node, + c_tree_add_head_list(NULL, + c_size_type, + EndLink)))); + + ptr_ftype_void = c_tree_build_function_type(c_ptr_type_node, EndLink); + ptr_ftype_ptr = c_tree_build_function_type(c_ptr_type_node, + c_tree_add_head_list(NULL, c_ptr_type_node, EndLink)); + +# ifdef LUDO_NO_SKIP + builtin_function ("__builtin_constant_p", c_default_function_type, + BUILT_IN_CONSTANT_P, NULL_PTR); + + builtin_function ("__builtin_return_address", + c_tree_build_function_type(ptr_type_node, + c_tree_add_head_list(NULL, + unsigned_type_node, + EndLink)), + BUILT_IN_RETURN_ADDRESS, NULL_PTR); + + builtin_function ("__builtin_frame_address", + c_tree_build_function_type(ptr_type_node, + c_tree_add_head_list(NULL, + unsigned_type_node, + EndLink)), + BUILT_IN_FRAME_ADDRESS, NULL_PTR); + + builtin_function ("__builtin_aggregate_incoming_address", + c_tree_build_function_type(ptr_type_node, NULL), + BUILT_IN_AGGREGATE_INCOMING_ADDRESS, NULL_PTR); + + /* Hooks for the DWARF 2 __throw routine. */ + builtin_function ("__builtin_unwind_init", + c_tree_build_function_type(void_type_node, EndLink), + BUILT_IN_UNWIND_INIT, NULL_PTR); + builtin_function ("__builtin_fp", ptr_ftype_void, BUILT_IN_FP, NULL_PTR); + builtin_function ("__builtin_sp", ptr_ftype_void, BUILT_IN_SP, NULL_PTR); + builtin_function ("__builtin_dwarf_fp_regnum", + c_tree_build_function_type(unsigned_type_node, EndLink), + BUILT_IN_DWARF_FP_REGNUM, NULL_PTR); + builtin_function ("__builtin_dwarf_reg_size", int_ftype_int, + BUILT_IN_DWARF_REG_SIZE, NULL_PTR); + builtin_function ("__builtin_frob_return_addr", ptr_ftype_ptr, + BUILT_IN_FROB_RETURN_ADDR, NULL_PTR); + builtin_function ("__builtin_extract_return_addr", ptr_ftype_ptr, + BUILT_IN_EXTRACT_RETURN_ADDR, NULL_PTR); + builtin_function ("__builtin_set_return_addr_reg", + c_tree_build_function_type(void_type_node, + c_tree_add_head_list(NULL, + ptr_type_node, + EndLink)), + BUILT_IN_SET_RETURN_ADDR_REG, NULL_PTR); + builtin_function ("__builtin_eh_stub", ptr_ftype_void, + BUILT_IN_EH_STUB, NULL_PTR); + builtin_function + ("__builtin_set_eh_regs", + c_tree_build_function_type(void_type_node, + c_tree_add_head_list(NULL, ptr_type_node, + c_tree_add_head_list(NULL, + type_for_mode (ptr_mode, 0), + EndLink))), + BUILT_IN_SET_EH_REGS, NULL_PTR); + + builtin_function ("__builtin_alloca", + c_tree_build_function_type(ptr_type_node, + c_tree_add_head_list(NULL, + sizetype, + EndLink)), + BUILT_IN_ALLOCA, "alloca"); + builtin_function ("__builtin_ffs", int_ftype_int, BUILT_IN_FFS, NULL_PTR); + /* Define alloca, ffs as builtins. + Declare _exit just to mark it as volatile. */ + if (! c_flag_no_builtin && !c_flag_no_nonansi_builtin) + { + temp = builtin_function ("alloca", + c_tree_build_function_type(ptr_type_node, + c_tree_add_head_list(NULL, + c_size_type, + EndLink)), + BUILT_IN_ALLOCA, NULL_PTR); + /* Suppress error if redefined as a non-function. */ + DECL_BUILT_IN_NONANSI (temp) = 1; + temp = builtin_function ("ffs", int_ftype_int, BUILT_IN_FFS, NULL_PTR); + /* Suppress error if redefined as a non-function. */ + DECL_BUILT_IN_NONANSI (temp) = 1; + temp = builtin_function ("_exit", void_ftype_any, NOT_BUILT_IN, + NULL_PTR); + TREE_THIS_VOLATILE (temp) = 1; + TREE_SIDE_EFFECTS (temp) = 1; + /* Suppress error if redefined as a non-function. */ + DECL_BUILT_IN_NONANSI (temp) = 1; + } + + builtin_function ("__builtin_abs", int_ftype_int, BUILT_IN_ABS, NULL_PTR); + builtin_function ("__builtin_fabsf", float_ftype_float, BUILT_IN_FABS, + NULL_PTR); + builtin_function ("__builtin_fabs", double_ftype_double, BUILT_IN_FABS, + NULL_PTR); + builtin_function ("__builtin_fabsl", ldouble_ftype_ldouble, BUILT_IN_FABS, + NULL_PTR); + builtin_function ("__builtin_labs", long_ftype_long, BUILT_IN_LABS, + NULL_PTR); + builtin_function ("__builtin_saveregs", + c_tree_build_function_type(ptr_type_node, NULL), + BUILT_IN_SAVEREGS, NULL_PTR); +# endif + } + + c_pedantic_lvalues = c_pedantic; + +# ifdef LUDO_NO_SKIP + /* Create the global bindings for __FUNCTION__ and __PRETTY_FUNCTION__. */ + declare_function_name (); + + start_identifier_warnings (); + + /* Prepare to check format strings against argument lists. */ + init_function_format_info (); + + init_iterators (); + + incomplete_decl_finalize_hook = finish_incomplete_decl; +# endif +} + +/*------------------------------------------------------------\ +| | +| Declaration Attributes | +| | +\------------------------------------------------------------*/ + +void c_decl_attributes( Node, Attributes, Prefix_attributes ) + + c_tree_node *Node; + c_tree_node *Attributes; + c_tree_node *Prefix_attributes; +{ +# ifdef LUDO_NO_SKIP + c_tree_node *decl = 0; + c_tree_node *type; + int is_type; + c_tree_node *a; + + if (attrtab_idx == 0) + init_attributes (); + + if ( CTreeNodeFirstCode( node ) == C_DECL_NODE ) + { + decl = node; + type = CTreeType(decl); + is_type = CTreeDeclCode(node) == C_TYPE_DECL; + } + else if ( CTreeNodeFirstCode( node ) == C_TYPE_NODE ) + { + type = node, is_type = 1; + } + + attributes = c_tree_concat_list(prefix_attributes, attributes); + + for (a = attributes; a; a = CTreeChain(a)) + { + c_tree_node *name = CTreeListPurpose(a); + c_tree_node *args = CTreeListValue(a); + int i; + int id; + +# ifdef LUDO_NO_SKIP + for (i = 0; i < attrtab_idx; i++) + if (attrtab[i].name == name) + break; +# else + i = attrtab_idx; +# endif + +# ifdef LUDO_NO_SKIP + if (i == attrtab_idx) + { + if (! valid_machine_attribute(name, args, decl, type)) + { + warning ("`%s' attribute directive ignored", CTreeIdentPointer(name)); + } + else if (decl != 0) + type = TREE_TYPE (decl); + continue; + } + else if (attrtab[i].decl_req && decl == 0) + { + warning ("`%s' attribute does not apply to types", + IDENTIFIER_POINTER (name)); + continue; + } + else if (list_length (args) < attrtab[i].min + || list_length (args) > attrtab[i].max) + { + error ("wrong number of arguments specified for `%s' attribute", + IDENTIFIER_POINTER (name)); + continue; + } + + id = attrtab[i].id; + switch (id) + { + case A_PACKED: + if (is_type) + TYPE_PACKED (type) = 1; + else if (TREE_CODE (decl) == FIELD_DECL) + DECL_PACKED (decl) = 1; + /* We can't set DECL_PACKED for a VAR_DECL, because the bit is + used for DECL_REGISTER. It wouldn't mean anything anyway. */ + else + warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); + break; + + case A_NOCOMMON: + if (TREE_CODE (decl) == VAR_DECL) + DECL_COMMON (decl) = 0; + else + warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); + break; + + case A_COMMON: + if (TREE_CODE (decl) == VAR_DECL) + DECL_COMMON (decl) = 1; + else + warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); + break; + + case A_NORETURN: + if (TREE_CODE (decl) == FUNCTION_DECL) + TREE_THIS_VOLATILE (decl) = 1; + else if (TREE_CODE (type) == POINTER_TYPE + && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE) + TREE_TYPE (decl) = type + = c_tree_build_pointer_type + (build_type_variant (TREE_TYPE (type), + TREE_READONLY (TREE_TYPE (type)), 1)); + else + warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); + break; + + case A_UNUSED: + if (is_type) + TREE_USED (type) = 1; + else if (TREE_CODE (decl) == PARM_DECL + || TREE_CODE (decl) == VAR_DECL + || TREE_CODE (decl) == FUNCTION_DECL) + CSetTreeNodeUsed(decl); + else + warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); + break; + + case A_CONST: + if (TREE_CODE (decl) == FUNCTION_DECL) + TREE_READONLY (decl) = 1; + else if (TREE_CODE (type) == POINTER_TYPE + && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE) + TREE_TYPE (decl) = type + = build_pointer_type + (build_type_variant (TREE_TYPE (type), 1, + TREE_THIS_VOLATILE (TREE_TYPE (type)))); + else + warning ( "`%s' attribute ignored", IDENTIFIER_POINTER (name)); + break; + + case A_T_UNION: + if (is_type + && TREE_CODE (type) == UNION_TYPE + && (decl == 0 + || (TYPE_FIELDS (type) != 0 + && TYPE_MODE (type) == DECL_MODE (TYPE_FIELDS (type))))) + TYPE_TRANSPARENT_UNION (type) = 1; + else if (decl != 0 && TREE_CODE (decl) == PARM_DECL + && TREE_CODE (type) == UNION_TYPE + && TYPE_MODE (type) == DECL_MODE (TYPE_FIELDS (type))) + DECL_TRANSPARENT_UNION (decl) = 1; + else + warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); + break; + + case A_CONSTRUCTOR: + if (TREE_CODE (decl) == FUNCTION_DECL + && TREE_CODE (type) == FUNCTION_TYPE + && decl_function_context (decl) == 0) + { + DECL_STATIC_CONSTRUCTOR (decl) = 1; + CSetTreeNodeUsed(decl); + } + else + warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); + break; + + case A_DESTRUCTOR: + if (TREE_CODE (decl) == FUNCTION_DECL + && TREE_CODE (type) == FUNCTION_TYPE + && decl_function_context (decl) == 0) + { + DECL_STATIC_DESTRUCTOR (decl) = 1; + CSetTreeNodeUsed(decl); + } + else + warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); + break; + + case A_MODE: + if (TREE_CODE (TREE_VALUE (args)) != IDENTIFIER_NODE) + warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); + else + { + int j; + char *p = IDENTIFIER_POINTER (TREE_VALUE (args)); + int len = strlen (p); + enum machine_mode mode = VOIDmode; + tree typefm; + + if (len > 4 && p[0] == '_' && p[1] == '_' + && p[len - 1] == '_' && p[len - 2] == '_') + { + char *newp = (char *) alloca (len - 1); + + strcpy (newp, &p[2]); + newp[len - 4] = '\0'; + p = newp; + } + + /* Give this decl a type with the specified mode. + First check for the special modes. */ + if (! strcmp (p, "byte")) + mode = byte_mode; + else if (!strcmp (p, "word")) + mode = word_mode; + else if (! strcmp (p, "pointer")) + mode = ptr_mode; + else + for (j = 0; j < NUM_MACHINE_MODES; j++) + if (!strcmp (p, GET_MODE_NAME (j))) + mode = (enum machine_mode) j; + + if (mode == VOIDmode) + error ("unknown machine mode `%s'", p); + else if (0 == (typefm = type_for_mode (mode, + TREE_UNSIGNED (type)))) + error ("no data type for mode `%s'", p); + else + { + TREE_TYPE (decl) = type = typefm; + DECL_SIZE (decl) = 0; + c_layout_decl(decl, 0); + } + } + break; + + case A_SECTION: +#ifdef ASM_OUTPUT_SECTION_NAME + if ((TREE_CODE (decl) == FUNCTION_DECL + || TREE_CODE (decl) == VAR_DECL) + && TREE_CODE (TREE_VALUE (args)) == STRING_CST) + { + if (TREE_CODE (decl) == VAR_DECL + && current_function_decl != NULL + && ! TREE_STATIC (decl)) + { + error_with_decl (decl, + "section attribute cannot be specified for local variables"); + /* The decl may have already been given a section attribute from + a previous declaration. Ensure they match. */ + } + else if (DECL_SECTION_NAME (decl) != NULL + && strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (decl)), + TREE_STRING_POINTER (TREE_VALUE (args))) != 0) + { + error_with_decl (node, + "section of `%s' conflicts with previous declaration"); + } + else + DECL_SECTION_NAME (decl) = TREE_VALUE (args); + } + else + error_with_decl (node, + "section attribute not allowed for `%s'"); +#else + error_with_decl (node, + "section attributes are not supported for this target"); +#endif + break; + + case A_ALIGNED: + { + tree align_expr + = (args ? TREE_VALUE (args) + : size_int (BIGGEST_ALIGNMENT / BITS_PER_UNIT)); + int align; + + /* Strip any NOPs of any kind. */ + while (TREE_CODE (align_expr) == NOP_EXPR + || TREE_CODE (align_expr) == CONVERT_EXPR + || TREE_CODE (align_expr) == NON_LVALUE_EXPR) + align_expr = TREE_OPERAND (align_expr, 0); + + if (TREE_CODE (align_expr) != INTEGER_CST) + { + error ("requested alignment is not a constant"); + continue; + } + + align = TREE_INT_CST_LOW (align_expr) * BITS_PER_UNIT; + + if (exact_log2 (align) == -1) + error ("requested alignment is not a power of 2"); + else if (is_type) + TYPE_ALIGN (type) = align; + else if (TREE_CODE (decl) != VAR_DECL + && TREE_CODE (decl) != FIELD_DECL) + { + error_with_decl (decl, + "alignment may not be specified for `%s'"); + } + else + DECL_ALIGN (decl) = align; + } + break; + + case A_FORMAT: + { + tree format_type = TREE_VALUE (args); + tree format_num_expr = TREE_VALUE (TREE_CHAIN (args)); + tree first_arg_num_expr + = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (args))); + int format_num; + int first_arg_num; + int is_scan; + tree argument; + int arg_num; + + if (TREE_CODE (decl) != FUNCTION_DECL) + { + error_with_decl (decl, + "argument format specified for non-function `%s'"); + continue; + } + + if (TREE_CODE (format_type) == IDENTIFIER_NODE + && (!strcmp (IDENTIFIER_POINTER (format_type), "printf") + || !strcmp (IDENTIFIER_POINTER (format_type), + "__printf__"))) + is_scan = 0; + else if (TREE_CODE (format_type) == IDENTIFIER_NODE + && (!strcmp (IDENTIFIER_POINTER (format_type), "scanf") + || !strcmp (IDENTIFIER_POINTER (format_type), + "__scanf__"))) + is_scan = 1; + else if (TREE_CODE (format_type) == IDENTIFIER_NODE) + { + error ("`%s' is an unrecognized format function type", + IDENTIFIER_POINTER (format_type)); + continue; + } + else + { + error ("unrecognized format specifier"); + continue; + } + + /* Strip any conversions from the string index and first arg number + and verify they are constants. */ + while (TREE_CODE (format_num_expr) == NOP_EXPR + || TREE_CODE (format_num_expr) == CONVERT_EXPR + || TREE_CODE (format_num_expr) == NON_LVALUE_EXPR) + format_num_expr = TREE_OPERAND (format_num_expr, 0); + + while (TREE_CODE (first_arg_num_expr) == NOP_EXPR + || TREE_CODE (first_arg_num_expr) == CONVERT_EXPR + || TREE_CODE (first_arg_num_expr) == NON_LVALUE_EXPR) + first_arg_num_expr = TREE_OPERAND (first_arg_num_expr, 0); + + if (TREE_CODE (format_num_expr) != INTEGER_CST + || TREE_CODE (first_arg_num_expr) != INTEGER_CST) + { + error ("format string has non-constant operand number"); + continue; + } + + format_num = TREE_INT_CST_LOW (format_num_expr); + first_arg_num = TREE_INT_CST_LOW (first_arg_num_expr); + if (first_arg_num != 0 && first_arg_num <= format_num) + { + error ("format string arg follows the args to be formatted"); + continue; + } + + /* If a parameter list is specified, verify that the format_num + argument is actually a string, in case the format attribute + is in error. */ + argument = TYPE_ARG_TYPES (type); + if (argument) + { + for (arg_num = 1; ; ++arg_num) + { + if (argument == 0 || arg_num == format_num) + break; + argument = TREE_CHAIN (argument); + } + if (! argument + || TREE_CODE (TREE_VALUE (argument)) != POINTER_TYPE + || (CTreeTypeMainVariant (TREE_TYPE (TREE_VALUE (argument))) + != char_type_node)) + { + error ("format string arg not a string type"); + continue; + } + if (first_arg_num != 0) + { + /* Verify that first_arg_num points to the last arg, + the ... */ + while (argument) + arg_num++, argument = TREE_CHAIN (argument); + if (arg_num != first_arg_num) + { + error ("args to be formatted is not ..."); + continue; + } + } + } + + record_function_format (DECL_NAME (decl), + DECL_ASSEMBLER_NAME (decl), + is_scan, format_num, first_arg_num); + break; + } + + case A_FORMAT_ARG: + { + tree format_num_expr = TREE_VALUE (args); + int format_num, arg_num; + tree argument; + + if (TREE_CODE (decl) != FUNCTION_DECL) + { + error_with_decl (decl, + "argument format specified for non-function `%s'"); + continue; + } + + /* Strip any conversions from the first arg number and verify it + is a constant. */ + while (TREE_CODE (format_num_expr) == NOP_EXPR + || TREE_CODE (format_num_expr) == CONVERT_EXPR + || TREE_CODE (format_num_expr) == NON_LVALUE_EXPR) + format_num_expr = TREE_OPERAND (format_num_expr, 0); + + if (TREE_CODE (format_num_expr) != INTEGER_CST) + { + error ("format string has non-constant operand number"); + continue; + } + + format_num = TREE_INT_CST_LOW (format_num_expr); + + /* If a parameter list is specified, verify that the format_num + argument is actually a string, in case the format attribute + is in error. */ + argument = TYPE_ARG_TYPES (type); + if (argument) + { + for (arg_num = 1; ; ++arg_num) + { + if (argument == 0 || arg_num == format_num) + break; + argument = TREE_CHAIN (argument); + } + if (! argument + || TREE_CODE (TREE_VALUE (argument)) != POINTER_TYPE + || (CTreeTypeMainVariant (TREE_TYPE (TREE_VALUE (argument))) + != char_type_node)) + { + error ("format string arg not a string type"); + continue; + } + } + + if (TREE_CODE (TREE_TYPE (TREE_TYPE (decl))) != POINTER_TYPE + || (CTreeTypeMainVariant (TREE_TYPE (TREE_TYPE (TREE_TYPE (decl)))) + != char_type_node)) + { + error ("function does not return string type"); + continue; + } + + record_international_format (DECL_NAME (decl), + DECL_ASSEMBLER_NAME (decl), + format_num); + break; + } + + case A_WEAK: + declare_weak (decl); + break; + + case A_ALIAS: + if ((TREE_CODE (decl) == FUNCTION_DECL && DECL_INITIAL (decl)) + || (TREE_CODE (decl) != FUNCTION_DECL && ! DECL_EXTERNAL (decl))) + { + error_with_decl (decl, + "`%s' defined both normally and as an alias"); + } + else if (decl_function_context (decl) == 0) + { + tree id = get_identifier (TREE_STRING_POINTER + (TREE_VALUE (args))); + if (TREE_CODE (decl) == FUNCTION_DECL) + DECL_INITIAL (decl) = error_mark_node; + else + DECL_EXTERNAL (decl) = 0; + assemble_alias (decl, id); + } + else + warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); + break; + } +# endif + } +# endif +} + +/*------------------------------------------------------------\ +| | +| Grant Fiel Declaration | +| | +\------------------------------------------------------------*/ + +/* Process the specs, declarator (NULL if omitted) and width (NULL if omitted) + of a structure component, returning a FIELD_DECL node. + WIDTH is non-NULL for bit fields only, and is an INTEGER_CST node. + + This is done during the parsing of the struct declaration. + The FIELD_DECL nodes are chained together and the lot of them + are ultimately passed to `build_struct' to make the RECORD_TYPE node. */ + +c_tree_node *c_grokfield( Filename, Line, Declarator, Declspecs, Width) + + char *Filename; + int Line; + c_tree_node *Declarator; + c_tree_node *Declspecs; + c_tree_node *Width; +{ + c_tree_node *Value; + + Value = c_grokdeclarator( Declarator, Declspecs, + ( Width != NULL ) ? C_CDECL_BIT_FIELD : C_CDECL_FIELD, 0 ); + + c_finish_decl( Value, NULL, NULL); + Value->DECL.INITIAL = Width; + +# ifdef LUDO_NO_SKIP + c_maybe_objc_check_decl(value); +# endif + return Value; +} + +/*------------------------------------------------------------\ +| | +| Grant Check Type Name | +| | +\------------------------------------------------------------*/ + +/* Decode a "typename", such as "int **", returning a ..._TYPE node. */ + +c_tree_node *c_groktypename( Typename ) + + c_tree_node *Typename; +{ + if ( CTreeNodeFirstCode( Typename ) == C_LIST_NODE ) + { + Typename = c_grokdeclarator( CTreeListValue( Typename ), + CTreeListPurpose( Typename ), C_CDECL_TYPENAME, 0); + } + + return( Typename ); +} + +/*------------------------------------------------------------\ +| | +| Start Declaration | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_start_decl( Declarator, Declspecs, Initialized, Attributes, + Prefix_attributes ) + c_tree_node *Declarator; + c_tree_node *Declspecs; + int Initialized; + c_tree_node *Attributes; + c_tree_node *Prefix_attributes; +{ + c_tree_node *TreeDecl; + c_tree_node *TreeType; + c_tree_node *TreeTypeSize; + c_tree_node *TreeNode; + int Init_written; + + Init_written = Initialized; + TreeDecl = c_grokdeclarator( Declarator, Declspecs, C_CDECL_NORMAL, Initialized); + + if (c_warn_main && !strcmp( CTreeIdentPointer( Declarator ), "main" ) ) + { + warning_with_decl( TreeDecl, "`%s' is usually a function"); + } + + if ( Initialized ) + { + /* Is it valid for this decl to have an initializer at all? + If not, set INITIALIZED to zero, which will indirectly + tell `finish_decl' to ignore the initializer once it is parsed. */ + switch ( CTreeDeclCode( TreeDecl ) ) + { + case C_TYPE_DECL: + /* typedef foo = bar means give foo the same type as bar. + We haven't parsed bar yet, so `finish_decl' will fix that up. + Any other case of an initialization in a TYPE_DECL is an error. */ + if ( c_pedantic || c_tree_get_list_length( Declspecs ) > 1) + { + error( "typedef `%s' is initialized", + CTreeIdentPointer( CTreeDeclName( TreeDecl ) ) ); + Initialized = 0; + } + break; + + case C_FUNCTION_DECL: + error( "function `%s' is initialized like a variable", + CTreeIdentPointer( CTreeDeclName( TreeDecl ) ) ); + Initialized = 0; + break; + + case C_PARAM_DECL: + /* DECL_INITIAL in a PARM_DECL is really DECL_ARG_TYPE. */ + error( "parameter `%s' is initialized", + CTreeIdentPointer( CTreeDeclName( TreeDecl ) ) ); + Initialized = 0; + break; + + default: + /* Don't allow initializations for incomplete types + except for arrays which might be completed by the initialization. */ + + TreeType = CTreeType( TreeDecl ); + TreeTypeSize = CTreeTypeSize( TreeType ); + + if ( CTreeTypeSize( TreeType ) != 0) + { + /* A complete type is ok if size is fixed. */ + if ( ( CTreeNodeFirstCode( TreeTypeSize ) != C_INT_CST_NODE ) + || CIsTreeDeclVarSize( TreeDecl ) ) + { + error ("variable-sized object may not be initialized"); + Initialized = 0; + } + } + else if ( CTreeTypeCode( TreeType ) != C_ARRAY_TYPE ) + { + error ("variable `%s' has initializer but incomplete type", + CTreeIdentPointer( CTreeDeclName( TreeDecl ) ) ); + Initialized = 0; + } + else if ( CTreeTypeSize( CTreeType( TreeType ) ) == 0 ) + { + error ("elements of array `%s' have incomplete type", + CTreeIdentPointer( CTreeDeclName( TreeDecl ) ) ); + Initialized = 0; + } + + break; + } + } + + if ( Initialized ) + { + CClearTreeNodeExternal( TreeDecl ); + + if ( c_current_binding_level == c_global_binding_level) + { + CSetTreeNodeStatic( TreeDecl ); + } + + /* Tell `c_push_decl' this is an Initialized decl + even though we don't yet have the initializer expression. + Also tell `finish_decl' it may store the real initializer. */ + + TreeDecl->DECL.INITIAL = c_error_mark_node; + } + + /* ANSI specifies that a tentative definition which is not merged with + a non-tentative definition behaves exactly like a definition with an + initializer equal to zero. (Section 3.7.2) + -fno-common gives strict ANSI behavior. Usually you don't want it. + This matters only for variables with external linkage. */ + if ( ! c_flag_no_common || ! CIsTreeNodePublic( TreeDecl ) ) + { + CSetTreeDeclCommon( TreeDecl ); + } + + /* Set attributes here so if duplicate decl, will have proper attributes. */ + c_decl_attributes( TreeDecl, Attributes, Prefix_attributes ); + + /* Add this decl to the current binding level. + TEM may equal DECL or it may be a previous decl of the same name. */ + TreeNode = c_push_decl( TreeDecl ); + + /* For a local variable, define the RTL now. */ +# ifdef LUDO_NO_SKIP + if ( c_current_binding_level != c_global_binding_level + /* But not if this is a duplicate decl + and we preserved the rtl from the previous one + (which may or may not happen). */ + && DECL_RTL (tem) == 0) + { + if (TYPE_SIZE (TREE_TYPE (tem)) != 0) + expand_decl (tem); + else if (TREE_CODE (TREE_TYPE (tem)) == ARRAY_TYPE + && DECL_INITIAL (tem) != 0) + expand_decl (tem); + } +# endif + + return( TreeNode ); +} + +/*------------------------------------------------------------\ +| | +| Finish Declaration | +| | +\------------------------------------------------------------*/ + +void c_finish_decl( decl, init, asmspec_tree) + + c_tree_node *decl; + c_tree_node *init; + c_tree_node *asmspec_tree; +{ + c_tree_node *type; + int was_incomplete; + char *asmspec = 0; + +# ifdef LUDO_NO_SKIP + int temporary = allocation_temporary_p (); +# endif + + type = CTreeType( decl ); + + was_incomplete = ( CTreeDeclSize(decl) == (c_tree_node *)0); + /* If a name was specified, get the string. */ + if (asmspec_tree) + { + asmspec = CTreeStringPointer(asmspec_tree); + } + + /* If `start_decl' didn't like having an initialization, ignore it now. */ + if ((init != (c_tree_node *)0) && + (CTreeDeclInitial(decl) == (c_tree_node *)0)) + { + init = (c_tree_node *)0; + } + + /* Don't crash if parm is initialized. */ + if ( CTreeDeclCode(decl) == C_PARAM_DECL) + { + init = (c_tree_node *)0; + } + + if (CIsTreeDeclIterator(decl)) + { + if (init == 0) + { + error_with_decl (decl, "iterator has no initial value"); + } + else + { +# ifdef LUDO_NO_SKIP + init = save_expr (init); +# endif + } + } + + if (init != (c_tree_node *)0 ) + { + if ( CTreeDeclCode(decl) != C_TYPE_DECL) + { + c_store_init_value( decl, init ); + } + else + { + /* typedef foo = bar; store the type of bar as the type of foo. */ + decl->COMMON.TYPE = CTreeType( init->COMMON.TYPE ); + decl->DECL.INITIAL = (c_tree_node *)0; + init->DECL.INITIAL = (c_tree_node *)0; + } + } + + /* Pop back to the obstack that is current for this binding level. + This is because MAXINDEX, rtl, etc. to be made below + must go in the permanent obstack. But don't discard the + temporary data yet. */ +# ifdef LUDO_NO_SKIP + pop_obstacks (); +# endif + + /* Deduce size of array from initialization, if not already known */ + + if ( CTreeTypeCode(type) == C_ARRAY_TYPE + && CTreeTypeValues(type) == 0 + && CTreeDeclCode(decl) != C_TYPE_DECL) + { + int do_default + = ( CIsTreeNodeStatic(decl) + /* Even if pedantic, an external linkage array + may have incomplete type at first. */ + ? c_pedantic && ! CIsTreeNodePublic(decl) + : ! CIsTreeDeclExternal(decl)); + int failure + = c_complete_array_type(type, CTreeDeclInitial(decl), do_default); + + /* Get the completed type made by complete_array_type. */ + type = CTreeType(decl); + + if (failure == 1) + { + error_with_decl (decl, "initializer fails to determine size of `%s'"); + } + + if (failure == 2) + { + if (do_default) + { + error_with_decl (decl, "array size missing in `%s'"); + } + /* If a `static' var's size isn't known, + make it extern as well as static, so it does not get + allocated. + If it is not `static', then do not mark extern; + finish_incomplete_decl will give it a default size + and it will get allocated. */ + else if (!c_pedantic && CIsTreeNodeStatic(decl) && ! CIsTreeNodePublic(decl)) + { + CSetTreeDeclExternal( decl ); + } + } + + /* TYPE_MAX_VALUE is always one less than the number of elements + in the array, because we start counting at zero. Therefore, + warn only if the value is less than zero. */ + if (c_pedantic && CTreeTypeValues(type) != 0 + && c_tree_is_int_cst_sgn( CTreeTypeMaxValue( CTreeTypeValues(type))) < 0) + { + error_with_decl (decl, "zero or negative size array `%s'"); + } + + c_layout_decl(decl, 0); + } + + if ( CTreeDeclCode( decl ) == C_VAR_DECL ) + { + if ( CTreeDeclSize(decl) == 0 + && CTreeTypeSize( CTreeType(decl)) != 0) + { + c_layout_decl(decl, 0); + } + + if ( CTreeDeclSize(decl) == 0 + && ( CIsTreeNodeStatic(decl) + ? + /* A static variable with an incomplete type + is an error if it is initialized. + Also if it is not file scope. + Otherwise, let it through, but if it is not `extern' + then it may cause an error message later. */ + /* A duplicate_decls call could have changed an extern + declaration into a file scope one. This can be detected + by TREE_ASM_WRITTEN being set. */ + ( CTreeDeclInitial(decl) != 0 + || (CTreeDeclContext(decl) != 0 && ! CIsTreeNodeAsmWritten(decl))) + : + /* An automatic variable with an incomplete type + is an error. */ + ! CIsTreeDeclExternal(decl))) + { + error_with_decl (decl, "storage size of `%s' isn't known"); + CTreeType(decl) = c_error_mark_node; + } + + if (( CIsTreeNodeExternal(decl) || CIsTreeNodeStatic(decl)) + && CTreeDeclSize(decl) != 0) + { + if ( CTreeNodeFirstCode( CTreeDeclSize(decl)) == C_INT_CST_NODE) + { + c_constant_expression_warning( CTreeDeclSize(decl)); + } + else + { + error_with_decl (decl, "storage size of `%s' isn't constant"); + } + } + + if ( CIsTreeNodeUsed(type)) CSetTreeNodeUsed(decl); + } + + /* If this is a function and an assembler name is specified, it isn't + builtin any more. Also reset DECL_RTL so we can give it its new + name. */ + if ( CTreeDeclCode(decl) == C_FUNCTION_DECL && asmspec) + { + CClearTreeDeclBuiltIn(decl); +# ifdef LUDO_NO_SKIP + DECL_RTL (decl) = 0; +# endif + } + + /* Output the assembler code and/or RTL code for variables and functions, + unless the type is an undefined structure or union. + If not, it will get done when the type is completed. */ + + if ( CTreeDeclCode(decl) == C_VAR_DECL || CTreeDeclCode(decl) == C_FUNCTION_DECL) + { +# ifdef LUDO_NO_SKIP + if ((c_flag_traditional || CIsTreeNodePermanent(decl)) && + allocation_temporary_p()) + { + push_obstacks_nochange (); + end_temporary_allocation (); + /* This is a no-op in c-lang.c or something real in objc-actions.c. */ + maybe_objc_check_decl (decl); + rest_of_decl_compilation (decl, asmspec, + (DECL_CONTEXT (decl) == 0 + || CIsTreeNodeAsmWritten(decl)), + 0); + pop_obstacks (); + } + else + { + /* This is a no-op in c-lang.c or something real in objc-actions.c. */ + maybe_objc_check_decl (decl); + rest_of_decl_compilation (decl, asmspec, DECL_CONTEXT (decl) == 0, + 0); + } +# endif + + if ( CTreeDeclContext(decl) != 0) + { + /* Recompute the RTL of a local array now + if it used to be an incomplete type. */ + if (was_incomplete + && ! CIsTreeNodeStatic(decl) && ! CIsTreeDeclExternal(decl)) + { + /* If we used it already as memory, it must stay in memory. */ + if ( CIsTreeNodeUsed( decl ) ) CSetTreeNodeAddressable( decl ); + else CClearTreeNodeAddressable( decl ); + /* If it's still incomplete now, no init will save it. */ + if ( CTreeDeclSize(decl) == 0) CTreeDeclInitial(decl) = 0; + +# ifdef LUDO_NO_SKIP + expand_decl (decl); +# endif + } + /* Compute and store the initial value. */ + +# ifdef LUDO_NO_SKIP + if ( CTreeDeclCode(decl) != C_FUNCTION_DECL) + expand_decl_init (decl); +# endif + } + } + + if ( CTreeDeclCode(decl) == C_TYPE_DECL) + { +# ifdef LUDO_NO_SKIP + /* This is a no-op in c-lang.c or something real in objc-actions.c. */ + maybe_objc_check_decl (decl); + rest_of_decl_compilation (decl, NULL_PTR, DECL_CONTEXT (decl) == 0, 0); +# endif + } + + /* ??? After 2.3, test (init != 0) instead of TREE_CODE. */ + /* This test used to include TREE_PERMANENT, however, we have the same + problem with initializers at the function level. Such initializers get + saved until the end of the function on the momentary_obstack. */ +# ifdef LUDO_NO_SKIP + if (!( CTreeDeclCode(decl) == C_FUNCTION_DECL && CIsTreeDeclInline(decl)) + && temporary + /* DECL_INITIAL is not defined in PARM_DECLs, since it shares + space with DECL_ARG_TYPE. */ + && CTreeDeclCode(decl) != C_PARAM_DECL) + { + /* We need to remember that this array HAD an initialization, + but discard the actual temporary nodes, + since we can't have a permanent node keep pointing to them. */ + /* We make an exception for inline functions, since it's + normal for a local extern redeclaration of an inline function + to have a copy of the top-level decl's DECL_INLINE. */ + if ( CTreeDeclInitial(decl) != 0 && CTreeDeclInitial(decl) != c_error_mark_node) + { + /* If this is a const variable, then preserve the + initializer instead of discarding it so that we can optimize + references to it. */ + /* This test used to include TREE_STATIC, but this won't be set + for function level initializers. */ + if ( CIsTreeNodeReadOnly(decl) || CIsTreeDeclIterator(decl)) + { +# ifdef LUDO_NO_SKIP + c_preserve_initializer (); +# endif + /* Hack? Set the permanent bit for something that is permanent, + but not on the permanent obstack, so as to convince + output_constant_def to make its rtl on the permanent + obstack. */ + CSetTreeNodePermanent( CTreeDeclInitial(decl)); + + /* The initializer and DECL must have the same (or equivalent + types), but if the initializer is a STRING_CST, its type + might not be on the right obstack, so copy the type + of DECL. */ + CTreeType( CTreeDeclInitial(decl)) = type; + } + else + CTreeDeclInitial(decl) = c_error_mark_node; + } + } +# endif + + /* If requested, warn about definitions of large data objects. */ + + if (c_warn_larger_than + && ( CTreeDeclCode(decl) == C_VAR_DECL || + CTreeDeclCode(decl) == C_PARAM_DECL) + && ! CIsTreeDeclExternal(decl)) + { + c_tree_node *decl_size = CTreeDeclSize(decl); + + if (decl_size && CTreeNodeFirstCode(decl_size) == C_INT_CST_NODE) + { + unsigned units = CTreeIntCstLow(decl_size) / C_BITS_PER_UNIT; + + if (units > c_larger_than_size) + { + warning_with_decl(decl, "size of `%s' is %u bytes", units); + } + } + } + +# ifdef LUDO_NO_SKIP + /* If we have gone back from temporary to permanent allocation, + actually free the temporary space that we no longer need. */ + if (temporary && !allocation_temporary_p ()) + permanent_allocation (0); + + /* At the end of a declaration, throw away any variable type sizes + of types defined inside that declaration. There is no use + computing them in the following function definition. */ + if (current_binding_level == global_binding_level) + c_get_pending_sizes (); +# endif +} + +/*------------------------------------------------------------\ +| | +| Split Specification and Attributes | +| | +\------------------------------------------------------------*/ + +/* Split SPECS_ATTRS, a list of declspecs and prefix attributes, into two + lists. SPECS_ATTRS may also be just a typespec (eg: RECORD_TYPE). + + The head of the declspec list is stored in DECLSPECS. + The head of the attribute list is stored in PREFIX_ATTRIBUTES. + + Note that attributes in SPECS_ATTRS are stored in the TREE_PURPOSE of + the list elements. We drop the containing TREE_LIST nodes and link the + resulting attributes together the way decl_attributes expects them. */ + +void c_split_specs_attrs( Specs_attrs, Declspecs, Prefix_attributes ) + c_tree_node *Specs_attrs; + c_tree_node **Declspecs; + c_tree_node **Prefix_attributes; +{ + c_tree_node *t, *s, *a, *next, *specs, *attrs; + + /* This can happen in c++ (eg: decl: typespec initdecls ';'). */ + if ((Specs_attrs != NULL) + && CTreeNodeFirstCode(Specs_attrs) != C_LIST_NODE) + { + *Declspecs = Specs_attrs; + *Prefix_attributes = NULL; + return; + } + + /* Remember to keep the lists in the same order, element-wise. */ + + specs = s = NULL; + attrs = a = NULL; + for (t = Specs_attrs; t; t = next) + { + next = CTreeChain(t); + /* Declspecs have a non-NULL TREE_VALUE. */ + if ( CTreeListValue(t) != NULL) + { + if (specs == NULL) + specs = s = t; + else + { + s->COMMON.CHAIN = t; + s = t; + } + } + else + { + if (attrs == NULL) + { + attrs = a = CTreeListPurpose(t); + } + else + { + a->COMMON.CHAIN = t->LIST.PURPOSE; + a = t->LIST.PURPOSE; + } + /* More attrs can be linked here, move A to the end. */ + while ( CTreeChain(a) != NULL) + a = CTreeChain(a); + } + } + + /* Terminate the lists. */ + if (s != NULL) + s->COMMON.CHAIN = NULL; + if (a != NULL) + a->COMMON.CHAIN = NULL; + + /* All done. */ + *Declspecs = specs; + *Prefix_attributes = attrs; +} + +/*------------------------------------------------------------\ +| | +| Layout Record | +| | +\------------------------------------------------------------*/ + + +/* Lay out a RECORD_TYPE type (a C struct). + This means laying out the fields, determining their positions, + and computing the overall size and required alignment of the record. + Note that if you set the TYPE_ALIGN before calling this + then the struct is aligned to at least that boundary. + + If the type has basetypes, you must call layout_basetypes + before calling this function. + + The return value is a list of static members of the record. + They still need to be laid out. */ + +static c_tree_node *c_layout_record(rec) + c_tree_node *rec; +{ + c_tree_node *field; +# ifdef LUDO_NO_SKIP + unsigned record_align = MAX(C_BITS_PER_UNIT, CTreeTypeAlign(rec)); +# endif + /* These must be laid out *after* the record is. */ + c_tree_node *pending_statics = NULL; + /* Record size so far is CONST_SIZE + VAR_SIZE bits, + where CONST_SIZE is an integer + and VAR_SIZE is a c_tree_node *expression. + If VAR_SIZE is null, the size is just CONST_SIZE. + Naturally we try to avoid using VAR_SIZE. */ + int const_size = 0; + c_tree_node *var_size = 0; + /* Once we start using VAR_SIZE, this is the maximum alignment + that we know VAR_SIZE has. */ + int var_align = C_BITS_PER_UNIT; + +#ifdef STRUCTURE_SIZE_BOUNDARY + /* Packed structures don't need to have minimum size. */ + if (! TYPE_PACKED (rec)) + record_align = MAX (record_align, STRUCTURE_SIZE_BOUNDARY); +#endif + + for (field = CTreeTypeValues(rec); field; field = CTreeChain(field)) + { + int known_align = var_size ? var_align : const_size; +# ifdef LUDO_NO_SKIP + int desired_align; +# endif + + /* If FIELD is static, then treat it like a separate variable, + not really like a structure field. + If it is a FUNCTION_DECL, it's a method. + In both cases, all we do is lay out the decl, + and we do it *after* the record is laid out. */ + + if ( CTreeDeclCode(field) == C_VAR_DECL) + { + pending_statics = c_tree_add_head_list(NULL, field, pending_statics); + continue; + } + /* Enumerators and enum types which are local to this class need not + be laid out. Likewise for initialized constant fields. */ + if ( CTreeDeclCode(field) != C_FIELD_DECL) + continue; + + /* Lay out the field so we know what alignment it needs. + For a packed field, use the alignment as specified, + disregarding what the type would want. */ +# ifdef LUDO_NO_SKIP + if (DECL_PACKED (field)) + desired_align = DECL_ALIGN (field); +# endif + c_layout_decl(field, known_align); + +# ifdef LUDO_NO_SKIP + if (! DECL_PACKED (field)) + desired_align = DECL_ALIGN (field); + /* Some targets (i.e. VMS) limit struct field alignment + to a lower boundary than alignment of variables. */ +#ifdef BIGGEST_FIELD_ALIGNMENT + desired_align = MIN (desired_align, BIGGEST_FIELD_ALIGNMENT); +#endif +#ifdef ADJUST_FIELD_ALIGN + desired_align = ADJUST_FIELD_ALIGN (field, desired_align); +#endif + + /* Record must have at least as much alignment as any field. + Otherwise, the alignment of the field within the record + is meaningless. */ + +#ifndef PCC_BITFIELD_TYPE_MATTERS + record_align = MAX (record_align, desired_align); +#else + if (PCC_BITFIELD_TYPE_MATTERS && CTreeType(field) != error_mark_node + && DECL_BIT_FIELD_TYPE (field) + && ! integer_zerop (CTreeTypeSize(CTreeType(field)))) + { + /* For these machines, a zero-length field does not + affect the alignment of the structure as a whole. + It does, however, affect the alignment of the next field + within the structure. */ + if (! integer_zerop (DECL_SIZE (field))) + record_align = MAX (record_align, desired_align); + else if (! DECL_PACKED (field)) + desired_align = TYPE_ALIGN (CTreeType(field)); + /* A named bit field of declared type `int' + forces the entire structure to have `int' alignment. */ + if (CTreeDeclName(field) != 0) + { + int type_align = TYPE_ALIGN (CTreeType(field)); + if (maximum_field_alignment != 0) + type_align = MIN (type_align, maximum_field_alignment); + else if (DECL_PACKED (field)) + type_align = MIN (type_align, BITS_PER_UNIT); + + record_align = MAX (record_align, type_align); + } + } + else + record_align = MAX (record_align, desired_align); +#endif + + /* Does this field automatically have alignment it needs + by virtue of the fields that precede it and the record's + own alignment? */ + + if (const_size % desired_align != 0 + || (var_align % desired_align != 0 + && var_size != 0)) + { + /* No, we need to skip space before this field. + Bump the cumulative size to multiple of field alignment. */ + + if (var_size == 0 + || var_align % desired_align == 0) + const_size + = CEIL (const_size, desired_align) * desired_align; + else + { + if (const_size > 0) + var_size = c_build_size_binop(PLUS_EXPR, var_size, + size_int (const_size)); + const_size = 0; + var_size = round_up (var_size, desired_align); + var_align = MIN (var_align, desired_align); + } + } + +#ifdef PCC_BITFIELD_TYPE_MATTERS + if (PCC_BITFIELD_TYPE_MATTERS + && TREE_CODE (field) == FIELD_DECL + && CTreeType(field) != error_mark_node + && DECL_BIT_FIELD_TYPE (field) + && !DECL_PACKED (field) + && maximum_field_alignment == 0 + && !integer_zerop (DECL_SIZE (field))) + { + int type_align = TYPE_ALIGN (CTreeType(field)); + register c_tree_node *dsize = DECL_SIZE (field); + int field_size = TREE_INT_CST_LOW (dsize); + + /* A bit field may not span more units of alignment of its type + than its type itself. Advance to next boundary if necessary. */ + if (((const_size + field_size + type_align - 1) / type_align + - const_size / type_align) + > TREE_INT_CST_LOW (CTreeTypeSize(CTreeType(field))) / type_align) + const_size = CEIL (const_size, type_align) * type_align; + } +#endif + +/* No existing machine description uses this parameter. + So I have made it in this aspect identical to PCC_BITFIELD_TYPE_MATTERS. */ +#ifdef BITFIELD_NBYTES_LIMITED + if (BITFIELD_NBYTES_LIMITED + && TREE_CODE (field) == FIELD_DECL + && CTreeType(field) != error_mark_node + && DECL_BIT_FIELD_TYPE (field) + && !DECL_PACKED (field) + && !integer_zerop (DECL_SIZE (field))) + { + int type_align = TYPE_ALIGN (CTreeType(field)); + register c_tree_node *dsize = DECL_SIZE (field); + int field_size = TREE_INT_CST_LOW (dsize); + + if (maximum_field_alignment != 0) + type_align = MIN (type_align, maximum_field_alignment); + /* ??? This test is opposite the test in the containing if + statement, so this code is unreachable currently. */ + else if (DECL_PACKED (field)) + type_align = MIN (type_align, BITS_PER_UNIT); + + /* A bit field may not span the unit of alignment of its type. + Advance to next boundary if necessary. */ + /* ??? This code should match the code above for the + PCC_BITFIELD_TYPE_MATTERS case. */ + if (const_size / type_align + != (const_size + field_size - 1) / type_align) + const_size = CEIL (const_size, type_align) * type_align; + } +#endif + + /* Size so far becomes the position of this field. */ + + if (var_size && const_size) + CTreeDeclArguments(field) + = c_build_size_binop(PLUS_EXPR, var_size, size_int (const_size)); + else if (var_size) + CTreeDeclArguments(field) = var_size; + else +# endif + { + CTreeDeclArguments(field) = c_tree_get_size_int(const_size); + + /* If this field ended up more aligned than we thought it + would be (we approximate this by seeing if its position + changed), lay out the field again; perhaps we can use an + integral mode for it now. */ + if (known_align != const_size) + { + c_layout_decl(field, const_size); + } + } + + /* Now add size of this field to the size of the record. */ + + { + c_tree_node *dsize = CTreeDeclSize(field); + + /* This can happen when we have an invalid nested struct definition, + such as struct j { struct j { int i; } }. The error message is + printed in finish_struct. */ + if (dsize == 0) + /* Do nothing. */; + else if ( CTreeNodeFirstCode(dsize) == C_INT_CST_NODE + && ! CIsTreeNodeStatic(dsize) + && CTreeIntCstHigh(dsize) == 0 + && CTreeIntCstLow(dsize) + const_size >= const_size) + { + /* Use const_size if there's no overflow. */ + const_size += CTreeIntCstLow(dsize); + } + else + { + if (var_size == 0) + { + var_size = dsize; + } + else + { + var_size = c_build_size_binop( C_PLUS_EXPR, var_size, dsize); + } + } + } + } + + /* Work out the total size and alignment of the record + as one expression and store in the record type. + Round it up to a multiple of the record's alignment. */ + + if (var_size == 0) + { + CTreeTypeSize(rec) = c_tree_get_size_int(const_size); + } + else + { + if (const_size) + { + var_size = c_build_size_binop( C_PLUS_EXPR, var_size, c_tree_get_size_int( const_size ) ); + } + CTreeTypeSize(rec) = var_size; + } + +# ifdef LUDO_NO_SKIP + /* Determine the desired alignment. */ +#ifdef ROUND_TYPE_ALIGN + TYPE_ALIGN (rec) = ROUND_TYPE_ALIGN (rec, TYPE_ALIGN (rec), record_align); +#else + TYPE_ALIGN (rec) = MAX (TYPE_ALIGN (rec), record_align); +#endif + +#ifdef ROUND_TYPE_SIZE + CTreeTypeSize(rec) = ROUND_CTreeTypeSize(rec, CTreeTypeSize(rec), TYPE_ALIGN (rec)); +#else + /* Round the size up to be a multiple of the required alignment */ + CTreeTypeSize(rec) = round_up (CTreeTypeSize(rec), TYPE_ALIGN (rec)); +#endif +# endif + + return pending_statics; +} + +/* Return the value of VALUE, rounded up to a multiple of DIVISOR. */ + +c_tree_node *c_round_up(value, divisor) + c_tree_node *value; + int divisor; +{ + c_tree_node *tmp; + + tmp = c_build_size_binop( C_CEIL_DIV_EXPR, value, c_tree_get_size_int(divisor)); + tmp = c_build_size_binop( C_MULT_EXPR, tmp, c_tree_get_size_int(divisor)); + + return( tmp ); +} + +/*------------------------------------------------------------\ +| | +| Layout Union | +| | +\------------------------------------------------------------*/ + +/* Lay out a UNION_TYPE or QUAL_UNION_TYPE type. + Lay out all the fields, set their positions to zero, + and compute the size and alignment of the union (maximum of any field). + Note that if you set the TYPE_ALIGN before calling this + then the union align is aligned to at least that boundary. */ + +static void c_layout_union (rec) + c_tree_node *rec; +{ + c_tree_node *field; +# ifdef LUDO_NO_SKIP + unsigned union_align = C_BITS_PER_UNIT; +# endif + + /* The size of the union, based on the fields scanned so far, + is max (CONST_SIZE, VAR_SIZE). + VAR_SIZE may be null; then CONST_SIZE by itself is the size. */ + int const_size = 0; + c_tree_node *var_size = 0; + +#ifdef STRUCTURE_SIZE_BOUNDARY + /* Packed structures don't need to have minimum size. */ + if (! TYPE_PACKED (rec)) + union_align = STRUCTURE_SIZE_BOUNDARY; +#endif + + /* If this is a QUAL_UNION_TYPE, we want to process the fields in + the reverse order in building the COND_EXPR that denotes its + size. We reverse them again later. */ + if ( CTreeTypeCode(rec) == C_QUAL_UNION_TYPE) + { + CTreeTypeValues(rec) = c_tree_reverse_list( CTreeTypeValues(rec)); + } + + for (field = CTreeTypeValues(rec); field; field = CTreeChain(field)) + { + /* Enums which are local to this class need not be laid out. */ + if ( CTreeDeclCode(field) == C_CONST_DECL || CTreeDeclCode(field) == C_TYPE_DECL) + continue; + + c_layout_decl(field, 0); + CTreeDeclArguments(field) = c_tree_get_size_int(0); + + /* Union must be at least as aligned as any field requires. */ + +# ifdef LUDO_NO_SKIP + union_align = MAX (union_align, DECL_ALIGN (field)); + +#ifdef PCC_BITFIELD_TYPE_MATTERS + /* On the m88000, a bit field of declare type `int' + forces the entire union to have `int' alignment. */ + if (PCC_BITFIELD_TYPE_MATTERS && DECL_BIT_FIELD_TYPE (field)) + union_align = MAX (union_align, TYPE_ALIGN (CTreeType(field))); +#endif +# endif + + if ( CTreeTypeCode(rec) == C_UNION_TYPE) + { + /* Set union_size to max (decl_size, union_size). + There are more and less general ways to do this. + Use only CONST_SIZE unless forced to use VAR_SIZE. */ + + if ( CTreeNodeFirstCode( CTreeDeclSize(field)) == C_INT_CST_NODE) + { + const_size + = MAX(const_size, CTreeIntCstLow( CTreeDeclSize(field))); + } + else if (var_size == 0) + { + var_size = CTreeDeclSize(field); + } + else + { + var_size = c_build_size_binop( + C_MAX_EXPR, var_size, CTreeDeclSize(field)); + } + } + else if ( CTreeTypeCode(rec) == C_QUAL_UNION_TYPE) + { + var_size = c_tree_build_ternary_expr( C_COND_EXPR, + CTreeDeclInitial( field ), CTreeDeclSize( field ), + var_size ? var_size : c_integer_zero_node ); + CTreeType( var_size ) = c_size_type; + } + } + + if ( CTreeTypeCode(rec) == C_QUAL_UNION_TYPE) + { + CTreeTypeValues(rec) = c_tree_reverse_list( CTreeTypeValues(rec)); + } + + /* Determine the ultimate size of the union (in bytes). */ + if (var_size == NULL) + { +#define CEIL(x,y) (((x) + (y) - 1) / (y)) + + CTreeTypeSize(rec) = c_tree_get_size_int( + CEIL(const_size, C_BITS_PER_UNIT) * C_BITS_PER_UNIT); + } + else if (const_size == 0) + { + CTreeTypeSize(rec) = var_size; + } + else + { + c_tree_node *tmp_node; + + tmp_node = c_round_up( c_tree_get_size_int(const_size), C_BITS_PER_UNIT); + tmp_node = c_build_size_binop( C_MAX_EXPR, var_size, tmp_node ); + CTreeTypeSize(rec) = tmp_node; + } + +# ifdef LUDO_NO_SKIP + /* Determine the desired alignment. */ +#ifdef ROUND_TYPE_ALIGN + TYPE_ALIGN (rec) = ROUND_TYPE_ALIGN (rec, TYPE_ALIGN (rec), union_align); +#else + TYPE_ALIGN (rec) = MAX (TYPE_ALIGN (rec), union_align); +#endif +# endif + +#ifdef ROUND_TYPE_SIZE + CTreeTypeSize(rec) = ROUND_CTreeTypeSize(rec, CTreeTypeSize(rec), TYPE_ALIGN (rec)); +#else + /* Round the size up to be a multiple of the required alignment */ + CTreeTypeSize(rec) = c_round_up( CTreeTypeSize(rec), CTreeTypeAlign(rec)); +#endif +} + + +/*------------------------------------------------------------\ +| | +| Layout Declaration | +| | +\------------------------------------------------------------*/ + +/* Set the size, mode and alignment of a ..._DECL node. + TYPE_DECL does need this for C++. + Note that LABEL_DECL and CONST_DECL nodes do not need this, + and FUNCTION_DECL nodes have them set up in a special (and simple) way. + Don't call layout_decl for them. + + KNOWN_ALIGN is the amount of alignment we can assume this + decl has with no special effort. It is relevant only for FIELD_DECLs + and depends on the previous fields. + All that matters about KNOWN_ALIGN is which powers of 2 divide it. + If KNOWN_ALIGN is 0, it means, "as much alignment as you like": + the record will be aligned to suit. */ + +void c_layout_decl(decl, known_align) + c_tree_node *decl; + unsigned known_align; +{ + c_tree_node *type = CTreeType(decl); + int code = CTreeDeclCode(decl); + int spec_size = CTreeDeclFieldSize(decl); + + if (code == C_CONST_DECL) + { + return; + } + + if (code != C_VAR_DECL && code != C_PARAM_DECL && code != C_RESULT_DECL + && code != C_FIELD_DECL && code != C_TYPE_DECL) + { + abort (); + } + + if (type == c_error_mark_node) + { + type = c_void_type_node; + spec_size = 0; + } + + /* Usually the size and mode come from the data type without change. */ + + decl->DECL.MODE = CTreeTypeMode(type); + if ( CIsTreeNodeUnsigned( type ) ) + { + CSetTreeNodeUnsigned( decl ); + } + + if ( CTreeDeclSize(decl) == (c_tree_node *)0) + { + decl->DECL.SIZE = type->TYPE.SIZE; + } + + if (code == C_FIELD_DECL && CIsTreeDeclBitField(decl)) + { + if (spec_size == 0 && CTreeDeclName(decl) != 0) + { + abort (); + } + + /* Size is specified number of bits. */ + CTreeDeclSize(decl) = c_tree_get_size_int(spec_size); + } + /* Force alignment required for the data type. + But if the decl itself wants greater alignment, don't override that. + Likewise, if the decl is packed, don't override it. */ +# ifdef LUDO_NO_SKIP + else if (DECL_ALIGN (decl) == 0 + || (! DECL_PACKED (decl) && TYPE_ALIGN (type) > DECL_ALIGN (decl))) + DECL_ALIGN (decl) = TYPE_ALIGN (type); +# endif + + /* See if we can use an ordinary integer mode for a bit-field. */ + /* Conditions are: a fixed size that is correct for another mode + and occupying a complete byte or bytes on proper boundary. */ + if (code == C_FIELD_DECL) + { + CTreeDeclResult(decl) = CIsTreeDeclBitField(decl) ? type : 0; +# ifdef LUDO_NO_SKIP + if ( maximum_field_alignment != 0) + DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), maximum_field_alignment); + else if (DECL_PACKED (decl)) + DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), BITS_PER_UNIT); +# endif + } + +# ifdef LUDO_NO_SKIP + if ( CIsTreeDeclBitField(decl) + && CTreeTypeSize(type) != 0 + && CTreeNodeFirstCode( CTreeTypeSize(type)) == C_INT_CST_NODE + && GET_MODE_CLASS (TYPE_MODE (type)) == MODE_INT + ) + { + register enum machine_mode xmode + = mode_for_size (TREE_INT_CST_LOW (DECL_SIZE (decl)), MODE_INT, 1); + + if (xmode != BLKmode + && known_align % GET_MODE_ALIGNMENT (xmode) == 0) + { + DECL_ALIGN (decl) = MAX (GET_MODE_ALIGNMENT (xmode), + DECL_ALIGN (decl)); + DECL_MODE (decl) = xmode; + DECL_SIZE (decl) = size_int (GET_MODE_BITSIZE (xmode)); + /* This no longer needs to be accessed as a bit field. */ + CClearTreeDeclBitField(decl); + } + } + + /* Turn off DECL_BIT_FIELD if we won't need it set. */ + if (DECL_BIT_FIELD (decl) && TYPE_MODE (type) == BLKmode + && known_align % TYPE_ALIGN (type) == 0 + && DECL_SIZE (decl) != 0 + && (TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST + || (TREE_INT_CST_LOW (DECL_SIZE (decl)) % BITS_PER_UNIT) == 0) + && DECL_ALIGN (decl) >= TYPE_ALIGN (type)) + DECL_BIT_FIELD (decl) = 0; + + /* Evaluate nonconstant size only once, either now or as soon as safe. */ + if (CTreeDeclSize(decl) != 0 && CTreeNodeFirstCode(CTreeDeclSize(decl)) != C_INT_CST_NODE) + CTreeDeclSize(decl) = variable_size (DECL_SIZE (decl)); +# endif +} + +/*------------------------------------------------------------\ +| | +| Layout Type | +| | +\------------------------------------------------------------*/ + +/* Calculate the mode, size, and alignment for TYPE. + For an array type, calculate the element separation as well. + Record TYPE on the chain of permanent or temporary types + so that dbxout will find out about it. + + TYPE_SIZE of a type is nonzero if the type has been laid out already. + c_layout_type does nothing on such a type. + + If the type is incomplete, its TYPE_SIZE remains zero. */ + +void c_layout_type(type) + c_tree_node *type; +{ +# ifdef LUDO_NO_SKIP + int old; +# endif + c_tree_node *pending_statics; + + if (type == 0) + { + abort (); + } + + /* Do nothing if type has been laid out before. */ + if ( CTreeTypeSize(type)) return; + +# ifdef LUDO_NO_SKIP + /* Make sure all nodes we allocate are not momentary; + they must last past the current statement. */ + old = suspend_momentary (); + + /* Put all our nodes into the same obstack as the type. Also, + make expressions saveable (this is a no-op for permanent types). */ + + push_obstacks (TYPE_OBSTACK (type), TYPE_OBSTACK (type)); + saveable_allocation (); +# endif + + switch ( CTreeTypeCode( type ) ) + { + case C_LANG_TYPE: + /* This kind of type is the responsibility + of the language-specific code. */ + abort (); + + case C_BOOLEAN_TYPE: /* Used for Java, Pascal, and Chill. */ + if ( CTreeTypePrecision(type) == 0) + { + type->TYPE.PRECISION = 1; /* default to one byte/boolean. */ + } + /* ... fall through ... */ + + case C_INTEGER_TYPE: + case C_ENUMERAL_TYPE: + case C_CHAR_TYPE: + if ( (CTreeNodeFirstCode(TYPE_MIN_VALUE(type)) == C_INT_CST_NODE ) + && c_tree_is_int_cst_sgn(TYPE_MIN_VALUE (type)) >= 0) + { + CSetTreeNodeUnsigned(type); + } +# ifdef LUDO_NO_SKIP + type->TYPE.MODE = c_get_smallest_mode_for_size( TYPE_PRECISION(type), MODE_INT ); + type->TYPE.SIZE = c_get_size_int( GET_MODE_BITSIZE( CTreeTypeMode(type))); +# else + type->TYPE.SIZE = c_tree_get_size_int( CTreeTypePrecision( type ) ); +# endif + + break; + + case C_REAL_TYPE: +# ifdef LUDO_NO_SKIP + type->TYPE.MODE = c_get_mode_for_size( CTreeTypePrecision(type), MODE_FLOAT, 0); + type->TYPE.SIZE = c_get_size_int( GET_MODE_BITSIZE( CTreeTypeMode(type))); +# else + type->TYPE.SIZE = c_tree_get_size_int( CTreeTypePrecision( type ) ); +# endif + break; + + case C_COMPLEX_TYPE: + if ( CIsTreeNodeUnsigned( CTreeType(type))) + { + CSetTreeNodeUnsigned( type ); + } +# ifdef LUDO_NO_SKIP + TYPE_MODE (type) + = mode_for_size (2 * TYPE_PRECISION (TREE_TYPE (type)), + (TREE_CODE (TREE_TYPE (type)) == INTEGER_TYPE + ? MODE_COMPLEX_INT : MODE_COMPLEX_FLOAT), + 0); + TYPE_SIZE (type) = size_int (GET_MODE_BITSIZE (TYPE_MODE (type))); +# else + type->TYPE.SIZE = c_tree_get_size_int( CTreeTypePrecision( type ) ); +# endif + break; + + case C_VOID_TYPE: + CTreeTypeSize(type) = c_size_zero_node; + CTreeTypeAlign( type ) = 1; +# ifdef LUDO_NO_SKIP + TYPE_MODE (type) = VOIDmode; +# endif + break; + + case C_OFFSET_TYPE: + CTreeTypeSize(type) = c_tree_get_size_int( C_POINTER_TYPE_SIZE ); +# ifdef LUDO_NO_SKIP + TYPE_MODE (type) = ptr_mode; +# endif + break; + + case C_FUNCTION_TYPE: + case C_METHOD_TYPE: +# ifdef LUDO_NO_SKIP + TYPE_MODE (type) = mode_for_size (2 * POINTER_SIZE, MODE_INT, 0); +# endif + CTreeTypeSize(type) = c_tree_get_size_int( C_POINTER_TYPE_SIZE * 2 ); + break; + + case C_POINTER_TYPE: + case C_REFERENCE_TYPE: +# ifdef LUDO_NO_SKIP + TYPE_MODE (type) = ptr_mode; +# endif + CTreeTypeSize(type) = c_tree_get_size_int( C_POINTER_TYPE_SIZE); + CSetTreeNodeUnsigned(type); + CTreeTypePrecision(type) = C_POINTER_TYPE_SIZE; + break; + + case C_ARRAY_TYPE: + { + c_tree_node * index = CTreeTypeValues(type); + c_tree_node * element = CTreeType(type); + + c_tree_build_pointer_type(element); + + /* We need to know both bounds in order to compute the size. */ + if (index && CTreeTypeMaxValue(index) && CTreeTypeMinValue(index) + && CTreeTypeSize(element)) + { + c_tree_node * ub = CTreeTypeMaxValue(index); + c_tree_node * lb = CTreeTypeMinValue(index); + c_tree_node * length; + c_tree_node * tmp_node; + + /* If UB is max (lb - 1, x), remove the MAX_EXPR since the + test for negative below covers it. */ + if ( CTreeNodeCode(ub) == C_MAX_EXPR + && CTreeNodeCode( CTreeExprOperand(ub, 0)) == C_MINUS_EXPR + && c_tree_is_integer_onep ( CTreeExprOperand( CTreeExprOperand(ub, 0), 1)) + && c_is_operand_equal_p ( CTreeExprOperand( CTreeExprOperand(ub, 0), 0), + lb, 0)) + ub = CTreeExprOperand(ub, 1); + else if ( CTreeNodeCode(ub) == C_MAX_EXPR + && CTreeNodeCode( CTreeExprOperand(ub, 1)) == C_MINUS_EXPR + && c_tree_is_integer_onep( CTreeExprOperand( CTreeExprOperand(ub, 1), 1)) + && c_is_operand_equal_p( CTreeExprOperand( CTreeExprOperand(ub, 1), + 0), + lb, 0)) + ub = CTreeExprOperand(ub, 0); + tmp_node = c_build_size_binop( C_MINUS_EXPR, ub, lb ); + length = c_build_size_binop( C_PLUS_EXPR, c_size_one_node, tmp_node ); + + /* If neither bound is a constant and sizetype is signed, make + sure the size is never negative. We should really do this + if *either* bound is non-constant, but this is the best + compromise between C and Ada. */ + if (! CIsTreeNodeUnsigned(c_size_type) + && CTreeNodeFirstCode( CTreeTypeMinValue(index)) != C_INT_CST_NODE + && CTreeNodeFirstCode( CTreeTypeMaxValue(index)) != C_INT_CST_NODE) + { + length = c_build_size_binop( C_MAX_EXPR, length, c_size_zero_node ); + } + + tmp_node = c_build_size_binop( C_MULT_EXPR, length, CTreeTypeSize( element ) ); + CTreeTypeSize(type) = tmp_node; + } + + /* Now round the alignment and size, + using machine-dependent criteria if any. */ + +# ifdef LUDO_NO_SKIP +#ifdef ROUND_TYPE_ALIGN + TYPE_ALIGN (type) + = ROUND_TYPE_ALIGN (type, TYPE_ALIGN (element), BITS_PER_UNIT); +#else + TYPE_ALIGN (type) = MAX (TYPE_ALIGN (element), BITS_PER_UNIT); +#endif + +#ifdef ROUND_TYPE_SIZE + if (TYPE_SIZE (type) != 0) + TYPE_SIZE (type) + = ROUND_TYPE_SIZE (type, TYPE_SIZE (type), TYPE_ALIGN (type)); +#endif + + TYPE_MODE (type) = BLKmode; + if ( CTreeTypeSize(type) != 0 + && CTreeNodeFirstCode( CTreeTypeSize(type)) == C_INT_CST_NODE + /* BLKmode elements force BLKmode aggregate; + else extract/store fields may lose. */ + && (TYPE_MODE (TREE_TYPE (type)) != BLKmode + || TYPE_NO_FORCE_BLK (TREE_TYPE (type)))) + { + TYPE_MODE (type) + = mode_for_size (TREE_INT_CST_LOW (TYPE_SIZE (type)), + MODE_INT, 1); + + if (STRICT_ALIGNMENT && TYPE_ALIGN (type) < BIGGEST_ALIGNMENT + && TYPE_ALIGN (type) < TREE_INT_CST_LOW (TYPE_SIZE (type)) + && TYPE_MODE (type) != BLKmode) + { + TYPE_NO_FORCE_BLK (type) = 1; + TYPE_MODE (type) = BLKmode; + } + } +# endif + break; + } + + case C_RECORD_TYPE: + pending_statics = c_layout_record(type); +# ifdef LUDO_NO_SKIP + TYPE_MODE (type) = BLKmode; + if ( CTreeNodeFirstCode( CTreeTypeSize(type)) == C_INT_CST_NODE) + { + c_tree_node * field; + enum machine_mode mode = VOIDmode; + + /* A record which has any BLKmode members must itself be BLKmode; + it can't go in a register. + Unless the member is BLKmode only because it isn't aligned. */ + for (field = CTreeTypeValues(type); field; field = CTreeChain(field)) + { + int bitpos; + + if ( CTreeDeclCode(field) != C_FIELD_DECL) continue; + + if (TYPE_MODE (TREE_TYPE (field)) == BLKmode + && ! TYPE_NO_FORCE_BLK (TREE_TYPE (field))) + goto record_lose; + + if ( CTreeNodeFirstCode( CTreeDeclArguments(field)) != C_INT_CST_NODE) + { + goto record_lose; + } + + bitpos = CTreeIntCstLow( CTreeDeclArguments(field)); + + /* Must be BLKmode if any field crosses a word boundary, + since extract_bit_field can't handle that in registers. */ + if (bitpos / C_BITS_PER_WORD + != (( CTreeIntCstLow( CTreeDeclSize(field)) + bitpos - 1) + / C_BITS_PER_WORD) + /* But there is no problem if the field is entire words. */ + && CTreeIntCstLow( CTreeDeclSize(field)) % C_BITS_PER_WORD != 0) + { + goto record_lose; + } + + /* If this field is the whole struct, remember its mode so + that, say, we can put a double in a class into a DF + register instead of forcing it to live in the stack. */ + if (simple_cst_equal (TYPE_SIZE (type), DECL_SIZE (field))) + { + mode = DECL_MODE (field); + } + } + + if (mode != VOIDmode) + /* We only have one real field; use its mode. */ + TYPE_MODE (type) = mode; + else + TYPE_MODE (type) + = mode_for_size (TREE_INT_CST_LOW (TYPE_SIZE (type)), + MODE_INT, 1); + + /* If structure's known alignment is less than + what the scalar mode would need, and it matters, + then stick with BLKmode. */ + if (STRICT_ALIGNMENT + && ! (TYPE_ALIGN (type) >= BIGGEST_ALIGNMENT + || (TYPE_ALIGN (type) + >= TREE_INT_CST_LOW (TYPE_SIZE (type))))) + { + if (TYPE_MODE (type) != BLKmode) + /* If this is the only reason this type is BLKmode, + then don't force containing types to be BLKmode. */ + TYPE_NO_FORCE_BLK (type) = 1; + TYPE_MODE (type) = BLKmode; + } + + record_lose: ; + } +# endif + + /* Lay out any static members. This is done now + because their type may use the record's type. */ + while (pending_statics) + { + c_layout_decl( CTreeListValue(pending_statics), 0); + pending_statics = CTreeChain(pending_statics); + } + break; + + case C_UNION_TYPE: + case C_QUAL_UNION_TYPE: + c_layout_union(type); + +# ifdef LUDO_NO_SKIP + TYPE_MODE (type) = BLKmode; + if (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST + /* If structure's known alignment is less than + what the scalar mode would need, and it matters, + then stick with BLKmode. */ + && (! STRICT_ALIGNMENT + || TYPE_ALIGN (type) >= BIGGEST_ALIGNMENT + || TYPE_ALIGN (type) >= TREE_INT_CST_LOW (TYPE_SIZE (type)))) + { + c_tree_node * field; + /* A union which has any BLKmode members must itself be BLKmode; + it can't go in a register. + Unless the member is BLKmode only because it isn't aligned. */ + for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) + { + if (TREE_CODE (field) != FIELD_DECL) + continue; + + if (TYPE_MODE (TREE_TYPE (field)) == BLKmode + && ! TYPE_NO_FORCE_BLK (TREE_TYPE (field))) + goto union_lose; + } + + TYPE_MODE (type) + = mode_for_size (TREE_INT_CST_LOW (TYPE_SIZE (type)), + MODE_INT, 1); + + union_lose: ; + } +# endif + break; + + case C_SET_TYPE: /* Used by Chill and Pascal. */ + if ( CTreeNodeFirstCode( CTreeTypeMaxValue( CTreeTypeValues(type))) != C_INT_CST_NODE + || CTreeNodeFirstCode( CTreeTypeMinValue( CTreeTypeValues(type))) != C_INT_CST_NODE) + abort(); + else + { +#ifndef SET_WORD_SIZE +#define SET_WORD_SIZE BITS_PER_WORD +#endif +# ifdef LUDO_NO_SKIP + int alignment = set_alignment ? set_alignment : SET_WORD_SIZE; +# endif + int size_in_bits + = ( CTreeIntCstLow( CTreeTypeMaxValue( CTreeTypeValues(type))) + - CTreeIntCstLow( CTreeTypeMinValue( CTreeTypeValues(type))) + 1); +# ifdef LUDO_NO_SKIP + int rounded_size + = ((size_in_bits + alignment - 1) / alignment) * alignment; + if (rounded_size > alignment) + TYPE_MODE (type) = BLKmode; + else + TYPE_MODE (type) = mode_for_size (alignment, MODE_INT, 1); + TYPE_SIZE (type) = c_tree_get_size_int(rounded_size); + TYPE_ALIGN (type) = alignment; +# endif + CTreeTypePrecision(type) = size_in_bits; + } + break; + + case C_FILE_TYPE: +# ifdef LUDO_NO_SKIP + /* The size may vary in different languages, so the language front end + should fill in the size. */ + TYPE_ALIGN (type) = BIGGEST_ALIGNMENT; + TYPE_MODE (type) = BLKmode; +# endif + break; + + default: + + abort (); + } /* end switch */ + + /* Normally, use the alignment corresponding to the mode chosen. + However, where strict alignment is not required, avoid + over-aligning structures, since most compilers do not do this + alignment. */ + +# ifdef LUDO_NO_SKIP + if (TYPE_MODE (type) != BLKmode && TYPE_MODE (type) != VOIDmode + && (STRICT_ALIGNMENT + || (TREE_CODE (type) != RECORD_TYPE && TREE_CODE (type) != UNION_TYPE + && TREE_CODE (type) != QUAL_UNION_TYPE + && TREE_CODE (type) != ARRAY_TYPE))) + TYPE_ALIGN (type) = GET_MODE_ALIGNMENT (TYPE_MODE (type)); + + /* Evaluate nonconstant size only once, either now or as soon as safe. */ + if (TYPE_SIZE (type) != 0 && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST) + TYPE_SIZE (type) = variable_size (TYPE_SIZE (type)); +# endif + + /* Also layout any other variants of the type. */ + if ( CTreeTypeNextVariant(type) + || type != CTreeTypeMainVariant(type)) + { + c_tree_node * variant; + /* Record layout info of this variant. */ + c_tree_node * size = CTreeTypeSize (type); +# ifdef LUDO_NO_SKIP + int align = TYPE_ALIGN (type); + enum machine_mode mode = TYPE_MODE (type); +# endif + + /* Copy it into all variants. */ + for (variant = CTreeTypeMainVariant(type); + variant; + variant = CTreeTypeNextVariant(variant)) + { + CTreeTypeSize(variant) = size; +# ifdef LUDO_NO_SKIP + TYPE_ALIGN (variant) = align; + TYPE_MODE (variant) = mode; +# endif + } + } + +# ifdef LUDO_NO_SKIP + pop_obstacks (); + resume_momentary (old); +# endif +} + +/*------------------------------------------------------------\ +| | +| Param List Tags Warning | +| | +\------------------------------------------------------------*/ + +/* At end of parameter list, warn about any struct, union or enum tags + defined within. Do so because these types cannot ever become complete. */ + +void c_parmlist_tags_warning() +{ + c_tree_node *elt; + static int already; + + for (elt = c_current_binding_level->TAG_LIST; elt; elt = CTreeChain(elt)) + { + int code = CTreeTypeCode( CTreeListValue(elt)); + /* An anonymous union parm type is meaningful as a GNU extension. + So don't warn for that. */ + if (code == C_UNION_TYPE && CTreeListPurpose(elt) == 0 && !c_pedantic) continue; + if ( CTreeListPurpose(elt) != 0) + { + warning ("`%s %s' declared inside parameter list", + (code == C_RECORD_TYPE ? "struct" + : code == C_UNION_TYPE ? "union" + : "enum"), + CTreeIdentPointer( CTreeListPurpose(elt))); + } + else + { + warning ("anonymous %s declared inside parameter list", + (code == C_RECORD_TYPE ? "struct" + : code == C_UNION_TYPE ? "union" + : "enum")); + } + + if (! already) + { + warning ("its scope is only this definition or declaration,"); + warning ("which is probably not what you want."); + already = 1; + } + } +} + +/* Identify this binding level as a level of parameters. + DEFINITION_FLAG is 1 for a definition, 0 for a declaration. + But it turns out there is no way to pass the right value for + DEFINITION_FLAG, so we ignore it. */ + +void c_declare_parm_level( definition_flag ) + int definition_flag; +{ + c_current_binding_level->PARAM_FLAG = 1; +} + + +/* Nonzero if currently making parm declarations. */ + +int c_in_parm_level_p() +{ + return c_current_binding_level->PARAM_FLAG; +} + +/* Nonzero if the current level needs to have a BLOCK made. */ + +int +c_kept_level_p () +{ + return ((c_current_binding_level->KEEP_IF_SUBBLOCKS + && c_current_binding_level->BLOCK_LIST != 0) + || c_current_binding_level->KEEP + || c_current_binding_level->NAME_LIST != 0 + || (c_current_binding_level->TAG_LIST != 0 + && !c_current_binding_level->TAG_TRANSPARENT)); +} + +/* Given NAME, an IDENTIFIER_NODE, + return the structure (or union or enum) definition for that name. + Searches binding levels from BINDING_LEVEL up to the global level. + If THISLEVEL_ONLY is nonzero, searches only the specified context + (but skips any tag-transparent contexts to find one that is + meaningful for tags). + CODE says which kind of type the caller wants; + it is RECORD_TYPE or UNION_TYPE or ENUMERAL_TYPE. + If the wrong kind of type is found, an error is reported. */ + +static c_tree_node *c_lookup_tag(code, name, binding_level, thislevel_only) + + int code; + c_binding_level *binding_level; + c_tree_node *name; + int thislevel_only; +{ + c_binding_level *level; + c_tree_node *tail; + + for (level = binding_level; level; level = level->LEVEL_CHAIN) + { + for (tail = level->TAG_LIST; tail; tail = CTreeChain(tail)) + { + if ( CTreeListPurpose(tail) == name) + { + if ( CTreeTypeCode( CTreeListValue(tail)) != code) + { + /* Definition isn't the kind we were looking for. */ + c_pending_invalid_xref = name; + c_pending_invalid_xref_file = c_input_filename; + c_pending_invalid_xref_line = c_lineno; + } + return CTreeListValue(tail); + } + } + + if ( thislevel_only && ! level->TAG_TRANSPARENT) + { + return ( (c_tree_node *)0 ); + } + } + + return ( (c_tree_node *)0 ); +} + +/* Push a definition or a declaration of struct, union or enum tag "name". + "type" should be the type node. + We assume that the tag "name" is not already defined. + + Note that the definition may really be just a forward reference. + In that case, the TYPE_SIZE will be zero. */ + +void c_push_tag(name, type) + + c_tree_node *name; + c_tree_node *type; +{ + c_binding_level *b; + + /* Find the proper binding level for this type tag. */ + + for (b = c_current_binding_level; b->TAG_TRANSPARENT; b = b->LEVEL_CHAIN) + { + continue; + } + + if (name) + { + /* Record the identifier as the type's name if it has none. */ + + if ( CTreeTypeName(type) == (c_tree_node *)0) + { + CTreeTypeName(type) = name; + } + } + + if (b == c_global_binding_level) + { + b->TAG_LIST = c_tree_add_head_list(name, type, b->TAG_LIST); + } + else + { + b->TAG_LIST = c_tree_add_head_list(name, type, b->TAG_LIST); + } + + /* Create a fake NULL-named TYPE_DECL node whose TREE_TYPE will be the + tagged type we just added to the current binding level. This fake + NULL-named TYPE_DECL node helps dwarfout.c to know when it needs + to output a representation of a tagged type, and it also gives + us a convenient place to record the "scope start" address for the + tagged type. */ + + CTreeChain(type) = c_push_decl( c_tree_build_decl(C_TYPE_DECL, NULL, type)); + + /* An approximation for now, so we can tell this is a function-scope tag. + This will be updated in poplevel. */ + CTreeTypeContext(type) = CTreeDeclContext( CTreeChain(type)); +} + +/* Make sure that the tag NAME is defined *in the current binding level* + at least as a forward reference. + CODE says which kind of tag NAME ought to be. + + We also do a push_obstacks_nochange + whose matching pop is in finish_struct. */ + +c_tree_node *c_start_struct(code_type, name) + + int code_type; + c_tree_node *name; +{ + /* If there is already a tag defined at this binding level + (as a forward reference), just return it. */ + + c_tree_node *ref = 0; + +# ifdef LUDO_NO_SKIP + push_obstacks_nochange (); + + if (c_current_binding_level == c_global_binding_level) + { + end_temporary_allocation (); + } +# endif + + if (name != 0) + { + ref = c_lookup_tag(code_type, name, c_current_binding_level, 1); + } + + if (ref && CTreeTypeCode(ref) == code_type) + { +# ifdef LUDO_NO_SKIP + C_TYPE_BEING_DEFINED(ref) = 1; + TYPE_PACKED (ref) = c_flag_pack_struct; +# endif + if ( CTreeTypeValues(ref) != (c_tree_node *)0 ) + { + error((code_type == C_UNION_TYPE ? "redefinition of `union %s'" + : "redefinition of `struct %s'"), + CTreeIdentPointer(name)); + } + + return ref; + } + + /* Otherwise create a forward-reference just so the tag is in scope. */ + + ref = c_tree_build_type( code_type ); + + c_push_tag(name, ref); + +# ifdef LUDO_NO_SKIP + C_TYPE_BEING_DEFINED (ref) = 1; + TYPE_PACKED (ref) = flag_pack_struct; +# endif + return ref; +} + +/* Lay out the type T, and its element type, and so on. */ + +static void c_layout_array_type(t) + + c_tree_node *t; +{ + if ( CTreeTypeCode( CTreeType(t)) == C_ARRAY_TYPE) + { + c_layout_array_type( CTreeType(t)); + } + + c_layout_type (t); +} + +/* Fill in the fields of a RECORD_TYPE or UNION_TYPE node, T. + FIELDLIST is a chain of FIELD_DECL nodes for the fields. + ATTRIBUTES are attributes to be applied to the structure. + + We also do a pop_obstacks to match the push in start_struct. */ + +c_tree_node *c_finish_struct(t, fieldlist, attributes) + + c_tree_node *t; + c_tree_node *fieldlist; + c_tree_node *attributes; +{ + c_tree_node *x; +# ifdef LUDO_NO_SKIP + int old_momentary; + int toplevel = c_global_binding_level == c_current_binding_level; +# endif + + /* If this type was previously laid out as a forward reference, + make sure we lay it out again. */ + + CTreeTypeSize(t) = 0; + + c_decl_attributes(t, attributes, NULL); + + /* Nameless union parm types are useful as GCC extension. */ + if (! (CTreeTypeCode(t) == C_UNION_TYPE && + CTreeTypeName(t) == 0) && !c_pedantic) + { + /* Otherwise, warn about any struct or union def. in parmlist. */ + if (c_in_parm_level_p ()) + { + if (c_pedantic) + { + pedwarn (( CTreeTypeCode(t) == C_UNION_TYPE ? "union defined inside parms" + : "structure defined inside parms")); + } + else if (! c_flag_traditional) + { + warning (( CTreeTypeCode(t) == C_UNION_TYPE ? "union defined inside parms" + : "structure defined inside parms")); + } + } + } + +# ifdef LUDO_NO_SKIP + old_momentary = suspend_momentary (); +# endif + + if (c_pedantic) + { + for (x = fieldlist; x; x = CTreeChain(x)) + { + if ( CTreeDeclName(x) != NULL ) break; + } + + if (x == 0) + { + pedwarn ("%s has no %smembers", + ( CTreeTypeCode(t) == C_UNION_TYPE ? "union" : "structure"), + (fieldlist != NULL ? "named " : "")); + } + } + + /* Install struct as DECL_CONTEXT of each field decl. + Also process specified field sizes. + Set DECL_FIELD_SIZE to the specified size, or 0 if none specified. + The specified size is found in the DECL_INITIAL. + Store 0 there, except for ": 0" fields (so we can find them + and delete them, below). */ + + for (x = fieldlist; x; x = CTreeChain(x)) + { + CTreeDeclContext(x) = t; + +# ifdef LUDO_NO_SKIP + DECL_PACKED (x) |= TYPE_PACKED (t); +# endif + CTreeDeclFieldSize(x) = 0; + + /* If any field is const, the structure type is pseudo-const. */ + if ( CIsTreeNodeReadOnly(x)) + { + CSetTreeTypeFieldsReadOnly(t); + } + else + { + /* A field that is pseudo-const makes the structure likewise. */ + tree t1 = CTreeType(x); + while (CTreeTypeCode(t1) == C_ARRAY_TYPE) + t1 = CTreeType(t1); + if ((CTreeTypeCode(t1) == C_RECORD_TYPE || + CTreeTypeCode(t1) == C_UNION_TYPE) + && CIsTreeTypeFieldsReadOnly(t1)) + CSetTreeTypeFieldsReadOnly(t); + } + + /* Any field that is volatile means variables of this type must be + treated in some ways as volatile. */ + if ( CIsTreeNodeVolatile(x)) + CSetTreeTypeFieldsVolatile(t); + + /* Any field of nominal variable size implies structure is too. */ + if ( CIsTreeDeclVarSize (x)) + CSetTreeTypeVarSize(t); + + /* Detect invalid nested redefinition. */ + if ( CTreeType(x) == t) + { + error ("nested redefinition of `%s'", CTreeIdentPointer( CTreeTypeName(t))); + } + + /* Detect invalid bit-field size. */ + if ( CTreeDeclInitial(x) ) + { + CStripNops( CTreeDeclInitial(x)); + } + + if ( CTreeDeclInitial(x)) + { + if ( CTreeNodeFirstCode( CTreeDeclInitial(x)) == C_INT_CST_NODE) + { + c_constant_expression_warning (CTreeDeclInitial(x)); + } + else + { + error_with_decl (x, "bit-field `%s' width not an integer constant"); + CTreeDeclInitial(x) = NULL; + } + } + + /* Detect invalid bit-field type. */ + if ( CTreeDeclInitial(x) + && CTreeTypeCode( CTreeType(x)) != C_INTEGER_TYPE + && CTreeTypeCode( CTreeType(x)) != C_ENUMERAL_TYPE) + { + error_with_decl (x, "bit-field `%s' has invalid type"); + CTreeDeclInitial(x) = NULL; + } + + if ( CTreeDeclInitial(x) && c_pedantic + && CTreeTypeMainVariant( CTreeType(x)) != c_integer_type_node + && CTreeTypeMainVariant( CTreeType(x)) != c_unsigned_type_node + /* Accept an enum that's equivalent to int or unsigned int. */ + && !( CTreeTypeCode( CTreeType(x)) == C_ENUMERAL_TYPE + && ( CTreeTypePrecision( CTreeType(x)) + == CTreeTypePrecision(c_integer_type_node)))) + { + pedwarn_with_decl (x, "bit-field `%s' type invalid in ANSI C"); + } + + /* Detect and ignore out of range field width. */ + if ( CTreeDeclInitial(x)) + { + unsigned int width = CTreeIntCstLow( CTreeDeclInitial(x)); + + if (c_tree_is_int_cst_sgn( CTreeDeclInitial(x)) < 0) + { + CTreeDeclInitial(x) = NULL; + error_with_decl (x, "negative width in bit-field `%s'"); + } + else if ( CTreeIntCstHigh(CTreeDeclInitial(x)) != 0 + || width > CTreeTypePrecision(CTreeType(x))) + { + CTreeDeclInitial(x) = NULL; + pedwarn_with_decl (x, "width of `%s' exceeds its type"); + } + else if (width == 0 && CTreeDeclName(x) != 0) + { + error_with_decl (x, "zero width for bit-field `%s'"); + CTreeDeclInitial(x) = NULL; + } + } + + /* Process valid field width. */ + if ( CTreeDeclInitial(x) != NULL ) + { + int width = CTreeIntCstLow(CTreeDeclInitial(x)); + + if ( CTreeTypeCode(CTreeType(x)) == C_ENUMERAL_TYPE + && (width < c_min_precision( CTreeTypeMinValue(CTreeType(x)), + CIsTreeNodeUnsigned(CTreeType(x))) + || width < c_min_precision( CTreeTypeMaxValue(CTreeType(x)), + CIsTreeNodeUnsigned(CTreeType(x))))) + { + c_warning_with_decl(x, "`%s' is narrower than values of its type"); + } + + CTreeDeclFieldSize(x) = width; + CSetTreeDeclBitField(x); + CSetTreeDeclCBitField(x); + CTreeDeclInitial(x) = NULL; + +# ifdef LUDO_NO_SKIP + if (width == 0) + { + /* field size 0 => force desired amount of alignment. */ +#ifdef EMPTY_FIELD_BOUNDARY + DECL_ALIGN (x) = MAX (DECL_ALIGN (x), EMPTY_FIELD_BOUNDARY); +#endif +#ifdef PCC_BITFIELD_TYPE_MATTERS + if (PCC_BITFIELD_TYPE_MATTERS) + DECL_ALIGN (x) = MAX (DECL_ALIGN (x), + TYPE_ALIGN (CTreeType(x))); +#endif + } +# endif + } + else if ( CTreeType(x) != c_error_mark_node) + { +# ifdef LUDO_NO_SKIP + int min_align = (DECL_PACKED (x) ? BITS_PER_UNIT + : TYPE_ALIGN (CTreeType(x))); + /* Non-bit-fields are aligned for their type, except packed + fields which require only BITS_PER_UNIT alignment. */ + DECL_ALIGN (x) = MAX (DECL_ALIGN (x), min_align); +# endif + } + } + + /* Now CTreeDeclInitialis null on all members. */ + + /* Delete all duplicate fields from the fieldlist */ + for (x = fieldlist; x && CTreeChain(x);) + { + /* Anonymous fields aren't duplicates. */ + if (CTreeDeclName(CTreeChain(x)) == NULL) + { + x = CTreeChain(x); + } + else + { + c_tree_node *y = fieldlist; + + while (1) + { + if (CTreeDeclName(y) == CTreeDeclName(CTreeChain(x))) break; + if (y == x) break; + y = CTreeChain(y); + } + + if (CTreeDeclName(y) == CTreeDeclName(CTreeChain(x))) + { + error_with_decl (CTreeChain(x), "duplicate member `%s'"); + CTreeChain(x) = CTreeChain(CTreeChain(x)); + } + else + { + x = CTreeChain(x); + } + } + } + + /* Now we have the nearly final fieldlist. Record it, + then lay out the structure or union (including the fields). */ + + CTreeTypeValues(t) = fieldlist; + + c_layout_type(t); + + /* Delete all zero-width bit-fields from the front of the fieldlist */ + while (fieldlist + && CTreeDeclInitial(fieldlist)) + { + fieldlist = CTreeChain(fieldlist); + } + /* Delete all such members from the rest of the fieldlist */ + for (x = fieldlist; x;) + { + if (CTreeChain(x) && CTreeDeclInitial(CTreeChain(x))) + { + CTreeChain(x) = CTreeChain(CTreeChain(x)); + } + else + { + x = CTreeChain(x); + } + } + + /* Now we have the truly final field list. + Store it in this type and in the variants. */ + + CTreeTypeValues(t) = fieldlist; + + /* If there are lots of fields, sort so we can look through them fast. + We arbitrarily consider 16 or more elts to be "a lot". */ +# ifdef LUDO_NO_SKIP + { + int len = 0; + + for (x = fieldlist; x; x = CTreeChain(x)) + { + if (len > 15) break; + len += 1; + } + + if (len > 15) + { + tree *field_array; + char *space; + + len += c_tree_get_list_length (x); + /* Use the same allocation policy here that make_node uses, to + ensure that this lives as long as the rest of the struct decl. + All decls in an inline function need to be saved. */ + if (allocation_temporary_p ()) + space = savealloc (sizeof (struct lang_type) + len * sizeof (tree)); + else + space = oballoc (sizeof (struct lang_type) + len * sizeof (tree)); + + TYPE_LANG_SPECIFIC (t) = (struct lang_type *) space; + TYPE_LANG_SPECIFIC (t)->len = len; + + field_array = &TYPE_LANG_SPECIFIC (t)->elts[0]; + len = 0; + for (x = fieldlist; x; x = CTreeChain(x)) + field_array[len++] = x; + + qsort (field_array, len, sizeof (tree), field_decl_cmp); + } + } +# endif + + for (x = CTreeTypeMainVariant(t); x; x = CTreeTypeNextVariant(x)) + { + CTreeTypeValues(x) = CTreeTypeValues(t); +# ifdef LUDO_NO_SKIP + TYPE_LANG_SPECIFIC (x) = TYPE_LANG_SPECIFIC (t); + TYPE_ALIGN (x) = TYPE_ALIGN (t); +# endif + } + +# ifdef LUDO_NO_SKIP + /* If this was supposed to be a transparent union, but we can't + make it one, warn and turn off the flag. */ + if ( CTreeTypeCode(t) == C_UNION_TYPE + && TYPE_TRANSPARENT_UNION (t) + && CTreeTypeMode(t) != CTreeDeclMode( CTreeTypeValues(t))) + { + TYPE_TRANSPARENT_UNION (t) = 0; + warning ("union cannot be made transparent"); + } +# endif + + /* If this structure or union completes the type of any previous + variable declaration, lay it out and output its rtl. */ + + if (c_current_binding_level->N_INCOMPLETE != 0) + { + c_tree_node *decl; + + for (decl = c_current_binding_level->NAME_LIST; decl; decl = CTreeChain(decl)) + { + if ( ( CTreeType(decl) == t ) && + ( CTreeDeclCode(decl) != C_TYPE_DECL ) ) + { + c_layout_decl(decl, 0); + /* This is a no-op in c-lang.c or something real in objc-actions.c. */ +# ifdef LUDO_NO_SKIP + maybe_objc_check_decl (decl); + rest_of_decl_compilation (decl, NULL_PTR, toplevel, 0); + if (! toplevel) + { + expand_decl (decl); + } +# endif + --c_current_binding_level->N_INCOMPLETE; + } + else if (CTreeTypeSize(CTreeType(decl)) == 0 + && CTreeTypeCode(CTreeType(decl)) == C_ARRAY_TYPE) + { + c_tree_node *element = CTreeType(decl); + + while ( CTreeTypeCode(element) == C_ARRAY_TYPE) + { + element = CTreeType(element); + } + + if (element == t) + { + c_layout_array_type(CTreeType(decl)); + } + } + } + } + +# ifdef LUDO_NO_SKIP + resume_momentary (old_momentary); + + /* Finish debugging output for this type. */ + rest_of_type_compilation (t, toplevel); + + /* The matching push is in start_struct. */ + pop_obstacks (); +# endif + + return t; +} + +/* Get the struct, enum or union (CODE says which) with tag NAME. + Define the tag as a forward-reference if it is not defined. */ + +c_tree_node *c_xref_tag(code, name) + + int code; + c_tree_node *name; +{ +# ifdef LUDO_NO_SKIP + int temporary = allocation_temporary_p (); +# endif + + /* If a cross reference is requested, look up the type + already defined for this tag and return it. */ + + c_tree_node *ref = c_lookup_tag(code, name, c_current_binding_level, 0); + /* Even if this is the wrong type of tag, return what we found. + There will be an error message anyway, from pending_xref_error. + If we create an empty xref just for an invalid use of the type, + the main result is to create lots of superfluous error messages. */ + if (ref) + { + return ref; + } + +# ifdef LUDO_NO_SKIP + push_obstacks_nochange (); + + if (c_current_binding_level == c_global_binding_level && temporary) + { + end_temporary_allocation (); + } +# endif + + /* If no such tag is yet defined, create a forward-reference node + and record it as the "definition". + When a real declaration of this type is found, + the forward-reference will be altered into a real type. */ + + ref = c_tree_build_type(code); + + if (code == C_ENUMERAL_TYPE) + { + /* (In ANSI, Enums can be referred to only if already defined.) */ + if (c_pedantic) + { + pedwarn ("ANSI C forbids forward references to `enum' types"); + } + /* Give the type a default layout like unsigned int + to avoid crashing if it does not get defined. */ + CTreeTypeMode(ref) = CTreeTypeMode(c_unsigned_type_node); +# ifdef LUDO_NO_SKIP + TYPE_ALIGN (ref) = TYPE_ALIGN (c_unsigned_type_node); +# endif + CSetTreeNodeUnsigned( ref ); + CTreeTypePrecision(ref) = CTreeTypePrecision( c_unsigned_type_node); + CTreeTypeMinValue(ref) = CTreeTypeMinValue( c_unsigned_type_node); + CTreeTypeMaxValue(ref) = CTreeTypeMaxValue( c_unsigned_type_node); + } + + c_push_tag(name, ref); + +# ifdef LUDO_NO_SKIP + pop_obstacks (); +# endif + + return ref; +} + + +/* Given a type, find the tag that was defined for it and return the tag name. + Otherwise return 0. */ + +static c_tree_node *c_lookup_tag_reverse(type) + + c_tree_node *type; +{ + c_binding_level *level; + + for (level = c_current_binding_level; level; level = level->LEVEL_CHAIN) + { + c_tree_node *tail; + + for (tail = level->TAG_LIST; tail; tail = CTreeChain(tail)) + { + if ( CTreeListValue(tail) == type) + { + return CTreeListPurpose(tail); + } + } + } + + return NULL; +} + + +/* Called when a declaration is seen that contains no names to declare. + If its type is a reference to a structure, union or enum inherited + from a containing scope, shadow that tag name for the current scope + with a forward reference. + If its type defines a new named structure or union + or defines an enum, it is valid but we need not do anything here. + Otherwise, it is an error. */ + + + +void c_shadow_tag_warned(declspecs, warned) + + c_tree_node *declspecs; + int warned; + /* 1 => we have done a pedwarn. 2 => we have done a warning, but + no pedwarn. */ +{ + int found_tag = 0; + c_tree_node *link; + + c_pending_invalid_xref = NULL; + + for (link = declspecs; link; link = CTreeChain(link)) + { + c_tree_node *value = CTreeListValue(link); + int code = CTreeTypeCode(value); + + if (code == C_RECORD_TYPE || code == C_UNION_TYPE || code == C_ENUMERAL_TYPE) + /* Used to test also that CTreeTypeSize(value) != 0. + That caused warning for `struct foo;' at top level in the file. */ + { + c_tree_node *name = c_lookup_tag_reverse(value); + c_tree_node *t; + + found_tag++; + + if (name == 0) + { + if (warned != 1 && code != C_ENUMERAL_TYPE) + /* Empty unnamed enum OK */ + { + pedwarn ("unnamed struct/union that defines no instances"); + warned = 1; + } + } + else + { + t = c_lookup_tag(code, name, c_current_binding_level, 1); + + if (t == 0) + { + t = c_tree_build_type(code); + c_push_tag(name, t); + } + } + } + else + { + if (!warned && ! c_in_system_header) + { + warning ("useless keyword or type name in empty declaration"); + warned = 2; + } + } + } + + if (found_tag > 1) + { + error ("two types specified in one empty declaration"); + } + + if (warned != 1) + { + if (found_tag == 0) + { + pedwarn ("empty declaration"); + } + } +} + +void c_shadow_tag(declspecs) + + c_tree_node *declspecs; +{ + c_shadow_tag_warned(declspecs, 0); +} + +/* Make a label named NAME in the current function, + shadowing silently any that may be inherited from containing functions + or containing scopes. + + Note that valid use, if the label being shadowed + comes from another scope in the same function, + requires calling declare_nonlocal_label right away. */ + +c_tree_node *c_shadow_label(name) + + c_tree_node *name; +{ + c_tree_node *decl = CTreeIdentLabelValue(name); + + if (decl != 0) + { + c_tree_node *dup; + + /* Check to make sure that the label hasn't already been declared + at this label scope */ + for (dup = c_named_labels; dup; dup = CTreeChain(dup)) + { + if ( CTreeListValue(dup) == decl) + { + error ("duplicate label declaration `%s'", CTreeIdentPointer(name)); + error_with_decl (CTreeListValue(dup), "this is a previous declaration"); + /* Just use the previous declaration. */ + return c_lookup_label(name); + } + } + + c_shadowed_labels = c_tree_add_head_list( NULL, decl, c_shadowed_labels); + CTreeIdentLabelValue(name) = decl = NULL; + } + + return c_lookup_label(name); +} + + +/* Get the LABEL_DECL corresponding to identifier ID as a label. + Create one if none exists so far for the current function. + This function is called for both label definitions and label references. */ + +c_tree_node *c_lookup_label(id) + + c_tree_node *id; +{ + c_tree_node *decl = CTreeIdentLabelValue(id); + + if (c_current_function_decl == 0) + { + error ("label %s referenced outside of any function", CTreeIdentPointer(id)); + return 0; + } + + /* Use a label already defined or ref'd with this name. */ + if (decl != 0) + { + /* But not if it is inherited and wasn't declared to be inheritable. */ + if ( CTreeDeclContext(decl) != c_current_function_decl + && ! CIsTreeNodeCDeclLabel(decl)) + { + return c_shadow_label(id); + } + + return decl; + } + + decl = c_tree_build_decl( C_LABEL_DECL, id, c_void_type_node); + + /* Make sure every label has an rtx. */ +# ifdef LUDO_NO_SKIP + label_rtx (decl); +# endif + + /* A label not explicitly declared must be local to where it's ref'd. */ + CTreeDeclContext(decl) = c_current_function_decl; + +# ifdef LUDO_NO_SKIP + CTreeDeclMode(decl) = VOIDmode; +# endif + + /* Say where one reference is to the label, + for the sake of the error if it is not defined. */ + CTreeDeclLineNum(decl) = c_lineno; + CTreeDeclFileName(decl) = c_input_filename; + + CTreeIdentLabelValue(id) = decl; + + c_named_labels = c_tree_add_head_list( NULL, decl, c_named_labels); + + return decl; +} + +/* Define a label, specifying the location in the source file. + Return the LABEL_DECL node for the label, if the definition is valid. + Otherwise return 0. */ + +c_tree_node *c_define_label(filename, line, name) + + char *filename; + int line; + c_tree_node *name; +{ + c_tree_node *decl = c_lookup_label(name); + + /* If label with this name is known from an outer context, shadow it. */ + if (decl != 0 && CTreeDeclContext(decl) != c_current_function_decl) + { + c_shadowed_labels = c_tree_add_head_list( NULL, decl, c_shadowed_labels); + CTreeIdentLabelValue(name) = 0; + decl = c_lookup_label(name); + } + + if (CTreeDeclInitial(decl) != 0) + { + error ("duplicate label `%s'", CTreeIdentPointer(name)); + return 0; + } + else + { + /* Mark label as having been defined. */ + CTreeDeclInitial(decl) = c_error_mark_node; + /* Say where in the source. */ + CTreeDeclFileName(decl) = filename; + CTreeDeclLineNum(decl) = line; + + return decl; + } +} + +/* Begin compiling the definition of an enumeration type. + NAME is its name (or null if anonymous). + Returns the type object, as yet incomplete. + Also records info about it so that build_enumerator + may be used to declare the individual values as they are read. */ + +c_tree_node *c_start_enum(name) + + c_tree_node *name; +{ + c_tree_node *enumtype = 0; + + /* If this is the real definition for a previous forward reference, + fill in the contents in the same object that used to be the + forward reference. */ + + if (name != 0) + { + enumtype = c_lookup_tag( C_ENUMERAL_TYPE, name, c_current_binding_level, 1); + } + +# ifdef LUDO_NO_SKIP + /* The corresponding pop_obstacks is in finish_enum. */ + push_obstacks_nochange (); + /* If these symbols and types are global, make them permanent. */ + if (c_current_binding_level == c_global_binding_level) + { + end_temporary_allocation (); + } +# endif + + if (enumtype == 0 || CTreeTypeCode(enumtype) != C_ENUMERAL_TYPE) + { + enumtype = c_tree_build_type(C_ENUMERAL_TYPE); + c_push_tag(name, enumtype); + } + +# ifdef LUDO_NO_SKIP + C_TYPE_BEING_DEFINED (enumtype) = 1; +# endif + + if ( CTreeTypeValues(enumtype) != 0) + { + /* This enum is a named one that has been declared already. */ + error("redeclaration of `enum %s'", CTreeIdentPointer(name)); + + /* Completely replace its old definition. + The old enumerators remain defined, however. */ + CTreeTypeValues(enumtype) = 0; + } + + c_enum_next_value = c_integer_zero_node; + c_enum_overflow = 0; + +# ifdef LUDO_NO_SKIP + if (c_flag_short_enums) + { + TYPE_PACKED (enumtype) = 1; + } +# endif + + return enumtype; +} + +/* After processing and defining all the values of an enumeration type, + install their decls in the enumeration type and finish it off. + ENUMTYPE is the type object, VALUES a list of decl-value pairs, + and ATTRIBUTES are the specified attributes. + Returns ENUMTYPE. */ + +c_tree_node *c_finish_enum(enumtype, values, attributes) + c_tree_node *enumtype; + c_tree_node *values; + c_tree_node *attributes; +{ + c_tree_node *pair; + c_tree_node *tem; + c_tree_node *minnode = 0; + c_tree_node *maxnode = 0; + int lowprec, highprec, precision; +# ifdef LUDO_NO_SKIP + int toplevel = c_global_binding_level == c_current_binding_level; +# endif + + if (c_in_parm_level_p ()) + { + warning ("enum defined inside parms"); + } + + c_decl_attributes(enumtype, attributes, NULL); + + /* Calculate the maximum value of any enumerator in this type. */ + + if (values == c_error_mark_node) + { + minnode = maxnode = c_integer_zero_node; + } + else + { + for (pair = values; pair; pair = CTreeChain(pair)) + { + c_tree_node *value = CTreeListValue(pair); + + if (pair == values) + { + minnode = maxnode = CTreeListValue(pair); + } + else + { + if ( c_tree_is_int_cst_lt(maxnode, value)) + { + maxnode = value; + } + if ( c_tree_is_int_cst_lt(value, minnode)) + { + minnode = value; + } + } + } + } + + CTreeTypeMinValue(enumtype) = minnode; + CTreeTypeMaxValue(enumtype) = maxnode; + + /* An enum can have some negative values; then it is signed. */ + if ( c_tree_is_int_cst_sgn(minnode) >= 0 ) + { + CSetTreeNodeUnsigned(enumtype); + } + + /* Determine the precision this type needs. */ + + lowprec = c_min_precision(minnode, CIsTreeNodeUnsigned(enumtype)); + highprec = c_min_precision(maxnode, CIsTreeNodeUnsigned(enumtype)); + precision = MAX (lowprec, highprec); + + if ( +# ifdef LUDO_NO_SKIP + TYPE_PACKED (enumtype) || +# endif + precision > CTreeTypePrecision(c_integer_type_node)) + { + c_tree_node *narrowest = c_get_type_for_size(precision, 1); + if (narrowest == 0) + { + warning ("enumeration values exceed range of largest integer"); + narrowest = c_long_long_integer_type_node; + } + + CTreeTypePrecision(enumtype) = CTreeTypePrecision(narrowest); + } + else + { + CTreeTypePrecision(enumtype) = CTreeTypePrecision(c_integer_type_node); + } + + CTreeTypeSize(enumtype) = 0; + c_layout_type(enumtype); + + if (values != c_error_mark_node) + { + /* Change the type of the enumerators to be the enum type. + Formerly this was done only for enums that fit in an int, + but the comment said it was done only for enums wider than int. + It seems necessary to do this for wide enums, + and best not to change what's done for ordinary narrower ones. */ + for (pair = values; pair; pair = CTreeChain(pair)) + { + CTreeType( CTreeListPurpose(pair)) = enumtype; + CTreeDeclSize( CTreeListPurpose(pair)) = CTreeTypeSize(enumtype); + +# ifdef LUDO_NO_SKIP + if ( CTreeDeclCode( CTreeListPurpose(pair)) != C_FUNCTION_DECL) + { + DECL_ALIGN (TREE_PURPOSE (pair)) = TYPE_ALIGN (enumtype); + } +# endif + } + + /* Replace the decl nodes in VALUES with their names. */ + for (pair = values; pair; pair = CTreeChain(pair)) + { + CTreeListPurpose(pair) = CTreeDeclName( CTreeListPurpose(pair)); + } + + CTreeTypeValues(enumtype) = values; + } + + /* Fix up all variant types of this enum type. */ + for (tem = CTreeTypeMainVariant(enumtype); tem; tem = CTreeTypeNextVariant(tem)) + { + CTreeTypeValues(tem) = CTreeTypeValues(enumtype); + CTreeTypeMinValue(tem) = CTreeTypeMinValue(enumtype); + CTreeTypeMaxValue(tem) = CTreeTypeMaxValue(enumtype); + CTreeTypeSize(tem) = CTreeTypeSize(enumtype); + CTreeTypeMode(tem) = CTreeTypeMode(enumtype); + CTreeTypePrecision(tem) = CTreeTypePrecision(enumtype); + CTreeTypeAlign(tem) = CTreeTypeAlign(enumtype); + + if ( CIsTreeNodeUnsigned( enumtype ) ) + { + CSetTreeNodeUnsigned( tem ); + } + } + +# ifdef LUDO_NO_SKIP + /* Finish debugging output for this type. */ + rest_of_type_compilation (enumtype, toplevel); + + /* This matches a push in start_enum. */ + pop_obstacks (); +# endif + + return enumtype; +} + +/* Build and install a CONST_DECL for one value of the + current enumeration type (one that was begun with start_enum). + Return a tree-list containing the CONST_DECL and its value. + Assignment of sequential values by default is handled here. */ + +c_tree_node *c_build_enumerator(name, value) + c_tree_node *name; + c_tree_node *value; +{ + c_tree_node *decl; + c_tree_node *type; + + /* Validate and default VALUE. */ + + /* Remove no-op casts from the value. */ + if (value) + { + CStripNops(value); + } + + if (value != 0) + { + if ( CTreeNodeFirstCode(value) == C_INT_CST_NODE) + { + value = c_default_conversion(value); + c_constant_expression_warning(value); + } + else + { + error ("enumerator value for `%s' not integer constant", CTreeIdentPointer(name)); + value = 0; + } + } + + /* Default based on previous value. */ + /* It should no longer be possible to have NON_LVALUE_EXPR + in the default. */ + if (value == 0) + { + value = c_enum_next_value; + + if (c_enum_overflow) + { + error ("overflow in enumeration values"); + } + } + + if (c_pedantic && ! c_int_fits_type_p(value, c_integer_type_node)) + { + pedwarn ("ANSI C restricts enumerator values to range of `int'"); + value = c_integer_zero_node; + } + + /* Set basis for default for next value. */ + c_enum_next_value = c_build_binary_op(C_PLUS_EXPR, value, c_integer_one_node, 0); + c_enum_overflow = c_tree_is_int_cst_lt(c_enum_next_value, value); + + /* Now create a declaration for the enum value name. */ + + + type = CTreeType(value); + type = c_get_type_for_size( + MAX( CTreeTypePrecision(type), CTreeTypePrecision(c_integer_type_node)), + ((c_flag_traditional || + CTreeTypePrecision(type) >= CTreeTypePrecision(c_integer_type_node)) + && CIsTreeNodeUnsigned(type))); + + decl = c_tree_build_decl( C_CONST_DECL, name, type); + CTreeDeclInitial(decl) = value; + CTreeType(value) = type; + c_push_decl(decl); + + return c_tree_add_head_list(decl, value, NULL); +} + + +/* Create the FUNCTION_DECL for a function definition. + DECLSPECS, DECLARATOR, PREFIX_ATTRIBUTES and ATTRIBUTES are the parts of + the declaration; they describe the function's name and the type it returns, + but twisted together in a fashion that parallels the syntax of C. + + This function creates a binding context for the function body + as well as setting up the FUNCTION_DECL in current_function_decl. + + Returns 1 on success. If the DECLARATOR is not suitable for a function + (it defines a datum instead), we return 0, which tells + yyparse to report a parse error. + + NESTED is nonzero for a function nested within another function. */ + +int c_start_function( declspecs, declarator, prefix_attributes, attributes, nested ) + c_tree_node *declarator; + c_tree_node *declspecs; + c_tree_node *prefix_attributes; + c_tree_node *attributes; + int nested; +{ + c_tree_node *decl1; + c_tree_node *old_decl; + c_tree_node *restype; +# ifdef LUDO_NO_SKIP + int old_immediate_size_expand = immediate_size_expand; +# endif + + c_current_function_returns_value = 0; /* Assume, until we see it does. */ + c_current_function_returns_null = 0; + c_warn_about_return_type = 0; + c_current_extern_inline = 0; + c_c_function_varargs = 0; + c_named_labels = 0; + c_shadowed_labels = 0; + +# ifdef LUDO_NO_SKIP + /* Don't expand any sizes in the return type of the function. */ + immediate_size_expand = 0; +# endif + + decl1 = c_grokdeclarator(declarator, declspecs, C_CDECL_FUNCDEF, 1); + + /* If the declarator is not suitable for a function definition, + cause a syntax error. */ + if (decl1 == 0) + { +# ifdef LUDO_NO_SKIP + immediate_size_expand = old_immediate_size_expand; +# endif + return 0; + } + + c_decl_attributes(decl1, prefix_attributes, attributes); + +# ifdef LUDO_NO_SKIP + announce_function(decl1); +# endif + + if (CTreeTypeSize(CTreeType(CTreeType(decl1))) == 0) + { + error ("return-type is an incomplete type"); + /* Make it return void instead. */ + CTreeType(decl1) + = c_tree_build_function_type( c_void_type_node, + CTreeTypeValues(CTreeType(decl1))); + } + + if (c_warn_about_return_type) + { + warning("return-type defaults to `int'"); + } + + /* Save the parm names or decls from this function's declarator + where store_parm_decls will find them. */ + c_current_function_parms = c_last_function_parms; + c_current_function_parm_tags = c_last_function_parm_tags; + + /* Make the init_value nonzero so pushdecl knows this is not tentative. + error_mark_node is replaced below (in poplevel) with the BLOCK. */ + CTreeDeclInitial(decl1) = c_error_mark_node; + + /* If this definition isn't a prototype and we had a prototype declaration + before, copy the arg type info from that prototype. + But not if what we had before was a builtin function. */ + old_decl = c_lookup_name_current_level(CTreeDeclName(decl1)); + if (old_decl != 0 && CTreeTypeCode(CTreeType(old_decl)) == C_FUNCTION_TYPE + && ! CIsTreeDeclBuiltIn(old_decl) + && (CTreeTypeMainVariant(CTreeType(CTreeType(decl1))) + == CTreeTypeMainVariant(CTreeType(CTreeType(old_decl)))) + && CTreeTypeValues(CTreeType(decl1)) == 0) + { + CTreeType(decl1) = CTreeType(old_decl); + c_current_function_prototype_file = CTreeDeclFileName(old_decl); + c_current_function_prototype_line = CTreeDeclLineNum(old_decl); + } + + /* If there is no explicit declaration, look for any out-of-scope implicit + declarations. */ + if (old_decl == 0) + { + old_decl = CTreeIdentImplicitDecl(CTreeDeclName(decl1)); + } + + /* Optionally warn of old-fashioned def with no previous prototype. */ + if (c_warn_strict_prototypes + && CTreeTypeValues(CTreeType(decl1)) == 0 + && !(old_decl != 0 && CTreeTypeValues(CTreeType(old_decl)) != 0)) + { + warning ("function declaration isn't a prototype"); + } + /* Optionally warn of any global def with no previous prototype. */ + else if (c_warn_missing_prototypes + && CIsTreeNodePublic(decl1) + && !(old_decl != 0 && CTreeTypeValues(CTreeType(old_decl)) != 0) + && strcmp("main", CTreeIdentPointer(CTreeDeclName(decl1)))) + { + warning_with_decl(decl1, "no previous prototype for `%s'"); + } + /* Optionally warn of any def with no previous prototype + if the function has already been used. */ + else if (c_warn_missing_prototypes + && old_decl != 0 + && CIsTreeNodeUsed(old_decl) + && CTreeTypeValues(CTreeType(old_decl)) == 0) + { + warning_with_decl(decl1, "`%s' was used with no prototype before its definition"); + } + /* Optionally warn of any global def with no previous declaration. */ + else if (c_warn_missing_declarations + && CIsTreeNodePublic(decl1) + && old_decl == 0 + && strcmp ("main", CTreeIdentPointer(CTreeDeclName(decl1)))) + { + warning_with_decl(decl1, "no previous declaration for `%s'"); + } + /* Optionally warn of any def with no previous declaration + if the function has already been used. */ + else if (c_warn_missing_declarations + && old_decl != 0 + && CIsTreeNodeUsed(old_decl) + && old_decl == CTreeIdentImplicitDecl(CTreeDeclName(decl1)) + ) + { + warning_with_decl(decl1, "`%s' was used with no declaration before its definition"); + } + + /* This is a definition, not a reference. + So normally clear DECL_EXTERNAL. + However, `extern inline' acts like a declaration + except for defining how to inline. So set DECL_EXTERNAL in that case. */ + if ( c_current_extern_inline ) + { + CSetTreeDeclExternal(decl1); + } + + /* This function exists in static storage. + (This does not mean `static' in the C sense!) */ + CSetTreeNodeStatic(decl1); + + /* A nested function is not global. */ + if (c_current_function_decl != 0) + { + CClearTreeNodePublic(decl1); + } + + /* Warn for unlikely, improbable, or stupid declarations of `main'. */ + if (c_warn_main + && strcmp ("main", CTreeIdentPointer(CTreeDeclName(decl1))) == 0) + { + c_tree_node *args; + int argct = 0; + + if (CTreeTypeMainVariant(CTreeType(CTreeType(decl1))) + != c_integer_type_node) + { + pedwarn_with_decl(decl1, "return type of `%s' is not `int'"); + } + + for ( args = CTreeTypeValues(CTreeType(decl1)); args; + args = CTreeChain(args)) + { + c_tree_node *type = args ? CTreeListValue(args) : 0; + + if (type == c_void_type_node) break; + + ++argct; + switch (argct) + { + case 1: + if (CTreeTypeMainVariant(type) != c_integer_type_node) + { + pedwarn_with_decl(decl1, "first argument of `%s' should be `int'"); + } + break; + + case 2: + if ( CTreeTypeCode(type) != C_POINTER_TYPE + || CTreeTypeCode(CTreeType(type)) != C_POINTER_TYPE + || (CTreeTypeMainVariant(CTreeType(CTreeType(type))) + != c_char_type_node)) + { + pedwarn_with_decl(decl1, "second argument of `%s' should be `char **'"); + } + break; + + case 3: + if ( CTreeTypeCode(type) != C_POINTER_TYPE + || CTreeTypeCode(CTreeType(type)) != C_POINTER_TYPE + || (CTreeTypeMainVariant(CTreeType(CTreeType(type))) + != c_char_type_node)) + { + pedwarn_with_decl(decl1, "third argument of `%s' should probably be `char **'"); + } + break; + } + } + + /* It is intentional that this message does not mention the third + argument, which is warned for only pedantically, because it's + blessed by mention in an appendix of the standard. */ + + if (argct > 0 && (argct < 2 || argct > 3)) + { + pedwarn_with_decl(decl1, "`%s' takes only zero or two arguments"); + } + + if (argct == 3 && c_pedantic) + { + pedwarn_with_decl(decl1, "third argument of `%s' is deprecated"); + } + + if (! CIsTreeNodePublic(decl1)) + { + pedwarn_with_decl (decl1, "`%s' is normally a non-static function"); + } + } + + /* Record the decl so that the function name is defined. + If we already have a decl for this name, and it is a FUNCTION_DECL, + use the old decl. */ + + c_current_function_decl = c_push_decl(decl1); + + c_push_level(0); + c_declare_parm_level(1); + c_current_binding_level->SUBBLOCKS_TAG_TRANSPARENT = 1; + +# ifdef LUDO_NO_SKIP + make_function_rtl(current_function_decl); +# endif + + restype = CTreeType(CTreeType(c_current_function_decl)); + /* Promote the value to int before returning it. */ + + if (C_PROMOTING_INTEGER_TYPE_P(restype)) + { + /* It retains unsignedness if traditional + or if not really getting wider. */ + if ( CIsTreeNodeUnsigned(restype) + && (c_flag_traditional + || (CTreeTypePrecision(restype) + == CTreeTypePrecision(c_integer_type_node)))) + restype = c_unsigned_type_node; + else + restype = c_integer_type_node; + } + + CTreeDeclResult(c_current_function_decl) = + c_tree_build_decl( C_RESULT_DECL, NULL, restype); + +# ifdef LUDO_NO_SKIP + if (!nested) + { + /* Allocate further c_tree_node *nodes temporarily during compilation + of this function only. */ + temporary_allocation (); + } + + /* If this fcn was already referenced via a block-scope `extern' decl + (or an implicit decl), propagate certain information about the usage. */ + if (TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (current_function_decl))) + TREE_ADDRESSABLE (current_function_decl) = 1; + + immediate_size_expand = old_immediate_size_expand; +# endif + + return 1; +} + +/* Finish up a function declaration and compile that function + all the way to assembler language output. The free the storage + for the function definition. + + This is called after parsing the body of the function definition. + + NESTED is nonzero if the function being finished is nested in another. */ + +c_tree_node *c_finish_function(nested, body) + int nested; + c_tree_node *body; +{ + c_tree_node *fndecl = c_current_function_decl; + +/* TREE_READONLY (fndecl) = 1; + This caused &foo to be of type ptr-to-const-function + which then got a warning when stored in a ptr-to-function variable. */ + + c_pop_level(1, 0, 1); + + if ( CTreeBlockBody( CTreeDeclInitial( fndecl ) ) == (c_tree_node *)0 ) + { + CTreeBlockBody( CTreeDeclInitial( fndecl ) ) = body; + } + + CTreeBlockSuperContext(CTreeDeclInitial(fndecl)) = fndecl; + + /* Must mark the RESULT_DECL as being in this function. */ + + CTreeDeclContext( CTreeDeclResult(fndecl)) = fndecl; + + /* Obey `register' declarations if `setjmp' is called in this fn. */ +# ifdef LUDO_NO_SKIP + if (c_flag_traditional && c_current_function_calls_setjmp) + { + setjmp_protect (CTreeDeclInitial(fndecl)); + setjmp_protect_args (); + } +# endif + + if (! strcmp( CTreeIdentPointer(CTreeDeclName(fndecl)), "main")) + { + if (CTreeTypeMainVariant(CTreeType(CTreeType(fndecl))) != c_integer_type_node) + { + /* You would expect the sense of this test to be the other way + around, but if warn_main is set, we will already have warned, + so this would be a duplicate. This is the warning you get + in some environments even if you *don't* ask for it, because + these are environments where it may be more of a problem than + usual. */ + if (! c_warn_main) + { + pedwarn_with_decl( fndecl, "return type of `%s' is not `int'"); + } + } + else + { +#ifdef DEFAULT_MAIN_RETURN + /* Make it so that `main' always returns success by default. */ + DEFAULT_MAIN_RETURN; +#endif + } + } + +# ifdef LUDO_NO_SKIP + /* Generate rtl for function exit. */ + expand_function_end (input_filename, lineno, 0); +# endif + + /* So we can tell if jump_optimize sets it to 1. */ + c_can_reach_end = 0; + +# ifdef LUDO_NO_SKIP + /* Run the optimizers and output the assembler code for this function. */ + rest_of_compilation (fndecl); +# endif + + c_current_function_returns_null |= c_can_reach_end; + + if ( CIsTreeNodeVolatile(fndecl) && c_current_function_returns_null) + { + warning ("`noreturn' function does return"); + } + else if (c_warn_return_type && c_can_reach_end + && CTreeTypeMainVariant(CTreeType(CTreeType(fndecl))) != c_void_type_node) + /* If this function returns non-void and control can drop through, + complain. */ + { + warning ("control reaches end of non-void function"); + } + /* With just -W, complain only if function returns both with + and without a value. */ + else if (c_extra_warnings + && c_current_function_returns_value && c_current_function_returns_null) + { + warning ("this function may return with or without a value"); + } + + /* If requested, warn about function definitions where the function will + return a value (usually of some struct or union type) which itself will + take up a lot of stack space. */ + + if (c_warn_larger_than && ! CIsTreeDeclExternal(fndecl) && CTreeType(fndecl)) + { + c_tree_node *ret_type = CTreeType(CTreeType(fndecl)); + + if (ret_type) + { + c_tree_node *ret_type_size = CTreeTypeSize(ret_type); + + if (CTreeNodeFirstCode(ret_type_size) == C_INT_CST_NODE) + { + unsigned units = CTreeIntCstLow(ret_type_size) / C_BITS_PER_UNIT; + + if (units > c_larger_than_size) + { + warning_with_decl(fndecl, "size of return value of `%s' is %u bytes", units); + } + } + } + } + + /* Free all the c_tree_node *nodes making up this function. */ + /* Switch back to allocating nodes permanently + until we start another function. */ +# ifdef LUDO_NO_SKIP + if (! nested) + { + permanent_allocation (1); + } + + if (DECL_SAVED_INSNS(fndecl) == 0 && ! nested) + { + /* Stop pointing to the local nodes about to be freed. */ + /* But CTreeDeclInitialmust remain nonzero so we know this + was an actual function definition. */ + /* For a nested function, this is done in pop_c_function_context. */ + /* If rest_of_compilation set this to 0, leave it 0. */ + if (CTreeDeclInitial(fndecl) != 0) + CTreeDeclInitial(fndecl) = error_mark_node; + DECL_ARGUMENTS (fndecl) = 0; + } +# endif + +# ifdef LUDO_NO_SKIP + if (DECL_STATIC_CONSTRUCTOR (fndecl)) + { +#ifndef ASM_OUTPUT_CONSTRUCTOR + if (! flag_gnu_linker) + static_ctors = perm_tree_cons (NULL_TREE, fndecl, static_ctors); + else +#endif + assemble_constructor (IDENTIFIER_POINTER (CTreeDeclName(fndecl))); + } + if (DECL_STATIC_DESTRUCTOR (fndecl)) + { +#ifndef ASM_OUTPUT_DESTRUCTOR + if (! flag_gnu_linker) + static_dtors = perm_tree_cons (NULL_TREE, fndecl, static_dtors); + else +#endif + assemble_destructor (IDENTIFIER_POINTER (CTreeDeclName(fndecl))); + } +# endif + + /* + loc_c_tree_view_node( c_current_function_decl ); + */ + + if (! nested) + { + /* Let the error reporting routines know that we're outside a + function. For a nested function, this value is used in + pop_c_function_context and then reset via pop_function_context. */ + c_current_function_decl = NULL; + } + + return( fndecl ); +} + +/* Store the list of declarations of the current level. + This is done for the parameter declarations of a function being defined, + after they are modified in the light of any missing parameters. */ + +static void c_store_decls(decls) + + c_tree_node *decls; +{ + c_current_binding_level->NAME_LIST = decls; +} + +/* Similarly, store the list of tags of the current level. */ + +static void c_store_tags(tags) + + c_tree_node *tags; +{ + c_current_binding_level->TAG_LIST = tags; +} + + +/* Return the list of type-tags (for structs, etc) of the current level. */ + +c_tree_node *c_get_tags() +{ + return c_current_binding_level->TAG_LIST; +} + +/* Return the list of declarations of the current level. + Note that this list is in reverse order unless/until + you nreverse it; and when you do nreverse it, you must + store the result back using `storedecls' or you will lose. */ + +c_tree_node *c_get_decls() +{ + return c_current_binding_level->NAME_LIST; +} + +/* Return a tree_list node with info on a parameter list just parsed. + The TREE_PURPOSE is a chain of decls of those parms. + The TREE_VALUE is a list of structure, union and enum tags defined. + The CTreeChainis a list of argument types to go in the FUNCTION_TYPE. + This tree_list node is later fed to `grokparms'. + + VOID_AT_END nonzero means append `void' to the end of the type-list. + Zero means the parmlist ended with an ellipsis so don't append `void'. */ + +c_tree_node *c_get_parm_info(void_at_end) + int void_at_end; +{ + c_tree_node *decl; + c_tree_node *result; + c_tree_node *t; + c_tree_node *types = 0; + int erred = 0; + c_tree_node *tags = c_get_tags(); + c_tree_node *parms = c_get_decls(); + c_tree_node *new_parms = 0; + c_tree_node *order = c_current_binding_level->PARAM_LIST; + + + /* Just `void' (and no ellipsis) is special. There are really no parms. */ + if (void_at_end && parms != 0 + && CTreeChain(parms) == 0 + && CTreeTypeMainVariant(CTreeType(parms)) == c_void_type_node + && CTreeDeclName(parms) == 0) + { + parms = NULL; + c_store_decls(NULL); + return c_tree_add_head_list( NULL, NULL, + c_tree_add_head_list(NULL, c_void_type_node, NULL)); + } + + /* Extract enumerator values and other non-parms declared with the parms. + Likewise any forward parm decls that didn't have real parm decls. */ + for (decl = parms; decl; ) + { + c_tree_node *next = CTreeChain(decl); + + if ( CTreeDeclCode(decl) != C_PARAM_DECL) + { + CTreeChain(decl) = new_parms; + new_parms = decl; + } + else if ( CIsTreeNodeAsmWritten(decl)) + { + error_with_decl (decl, "parameter `%s' has just a forward declaration"); + CTreeChain(decl) = new_parms; + new_parms = decl; + } + + decl = next; + } + + /* Put the parm decls back in the order they were in in the parm list. */ + for (t = order; t; t = CTreeChain(t)) + { + if (CTreeChain(t)) + { + CTreeChain( CTreeListValue(t)) = CTreeListValue(CTreeChain(t)); + } + else + { + CTreeChain( CTreeListValue(t)) = 0; + } + } + + new_parms = c_tree_concat_list(order ? + c_tree_reverse_list(CTreeListValue(order)) : 0, new_parms); + + /* Store the parmlist in the binding level since the old one + is no longer a valid list. (We have changed the chain pointers.) */ + c_store_decls(new_parms); + + for (decl = new_parms; decl; decl = CTreeChain(decl)) + /* There may also be declarations for enumerators if an enumeration + type is declared among the parms. Ignore them here. */ + { + if ( CTreeDeclCode(decl) == C_PARAM_DECL) + { + /* Since there is a prototype, args are passed in their declared types. */ + c_tree_node *type = CTreeType(decl); + CTreeDeclInitial(decl) = type; + +#ifdef PROMOTE_PROTOTYPES + if ((TREE_CODE (type) == INTEGER_TYPE + || TREE_CODE (type) == ENUMERAL_TYPE) + && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)) + { + CTreeDeclInitial(decl) = c_integer_type_node; + } +#endif + + types = c_tree_add_head_list( NULL, CTreeType(decl), types); + + if (CTreeTypeMainVariant( CTreeListValue(types)) == c_void_type_node && + ! erred && CTreeDeclName(decl) == 0) + { + error ("`void' in parameter list must be the entire list"); + erred = 1; + } + } + } + + if (void_at_end) + { + result = c_tree_add_head_list( new_parms, tags, + c_tree_reverse_list( c_tree_add_head_list( NULL, c_void_type_node, types))); + } + else + { + result = c_tree_add_head_list(new_parms, tags, c_tree_reverse_list( types)); + } + + return( result ); +} + +/* Store the parameter declarations into the current function declaration. + This is called after parsing the parameter declarations, before + digesting the body of the function. + + For an old-style definition, modify the function's type + to specify at least the number of arguments. */ + +void c_store_parm_decls() +{ + c_tree_node *fndecl = c_current_function_decl; + c_tree_node *parm; + + /* This is either a chain of PARM_DECLs (if a prototype was used) + or a list of IDENTIFIER_NODEs (for an old-fashioned C definition). */ + c_tree_node *specparms = c_current_function_parms; + + /* This is a list of types declared among parms in a prototype. */ + c_tree_node *parmtags = c_current_function_parm_tags; + + /* This is a chain of PARM_DECLs from old-style parm declarations. */ + c_tree_node *parmdecls = c_get_decls(); + + /* This is a chain of any other decls that came in among the parm + declarations. If a parm is declared with enum {foo, bar} x; + then CONST_DECLs for foo and bar are put here. */ + c_tree_node *nonparms = 0; + + /* Nonzero if this definition is written with a prototype. */ + int prototype = 0; + + if (specparms != 0 && CTreeNodeFirstCode(specparms) != C_LIST_NODE) + { + /* This case is when the function was defined with an ANSI prototype. + The parms already have decls, so we need not do anything here + except record them as in effect + and complain if any redundant old-style parm decls were written. */ + + c_tree_node *next; + c_tree_node *others = 0; + + prototype = 1; + + if (parmdecls != 0) + { + c_tree_node *decl; + c_tree_node *link; + + error_with_decl (fndecl, "parm types given both in parmlist and separately"); + /* Get rid of the erroneous decls; don't keep them on + the list of parms, since they might not be PARM_DECLs. */ + for (decl = c_current_binding_level->NAME_LIST; decl; decl = CTreeChain(decl)) + { + if (CTreeDeclName(decl)) + { + CTreeIdentLocalValue(CTreeDeclName(decl)) = 0; + } + } + + for (link = c_current_binding_level->SHADOWED_LIST; + link; link = CTreeChain(link)) + { + CTreeIdentLocalValue( CTreeListPurpose(link)) = CTreeListValue(link); + } + + c_current_binding_level->NAME_LIST = 0; + c_current_binding_level->SHADOWED_LIST = 0; + } + + specparms = c_tree_reverse_list(specparms); + + for (parm = specparms; parm; parm = next) + { + next = CTreeChain(parm); + + if ( CTreeDeclCode(parm) == C_PARAM_DECL) + { + if (CTreeDeclName(parm) == 0) + { + error_with_decl (parm, "parameter name omitted"); + } + else if (CTreeTypeMainVariant(CTreeType(parm)) == c_void_type_node) + { + error_with_decl (parm, "parameter `%s' declared void"); + /* Change the type to error_mark_node so this parameter + will be ignored by assign_parms. */ + CTreeType(parm) = c_error_mark_node; + } + + c_push_decl(parm); + } + else + { + /* If we find an enum constant or a type tag, + put it aside for the moment. */ + CTreeChain(parm) = 0; + others = c_tree_concat_list(others, parm); + } + } + + /* Get the decls in their original chain order + and record in the function. */ + CTreeDeclArguments(fndecl) = c_get_decls(); + + /* Now pushdecl the enum constants. */ + for (parm = others; parm; parm = next) + { + next = CTreeChain(parm); + if (CTreeDeclName(parm) == 0) ; + else if (CTreeTypeMainVariant(CTreeType(parm)) == c_void_type_node) ; + else if ( CTreeDeclCode(parm) != C_PARAM_DECL) + { + c_push_decl(parm); + } + } + + c_store_tags( c_tree_concat_list( parmtags, c_get_tags())); + } + else + { + /* SPECPARMS is an identifier list--a chain of TREE_LIST nodes + each with a parm name as the TREE_VALUE. + + PARMDECLS is a chain of declarations for parameters. + Warning! It can also contain CONST_DECLs which are not parameters + but are names of enumerators of any enum types + declared among the parameters. + + First match each formal parameter name with its declaration. + Associate decls with the names and store the decls + into the TREE_PURPOSE slots. */ + + for (parm = parmdecls; parm; parm = CTreeChain(parm)) + { + CTreeDeclResult(parm) = 0; + } + + for (parm = specparms; parm; parm = CTreeChain(parm)) + { + c_tree_node *tail = NULL; + c_tree_node *found = NULL; + + if (CTreeListValue(parm) == 0) + { + error_with_decl (fndecl, "parameter name missing from parameter list"); + CTreeListPurpose(parm) = 0; + continue; + } + + /* See if any of the parmdecls specifies this parm by name. + Ignore any enumerator decls. */ + for (tail = parmdecls; tail; tail = CTreeChain(tail)) + { + if (CTreeDeclName(tail) == CTreeListValue(parm) && + CTreeDeclCode(tail) == C_PARAM_DECL) + { + found = tail; break; + } + } + + /* If declaration already marked, we have a duplicate name. + Complain, and don't use this decl twice. */ + if (found && CTreeDeclResult(found) != 0) + { + error_with_decl (found, "multiple parameters named `%s'"); + found = 0; + } + + /* If the declaration says "void", complain and ignore it. */ + if (found && CTreeTypeMainVariant(CTreeType(found)) == c_void_type_node) + { + error_with_decl (found, "parameter `%s' declared void"); + CTreeType(found) = c_integer_type_node; + CTreeDeclInitial(found) = c_integer_type_node; + c_layout_decl(found, 0); + } + + /* Traditionally, a parm declared float is actually a double. */ + if (found && c_flag_traditional + && CTreeTypeMainVariant(CTreeType(found)) == c_float_type_node) + { + CTreeType(found) = c_double_type_node; + CTreeDeclInitial(found) = c_double_type_node; + c_layout_decl(found, 0); + } + + /* If no declaration found, default to int. */ + if (!found) + { + found = c_tree_build_decl( C_PARAM_DECL, + CTreeListValue(parm), c_integer_type_node); + CTreeDeclInitial(found) = CTreeType(found); + CTreeDeclLineNum(found) = CTreeDeclLineNum(fndecl); + CTreeDeclFileName(found) = CTreeDeclFileName(fndecl); + + if (c_extra_warnings) + { + warning_with_decl (found, "type of `%s' defaults to `int'"); + } + c_push_decl(found); + } + + CTreeListPurpose(parm) = found; + + /* Mark this decl as "already found" -- see test, above. + It is safe to use DECL_RESULT for this + since it is not used in PARM_DECLs or CONST_DECLs. */ + CTreeDeclResult(found) = c_error_mark_node; + } + + /* Put anything which is on the parmdecls chain and which is + not a PARM_DECL onto the list NONPARMS. (The types of + non-parm things which might appear on the list include + enumerators and NULL-named TYPE_DECL nodes.) Complain about + any actual PARM_DECLs not matched with any names. */ + + nonparms = 0; + for (parm = parmdecls; parm; ) + { + c_tree_node *next = CTreeChain(parm); + CTreeChain(parm) = 0; + + if ( CTreeDeclCode(parm) != C_PARAM_DECL ) + { + nonparms = c_tree_concat_list(nonparms, parm); + } + else + { + /* Complain about args with incomplete types. */ + if (CTreeTypeSize(CTreeType(parm)) == 0) + { + error_with_decl(parm, "parameter `%s' has incomplete type"); + CTreeType(parm) = c_error_mark_node; + } + + if ( CTreeDeclResult(parm) == 0) + { + error_with_decl(parm, "declaration for parameter `%s' but no such parameter"); + /* Pretend the parameter was not missing. + This gets us to a standard state and minimizes + further error messages. */ + specparms = c_tree_concat_list(specparms, + c_tree_add_head_list(parm, NULL_TREE, NULL_TREE)); + } + } + + parm = next; + } + + /* Chain the declarations together in the order of the list of names. */ + /* Store that chain in the function decl, replacing the list of names. */ + parm = specparms; + CTreeDeclArguments(fndecl) = 0; + + { + c_tree_node *last; + + for (last = 0; parm; parm = CTreeChain(parm)) + { + if ( CTreeListPurpose(parm)) + { + if (last == 0) + { + CTreeDeclArguments(fndecl) = CTreeListPurpose(parm); + } + else + { + CTreeChain(last) = CTreeListPurpose(parm); + } + + last = CTreeListPurpose(parm); + CTreeChain(last) = 0; + } + } + } + + /* If there was a previous prototype, + set the DECL_ARG_TYPE of each argument according to + the type previously specified, and report any mismatches. */ + + if ( CTreeTypeValues(CTreeType(fndecl))) + { + c_tree_node *type; + + for (parm = CTreeDeclArguments(fndecl), + type = CTreeTypeValues(CTreeType(fndecl)); + parm || + (type && (CTreeTypeMainVariant( CTreeListValue(type)) != c_void_type_node)); + parm = CTreeChain(parm), type = CTreeChain(type)) + { + if (parm == 0 || + type == 0 || + CTreeTypeMainVariant( CTreeListValue(type)) == c_void_type_node) + { + error ("number of arguments doesn't match prototype"); + error_with_file_and_line (c_current_function_prototype_file, + c_current_function_prototype_line, + "prototype declaration"); + break; + } + /* Type for passing arg must be consistent + with that declared for the arg. */ + if (! c_is_comptypes( CTreeTypeValues(parm), CTreeListValue(type))) + { + if (CTreeTypeMainVariant(CTreeType(parm)) == + CTreeTypeMainVariant(CTreeListValue(type))) + { + /* Adjust argument to match prototype. E.g. a previous + `int foo(float);' prototype causes + `int foo(x) float x; {...}' to be treated like + `int foo(float x) {...}'. This is particularly + useful for argument types like uid_t. */ + CTreeTypeValues(parm) = CTreeType(parm); +#ifdef PROMOTE_PROTOTYPES + if ((TREE_CODE (CTreeType(parm)) == INTEGER_TYPE + || TREE_CODE (CTreeType(parm)) == ENUMERAL_TYPE) + && TYPE_PRECISION (CTreeType(parm)) + < TYPE_PRECISION (integer_type_node)) + DECL_ARG_TYPE (parm) = integer_type_node; +#endif + if (c_pedantic) + { + pedwarn("promoted argument `%s' doesn't match prototype", + CTreeIdentPointer(CTreeDeclName(parm))); + warning_with_file_and_line( + c_current_function_prototype_file, + c_current_function_prototype_line, "prototype declaration"); + } + } + /* If -traditional, allow `int' argument to match + `unsigned' prototype. */ + else + if (! (c_flag_traditional + && CTreeTypeMainVariant(CTreeType(parm)) == + c_integer_type_node + && CTreeTypeMainVariant(CTreeListValue(type)) == + c_unsigned_type_node)) + { + error ("argument `%s' doesn't match prototype", + CTreeIdentPointer(CTreeDeclName(parm))); + error_with_file_and_line( c_current_function_prototype_file, + c_current_function_prototype_line, + "prototype declaration"); + } + } + } + + CTreeTypeNonCopiedParts(CTreeType(fndecl)) = 0; + } + + /* Otherwise, create a prototype that would match. */ + + else + { + c_tree_node *actual = 0; + c_tree_node *last = 0; + c_tree_node *type; + + for (parm = CTreeDeclArguments(fndecl); parm; parm = CTreeChain(parm)) + { + type = c_tree_add_head_list( NULL, CTreeDeclInitial(parm), NULL); + + if (last) + { + CTreeChain(last) = type; + } + else + { + actual = type; + } + last = type; + } + + type = c_tree_add_head_list(NULL, c_void_type_node, NULL); + + if (last) + { + CTreeChain(last) = type; + } + else + { + actual = type; + } + + /* We are going to assign a new value for the TYPE_ACTUAL_ARG_TYPES + of the type of this function, but we need to avoid having this + affect the types of other similarly-typed functions, so we must + first force the generation of an identical (but separate) type + node for the relevant function type. The new node we create + will be a variant of the main variant of the original function + type. */ + + CTreeType(fndecl) = c_tree_build_type_copy(CTreeType(fndecl)); + CTreeTypeNonCopiedParts(CTreeType(fndecl)) = actual; + } + + /* Now store the final chain of decls for the arguments + as the decl-chain of the current lexical scope. + Put the enumerators in as well, at the front so that + DECL_ARGUMENTS is not modified. */ + + c_store_decls( c_tree_concat_list(nonparms, CTreeDeclArguments(fndecl))); + } + + /* Make sure the binding level for the top of the function body + gets a BLOCK if there are any in the function. + Otherwise, the dbx output is wrong. */ + + c_keep_next_if_subblocks = 1; + + /* Write a record describing this function definition to the prototypes + file (if requested). */ + +# ifdef LUDO_NO_SKIP + gen_aux_info_record (fndecl, 1, 0, prototype); + + /* Initialize the RTL code for the function. */ + + init_function_start(fndecl, input_filename, lineno); +# endif + + /* If this is a varargs function, inform function.c. */ + + if (c_c_function_varargs) + { + c_mark_varargs (); + } + +# ifdef LUDO_NO_SKIP + /* Declare __FUNCTION__ and __PRETTY_FUNCTION__ for this function. */ + + declare_function_name(); + + /* Set up parameters and prepare for return, for the function. */ + + expand_function_start(fndecl, 0); + + /* If this function is `main', emit a call to `__main' + to run global initializers, etc. */ + if (CTreeDeclName(fndecl) + && strcmp (IDENTIFIER_POINTER (CTreeDeclName(fndecl)), "main") == 0 + && DECL_CONTEXT (fndecl) == NULL_TREE) + { + expand_main_function (); + } +# endif +} + +/* Make TYPE a complete type based on INITIAL_VALUE. + Return 0 if successful, 1 if INITIAL_VALUE can't be deciphered, + 2 if there was no information (in which case assume 1 if DO_DEFAULT). */ + +int c_complete_array_type(type, initial_value, do_default) + + c_tree_node *type; + c_tree_node *initial_value; + int do_default; +{ + c_tree_node *maxindex = NULL; + int value = 0; + + if (initial_value) + { + /* Note MAXINDEX is really the maximum index, + one less than the size. */ + if ( CTreeNodeFirstCode(initial_value) == C_STRING_NODE) + { + int eltsize + = c_get_int_size_in_bytes(CTreeType(CTreeType(initial_value))); + maxindex = c_tree_build_int_2(( CTreeStringLength(initial_value) + / eltsize) - 1, 0); + } + else if ( ( CTreeNodeFirstCode(initial_value) == C_EXPR_NODE ) && + ( CTreeExprCode(initial_value) == C_CONSTRUCTOR_EXPR) ) + { + c_tree_node *elts = CTreeExprOperand(initial_value,1); + maxindex = c_build_size_binop( C_MINUS_EXPR, + c_integer_zero_node, c_size_one_node ); + + for (; elts; elts = CTreeChain(elts)) + { + if ( CTreeListPurpose(elts)) + { + maxindex = CTreeListPurpose(elts); + } + else + { + maxindex = c_build_size_binop( C_PLUS_EXPR, maxindex, c_size_one_node ); + } + } + maxindex = c_tree_copy_node(maxindex); + } + else + { + /* Make an error message unless that happened already. */ + if (initial_value != c_error_mark_node) + { + value = 1; + } + + /* Prevent further error messages. */ + maxindex = c_tree_build_int_2(0, 0); + } + } + + if (!maxindex) + { + if (do_default) + { + maxindex = c_tree_build_int_2(0, 0); + } + value = 2; + } + + if (maxindex) + { + CTreeTypeValues(type) = c_tree_build_index_type(maxindex); + + if (!CTreeType(maxindex)) + { + CTreeType(maxindex) = CTreeTypeValues(type); + } + } + + /* Lay out the type now that we can get the real answer. */ + + c_layout_type(type); + + return value; +} + + +/* Generate an implicit declaration for identifier FUNCTIONID + as a function of type int (). Print a warning if appropriate. */ + +c_tree_node *c_implicitly_declare(functionid) + c_tree_node *functionid; +{ + c_tree_node *decl; + int traditional_warning = 0; + /* Only one "implicit declaration" warning per identifier. */ + int implicit_warning; + + /* Save the decl permanently so we can warn if definition follows. */ +# ifdef LUDO_NO_SKIP + push_obstacks_nochange (); + end_temporary_allocation (); +# endif + + /* We used to reuse an old implicit decl here, + but this loses with inline functions because it can clobber + the saved decl chains. */ +/* if (IDENTIFIER_IMPLICIT_DECL (functionid) != 0) + decl = IDENTIFIER_IMPLICIT_DECL (functionid); + else */ + decl = c_tree_build_decl(C_FUNCTION_DECL, functionid, c_default_function_type); + + /* Warn of implicit decl following explicit local extern decl. + This is probably a program designed for traditional C. */ + if ( CIsTreeNodePublic(functionid) && + CTreeIdentGlobalValue(functionid) == 0) + { + traditional_warning = 1; + } + + /* Warn once of an implicit declaration. */ + implicit_warning = ( CTreeIdentImplicitDecl(functionid) == 0); + + CSetTreeDeclExternal(decl); + CSetTreeNodePublic(decl); + + /* Record that we have an implicit decl and this is it. */ + CTreeIdentImplicitDecl(functionid) = decl; + + /* ANSI standard says implicit declarations are in the innermost block. + So we record the decl in the standard fashion. + If flag_traditional is set, pushdecl does it top-level. */ + c_push_decl(decl); + +# ifdef LUDO_NO_SKIP + /* This is a no-op in c-lang.c or something real in objc-actions.c. */ + maybe_objc_check_decl (decl); + + rest_of_decl_compilation (decl, NULL_PTR, 0, 0); +# endif + + if (c_mesg_implicit_function_declaration && implicit_warning) + { + if (c_mesg_implicit_function_declaration == 2) + { + error ("implicit declaration of function `%s'", CTreeIdentPointer(functionid)); + } + else + { + warning ("implicit declaration of function `%s'", CTreeIdentPointer(functionid)); + } + } + else if (c_warn_traditional && traditional_warning) + { + warning ("function `%s' was previously declared within a block", + CTreeIdentPointer(functionid)); + } + + /* Write a record describing this implicit function declaration to the + prototypes file (if requested). */ + +# ifdef LUDO_NO_SKIP + gen_aux_info_record (decl, 0, 1, 0); + + pop_obstacks (); +# endif + + return decl; +} + +/* Record that this function is going to be a varargs function. + This is called before store_parm_decls, which is too early + to call mark_varargs directly. */ + +void c_c_mark_varargs() +{ + c_c_function_varargs = 1; +} + +/* Indicate that the current function uses extra args + not explicitly mentioned in the argument list in any fashion. */ + +void c_mark_varargs () +{ + c_current_function_varargs = 1; +} + +/*------------------------------------------------------------\ +| | +| c_finish_file | +| | +\------------------------------------------------------------*/ + +void c_finish_file( TreeNode ) + + c_tree_node *TreeNode; +{ + c_tree_program_node = TreeNode; + + for ( TreeNode = C_HEAD_NODE_LIST[ C_IDENTIFIER_NODE ]; + TreeNode != (c_tree_node *)0; + TreeNode = TreeNode->COMMON.NEXT ) + { + CTreeIdentGlobalValue( TreeNode ) = 0; + CTreeIdentLocalValue( TreeNode ) = 0; + CTreeIdentLabelValue( TreeNode ) = 0; + CTreeIdentImplicitDecl( TreeNode ) = 0; + CTreeIdentErrorLocus( TreeNode ) = 0; + CTreeIdentLimboValue( TreeNode ) = 0; + } +} + diff --git a/alliance/src/gcp/src/c_cdecl.h b/alliance/src/gcp/src/c_cdecl.h new file mode 100644 index 00000000..8f0af1ce --- /dev/null +++ b/alliance/src/gcp/src/c_cdecl.h @@ -0,0 +1,201 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : C | +| | +| File : c_cdecl.h | +| | +| Date : 09.07.99 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef C_CDECL_H +# define C_CDECL_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define C_INT_TYPE_SIZE (sizeof(int )*8) +# define C_CHAR_TYPE_SIZE (sizeof(char)*8) +# define C_LONG_TYPE_SIZE (sizeof(long)*8) +# define C_LONG_LONG_TYPE_SIZE (sizeof(long long int)*8) +# define C_SHORT_TYPE_SIZE (sizeof(short)*8) +# define C_FLOAT_TYPE_SIZE (sizeof(float)*8) +# define C_DOUBLE_TYPE_SIZE (sizeof(double)*8) +# define C_LONG_DOUBLE_TYPE_SIZE (sizeof(long double)*8) +# define C_POINTER_TYPE_SIZE (sizeof(char *)*8) +# define C_POINTER_SIZE C_POINTER_TYPE_SIZE + +# define C_HOST_BITS_PER_WIDE_INT (int)C_INT_TYPE_SIZE +# define C_HOST_BITS_PER_LONG (int)C_LONG_TYPE_SIZE +# define C_HOST_BITS_PER_INT (int)C_INT_TYPE_SIZE +# define C_HOST_BITS_PER_CHAR (int)C_CHAR_TYPE_SIZE + +# define C_HOST_WIDE_INT int + +# define C_WCHAR_TYPE_SIZE C_INT_TYPE_SIZE +# define C_BITS_PER_UNIT C_CHAR_TYPE_SIZE +# define C_WCHAR_BYTES 1 +# define C_BYTES_BIG_ENDIAN 0 +# define C_BITS_PER_WORD (int)C_INT_TYPE_SIZE + +/*------------------------------------------------------------\ +| | +| Declar | +| | +\------------------------------------------------------------*/ + +# define C_CDECL_NORMAL 1 +# define C_CDECL_FUNCDEF 2 +# define C_CDECL_PARAM 3 +# define C_CDECL_FIELD 4 +# define C_CDECL_BIT_FIELD 5 +# define C_CDECL_TYPENAME 6 + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +# define c_resume_momentary(N) + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct c_binding_level + { + struct c_binding_level *LEVEL_CHAIN; + c_tree_node *NAME_LIST; + c_tree_node *TAG_LIST; + c_tree_node *SHADOWED_LIST; + c_tree_node *BLOCK_LIST; + c_tree_node *THIS_BLOCK; + c_tree_node *PARAM_LIST; + char PARAM_FLAG; + char KEEP; + char KEEP_IF_SUBBLOCKS; + char TAG_TRANSPARENT; + char N_INCOMPLETE; + char SUBBLOCKS_TAG_TRANSPARENT; + } c_binding_level; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern c_tree_node *c_tree_program_node; + + extern c_tree_node *c_pending_invalid_xref; + extern char *c_pending_invalid_xref_file; + extern int c_pending_invalid_xref_line; + extern c_tree_node *c_current_function_decl; + extern int c_current_function_returns_value; + extern int c_current_function_returns_null; + + extern c_tree_node *c_lastiddecl; + + extern int c_skip_evaluation; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern c_binding_level * c_alloc_binding_level __P(()); + extern int c_global_bindings_p __P(()); + extern void c_view_binding __P((c_binding_level *Binding)); + extern void c_view_current_binding __P(()); + extern void c_clear_parm_order __P(()); + extern void c_push_level __P((int tag_transparent)); + extern c_tree_node * c_pop_level __P((int keep, int reverse, int functionbody)); + extern c_tree_node * c_lookup_name __P((c_tree_node *TreeName)); + extern c_tree_node * c_lookup_name_current_level __P((c_tree_node *TreeName)); + extern int c_is_self_promoting_args_p __P((c_tree_node *parms)); + extern int c_is_chain_member __P((c_tree_node *elem, c_tree_node *chain)); + extern c_tree_node * c_push_decl __P((c_tree_node *TreeDecl)); + extern void c_push_parm_decl __P((c_tree_node *parm)); + extern void c_init_decl_processing __P(()); + extern void c_decl_attributes __P((c_tree_node *Node, c_tree_node *Attributes, c_tree_node *Prefix_attributes)); + extern c_tree_node * c_grokfield __P((char *Filename, int Line, c_tree_node *Declarator, c_tree_node *Declspecs, c_tree_node *Width)); + extern c_tree_node * c_groktypename __P((c_tree_node *Typename)); + extern c_tree_node * c_start_decl __P((c_tree_node *Declarator, c_tree_node *Declspecs, int Initialized, c_tree_node *Attributes, c_tree_node *Prefix_attributes)); + extern void c_finish_decl __P((c_tree_node *decl, c_tree_node *init, c_tree_node *asmspec_tree)); + extern void c_split_specs_attrs __P((c_tree_node *Specs_attrs, c_tree_node **Declspecs, c_tree_node **Prefix_attributes)); + extern c_tree_node * c_round_up __P((c_tree_node *value, int divisor)); + extern void c_layout_decl __P((c_tree_node *decl, unsigned known_align)); + extern void c_layout_type __P((c_tree_node *type)); + extern void c_parmlist_tags_warning __P(()); + extern void c_declare_parm_level __P((int definition_flag)); + extern int c_in_parm_level_p __P(()); + extern int c_kept_level_p __P(()); + extern void c_push_tag __P((c_tree_node *name, c_tree_node *type)); + extern c_tree_node * c_start_struct __P((int code_type, c_tree_node *name)); + extern c_tree_node * c_finish_struct __P((c_tree_node *t, c_tree_node *fieldlist, c_tree_node *attributes)); + extern c_tree_node * c_xref_tag __P((int code, c_tree_node *name)); + extern void c_shadow_tag_warned __P((c_tree_node *declspecs, int warned)); + extern void c_shadow_tag __P((c_tree_node *declspecs)); + extern c_tree_node * c_shadow_label __P((c_tree_node *name)); + extern c_tree_node * c_lookup_label __P((c_tree_node *id)); + extern c_tree_node * c_define_label __P((char *filename, int line, c_tree_node *name)); + extern c_tree_node * c_start_enum __P((c_tree_node *name)); + extern c_tree_node * c_finish_enum __P((c_tree_node *enumtype, c_tree_node *values, c_tree_node *attributes)); + extern c_tree_node * c_build_enumerator __P((c_tree_node *name, c_tree_node *value)); + extern int c_start_function __P((c_tree_node *declarator, c_tree_node *declspecs, c_tree_node *prefix_attributes, c_tree_node *attributes, int nested)); + extern c_tree_node * c_finish_function __P((int nested, c_tree_node *body)); + extern c_tree_node * c_get_tags __P(()); + extern c_tree_node * c_get_decls __P(()); + extern c_tree_node * c_get_parm_info __P((int void_at_end)); + extern void c_store_parm_decls __P(()); + extern int c_complete_array_type __P((c_tree_node *type, c_tree_node *initial_value, int do_default)); + extern c_tree_node * c_implicitly_declare __P((c_tree_node *functionid)); + extern void c_c_mark_varargs __P(()); + extern void c_mark_varargs __P(()); + + extern void c_finish_file __P((c_tree_node *TreeNode )); + + +# endif diff --git a/alliance/src/gcp/src/c_clex.c b/alliance/src/gcp/src/c_clex.c new file mode 100644 index 00000000..27873b57 --- /dev/null +++ b/alliance/src/gcp/src/c_clex.c @@ -0,0 +1,2462 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/* Lexical analyzer for C and Objective C. + Copyright (C) 1987, 88, 89, 92, 94-97, 1998 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "gcp.h" + +# include "c_flags.h" +# include "c_tree.h" +# include "c_treecompat.h" +# include "c_clex.h" +# include "c_cdecl.h" +# include "c_ccomp.h" +# include "c_convert.h" +# include "c_ctypeck.h" +# include "c_debug.h" +# include "c_parse.h" + +#include + +/* MULTIBYTE_CHARS support only works for native compilers. + ??? Ideally what we want is to model widechar support after + the current floating point support. */ +#ifdef CROSS_COMPILE +#undef MULTIBYTE_CHARS +#endif + +#ifdef MULTIBYTE_CHARS +#include +#include +#endif + +#ifndef errno +extern int errno; +#endif + +#if USE_CPPLIB +#include "cpplib.h" +cpp_reader parse_in; +cpp_options parse_options; +static enum cpp_token cpp_token; +#endif + +/* The elements of `c_ridpointers' are identifier nodes + for the reserved type names and storage classes. + It is indexed by a RID_... value. */ + +c_tree_node *c_ridpointers[(int) RID_MAX]; +FILE *c_y_in = (FILE *)0; +int c_lineno; + +/* Cause the `c_y_debug' variable to be defined. */ +#define C_Y_DEBUG 1 + +#if USE_CPPLIB +static unsigned char *c_y__cur, *c_y__lim; + +int +c_y__get_token () +{ + for (;;) + { + parse_in.limit = parse_in.token_buffer; + cpp_token = cpp_get_token (&parse_in); + if (cpp_token == CPP_EOF) + return -1; + c_y__lim = CPP_PWRITTEN (&parse_in); + c_y__cur = parse_in.token_buffer; + if (c_y__cur < c_y__lim) + return *c_y__cur++; + } +} + +#define GETC() (c_y__cur < c_y__lim ? *c_y__cur++ : c_y__get_token ()) +#define UNGETC(c) ((c), c_y__cur--) +#else +#define GETC() getc (c_y_in) +#define UNGETC(c) ungetc (c, c_y_in) +#endif + +/* the declaration found for the last IDENTIFIER token read in. + c_y_lex must look this up to detect typedefs, which get token type TYPENAME, + so it is left around in case the identifier is not a typedef but is + used in a context which makes it a reference to a variable. */ +c_tree_node *c_lastiddecl; + +/* Nonzero enables objc features. */ + +# ifdef LUDO_DONE +extern tree c_is_class_name (); +# else +# define c_is_class_name(N) 0 +# endif + +extern int c_y_debug; + +/* Number of bytes in a wide character. */ + +static int maxtoken; /* Current nominal length of token buffer. */ +char *token_buffer; /* Pointer to token buffer. + Actual allocated length is maxtoken + 2. + This is not static because objc-parse.y uses it. */ + +static int indent_level = 0; /* Number of { minus number of }. */ + +/* Nonzero if end-of-file has been seen on input. */ +static int end_of_file; + +# ifdef LUDO_DONE +#if !USE_CPPLIB +/* Buffered-back input character; faster than using ungetc. */ +static int nextchar = -1; +#endif +# else +#if !USE_CPPLIB +/* Buffered-back input character; faster than using ungetc. */ +static int nextchar = '\n'; +#endif +# endif + + +int check_newline (); + +/* Do not insert generated code into the source, instead, include it. + This allows us to build gcc automatically even for targets that + need to add or modify the reserved keyword lists. */ +#include "c_gperf.h" + +/* Return something to represent absolute declarators containing a *. + TARGET is the absolute declarator that the * contains. + TYPE_QUALS is a list of modifiers such as const or volatile + to apply to the pointer type, represented as identifiers. + + We return an INDIRECT_REF whose "contents" are TARGET + and whose type is the modifier list. */ + +# ifdef LUDO_DONE +tree +make_pointer_declarator (type_quals, target) + tree type_quals, target; +{ + return build1 (INDIRECT_REF, type_quals, target); +} +# endif + +static void forget_protocol_qualifiers () +{ + int i, n = sizeof wordlist / sizeof (struct resword); + + for (i = 0; i < n; i++) + if ((int) wordlist[i].rid >= (int) RID_IN + && (int) wordlist[i].rid <= (int) RID_ONEWAY) + wordlist[i].name = ""; +} + +# ifdef LUDO_NO_SKIP +static void remember_protocol_qualifiers () +{ + int i, n = sizeof wordlist / sizeof (struct resword); + + for (i = 0; i < n; i++) + if (wordlist[i].rid == RID_IN) + wordlist[i].name = "in"; + else if (wordlist[i].rid == RID_OUT) + wordlist[i].name = "out"; + else if (wordlist[i].rid == RID_INOUT) + wordlist[i].name = "inout"; + else if (wordlist[i].rid == RID_BYCOPY) + wordlist[i].name = "bycopy"; + else if (wordlist[i].rid == RID_ONEWAY) + wordlist[i].name = "oneway"; +} +# endif + +#if USE_CPPLIB +void +init_parse (filename) + char *filename; +{ + init_lex (); + c_y__cur = "\n"; + c_y__lim = c_y__cur+1; + + cpp_reader_init (&parse_in); + parse_in.data = &parse_options; + cpp_options_init (&parse_options); + cpp_handle_options (&parse_in, 0, NULL); /* FIXME */ + parse_in.show_column = 1; + if (! cpp_start_read (&parse_in, filename)) + abort (); +} + +void +finish_parse () +{ + cpp_finish (&parse_in); +} +#endif + +void +c_init_lex ( InputFileName ) + + char *InputFileName; +{ + char *buffer; + + c_input_file_stack = + (struct c_file_stack *)autallocblock(sizeof (struct c_file_stack)); + + buffer = autallocblock( strlen( InputFileName ) + 3 ); + sprintf( buffer, "\"%s\"", InputFileName ); + + c_input_file_stack->NAME = autnamealloc( buffer ); + c_input_filename = c_input_file_stack->NAME; + + autfreeblock( buffer); + + /* Make identifier nodes long enough for the language-specific slots. */ +# ifdef LUDO_DONE + set_identifier_size(sizeof (struct lang_identifier)); +# endif + + /* Start it at 0, because check_newline is called at the very beginning + and will increment it to 1. */ + c_lineno = 0; + +#ifdef MULTIBYTE_CHARS + /* Change to the native locale for multibyte conversions. */ + setlocale (LC_CTYPE, ""); +#endif + + c_lastiddecl = 0; + indent_level = 0; + end_of_file = 0; + +# ifdef LUDO_DONE +#if !USE_CPPLIB +/* Buffered-back input character; faster than using ungetc. */ + nextchar = -1; +#endif +# else +#if !USE_CPPLIB +/* Buffered-back input character; faster than using ungetc. */ + nextchar = '\n'; +#endif +# endif + + maxtoken = 40; + token_buffer = (char *)autallocblock( maxtoken + 2); + + c_ridpointers[(int) RID_INT] = c_tree_get_identifier ("int"); + c_ridpointers[(int) RID_CHAR] = c_tree_get_identifier ("char"); + c_ridpointers[(int) RID_VOID] = c_tree_get_identifier ("void"); + c_ridpointers[(int) RID_FLOAT] = c_tree_get_identifier ("float"); + c_ridpointers[(int) RID_DOUBLE] = c_tree_get_identifier ("double"); + c_ridpointers[(int) RID_SHORT] = c_tree_get_identifier ("short"); + c_ridpointers[(int) RID_LONG] = c_tree_get_identifier ("long"); + c_ridpointers[(int) RID_UNSIGNED] = c_tree_get_identifier ("unsigned"); + c_ridpointers[(int) RID_SIGNED] = c_tree_get_identifier ("signed"); + c_ridpointers[(int) RID_INLINE] = c_tree_get_identifier ("inline"); + c_ridpointers[(int) RID_CONST] = c_tree_get_identifier ("const"); + c_ridpointers[(int) RID_VOLATILE] = c_tree_get_identifier ("volatile"); + c_ridpointers[(int) RID_AUTO] = c_tree_get_identifier ("auto"); + c_ridpointers[(int) RID_STATIC] = c_tree_get_identifier ("static"); + c_ridpointers[(int) RID_EXTERN] = c_tree_get_identifier ("extern"); + c_ridpointers[(int) RID_TYPEDEF] = c_tree_get_identifier ("typedef"); + c_ridpointers[(int) RID_REGISTER] = c_tree_get_identifier ("register"); + c_ridpointers[(int) RID_ITERATOR] = c_tree_get_identifier ("iterator"); + c_ridpointers[(int) RID_COMPLEX] = c_tree_get_identifier ("complex"); + c_ridpointers[(int) RID_ID] = c_tree_get_identifier ("id"); + c_ridpointers[(int) RID_IN] = c_tree_get_identifier ("in"); + c_ridpointers[(int) RID_OUT] = c_tree_get_identifier ("out"); + c_ridpointers[(int) RID_INOUT] = c_tree_get_identifier ("inout"); + c_ridpointers[(int) RID_BYCOPY] = c_tree_get_identifier ("bycopy"); + c_ridpointers[(int) RID_ONEWAY] = c_tree_get_identifier ("oneway"); + forget_protocol_qualifiers(); + + /* Some options inhibit certain reserved words. + Clear those words out of the hash table so they won't be recognized. */ +#define UNSET_RESERVED_WORD(STRING) \ + do { struct resword *s = c_is_reserved_word (STRING, sizeof (STRING) - 1); \ + if (s) s->name = ""; } while (0) + + if (! c_doing_objc_thang) + UNSET_RESERVED_WORD ("id"); + + if (c_flag_traditional) + { + UNSET_RESERVED_WORD ("const"); + UNSET_RESERVED_WORD ("volatile"); + UNSET_RESERVED_WORD ("typeof"); + UNSET_RESERVED_WORD ("signed"); + UNSET_RESERVED_WORD ("inline"); + UNSET_RESERVED_WORD ("iterator"); + UNSET_RESERVED_WORD ("complex"); + } + if (c_flag_no_asm) + { + UNSET_RESERVED_WORD ("asm"); + UNSET_RESERVED_WORD ("typeof"); + UNSET_RESERVED_WORD ("inline"); + UNSET_RESERVED_WORD ("iterator"); + UNSET_RESERVED_WORD ("complex"); + } +} + +void +c_reinit_parse_for_function () +{ +} + +/* Function used when c_y_debug is set, to print a token in more detail. */ + +void +c_y_print (file, c_y_char, c_y_lval) + FILE *file; + int c_y_char; + C_Y_STYPE c_y_lval; +{ + /* + if ( c_y_char >= tok_IDENTIFIER ) + { + fprintf( stdout, "\n" ); + c_fprintf( stdout, "token %d\n", c_y_char ); + loc_c_tree_view_node( c_y_lval.ttype ); + } + */ + /* + switch (c_y_char) + { + case tok_IDENTIFIER: + case tok_TYPENAME: + case tok_OBJECTNAME: + case tok_CONSTANT: + loc_c_tree_view_node( c_y_lval.ttype ); + break; + + case tok_SCSPEC : + case tok_TYPESPEC : + case tok_TYPE_QUAL : + case tok_STRING : + case tok_ELLIPSIS : + case tok_SIZEOF : + case tok_ENUM : + case tok_STRUCT : + case tok_UNION : + case tok_IF : + case tok_ELSE : + case tok_WHILE : + case tok_DO : + case tok_FOR : + case tok_SWITCH : + case tok_CASE : + case tok_DEFAULT : + case tok_BREAK : + case tok_CONTINUE : + case tok_RETURN : + case tok_GOTO : + case tok_ASM_KEYWORD : + case tok_TYPEOF : + case tok_ALIGNOF : + case tok_ATTRIBUTE : + case tok_EXTENSION : + case tok_LABEL : + case tok_REALPART : + case tok_IMAGPART : + case tok_ASSIGN : + case tok_OROR : + case tok_ANDAND : + case tok_EQCOMPARE : + case tok_ARITHCOMPARE : + case tok_LSHIFT : + case tok_RSHIFT : + case tok_UNARY : + case tok_PLUSPLUS : + case tok_MINUSMINUS : + case tok_HYPERUNARY : + case tok_POINTSAT : + case tok_INTERFACE : + case tok_IMPLEMENTATION : + case tok_END : + case tok_SELECTOR : + case tok_DEFS : + case tok_ENCODE : + case tok_CLASSNAME : + case tok_PUBLIC : + case tok_PRIVATE : + case tok_PROTECTED : + case tok_PROTOCOL : + case tok_CLASS : + case tok_ALIAS : + case tok_OBJC_STRING : + break; + } + */ +} + +/* If C is not whitespace, return C. + Otherwise skip whitespace and return first nonwhite char read. */ + +static int +skip_white_space (c) + register int c; +{ + static int newline_warning = 0; + + for (;;) + { + switch (c) + { + /* We don't recognize comments here, because + cpp output can include / and * consecutively as operators. + Also, there's no need, since cpp removes all comments. */ + + case '\n': + c = check_newline (); + break; + + case ' ': + case '\t': + case '\f': + case '\v': + case '\b': + c = GETC(); + break; + + case '\r': + /* ANSI C says the effects of a carriage return in a source file + are undefined. */ + if (c_pedantic && !newline_warning) + { + warning ("carriage return in source file"); + warning ("(we only warn about the first carriage return)"); + newline_warning = 1; + } + c = GETC(); + break; + + case '\\': + c = GETC(); + if (c == '\n') + c_lineno++; + else + { + error ("stray '\\' in program"); + } + c = GETC(); + break; + + default: + return (c); + } + } +} + +/* Skips all of the white space at the current location in the input file. + Must use and reset nextchar if it has the next character. */ + +void c_position_after_white_space () +{ + register int c; + +#if !USE_CPPLIB + if (nextchar != -1) + c = nextchar, nextchar = -1; + else +#endif + c = GETC(); + + UNGETC (skip_white_space (c)); +} + +/* Make the token buffer longer, preserving the data in it. + P should point to just beyond the last valid character in the old buffer. + The value we return is a pointer to the new buffer + at a place corresponding to P. */ + +static char * +extend_token_buffer (p) + char *p; +{ + int offset = p - token_buffer; + + maxtoken = maxtoken * 2 + 10; + token_buffer = (char *)realloc( token_buffer, maxtoken + 2 ); + + return token_buffer + offset; +} + +#if !USE_CPPLIB +#define GET_DIRECTIVE_LINE() get_directive_line (c_y_in) +#else /* USE_CPPLIB */ +/* Read the rest of a #-directive from input stream FINPUT. + In normal use, the directive name and the white space after it + have already been read, so they won't be included in the result. + We allow for the fact that the directive line may contain + a newline embedded within a character or string literal which forms + a part of the directive. + + The value is a string in a reusable buffer. It remains valid + only until the next time this function is called. */ + +static char * +GET_DIRECTIVE_LINE () +{ + static char *directive_buffer = NULL; + static unsigned buffer_length = 0; + register char *p; + register char *buffer_limit; + register int looking_for = 0; + register int char_escaped = 0; + + if (buffer_length == 0) + { + directive_buffer = (char *)xmalloc (128); + buffer_length = 128; + } + + buffer_limit = &directive_buffer[buffer_length]; + + for (p = directive_buffer; ; ) + { + int c; + + /* Make buffer bigger if it is full. */ + if (p >= buffer_limit) + { + register unsigned bytes_used = (p - directive_buffer); + + buffer_length *= 2; + directive_buffer + = (char *)xrealloc (directive_buffer, buffer_length); + p = &directive_buffer[bytes_used]; + buffer_limit = &directive_buffer[buffer_length]; + } + + c = GETC (); + + /* Discard initial whitespace. */ + if ((c == ' ' || c == '\t') && p == directive_buffer) + continue; + + /* Detect the end of the directive. */ + if (c == '\n' && looking_for == 0) + { + UNGETC (c); + c = '\0'; + } + + *p++ = c; + + if (c == 0) + return directive_buffer; + + /* Handle string and character constant syntax. */ + if (looking_for) + { + if (looking_for == c && !char_escaped) + looking_for = 0; /* Found terminator... stop looking. */ + } + else + if (c == '\'' || c == '"') + looking_for = c; /* Don't stop buffering until we see another + another one of these (or an EOF). */ + + /* Handle backslash. */ + char_escaped = (c == '\\' && ! char_escaped); + } +} +#endif /* USE_CPPLIB */ + +/* At the beginning of a line, increment the line number + and process any #-directive on this line. + If the line is a #-directive, read the entire line and return a newline. + Otherwise, return the line's first non-whitespace character. */ + +int +check_newline () +{ + register int c; + register int token; + + c_lineno++; + + /* Read first nonwhite char on the line. */ + + c = GETC(); + while (c == ' ' || c == '\t') + c = GETC(); + + if (c != '#') + { + /* If not #, return it so caller will use it. */ + return c; + } + + /* Read first nonwhite char after the `#'. */ + + c = GETC(); + while (c == ' ' || c == '\t') + c = GETC(); + + /* If a letter follows, then if the word here is `line', skip + it and ignore it; otherwise, ignore the line, with an error + if the word isn't `pragma', `ident', `define', or `undef'. */ + + if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) + { + if (c == 'p') + { + if (GETC() == 'r' + && GETC() == 'a' + && GETC() == 'g' + && GETC() == 'm' + && GETC() == 'a' + && ((c = GETC()) == ' ' || c == '\t' || c == '\n')) + { + while (c == ' ' || c == '\t') + c = GETC (); + if (c == '\n') + return c; +#ifdef HANDLE_SYSV_PRAGMA + UNGETC (c); + token = c_y_lex (); + if (token != IDENTIFIER) + goto skipline; + return handle_sysv_pragma (token); +#else /* !HANDLE_SYSV_PRAGMA */ +#ifdef HANDLE_PRAGMA +#if !USE_CPPLIB + UNGETC (c); + token = c_y_lex (); + if (token != IDENTIFIER) + goto skipline; + if (HANDLE_PRAGMA (c_y_in, c_y_lval.ttype)) + { + c = GETC (); + return c; + } +#else + ??? do not know what to do ???; +#endif /* !USE_CPPLIB */ +#endif /* HANDLE_PRAGMA */ +#endif /* !HANDLE_SYSV_PRAGMA */ + goto skipline; + } + } + + else if (c == 'd') + { + if (GETC() == 'e' + && GETC() == 'f' + && GETC() == 'i' + && GETC() == 'n' + && GETC() == 'e' + && ((c = GETC()) == ' ' || c == '\t' || c == '\n')) + { + if (c != '\n') + { +# ifdef LUDO_DONE + debug_define (c_lineno, GET_DIRECTIVE_LINE ()); +# endif + } + goto skipline; + } + } + else if (c == 'u') + { + if (GETC() == 'n' + && GETC() == 'd' + && GETC() == 'e' + && GETC() == 'f' + && ((c = GETC()) == ' ' || c == '\t' || c == '\n')) + { + if (c != '\n') + { +# ifdef LUDO_DONE + debug_undef (c_lineno, GET_DIRECTIVE_LINE ()); +# endif + } + goto skipline; + } + } + else if (c == 'l') + { + if (GETC() == 'i' + && GETC() == 'n' + && GETC() == 'e' + && ((c = GETC()) == ' ' || c == '\t')) + goto linenum; + } + else if (c == 'i') + { + if (GETC() == 'd' + && GETC() == 'e' + && GETC() == 'n' + && GETC() == 't' + && ((c = GETC()) == ' ' || c == '\t')) + { + /* #ident. The c_pedantic warning is now in cccp.c. */ + + /* Here we have just seen `#ident '. + A string constant should follow. */ + + while (c == ' ' || c == '\t') + c = GETC(); + + /* If no argument, ignore the line. */ + if (c == '\n') + return c; + + UNGETC (c); + token = c_y_lex (); + if (( token != tok_STRING ) || + ( CTreeNodeFirstCode( c_y_lval.ttype ) != C_STRING_NODE )) + { + error ("invalid #ident"); + goto skipline; + } + if (!c_flag_no_ident) + { +#ifdef ASM_OUTPUT_IDENT + ASM_OUTPUT_IDENT (asm_out_file, TREE_STRING_POINTER (c_y_lval.ttype)); +#endif + } + + /* Skip the rest of this line. */ + goto skipline; + } + } + + error ("undefined or invalid # directive"); + goto skipline; + } + +linenum: + /* Here we have either `#line' or `# '. + In either case, it should be a line number; a digit should follow. */ + + while (c == ' ' || c == '\t') + c = GETC(); + + /* If the # is the only nonwhite char on the line, + just ignore it. Check the new newline. */ + if (c == '\n') + return c; + + /* Something follows the #; read a token. */ + + UNGETC (c); + token = c_y_lex (); + + if ((token == tok_CONSTANT) && + (CTreeNodeFirstCode( c_y_lval.ttype ) == C_INT_CST_NODE)) + { + int old_lineno = c_lineno; + int used_up = 0; + /* subtract one, because it is the following line that + gets the specified number */ + + int l = CTreeIntCstLow(c_y_lval.ttype) - 1; + + /* Is this the last nonwhite stuff on the line? */ + c = GETC(); + while (c == ' ' || c == '\t') + c = GETC(); + if (c == '\n') + { + /* No more: store the line number and check following line. */ + c_lineno = l; + return c; + } + UNGETC (c); + + /* More follows: it must be a string constant (filename). */ + + /* Read the string constant. */ + token = c_y_lex (); + + if ((token != tok_STRING) || + ( CTreeNodeFirstCode( c_y_lval.ttype ) != C_STRING_NODE)) + { + error ("invalid #line"); + goto skipline; + } + + c_input_filename + = (char *) autallocblock( CTreeStringLength(c_y_lval.ttype) + 1); + strcpy (c_input_filename, CTreeStringPointer(c_y_lval.ttype)); + c_lineno = l; + + /* Each change of file name + reinitializes whether we are now in a system header. */ + c_in_system_header = 0; + + if (c_main_input_filename == 0) + c_main_input_filename = c_input_filename; + + /* Is this the last nonwhite stuff on the line? */ + c = GETC(); + while (c == ' ' || c == '\t') + c = GETC(); + if (c == '\n') + { + /* Update the name in the top element of input_file_stack. */ + if (c_input_file_stack) + c_input_file_stack->NAME = c_input_filename; + + return c; + } + UNGETC (c); + + token = c_y_lex (); + used_up = 0; + + /* `1' after file name means entering new file. + `2' after file name means just left a file. */ + + if ((token == tok_CONSTANT) + && (CTreeNodeFirstCode(c_y_lval.ttype ) == C_INT_CST_NODE )) + { + if (CTreeIntCstLow(c_y_lval.ttype) == 1) + { + /* Pushing to a new file. */ + struct c_file_stack *p + = (struct c_file_stack *) autallocblock(sizeof (struct c_file_stack)); + c_input_file_stack->LINE = old_lineno; + p->NEXT = c_input_file_stack; + p->NAME = c_input_filename; + p->INDENT_LEVEL = indent_level; + c_input_file_stack = p; + c_input_file_stack_tick++; +# ifdef LUDO_DONE + debug_start_source_file (c_input_filename); +# endif + used_up = 1; + } + else if (CTreeIntCstLow(c_y_lval.ttype) == 2) + { + /* Popping out of a file. */ + if (c_input_file_stack->NEXT) + { + struct c_file_stack *p = c_input_file_stack; + if (indent_level != p->INDENT_LEVEL) + { + c_warning_with_file_and_line( p->NAME, old_lineno, + "This file contains more `%c's than `%c's.", + indent_level > p->INDENT_LEVEL ? '{' : '}', + indent_level > p->INDENT_LEVEL ? '}' : '{'); + } + c_input_file_stack = p->NEXT; + free (p); + c_input_file_stack_tick++; +# ifdef LUDO_DONE + debug_end_source_file (c_input_file_stack->line); +# endif + } + else + { + error ("#-lines for entering and leaving files don't match"); + } + + used_up = 1; + } + } + + /* Now that we've pushed or popped the input stack, + update the name in the top element. */ + if (c_input_file_stack) + c_input_file_stack->NAME = c_input_filename; + + /* If we have handled a `1' or a `2', + see if there is another number to read. */ + if (used_up) + { + /* Is this the last nonwhite stuff on the line? */ + c = GETC(); + while (c == ' ' || c == '\t') + c = GETC(); + if (c == '\n') + return c; + UNGETC (c); + + token = c_y_lex (); + used_up = 0; + } + + /* `3' after file name means this is a system header file. */ + + if (( token == tok_CONSTANT ) + && ( CTreeNodeFirstCode(c_y_lval.ttype) == C_INT_CST_NODE ) + && ( CTreeIntCstLow( c_y_lval.ttype) == 3 )) + c_in_system_header = 1, used_up = 1; + + if (used_up) + { + /* Is this the last nonwhite stuff on the line? */ + c = GETC(); + while (c == ' ' || c == '\t') + c = GETC(); + if (c == '\n') + return c; + UNGETC (c); + } + + warning ("unrecognized text at end of #line"); + } + else + { + error ("invalid #-line"); + } + + /* skip the rest of this line. */ + skipline: +#if !USE_CPPLIB + if (c != '\n' && c != EOF && nextchar >= 0) + c = nextchar, nextchar = -1; +#endif + while (c != '\n' && c != EOF) + c = GETC(); + return c; +} + +#ifdef HANDLE_SYSV_PRAGMA + +/* Handle a #pragma directive. + TOKEN is the token we read after `#pragma'. Processes the entire input + line and returns a character for the caller to reread: either \n or EOF. */ + +/* This function has to be in this file, in order to get at + the token types. */ + +int +handle_sysv_pragma (token) + register int token; +{ + register int c; + + for (;;) + { + switch (token) + { + case tok_IDENTIFIER: + case tok_TYPENAME: + case tok_STRING: + case tok_CONSTANT: + handle_pragma_token (token_buffer, c_y_lval.ttype); + break; + default: + handle_pragma_token (token_buffer, 0); + } +#if !USE_CPPLIB + if (nextchar >= 0) + c = nextchar, nextchar = -1; + else +#endif + c = GETC (); + + while (c == ' ' || c == '\t') + c = GETC (); + if (c == '\n' || c == EOF) + { + handle_pragma_token (0, 0); + return c; + } + UNGETC (c); + token = c_y_lex (); + } +} + +#endif /* HANDLE_SYSV_PRAGMA */ + +#define ENDFILE -1 /* token that represents end-of-file */ + +/* Read an escape sequence, returning its equivalent as a character, + or store 1 in *ignore_ptr if it is backslash-newline. */ + +static int +readescape (ignore_ptr) + int *ignore_ptr; +{ + register int c = GETC(); + register int code; + register unsigned count; + unsigned firstdig = 0; + int nonnull; + + switch (c) + { + case 'x': + if (c_warn_traditional) + { + warning ("the meaning of `\\x' varies with -traditional"); + } + + if (c_flag_traditional) + return c; + + code = 0; + count = 0; + nonnull = 0; + while (1) + { + c = GETC(); + if (!(c >= 'a' && c <= 'f') + && !(c >= 'A' && c <= 'F') + && !(c >= '0' && c <= '9')) + { + UNGETC (c); + break; + } + code *= 16; + if (c >= 'a' && c <= 'f') + code += c - 'a' + 10; + if (c >= 'A' && c <= 'F') + code += c - 'A' + 10; + if (c >= '0' && c <= '9') + code += c - '0'; + if (code != 0 || count != 0) + { + if (count == 0) + firstdig = code; + count++; + } + nonnull = 1; + } + if (! nonnull) + { + error ("\\x used with no following hex digits"); + } + else if (count == 0) + /* Digits are all 0's. Ok. */ + ; + else + if ((count - 1) * 4 >= CTreeTypePrecision( c_integer_type_node) + || (count > 1 + && ((1 << (CTreeTypePrecision(c_integer_type_node) - (count - 1)*4)) + <= firstdig))) + { + pedwarn ("hex escape out of range"); + } + return code; + + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': + code = 0; + count = 0; + while ((c <= '7') && (c >= '0') && (count++ < 3)) + { + code = (code * 8) + (c - '0'); + c = GETC(); + } + UNGETC (c); + return code; + + case '\\': case '\'': case '"': + return c; + + case '\n': + c_lineno++; + *ignore_ptr = 1; + return 0; + + case 'n': + return '\n'; /* TARGET_NEWLINE */ + + case 't': + return '\t'; /* TARGET_TAB */ + + case 'r': + return '\r'; /* TARGET_CR */ + + case 'f': + return '\f'; /* TARGET_FF */ + + case 'b': + return '\b'; /* TARGET_BS */ + + case 'a': + if (c_warn_traditional) + { + warning ("the meaning of `\\a' varies with -traditional"); + } + + if (c_flag_traditional) + return c; + + return '\a'; /* TARGET_BELL */ + + case 'v': +#if 0 /* Vertical tab is present in common usage compilers. */ + if (c_flag_traditional) + return c; +#endif + return '\v'; /* TARGET_VT */ + + case 'e': + case 'E': + if (c_pedantic) + { + pedwarn ("non-ANSI-standard escape sequence, `\\%c'", c); + } + return 033; + + case '?': + return c; + + /* `\(', etc, are used at beginning of line to avoid confusing Emacs. */ + case '(': + case '{': + case '[': + /* `\%' is used to prevent SCCS from getting confused. */ + case '%': + if (c_pedantic) + { + pedwarn ("non-ANSI escape sequence `\\%c'", c); + } + return c; + } + if (c >= 040 && c < 0177) + { + pedwarn ("unknown escape sequence `\\%c'", c); + } + else + { + pedwarn ("unknown escape sequence: `\\' followed by char code 0x%x", c); + } + return c; +} + +void +c_y_error (string) + char *string; +{ + char buf[200]; + + strcpy (buf, string); + + /* We can't print string and character constants well + because the token_buffer contains the result of processing escapes. */ + if (end_of_file) + strcat (buf, " at end of input"); + else if (token_buffer[0] == 0) + strcat (buf, " at null character"); + else if (token_buffer[0] == '"') + strcat (buf, " before string constant"); + else if (token_buffer[0] == '\'') + strcat (buf, " before character constant"); + else if (token_buffer[0] < 040 || (unsigned char) token_buffer[0] >= 0177) + sprintf (buf + strlen (buf), " before character 0%o", + (unsigned char) token_buffer[0]); + else + strcat (buf, " before `%s'"); + + /* fprintf( stdout, "Line %d, File %s ::", c_lineno, c_input_filename ); */ + error (buf, token_buffer); + gcpexit(1); +} + +#if 0 + +struct try_type +{ + tree *node_var; + char unsigned_flag; + char long_flag; + char long_long_flag; +}; + +struct try_type type_sequence[] = +{ + { &integer_type_node, 0, 0, 0}, + { &unsigned_type_node, 1, 0, 0}, + { &long_integer_type_node, 0, 1, 0}, + { &long_unsigned_type_node, 1, 1, 0}, + { &long_long_integer_type_node, 0, 1, 1}, + { &long_long_unsigned_type_node, 1, 1, 1} +}; +#endif /* 0 */ + +int +c_y_lex () +{ + register int c; + register char *p; + register int value; + int wide_flag = 0; + int objc_flag = 0; + +#if !USE_CPPLIB + if (nextchar >= 0) + c = nextchar, nextchar = -1; + else +#endif + c = GETC(); + + /* Effectively do c = skip_white_space (c) + but do it faster in the usual cases. */ + while (1) + switch (c) + { + case ' ': + case '\t': + case '\f': + case '\v': + case '\b': + c = GETC(); + break; + + case '\r': + /* Call skip_white_space so we can warn if appropriate. */ + + case '\n': + case '/': + case '\\': + c = skip_white_space (c); + default: + goto found_nonwhite; + } + found_nonwhite: + + token_buffer[0] = c; + token_buffer[1] = 0; + +/* c_y_lloc.first_line = lineno; */ + + switch (c) + { + case EOF: + end_of_file = 1; + token_buffer[0] = 0; + value = ENDFILE; + break; + + case 'L': + /* Capital L may start a wide-string or wide-character constant. */ + { + register int c = GETC(); + if (c == '\'') + { + wide_flag = 1; + goto char_constant; + } + if (c == '"') + { + wide_flag = 1; + goto string_constant; + } + UNGETC (c); + } + goto letter; + + case '@': + if (!c_doing_objc_thang) + { + value = c; + break; + } + else + { + /* '@' may start a constant string object. */ + register int c = GETC (); + if (c == '"') + { + objc_flag = 1; + goto string_constant; + } + UNGETC (c); + /* Fall through to treat '@' as the start of an identifier. */ + } + + case 'A': case 'B': case 'C': case 'D': case 'E': + case 'F': case 'G': case 'H': case 'I': case 'J': + case 'K': case 'M': case 'N': case 'O': + case 'P': case 'Q': case 'R': case 'S': case 'T': + case 'U': case 'V': case 'W': case 'X': case 'Y': + case 'Z': + case 'a': case 'b': case 'c': case 'd': case 'e': + case 'f': case 'g': case 'h': case 'i': case 'j': + case 'k': case 'l': case 'm': case 'n': case 'o': + case 'p': case 'q': case 'r': case 's': case 't': + case 'u': case 'v': case 'w': case 'x': case 'y': + case 'z': + case '_': + case '$': + letter: + p = token_buffer; + while (isalnum (c) || c == '_' || c == '$' || c == '@') + { + /* Make sure this char really belongs in an identifier. */ + if (c == '@' && ! c_doing_objc_thang) + break; + if (c == '$') + { + if (! c_dollars_in_ident) + { + error ("`$' in identifier"); + } + else if (c_pedantic) + { + pedwarn ("`$' in identifier"); + } + } + + if (p >= token_buffer + maxtoken) + p = extend_token_buffer (p); + + *p++ = c; + c = GETC(); + } + + *p = 0; +#if USE_CPPLIB + UNGETC (c); +#else + nextchar = c; +#endif + + value = tok_IDENTIFIER; + c_y_lval.itype = 0; + + /* Try to recognize a keyword. Uses minimum-perfect hash function */ + + { + register struct resword *ptr; + + ptr = c_is_reserved_word (token_buffer, p - token_buffer); + if ( ptr ) + { + if (ptr->rid) + c_y_lval.ttype = c_ridpointers[(int) ptr->rid]; + value = (int) ptr->token; + + /* Only return OBJECTNAME if it is a typedef. */ + if (c_doing_objc_thang && value == tok_OBJECTNAME) + { + c_lastiddecl = c_lookup_name(c_y_lval.ttype); + + if ((c_lastiddecl == (c_tree_node *)0) || + (CTreeDeclCode(c_lastiddecl) != C_TYPE_DECL)) + { + value = tok_IDENTIFIER; + } + } + + /* Even if we decided to recognize asm, still perhaps warn. */ + if (c_pedantic + && (value == tok_ASM_KEYWORD || value == tok_TYPEOF + || ptr->rid == RID_INLINE) + && token_buffer[0] != '_') + { + pedwarn ("ANSI does not permit the keyword `%s'", + token_buffer); + } + } + } + + /* If we did not find a keyword, look for an identifier + (or a typename). */ + + if (value == tok_IDENTIFIER) + { + if (token_buffer[0] == '@') + { + error("invalid identifier `%s'", token_buffer); + } + + c_y_lval.ttype = c_tree_get_identifier( token_buffer ); + c_lastiddecl = c_lookup_name( c_y_lval.ttype ); + + if ((c_lastiddecl != 0) && (CTreeDeclCode(c_lastiddecl) == C_TYPE_DECL)) + { + value = tok_TYPENAME; + } + /* A user-invisible read-only initialized variable + should be replaced by its value. + We handle only strings since that's the only case used in C. */ + else if ((c_lastiddecl != 0) && + (CTreeDeclCode(c_lastiddecl) == C_VAR_DECL) && + (CIsTreeDeclIgnored(c_lastiddecl)) && + (CIsTreeNodeReadOnly(c_lastiddecl)) && + (CTreeDeclInitial(c_lastiddecl) != (c_tree_node *)0) && + (CTreeNodeFirstCode( CTreeDeclInitial(c_lastiddecl)) == C_STRING_NODE)) + { + c_tree_node *stringval = CTreeDeclInitial(c_lastiddecl); + + /* Copy the string value so that we won't clobber anything + if we put something in the TREE_CHAIN of this one. */ + c_y_lval.ttype = c_tree_build_string( + CTreeStringLength(stringval), + CTreeStringPointer(stringval)); + value = tok_STRING; + } +# ifdef LUDO_DONE + else if (c_doing_objc_thang) + { + c_tree_node *objc_interface_decl = c_is_class_name (c_y_lval.ttype); + + if (objc_interface_decl) + { + value = CLASSNAME; + c_y_lval.ttype = objc_interface_decl; + } + } +# endif + } + + break; + + case '0': case '1': + { + int next_c; + /* Check first for common special case: single-digit 0 or 1. */ + + next_c = GETC (); + UNGETC (next_c); /* Always undo this lookahead. */ + if (!isalnum (next_c) && next_c != '.') + { + token_buffer[0] = (char)c, token_buffer[1] = '\0'; + c_y_lval.ttype = (c == '0') ? c_integer_zero_node : c_integer_one_node; + value = tok_CONSTANT; + break; + } + /*FALLTHRU*/ + } + + case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + case '.': + { + int base = 10; + int count = 0; + int largest_digit = 0; + int numdigits = 0; + /* for multi-precision arithmetic, + we actually store only C_HOST_BITS_PER_CHAR bits in each part. + The number of parts is chosen so as to be sufficient to hold + the enough bits to fit into the two C_HOST_WIDE_INTs that contain + the integer value (this is always at least as many bits as are + in a target `long long' value, but may be wider). */ +#define TOTAL_PARTS ((C_HOST_BITS_PER_WIDE_INT / C_HOST_BITS_PER_CHAR) * 2 + 2) + + int parts[TOTAL_PARTS]; + int overflow = 0; + + enum anon1 { NOT_FLOAT, AFTER_POINT, TOO_MANY_POINTS} floatflag + = NOT_FLOAT; + + for (count = 0; count < TOTAL_PARTS; count++) + { + parts[count] = 0; + } + + p = token_buffer; + *p++ = c; + + if (c == '0') + { + *p++ = (c = GETC()); + if ((c == 'x') || (c == 'X')) + { + base = 16; + *p++ = (c = GETC()); + } + /* Leading 0 forces octal unless the 0 is the only digit. */ + else if (c >= '0' && c <= '9') + { + base = 8; + numdigits++; + } + else + numdigits++; + } + + /* Read all the digits-and-decimal-points. */ + + while (c == '.' + || (isalnum (c) && c != 'l' && c != 'L' + && c != 'u' && c != 'U' + && c != 'i' && c != 'I' && c != 'j' && c != 'J' + && (floatflag == NOT_FLOAT || ((c != 'f') && (c != 'F'))))) + { + if (c == '.') + { + if (base == 16) + { + error ("floating constant may not be in radix 16"); + } + if (floatflag == TOO_MANY_POINTS) + /* We have already emitted an error. Don't need another. */ + ; + else if (floatflag == AFTER_POINT) + { + error ("malformed floating constant"); + floatflag = TOO_MANY_POINTS; + /* Avoid another error from atof by forcing all characters + from here on to be ignored. */ + p[-1] = '\0'; + } + else + floatflag = AFTER_POINT; + + base = 10; + *p++ = c = GETC(); + /* Accept '.' as the start of a floating-point number + only when it is followed by a digit. + Otherwise, unread the following non-digit + and use the '.' as a structural token. */ + if (p == token_buffer + 2 && !isdigit (c)) + { + if (c == '.') + { + c = GETC(); + if (c == '.') + { + *p++ = c; + *p = 0; + return tok_ELLIPSIS; + } + error ("parse error at `..'"); + } + UNGETC (c); + token_buffer[1] = 0; + value = '.'; + goto done; + } + } + else + { + /* It is not a decimal point. + It should be a digit (perhaps a hex digit). */ + + if (isdigit (c)) + { + c = c - '0'; + } + else if (base <= 10) + { + if (c == 'e' || c == 'E') + { + base = 10; + floatflag = AFTER_POINT; + break; /* start of exponent */ + } + error ("nondigits in number and not hexadecimal"); + c = 0; + } + else if (c >= 'a') + { + c = c - 'a' + 10; + } + else + { + c = c - 'A' + 10; + } + if (c >= largest_digit) + largest_digit = c; + numdigits++; + + for (count = 0; count < TOTAL_PARTS; count++) + { + parts[count] *= base; + if (count) + { + parts[count] + += (parts[count-1] >> C_HOST_BITS_PER_CHAR); + parts[count-1] + &= (1 << C_HOST_BITS_PER_CHAR) - 1; + } + else + parts[0] += c; + } + + /* If the extra highest-order part ever gets anything in it, + the number is certainly too big. */ + if (parts[TOTAL_PARTS - 1] != 0) + overflow = 1; + + if (p >= token_buffer + maxtoken - 3) + p = extend_token_buffer (p); + *p++ = (c = GETC()); + } + } + + if (numdigits == 0) + { + error ("numeric constant with no digits"); + } + + if (largest_digit >= base) + { + error ("numeric constant contains digits beyond the radix"); + } + + /* Remove terminating char from the token buffer and delimit the string */ + *--p = 0; + + if (floatflag != NOT_FLOAT) + { + c_tree_node *type = c_double_type_node; + int imag = 0; + int conversion_errno = 0; + double value; +# ifdef LUDO_DONE + jmp_buf handler; +# endif + /* Read explicit exponent if any, and put it in tokenbuf. */ + + if ((c == 'e') || (c == 'E')) + { + if (p >= token_buffer + maxtoken - 3) + p = extend_token_buffer(p); + *p++ = c; + c = GETC(); + if ((c == '+') || (c == '-')) + { + *p++ = c; + c = GETC(); + } + if (! isdigit (c)) + { + error ("floating constant exponent has no digits"); + } + while (isdigit (c)) + { + if (p >= token_buffer + maxtoken - 3) + p = extend_token_buffer (p); + *p++ = c; + c = GETC(); + } + } + + *p = 0; + + /* Convert string to a double, checking for overflow. */ +# ifdef LUDO_DONE + if (setjmp (handler)) + { + error ("floating constant out of range"); + value = dconst0; + } + else +# endif + { + int fflag = 0, lflag = 0; + /* Copy token_buffer now, while it has just the number + and not the suffixes; once we add `f' or `i', + REAL_VALUE_ATOF may not work any more. */ + char *copy = (char *) autallocblock(p - token_buffer + 1); + bcopy (token_buffer, copy, p - token_buffer + 1); + +# ifdef LUDO_DONE + set_float_handler (handler); +# endif + while (1) + { + int lose = 0; + + /* Read the suffixes to choose a data type. */ + switch (c) + { + case 'f': case 'F': + if (fflag) + { + error ("more than one `f' in numeric constant"); + } + fflag = 1; + break; + + case 'l': case 'L': + if (lflag) + { + error ("more than one `l' in numeric constant"); + } + lflag = 1; + break; + + case 'i': case 'I': + if (imag) + { + error ("more than one `i' or `j' in numeric constant"); + } + else if (c_pedantic) + { + pedwarn ("ANSI C forbids imaginary numeric constants"); + } + imag = 1; + break; + + default: + lose = 1; + } + + if (lose) + break; + + if (p >= token_buffer + maxtoken - 3) + p = extend_token_buffer (p); + *p++ = c; + *p = 0; + c = GETC(); + } + + /* The second argument, machine_mode, of REAL_VALUE_ATOF + tells the desired precision of the binary result + of decimal-to-binary conversion. */ + + if (fflag) + { + if (lflag) + { + error ("both `f' and `l' in floating constant"); + } + + type = c_float_type_node; + errno = 0; + value = atof(copy); + + conversion_errno = errno; +# ifdef LUDO_DONE + /* A diagnostic is required here by some ANSI C testsuites. + This is not pedwarn, become some people don't want + an error for this. */ + if (REAL_VALUE_ISINF (value) && c_pedantic) + { + warning ("floating point number exceeds range of `float'"); + } +# endif + } + else if (lflag) + { + type = c_long_double_type_node; + errno = 0; + value = atof(copy); + conversion_errno = errno; +# ifdef LUDO_DONE + if (REAL_VALUE_ISINF (value) && c_pedantic) + { + warning ("floating point number exceeds range of `long double'"); + } +# endif + } + else + { + errno = 0; + value = atof(copy); + conversion_errno = errno; +# ifdef LUDO_DONE + if (REAL_VALUE_ISINF (value) && c_pedantic) + { + warning ("floating point number exceeds range of `double'"); + } +# endif + } + +# ifdef LUDO_DONE + set_float_handler (NULL_PTR); +# endif + } + +# ifdef LUDO_DONE +#ifdef ERANGE + /* ERANGE is also reported for underflow, + so test the value to distinguish overflow from that. */ + if (conversion_errno == ERANGE && !c_flag_traditional && c_pedantic + && (REAL_VALUES_LESS (dconst1, value) + || REAL_VALUES_LESS (value, dconstm1))) + { + warning ("floating point number exceeds range of `double'"); + } +#endif + + /* If the result is not a number, assume it must have been + due to some error message above, so silently convert + it to a zero. */ + if (REAL_VALUE_ISNAN (value)) + value = dconst0; +# endif + + /* Create a node with determined type and value. */ + if (imag) + { + c_y_lval.ttype = c_tree_build_complex( (c_tree_node *)0, + c_convert_expr(type, c_integer_zero_node), + c_tree_build_real(type, value)); + } + else + { + c_y_lval.ttype = c_tree_build_real(type, value); + } + } + else + { + c_tree_node *traditional_type; + c_tree_node *ansi_type; + c_tree_node *type; + int high, low; + int spec_unsigned = 0; + int spec_long = 0; + int spec_long_long = 0; + int spec_imag = 0; + int bytes, warn, i; + + while (1) + { + if (c == 'u' || c == 'U') + { + if (spec_unsigned) + { + error ("two `u's in integer constant"); + } + spec_unsigned = 1; + } + else if (c == 'l' || c == 'L') + { + if (spec_long) + { + if (spec_long_long) + { + error ("three `l's in integer constant"); + } + else if (c_pedantic) + { + pedwarn ("ANSI C forbids long long integer constants"); + } + spec_long_long = 1; + } + spec_long = 1; + } + else if (c == 'i' || c == 'j' || c == 'I' || c == 'J') + { + if (spec_imag) + { + error ("more than one `i' or `j' in numeric constant"); + } + else if (c_pedantic) + { + pedwarn ("ANSI C forbids imaginary numeric constants"); + } + spec_imag = 1; + } + else + break; + if (p >= token_buffer + maxtoken - 3) + { + p = extend_token_buffer (p); + } + *p++ = c; + c = GETC(); + } + + /* If the constant won't fit in an unsigned long long, + then warn that the constant is out of range. */ + + /* ??? This assumes that long long and long integer types are + a multiple of 8 bits. This better than the original code + though which assumed that long was exactly 32 bits and long + long was exactly 64 bits. */ + + bytes = CTreeTypePrecision(c_long_long_integer_type_node) / 8; + + warn = overflow; + for (i = bytes; i < TOTAL_PARTS; i++) + { + if (parts[i]) warn = 1; + } + if (warn) + { + pedwarn ("integer constant out of range"); + } + + /* This is simplified by the fact that our constant + is always positive. */ + + high = low = 0; + + for (i = 0; i < C_HOST_BITS_PER_WIDE_INT / C_HOST_BITS_PER_CHAR; i++) + { + high |= ((int) parts[i + (C_HOST_BITS_PER_WIDE_INT + / C_HOST_BITS_PER_CHAR)] + << (i * C_HOST_BITS_PER_CHAR)); + low |= (int) parts[i] << (i * C_HOST_BITS_PER_CHAR); + } + + c_y_lval.ttype = c_tree_build_int_2(low, high); + CTreeType( c_y_lval.ttype ) = c_long_long_unsigned_type_node; + + /* If warn_traditional, calculate both the ANSI type and the + traditional type, then see if they disagree. + Otherwise, calculate only the type for the dialect in use. */ + if (c_warn_traditional || c_flag_traditional) + { + /* Calculate the traditional type. */ + /* Traditionally, any constant is signed; + but if unsigned is specified explicitly, obey that. + Use the smallest size with the right number of bits, + except for one special case with decimal constants. */ + if (! spec_long && base != 10 + && c_int_fits_type_p(c_y_lval.ttype, c_unsigned_type_node)) + traditional_type = (spec_unsigned ? c_unsigned_type_node + : c_integer_type_node); + /* A decimal constant must be long + if it does not fit in type int. + I think this is independent of whether + the constant is signed. */ + else if (! spec_long && base == 10 + && c_int_fits_type_p(c_y_lval.ttype, c_integer_type_node)) + traditional_type = (spec_unsigned ? c_unsigned_type_node + : c_integer_type_node); + else if (! spec_long_long) + traditional_type = (spec_unsigned ? c_long_unsigned_type_node + : c_long_integer_type_node); + else + traditional_type = (spec_unsigned + ? c_long_long_unsigned_type_node + : c_long_long_integer_type_node); + } + if (c_warn_traditional || ! c_flag_traditional) + { + /* Calculate the ANSI type. */ + if (! spec_long && ! spec_unsigned + && c_int_fits_type_p(c_y_lval.ttype, c_integer_type_node)) + ansi_type = c_integer_type_node; + else if (! spec_long && (base != 10 || spec_unsigned) + && c_int_fits_type_p(c_y_lval.ttype, c_unsigned_type_node)) + ansi_type = c_unsigned_type_node; + else if (! spec_unsigned && !spec_long_long + && c_int_fits_type_p(c_y_lval.ttype, c_long_integer_type_node)) + ansi_type = c_long_integer_type_node; + else if (! spec_long_long + && c_int_fits_type_p(c_y_lval.ttype, + c_long_unsigned_type_node)) + ansi_type = c_long_unsigned_type_node; + else if (! spec_unsigned + && c_int_fits_type_p(c_y_lval.ttype, + c_long_long_integer_type_node)) + ansi_type = c_long_long_integer_type_node; + else + ansi_type = c_long_long_unsigned_type_node; + } + + type = c_flag_traditional ? traditional_type : ansi_type; + + if (c_warn_traditional && traditional_type != ansi_type) + { + if ( CTreeTypePrecision(traditional_type) != + CTreeTypePrecision(ansi_type)) + { + warning ("width of integer constant changes with -traditional"); + } + else if ( CIsTreeNodeUnsigned(traditional_type) != + CIsTreeNodeUnsigned(ansi_type)) + { + warning("integer constant is unsigned in ANSI C, signed with -traditional"); + } + else + { + warning("width of integer constant may change on other systems with -traditional"); + } + } + + if (c_pedantic && !c_flag_traditional && !spec_long_long && !warn + && (CTreeTypePrecision(c_long_integer_type_node) + < CTreeTypePrecision(type))) + { + pedwarn("integer constant out of range"); + } + + if (base == 10 && ! spec_unsigned && CIsTreeNodeUnsigned(type)) + { + warning("decimal constant is so large that it is unsigned"); + } + + if (spec_imag) + { + if ( CTreeTypePrecision(type) + <= CTreeTypePrecision(c_integer_type_node)) + c_y_lval.ttype + = c_tree_build_complex((c_tree_node *)0, c_integer_zero_node, + c_convert_expr(c_integer_type_node, c_y_lval.ttype)); + else + { + error ("complex integer constant is too wide for `complex int'"); + } + } + else if (c_flag_traditional && !c_int_fits_type_p (c_y_lval.ttype, type)) + /* The traditional constant 0x80000000 is signed + but doesn't fit in the range of int. + This will change it to -0x80000000, which does fit. */ + { + CTreeType(c_y_lval.ttype) = c_get_unsigned_type(type); + c_y_lval.ttype = c_convert_expr(type, c_y_lval.ttype); + CClearTreeNodeCstOverflow( c_y_lval.ttype ); + CClearTreeNodeOverflow( c_y_lval.ttype ); + } + else + { + CTreeType(c_y_lval.ttype) = type; + } + } + + UNGETC (c); + *p = 0; + + if (isalnum (c) || c == '.' || c == '_' || c == '$' + || (!c_flag_traditional && (c == '-' || c == '+') + && (p[-1] == 'e' || p[-1] == 'E'))) + { + error ("missing white space after number `%s'", token_buffer); + } + + value = tok_CONSTANT; break; + } + + case '\'': + char_constant: + { + register int result = 0; + register int num_chars = 0; + unsigned width = CTreeTypePrecision(c_char_type_node); + int max_chars; + + if (wide_flag) + { + width = C_WCHAR_TYPE_SIZE; +#ifdef MULTIBYTE_CHARS + max_chars = MB_CUR_MAX; +#else + max_chars = 1; +#endif + } + else + max_chars = CTreeTypePrecision( c_integer_type_node ) / width; + + while (1) + { + tryagain: + + c = GETC(); + + if (c == '\'' || c == EOF) + break; + + if (c == '\\') + { + int ignore = 0; + c = readescape (&ignore); + if (ignore) + goto tryagain; + if (width < C_HOST_BITS_PER_INT + && (unsigned) c >= (1 << width)) + { + pedwarn ("escape sequence out of range for character"); + } +#ifdef MAP_CHARACTER + if (isprint (c)) + c = MAP_CHARACTER (c); +#endif + } + else if (c == '\n') + { + if (c_pedantic) + { + pedwarn ("ANSI C forbids newline in character constant"); + } + c_lineno++; + } +#ifdef MAP_CHARACTER + else + c = MAP_CHARACTER (c); +#endif + + num_chars++; + if (num_chars > maxtoken - 4) + extend_token_buffer( token_buffer ); + + token_buffer[num_chars] = c; + + /* Merge character into result; ignore excess chars. */ + if (num_chars < max_chars + 1) + { + if (width < C_HOST_BITS_PER_INT) + result = (result << width) | (c & ((1 << width) - 1)); + else + result = c; + } + } + + token_buffer[num_chars + 1] = '\''; + token_buffer[num_chars + 2] = 0; + + if (c != '\'') + { + error("malformatted character constant"); + } + else if (num_chars == 0) + { + error("empty character constant"); + } + else if (num_chars > max_chars) + { + num_chars = max_chars; + { + error ("character constant too long"); + } + } + else if (num_chars != 1 && ! c_flag_traditional) + { + warning("multi-character character constant"); + } + + /* If char type is signed, sign-extend the constant. */ + if (! wide_flag) + { + int num_bits = num_chars * width; + if (num_bits == 0) + /* We already got an error; avoid invalid shift. */ + c_y_lval.ttype = c_tree_build_int_2 (0, 0); + else if ( CIsTreeNodeUnsigned( c_char_type_node ) + || ((result >> (num_bits - 1)) & 1) == 0) + c_y_lval.ttype + = c_tree_build_int_2( result & ((unsigned int) ~0 + >> (C_HOST_BITS_PER_WIDE_INT - num_bits)), 0); + else + c_y_lval.ttype + = c_tree_build_int_2 (result | ~((unsigned int) ~0 + >> (C_HOST_BITS_PER_WIDE_INT - num_bits)), -1); + CTreeType( c_y_lval.ttype ) = c_integer_type_node; + } + else + { +#ifdef MULTIBYTE_CHARS + /* Set the initial shift state and convert the next sequence. */ + result = 0; + /* In all locales L'\0' is zero and mbtowc will return zero, + so don't use it. */ + if (num_chars > 1 + || (num_chars == 1 && token_buffer[1] != '\0')) + { + wchar_t wc; + (void) mbtowc (NULL_PTR, NULL_PTR, 0); + if (mbtowc (& wc, token_buffer + 1, num_chars) == num_chars) + result = wc; + else + { + warning ("Ignoring invalid multibyte character"); + } + } +#endif + c_y_lval.ttype = c_tree_build_int_2(result, 0); + CTreeType( c_y_lval.ttype ) = c_wchar_type_node; + } + value = tok_CONSTANT; + break; + } + + case '"': + string_constant: + { + c = GETC(); + p = token_buffer + 1; + + while (c != '"' && c >= 0) + { + if (c == '\\') + { + int ignore = 0; + c = readescape (&ignore); + if (ignore) + goto skipnewline; + if (!wide_flag + && CTreeTypePrecision( c_char_type_node) < C_HOST_BITS_PER_INT + && c >= (1 << CTreeTypePrecision( c_char_type_node ))) + { + pedwarn ("escape sequence out of range for character"); + } + } + else if (c == '\n') + { + if (c_pedantic) + { + pedwarn ("ANSI C forbids newline in string constant"); + } + c_lineno++; + } + + if (p == token_buffer + maxtoken) + p = extend_token_buffer (p); + *p++ = c; + + skipnewline: + c = GETC(); + } + + *p = 0; + + if (c < 0) + { + error ("Unterminated string constant"); + } + + /* We have read the entire constant. + Construct a STRING_CST for the result. */ + + if (wide_flag) + { + /* If this is a L"..." wide-string, convert the multibyte string + to a wide character string. */ + char *widep = (char *) autallocblock((p - token_buffer) * C_WCHAR_BYTES); + int len; + +#ifdef MULTIBYTE_CHARS + len = mbstowcs ((wchar_t *) widep, token_buffer + 1, p - token_buffer); + if (len < 0 || len >= (p - token_buffer)) + { + warning ("Ignoring invalid multibyte string"); + len = 0; + } + bzero (widep + (len * WCHAR_BYTES), WCHAR_BYTES); +#else + { + char *wp, *cp; + + wp = widep + (C_BYTES_BIG_ENDIAN ? C_WCHAR_BYTES - 1 : 0); + bzero (widep, (p - token_buffer) * C_WCHAR_BYTES); + for (cp = token_buffer + 1; cp < p; cp++) + *wp = *cp, wp += C_WCHAR_BYTES; + len = p - token_buffer - 1; + } +#endif + c_y_lval.ttype = c_tree_build_string ((len + 1) * C_WCHAR_BYTES, widep); + CTreeType( c_y_lval.ttype ) = c_wchar_array_type_node; + value = tok_STRING; + } +# ifdef LUDO_DONE + else if (objc_flag) + { + extern tree build_objc_string(); + /* Return an Objective-C @"..." constant string object. */ + c_y_lval.ttype = build_objc_string (p - token_buffer, + token_buffer + 1); + TREE_TYPE (c_y_lval.ttype) = char_array_type_node; + value = tok_OBJC_STRING; + } +# endif + else + { + *p++ = '"'; + *p = 0; + + c_y_lval.ttype = c_tree_build_string(p - token_buffer, token_buffer ); + CTreeType( c_y_lval.ttype ) = c_char_array_type_node; + value = tok_STRING; + } + + + break; + } + + case '+': + case '-': + case '&': + case '|': + case ':': + case '<': + case '>': + case '*': + case '/': + case '%': + case '^': + case '!': + case '=': + { + register int c1; + + combine: + + switch (c) + { + case '+': + c_y_lval.code = C_PLUS_EXPR; break; + case '-': + c_y_lval.code = C_MINUS_EXPR; break; + case '&': + c_y_lval.code = C_BIT_AND_EXPR; break; + case '|': + c_y_lval.code = C_BIT_IOR_EXPR; break; + case '*': + c_y_lval.code = C_MULT_EXPR; break; + case '/': + c_y_lval.code = C_TRUNC_DIV_EXPR; break; + case '%': + c_y_lval.code = C_TRUNC_MOD_EXPR; break; + case '^': + c_y_lval.code = C_BIT_XOR_EXPR; break; + case tok_LSHIFT: + c_y_lval.code = C_LSHIFT_EXPR; break; + case tok_RSHIFT: + c_y_lval.code = C_RSHIFT_EXPR; break; + case '<': + c_y_lval.code = C_LT_EXPR; break; + case '>': + c_y_lval.code = C_GT_EXPR; break; + } + + token_buffer[1] = c1 = GETC(); + token_buffer[2] = 0; + + if (c1 == '=') + { + switch (c) + { + case '<': + value = tok_ARITHCOMPARE; c_y_lval.code = C_LE_EXPR; goto done; + case '>': + value = tok_ARITHCOMPARE; c_y_lval.code = C_GE_EXPR; goto done; + case '!': + value = tok_EQCOMPARE; c_y_lval.code = C_NE_EXPR; goto done; + case '=': + value = tok_EQCOMPARE; c_y_lval.code = C_EQ_EXPR; goto done; + } + value = tok_ASSIGN; goto done; + } + else if (c == c1) + switch (c) + { + case '+': + value = tok_PLUSPLUS; goto done; + case '-': + value = tok_MINUSMINUS; goto done; + case '&': + value = tok_ANDAND; goto done; + case '|': + value = tok_OROR; goto done; + case '<': + c = tok_LSHIFT; + goto combine; + case '>': + c = tok_RSHIFT; + goto combine; + } + else + switch (c) + { + case '-': + if (c1 == '>') + { value = tok_POINTSAT; goto done; } + break; + case ':': + if (c1 == '>') + { value = ']'; goto done; } + break; + case '<': + if (c1 == '%') + { value = '{'; indent_level++; goto done; } + if (c1 == ':') + { value = '['; goto done; } + break; + case '%': + if (c1 == '>') + { value = '}'; indent_level--; goto done; } + break; + } + UNGETC (c1); + token_buffer[1] = 0; + + if ((c == '<') || (c == '>')) + value = tok_ARITHCOMPARE; + else value = c; + goto done; + } + + case 0: + /* Don't make c_y_parse think this is eof. */ + value = 1; + break; + + case '{': + indent_level++; + value = c; + break; + + case '}': + indent_level--; + value = c; + break; + + default: + value = c; + } + +done: +/* c_y_lloc.last_line = lineno; */ + + return value; +} + +/* Sets the value of the 'c_y_debug' variable to VALUE. + This is a function so we don't have to have C_Y_DEBUG defined + in order to build the compiler. */ + +void +set_c_y_debug (value) + int value; +{ +#if C_Y_DEBUG != 0 + c_y_debug = value; +#else + warning ("C_Y_DEBUG not defined."); +#endif +} diff --git a/alliance/src/gcp/src/c_clex.h b/alliance/src/gcp/src/c_clex.h new file mode 100644 index 00000000..24af2c6c --- /dev/null +++ b/alliance/src/gcp/src/c_clex.h @@ -0,0 +1,120 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/* Define constants for communication with c-parse.y. + Copyright (C) 1987, 1992 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + + + +enum rid +{ + RID_UNUSED, + RID_INT, + RID_CHAR, + RID_FLOAT, + RID_DOUBLE, + RID_VOID, + RID_UNUSED1, + + RID_UNSIGNED, + RID_SHORT, + RID_LONG, + RID_AUTO, + RID_STATIC, + RID_EXTERN, + RID_REGISTER, + RID_TYPEDEF, + RID_SIGNED, + RID_CONST, + RID_VOLATILE, + RID_INLINE, + RID_NOALIAS, + RID_ITERATOR, + RID_COMPLEX, + + RID_IN, + RID_OUT, + RID_INOUT, + RID_BYCOPY, + RID_ONEWAY, + RID_ID, + + RID_MAX +}; + +typedef struct c_stmt_or_label +{ + c_tree_node *stmt; + int ends_in_label; + +} c_stmt_or_label; + + +#define NORID RID_UNUSED + +#define RID_FIRST_MODIFIER RID_UNSIGNED + +/* The elements of `ridpointers' are identifier nodes + for the reserved type names and storage classes. + It is indexed by a RID_... value. */ +extern c_tree_node *c_ridpointers[(int) RID_MAX]; + +/* the declaration found for the last IDENTIFIER token read in. + yylex must look this up to detect typedefs, which get token type TYPENAME, + so it is left around in case the identifier is not a typedef but is + used in a context which makes it a reference to a variable. */ +extern c_tree_node *c_lastiddecl; + +extern char *token_buffer; /* Pointer to token buffer. */ + +# ifdef LUDO_NO_SKIP +extern tree make_pointer_declarator(); +extern int yylex (); +# else + extern int c_y_lex __P(()); +# endif + extern void c_reinit_parse_for_function __P(()); + extern void c_position_after_white_space __P(()); + extern void c_init_lex __P(( char *InputFileName )); + + extern char *get_directive_line (); diff --git a/alliance/src/gcp/src/c_common.c b/alliance/src/gcp/src/c_common.c new file mode 100644 index 00000000..f0724f12 --- /dev/null +++ b/alliance/src/gcp/src/c_common.c @@ -0,0 +1,527 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : C | +| | +| File : c_common.c | +| | +| Date : 09.07.99 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include + +# include "mut.h" +# include "aut.h" +# include "gcp.h" + +# include "c_flags.h" +# include "c_tree.h" +# include "c_treecompat.h" +# include "c_cdecl.h" +# include "c_convert.h" +# include "c_ctypeck.h" +# include "c_common.h" +# include "c_foldconst.h" +# include "c_debug.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + +/* Print a warning if a constant expression had overflow in folding. + Invoke this function on every expression that the language + requires to be a constant expression. + Note the ANSI C standard says it is erroneous for a + constant expression to overflow. */ + +void c_constant_expression_warning (value) + c_tree_node *value; +{ + if (( CTreeNodeFirstCode(value) == C_INT_CST_NODE || CTreeNodeFirstCode(value) == C_REAL_CST_NODE + || CTreeNodeFirstCode(value) == C_COMPLEX_NODE) + && CIsTreeNodeStatic(value) && c_pedantic) + { + pedwarn ("overflow in constant expression"); + } +} + +/* Given X, an unsigned number, return the largest int Y such that 2**Y <= X. + If X is 0, return -1. + + This should be used via the floor_log2 macro. */ + +int +c_floor_log2_wide (x) + register unsigned C_HOST_WIDE_INT x; +{ + register int log = -1; + while (x != 0) + log++, + x >>= 1; + return log; +} + + +/* Return the minimum number of bits needed to represent VALUE in a + signed or unsigned type, UNSIGNEDP says which. */ + +int c_min_precision (value, unsignedp) + c_tree_node *value; + int unsignedp; +{ + int log; + + /* If the value is negative, compute its negative minus 1. The latter + adjustment is because the absolute value of the largest negative value + is one larger than the largest positive value. This is equivalent to + a bit-wise negation, so use that operation instead. */ + + if (c_tree_is_int_cst_sgn(value) < 0) + value = c_fold (c_tree_build_unary_typed_expr(C_BIT_NOT_EXPR, CTreeType(value), value)); + + /* Return the number of bits needed, taking into account the fact + that we need one more bit for a signed than unsigned type. */ + + if (c_tree_is_integer_zerop (value)) + log = 0; + else if (CTreeIntCstHigh(value) != 0) + log = C_HOST_BITS_PER_WIDE_INT + c_floor_log2_wide (CTreeIntCstHigh(value)); + else + log = c_floor_log2_wide (CTreeIntCstLow(value)); + + return log + 1 + ! unsignedp; +} + + +/* Validate the expression after `case' and apply default promotions. */ + +c_tree_node *c_check_case_value(value) + c_tree_node *value; +{ + if (value == NULL) + return value; + + /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */ + CStripTypeNops(value); + + if ( CTreeNodeFirstCode(value) != C_INT_CST_NODE + && value != c_error_mark_node) + { + error ("case label does not reduce to an integer constant"); + value = c_error_mark_node; + } + else + /* Promote char or short to int. */ + value = c_default_conversion(value); + + c_constant_expression_warning(value); + + return value; +} + + +/* Subroutine of build_binary_op, used for comparison operations. + See if the operands have both been converted from subword integer types + and, if so, perhaps change them both back to their original type. + This function is also responsible for converting the two operands + to the proper common type for comparison. + + The arguments of this function are all pointers to local variables + of build_binary_op: OP0_PTR is &OP0, OP1_PTR is &OP1, + RESTYPE_PTR is &RESULT_TYPE and RESCODE_PTR is &RESULTCODE. + + If this function returns nonzero, it means that the comparison has + a constant value. What this function returns is an expression for + that value. */ + +c_tree_node *c_shorten_compare(op0_ptr, op1_ptr, restype_ptr, rescode_ptr) + c_tree_node **op0_ptr; + c_tree_node **op1_ptr; + c_tree_node **restype_ptr; + int *rescode_ptr; +{ + c_tree_node *type; + c_tree_node *op0 = *op0_ptr; + c_tree_node *op1 = *op1_ptr; + int unsignedp0, unsignedp1; + int real1, real2; + c_tree_node *primop0; + c_tree_node *primop1; + int code = *rescode_ptr; + + /* Throw away any conversions to wider types + already present in the operands. */ + + primop0 = c_get_narrower(op0, &unsignedp0); + primop1 = c_get_narrower(op1, &unsignedp1); + + /* Handle the case that OP0 does not *contain* a conversion + but it *requires* conversion to FINAL_TYPE. */ + + if (op0 == primop0 && CTreeType(op0) != *restype_ptr) + unsignedp0 = CIsTreeNodeUnsigned(CTreeType(op0)); + if (op1 == primop1 && CTreeType(op1) != *restype_ptr) + unsignedp1 = CIsTreeNodeUnsigned(CTreeType(op1)); + + /* If one of the operands must be floated, we cannot optimize. */ + real1 = CTreeTypeCode(CTreeType(primop0)) == C_REAL_TYPE; + real2 = CTreeTypeCode(CTreeType(primop1)) == C_REAL_TYPE; + + /* If first arg is constant, swap the args (changing operation + so value is preserved), for canonicalization. Don't do this if + the second arg is 0. */ + + if ( CIsTreeNodeConstant(primop0) + && ! c_tree_is_integer_zerop(primop1) && ! + c_tree_is_real_zerop(primop1)) + { + c_tree_node *tem = primop0; + int temi = unsignedp0; + primop0 = primop1; + primop1 = tem; + tem = op0; + op0 = op1; + op1 = tem; + *op0_ptr = op0; + *op1_ptr = op1; + unsignedp0 = unsignedp1; + unsignedp1 = temi; + temi = real1; + real1 = real2; + real2 = temi; + + switch (code) + { + case C_LT_EXPR: + code = C_GT_EXPR; + break; + case C_GT_EXPR: + code = C_LT_EXPR; + break; + case C_LE_EXPR: + code = C_GE_EXPR; + break; + case C_GE_EXPR: + code = C_LE_EXPR; + break; + default: + break; + } + *rescode_ptr = code; + } + + /* If comparing an integer against a constant more bits wide, + maybe we can deduce a value of 1 or 0 independent of the data. + Or else truncate the constant now + rather than extend the variable at run time. + + This is only interesting if the constant is the wider arg. + Also, it is not safe if the constant is unsigned and the + variable arg is signed, since in this case the variable + would be sign-extended and then regarded as unsigned. + Our technique fails in this case because the lowest/highest + possible unsigned results don't follow naturally from the + lowest/highest possible values of the variable operand. + For just EQ_EXPR and NE_EXPR there is another technique that + could be used: see if the constant can be faithfully represented + in the other operand's type, by truncating it and reextending it + and see if that preserves the constant's value. */ + + if (!real1 && !real2 + && CTreeNodeFirstCode(primop1) == C_INT_CST_NODE + && CTreeTypePrecision(CTreeType(primop0)) < CTreeTypePrecision(*restype_ptr)) + { + int min_gt, max_gt, min_lt, max_lt; + c_tree_node *maxval; + c_tree_node *minval; + /* 1 if comparison is nominally unsigned. */ + int unsignedp = CIsTreeNodeUnsigned(*restype_ptr); + c_tree_node *val; + + type = c_get_signed_or_unsigned_type(unsignedp0, CTreeType(primop0)); + + maxval = CTreeTypeMaxValue(type); + minval = CTreeTypeMinValue(type); + + if (unsignedp && !unsignedp0) + *restype_ptr = c_get_signed_type(*restype_ptr); + + if (CTreeType(primop1) != *restype_ptr) + primop1 = c_convert_expr(*restype_ptr, primop1); + if (type != *restype_ptr) + { + minval = c_convert_expr(*restype_ptr, minval); + maxval = c_convert_expr(*restype_ptr, maxval); + } + + if (unsignedp && unsignedp0) + { + min_gt = INT_CST_LT_UNSIGNED (primop1, minval); + max_gt = INT_CST_LT_UNSIGNED (primop1, maxval); + min_lt = INT_CST_LT_UNSIGNED (minval, primop1); + max_lt = INT_CST_LT_UNSIGNED (maxval, primop1); + } + else + { + min_gt = INT_CST_LT (primop1, minval); + max_gt = INT_CST_LT (primop1, maxval); + min_lt = INT_CST_LT (minval, primop1); + max_lt = INT_CST_LT (maxval, primop1); + } + + val = 0; + /* This used to be a switch, but Genix compiler can't handle that. */ + if (code == C_NE_EXPR) + { + if (max_lt || min_gt) + val = c_boolean_true_node; + } + else if (code == C_EQ_EXPR) + { + if (max_lt || min_gt) + val = c_boolean_false_node; + } + else if (code == C_LT_EXPR) + { + if (max_lt) + val = c_boolean_true_node; + if (!min_lt) + val = c_boolean_false_node; + } + else if (code == C_GT_EXPR) + { + if (min_gt) + val = c_boolean_true_node; + if (!max_gt) + val = c_boolean_false_node; + } + else if (code == C_LE_EXPR) + { + if (!max_gt) + val = c_boolean_true_node; + if (min_gt) + val = c_boolean_false_node; + } + else if (code == C_GE_EXPR) + { + if (!min_lt) + val = c_boolean_true_node; + if (max_lt) + val = c_boolean_false_node; + } + + /* If primop0 was sign-extended and unsigned comparison specd, + we did a signed comparison above using the signed type bounds. + But the comparison we output must be unsigned. + + Also, for inequalities, VAL is no good; but if the signed + comparison had *any* fixed result, it follows that the + unsigned comparison just tests the sign in reverse + (positive values are LE, negative ones GE). + So we can generate an unsigned comparison + against an extreme value of the signed type. */ + + if (unsignedp && !unsignedp0) + { + if (val != 0) + switch (code) + { + case C_LT_EXPR: + case C_GE_EXPR: + primop1 = CTreeTypeMinValue(type); + val = 0; + break; + + case C_LE_EXPR: + case C_GT_EXPR: + primop1 = CTreeTypeMaxValue(type); + val = 0; + break; + + default: + break; + } + type = c_get_unsigned_type(type); + } + + if (!max_gt && !unsignedp0 && CTreeNodeFirstCode(primop0) != C_INT_CST_NODE) + { + /* This is the case of (char)x >?< 0x80, which people used to use + expecting old C compilers to change the 0x80 into -0x80. */ + if (val == c_boolean_false_node) + { + warning ("comparison is always 0 due to limited range of data type"); + } + if (val == c_boolean_true_node) + { + warning ("comparison is always 1 due to limited range of data type"); + } + } + + if (!min_lt && unsignedp0 && CTreeNodeFirstCode(primop0) != C_INT_CST_NODE) + { + /* This is the case of (unsigned char)x >?< -1 or < 0. */ + if (val == c_boolean_false_node) + { + warning ("comparison is always 0 due to limited range of data type"); + } + if (val == c_boolean_true_node) + { + warning ("comparison is always 1 due to limited range of data type"); + } + } + + if (val != 0) + { + /* Don't forget to evaluate PRIMOP0 if it has side effects. */ + if ( CIsTreeNodeSideEffect(primop0)) + return c_tree_build_binary_typed_expr( + C_COMPOUND_EXPR, CTreeType(val), primop0, val); + return val; + } + + /* Value is not predetermined, but do the comparison + in the type of the operand that is not constant. + TYPE is already properly set. */ + } + else if (real1 && real2 + && (CTreeTypePrecision(CTreeType(primop0)) + == CTreeTypePrecision(CTreeType(primop1)))) + type = CTreeType(primop0); + + /* If args' natural types are both narrower than nominal type + and both extend in the same manner, compare them + in the type of the wider arg. + Otherwise must actually extend both to the nominal + common type lest different ways of extending + alter the result. + (eg, (short)-1 == (unsigned short)-1 should be 0.) */ + + else if (unsignedp0 == unsignedp1 && real1 == real2 + && CTreeTypePrecision(CTreeType(primop0)) < CTreeTypePrecision(*restype_ptr) + && CTreeTypePrecision(CTreeType(primop1)) < CTreeTypePrecision(*restype_ptr)) + { + type = c_get_common_type(CTreeType(primop0), CTreeType(primop1)); + type = c_get_signed_or_unsigned_type(unsignedp0 + || CIsTreeNodeUnsigned(*restype_ptr), + type); + /* Make sure shorter operand is extended the right way + to match the longer operand. */ + primop0 = c_convert_expr( + c_get_signed_or_unsigned_type(unsignedp0, CTreeType(primop0)), primop0); + primop1 = c_convert_expr( + c_get_signed_or_unsigned_type(unsignedp1, CTreeType(primop1)), primop1); + } + else + { + /* Here we must do the comparison on the nominal type + using the args exactly as we received them. */ + type = *restype_ptr; + primop0 = op0; + primop1 = op1; + + if (!real1 && !real2 && c_tree_is_integer_zerop(primop1) + && CIsTreeNodeUnsigned(*restype_ptr)) + { + c_tree_node *value = 0; + switch (code) + { + case C_GE_EXPR: + /* All unsigned values are >= 0, so we warn if extra warnings + are requested. However, if OP0 is a constant that is + >= 0, the signedness of the comparison isn't an issue, + so suppress the warning. */ + if (c_extra_warnings + && ! ( CTreeNodeFirstCode(primop0) == C_INT_CST_NODE + && ! CIsTreeNodeOverflow( + c_convert_expr(c_get_signed_type(type), primop0)))) + { + warning ("unsigned value >= 0 is always 1"); + } + value = c_boolean_true_node; + break; + + case C_LT_EXPR: + if (c_extra_warnings + && ! ( CTreeNodeFirstCode(primop0) == C_INT_CST_NODE + && ! CIsTreeNodeOverflow( + c_convert_expr(c_get_signed_type(type), primop0)))) + { + warning ("unsigned value < 0 is always 0"); + } + value = c_boolean_false_node; + break; + + default: + break; + } + + if (value != 0) + { + /* Don't forget to evaluate PRIMOP0 if it has side effects. */ + if ( CIsTreeNodeSideEffect(primop0)) + return c_tree_build_binary_typed_expr( + C_COMPOUND_EXPR, CTreeType(value), primop0, value); + return value; + } + } + } + + *op0_ptr = c_convert_expr(type, primop0); + *op1_ptr = c_convert_expr(type, primop1); + + *restype_ptr = c_boolean_type_node; + + return 0; +} diff --git a/alliance/src/gcp/src/c_common.h b/alliance/src/gcp/src/c_common.h new file mode 100644 index 00000000..30d5fbe2 --- /dev/null +++ b/alliance/src/gcp/src/c_common.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : C | +| | +| File : c_common.h | +| | +| Date : 09.07.99 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef C_COMMON_H +# define C_COMMON_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + extern void c_constant_expression_warning __P((c_tree_node *value)); + extern int c_min_precision __P((c_tree_node *value, int unsignedp)); + extern c_tree_node * c_check_case_value __P((c_tree_node *value)); + extern c_tree_node * c_check_case_value __P((c_tree_node *value)); + extern c_tree_node * c_shorten_compare __P(( c_tree_node **op0_ptr, c_tree_node **op1_ptr, c_tree_node **restype_ptr, int *rescode_ptr )); + +# endif diff --git a/alliance/src/gcp/src/c_convert.c b/alliance/src/gcp/src/c_convert.c new file mode 100644 index 00000000..304b6d18 --- /dev/null +++ b/alliance/src/gcp/src/c_convert.c @@ -0,0 +1,1267 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : C | +| | +| File : c_convert.c | +| | +| Date : 09.07.99 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include + +# include "mut.h" +# include "aut.h" +# include "gcp.h" + +# include "c_tree.h" +# include "c_treecompat.h" +# include "c_cdecl.h" +# include "c_ctypeck.h" +# include "c_flags.h" +# include "c_convert.h" +# include "c_foldconst.h" +# include "c_debug.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + +/* Convert EXPR to some pointer or reference type TYPE. + + EXPR must be pointer, reference, integer, enumeral, or literal zero; + in other cases error is called. */ + +c_tree_node *c_convert_to_pointer( type, expr ) + + c_tree_node *type; + c_tree_node *expr; +{ + c_tree_node *intype = CTreeType(expr); + int form = CTreeTypeCode(intype); + + if ( c_tree_is_integer_zerop(expr)) + { + expr = c_tree_build_int_2(0, 0); + CTreeType(expr) = type; + return expr; + } + + if (form == C_POINTER_TYPE || form == C_REFERENCE_TYPE) + { + expr = c_tree_build_unary_expr( C_NOP_EXPR, expr ); + CTreeType( expr ) = type; + + return( expr ); + } + + + if ( form == C_INTEGER_TYPE || form == C_ENUMERAL_TYPE ) + { + if (c_type_precision(intype) == C_POINTER_TYPE_SIZE) + { + expr = c_tree_build_unary_expr( C_CONVERT_EXPR, expr ); + CTreeType( expr ) = type; + + return expr; + } + + expr = c_convert_expr(c_get_type_for_size(C_POINTER_TYPE_SIZE, 0), expr); + /* Modes may be different but sizes should be the same. */ +# ifdef LUDO_DONE + if (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (expr))) + != GET_MODE_SIZE (TYPE_MODE (type))) + /* There is supposed to be some integral type + that is the same width as a pointer. */ + abort (); +# endif + return c_convert_to_pointer(type, expr); + } + + error ("cannot convert to a pointer type"); + + expr = c_tree_build_int_2(0, 0); + CTreeType(expr) = type; + + return expr; +} + +/* Convert EXPR to some floating-point type TYPE. + + EXPR must be float, integer, or enumeral; + in other cases error is called. */ + +c_tree_node *c_convert_to_real(type, expr) + c_tree_node *type; + c_tree_node *expr; +{ + int form = CTreeTypeCode( CTreeType(expr)); + + if (form == C_REAL_TYPE) + { + expr = c_tree_build_unary_expr( + c_flag_float_store ? C_CONVERT_EXPR : C_NOP_EXPR, expr ); + + CTreeType( expr ) = type; + + return( expr ); + } + + if ( INTEGRAL_TYPE_P( CTreeType(expr))) + { + expr = c_tree_build_unary_expr( C_FLOAT_EXPR, expr ); + CTreeType( expr ) = type; + + return( expr ); + } + + if (form == C_COMPLEX_TYPE) + { + c_tree_node *tmp; + + tmp = c_tree_build_unary_expr( C_REALPART_EXPR, expr ); + CTreeType( tmp ) = CTreeType( CTreeType( expr ) ); + tmp = c_fold( tmp ); + + expr = c_convert_expr( type, tmp ); + + return( expr ); + } + + if (form == C_POINTER_TYPE || form == C_REFERENCE_TYPE) + { + error ("pointer value used where a floating point value was expected"); + } + else + { + error ("aggregate value used where a float was expected"); + } + + { + c_tree_node *tem = c_tree_add_node( C_REAL_CST_NODE ); + CTreeType(tem) = type; + CTreeRealCstValue(tem) = 0.0; +# ifdef LUDO_DONE + TREE_REAL_CST (tem) = REAL_VALUE_ATOF ("0.0", TYPE_MODE (type)); +# endif + return tem; + } +} + +/* Convert EXPR to the complex type TYPE in the usual ways. */ + +c_tree_node *c_convert_to_complex(type, expr) + c_tree_node *type; + c_tree_node *expr; +{ + int form = CTreeTypeCode( CTreeType(expr)); + c_tree_node *subtype = CTreeType(type); + + if (form == C_REAL_TYPE || form == C_INTEGER_TYPE || form == C_ENUMERAL_TYPE) + { + expr = c_convert_expr( subtype, expr ); + + expr = c_tree_build_binary_expr( + C_COMPLEX_EXPR, expr, + c_convert_expr(subtype, c_integer_zero_node)); + + CTreeType( expr ) = type; + + return( expr ); + } + + if ( form == C_COMPLEX_TYPE ) + { + c_tree_node *elt_type = CTreeType( CTreeType(expr)); + if ( CTreeTypeMainVariant(elt_type) == CTreeTypeMainVariant(subtype)) + { + return expr; + } + else if ( CTreeExprCode(expr) == C_COMPLEX_EXPR) + { + expr = c_tree_build_binary_expr( + C_COMPLEX_EXPR, + c_convert_expr(subtype, CTreeExprOperand(expr, 0)), + c_convert_expr(subtype, CTreeExprOperand(expr, 1))); + CTreeType( expr ) = type; + expr = c_fold( expr ); + + return( expr ); + } + else + { + c_tree_node *oper1; + c_tree_node *oper2; + + oper1 = c_tree_build_unary_expr( C_REALPART_EXPR, expr); + CTreeType( oper1 ) = CTreeType( CTreeType(expr)); + oper1 = c_fold( oper1 ); + + oper2 = c_tree_build_unary_expr( C_IMAGPART_EXPR, expr); + CTreeType( oper2 ) = CTreeType( CTreeType(expr)); + oper2 = c_fold( oper2 ); + + expr = c_tree_build_binary_expr( + C_COMPLEX_EXPR, + c_convert_expr(subtype,oper1), + c_convert_expr(subtype,oper2) ); + + CTreeType( expr ) = type; + expr = c_fold( expr ); + + return( expr ); + } + } + + if (form == C_POINTER_TYPE || form == C_REFERENCE_TYPE) + { + error ("pointer value used where a complex was expected"); + } + else + { + error ("aggregate value used where a complex was expected"); + } + + expr = c_tree_build_binary_expr( C_COMPLEX_EXPR, + c_convert_expr(subtype, c_integer_zero_node), + c_convert_expr(subtype, c_integer_zero_node)); + + CTreeType( expr ) = type; + + return( expr ); +} + +/* Convert EXPR to some integer (or enum) type TYPE. + EXPR must be pointer, integer, discrete (enum, char, or bool), or float; + in other cases error is called. + + The result of this is always supposed to be a newly created tree node + not in use in any existing structure. */ + +c_tree_node *c_convert_to_integer(type, expr) + c_tree_node *type; + c_tree_node *expr; +{ + c_tree_node *intype = CTreeType(expr); + int form = CTreeTypeCode(intype); + + if (form == C_POINTER_TYPE || form == C_REFERENCE_TYPE) + { + if (c_tree_is_integer_zerop (expr)) + { + expr = c_integer_zero_node; + intype = CTreeType( expr ); + } + else + { + intype = c_get_type_for_size( C_POINTER_TYPE_SIZE, 0); + expr = c_tree_build_unary_expr( C_CONVERT_EXPR, expr); + CTreeType( expr ) = intype; + expr = c_fold( expr ); + } + + form = CTreeTypeCode(intype); + + if (intype == type) + { + return expr; + } + } + + if (form == C_INTEGER_TYPE || form == C_ENUMERAL_TYPE + || form == C_BOOLEAN_TYPE || form == C_CHAR_TYPE) + { + unsigned outprec = CTreeTypePrecision(type); + unsigned inprec = CTreeTypePrecision(intype); + int ex_form = CTreeExprCode(expr); + + /* If we are widening the type, put in an explicit conversion. + Similarly if we are not changing the width. However, if this is + a logical operation that just returns 0 or 1, we can change the + type of the expression. For logical operations, we must + also change the types of the operands to maintain type + correctness. */ + + if ( (ex_form == C_LT_EXPR) || + (ex_form == C_LE_EXPR) || + (ex_form == C_GT_EXPR) || + (ex_form == C_GE_EXPR) || + (ex_form == C_EQ_EXPR) || + (ex_form == C_NE_EXPR) || + (ex_form == C_SET_LE_EXPR) ) + { + CTreeType(expr) = type; + return expr; + } + else if (ex_form == C_TRUTH_AND_EXPR || ex_form == C_TRUTH_ANDIF_EXPR + || ex_form == C_TRUTH_OR_EXPR || ex_form == C_TRUTH_ORIF_EXPR + || ex_form == C_TRUTH_XOR_EXPR) + { + CTreeExprOperand(expr, 0) = c_convert_expr(type, CTreeExprOperand(expr, 0)); + CTreeExprOperand(expr, 1) = c_convert_expr(type, CTreeExprOperand(expr, 1)); + CTreeType(expr) = type; + + return expr; + } + else if (ex_form == C_TRUTH_NOT_EXPR) + { + CTreeExprOperand(expr, 0) = c_convert_expr(type, CTreeExprOperand(expr, 0)); + CTreeType(expr) = type; + return expr; + } + else if (outprec >= inprec) + { + expr = c_tree_build_unary_expr( C_NOP_EXPR, expr); + CTreeType( expr ) = type; + return expr; + } + + /* If TYPE is an enumeral type or a type with a precision less + than the number of bits in its mode, do the conversion to the + type corresponding to its mode, then do a nop conversion + to TYPE. */ +# ifdef LUDO_DONE + else if ( CTreeTypeCode(type) == C_ENUMERAL_TYPE + || outprec != GET_MODE_BITSIZE(TYPE_MODE (type))) + { + return build1 (NOP_EXPR, type, + convert (type_for_mode (TYPE_MODE (type), + TREE_UNSIGNED (type)), + expr)); + } +# endif + + /* Here detect when we can distribute the truncation down past some + arithmetic. For example, if adding two longs and converting to an + int, we can equally well convert both to ints and then add. + For the operations handled here, such truncation distribution + is always safe. + It is desirable in these cases: + 1) when truncating down to full-word from a larger size + 2) when truncating takes no work. + 3) when at least one operand of the arithmetic has been extended + (as by C's default conversions). In this case we need two conversions + if we do the arithmetic as already requested, so we might as well + truncate both and then combine. Perhaps that way we need only one. + + Note that in general we cannot do the arithmetic in a type + shorter than the desired result of conversion, even if the operands + are both extended from a shorter type, because they might overflow + if combined in that type. The exceptions to this--the times when + two narrow values can be combined in their narrow type even to + make a wider result--are handled by "shorten" in build_binary_op. */ + + switch (ex_form) + { + case C_RSHIFT_EXPR: + /* We can pass truncation down through right shifting + when the shift count is a nonpositive constant. */ + if ( CTreeNodeFirstCode( CTreeExprOperand(expr, 1)) == C_INT_CST_NODE + && c_tree_is_int_cst_lt( CTreeExprOperand(expr, 1), + c_convert_expr( CTreeType(CTreeExprOperand (expr, 1)), + c_integer_one_node))) + goto trunc1; + break; + + case C_LSHIFT_EXPR: + /* We can pass truncation down through left shifting + when the shift count is a nonnegative constant. */ + if ( CTreeNodeFirstCode(CTreeExprOperand(expr, 1)) == C_INT_CST_NODE + && c_tree_is_int_cst_sgn(CTreeExprOperand(expr, 1)) >= 0 + && CTreeNodeFirstCode( CTreeTypeSize(type)) == C_INT_CST_NODE) + { + /* If shift count is less than the width of the truncated type, + really shift. */ + if ( c_tree_is_int_cst_lt(CTreeExprOperand(expr, 1), + CTreeTypeSize(type))) + /* In this case, shifting is like multiplication. */ + goto trunc1; + else + { + /* If it is >= that width, result is zero. + Handling this with trunc1 would give the wrong result: + (int) ((long long) a << 32) is well defined (as 0) + but (int) a << 32 is undefined and would get a + warning. */ + + c_tree_node *t = c_convert_to_integer(type, c_integer_zero_node); + + /* If the original expression had side-effects, we must + preserve it. */ + if ( CIsTreeNodeSideEffect(expr)) + { + c_tree_node *tmp_node; + + tmp_node = c_tree_build_binary_expr( C_COMPOUND_EXPR, expr, t ); + CTreeType( tmp_node ) = type; + + return tmp_node; + } + else + return t; + } + } + break; + + case C_MAX_EXPR: + case C_MIN_EXPR: + case C_MULT_EXPR: + { + c_tree_node *arg0 = c_get_unwidened( CTreeExprOperand(expr, 0), type); + c_tree_node *arg1 = c_get_unwidened( CTreeExprOperand(expr, 1), type); + + /* Don't distribute unless the output precision is at least as big + as the actual inputs. Otherwise, the comparison of the + truncated values will be wrong. */ + if (outprec >= CTreeTypePrecision( CTreeType(arg0)) + && outprec >= CTreeTypePrecision( CTreeType(arg1)) + /* If signedness of arg0 and arg1 don't match, + we can't necessarily find a type to compare them in. */ + && ( CIsTreeNodeUnsigned( CTreeType(arg0)) + == CIsTreeNodeUnsigned( CTreeType(arg1)))) + goto trunc1; + break; + } + + case C_PLUS_EXPR: + case C_MINUS_EXPR: + case C_BIT_AND_EXPR: + case C_BIT_IOR_EXPR: + case C_BIT_XOR_EXPR: + case C_BIT_ANDTC_EXPR: + trunc1: + { +# ifdef LUDO_DONE + c_tree_node * arg0 = c_get_unwidened(CTreeExprOperand (expr, 0), type); + c_tree_node * arg1 = c_get_unwidened(CTreeExprOperand (expr, 1), type); + + if (outprec >= C_BITS_PER_WORD + || TRULY_NOOP_TRUNCATION (outprec, inprec) + || inprec > TYPE_PRECISION (TREE_TYPE (arg0)) + || inprec > TYPE_PRECISION (TREE_TYPE (arg1))) + { + /* Do the arithmetic in type TYPEX, + then convert result to TYPE. */ + register tree typex = type; + + /* Can't do arithmetic in enumeral types + so use an integer type that will hold the values. */ + if (TREE_CODE (typex) == ENUMERAL_TYPE) + typex = type_for_size (TYPE_PRECISION (typex), + TREE_UNSIGNED (typex)); + + /* But now perhaps TYPEX is as wide as INPREC. + In that case, do nothing special here. + (Otherwise would recurse infinitely in convert. */ + if (TYPE_PRECISION (typex) != inprec) + { + /* Don't do unsigned arithmetic where signed was wanted, + or vice versa. + Exception: if either of the original operands were + unsigned then can safely do the work as unsigned. + And we may need to do it as unsigned + if we truncate to the original size. */ + typex = ((TREE_UNSIGNED (TREE_TYPE (expr)) + || TREE_UNSIGNED (TREE_TYPE (arg0)) + || TREE_UNSIGNED (TREE_TYPE (arg1))) + ? unsigned_type (typex) : signed_type (typex)); + return convert (type, + c_fold (build (ex_form, typex, + convert (typex, arg0), + convert (typex, arg1), + 0))); + } + } +# endif + } + break; + + case C_NEGATE_EXPR: + case C_BIT_NOT_EXPR: + /* This is not correct for ABS_EXPR, + since we must test the sign before truncation. */ + { + c_tree_node *typex = type; + + /* Can't do arithmetic in enumeral types + so use an integer type that will hold the values. */ + if ( CTreeTypeCode(typex) == C_ENUMERAL_TYPE) + typex = c_get_type_for_size( CTreeTypePrecision(typex), + CIsTreeNodeUnsigned(typex)); + + /* But now perhaps TYPEX is as wide as INPREC. + In that case, do nothing special here. + (Otherwise would recurse infinitely in convert. */ + if ( CTreeTypePrecision(typex) != inprec) + { + c_tree_node *tmp_node; + /* Don't do unsigned arithmetic where signed was wanted, + or vice versa. */ + typex = ( CIsTreeNodeUnsigned( CTreeType(expr)) + ? c_get_unsigned_type(typex) : c_get_signed_type(typex)); + + tmp_node = c_tree_build_unary_expr( ex_form, + c_convert_expr( typex, CTreeExprOperand( expr, 0 ) ) ); + CTreeType( tmp_node ) = typex; + tmp_node = c_fold( tmp_node ); + + return c_convert_expr(type, tmp_node ); + } + } + + case C_NOP_EXPR: + /* If truncating after truncating, might as well do all at once. + If truncating after extending, we may get rid of wasted work. */ + return c_convert_expr(type, c_get_unwidened(CTreeExprOperand(expr, 0), type)); + + case C_COND_EXPR: + /* Can treat the two alternative values like the operands + of an arithmetic expression. */ + { +# ifdef LUDO_DONE + c_tree_node * arg1 = c_get_unwidened(CTreeExprOperand (expr, 1), type); + c_tree_node * arg2 = c_get_unwidened(CTreeExprOperand (expr, 2), type); + + if (outprec >= BITS_PER_WORD + || TRULY_NOOP_TRUNCATION (outprec, inprec) + || inprec > TYPE_PRECISION (TREE_TYPE (arg1)) + || inprec > TYPE_PRECISION (TREE_TYPE (arg2))) + { + /* Do the arithmetic in type TYPEX, + then convert result to TYPE. */ + register tree typex = type; + + /* Can't do arithmetic in enumeral types + so use an integer type that will hold the values. */ + if (TREE_CODE (typex) == ENUMERAL_TYPE) + typex = type_for_size (TYPE_PRECISION (typex), + TREE_UNSIGNED (typex)); + + /* But now perhaps TYPEX is as wide as INPREC. + In that case, do nothing special here. + (Otherwise would recurse infinitely in convert. */ + if (TYPE_PRECISION (typex) != inprec) + { + /* Don't do unsigned arithmetic where signed was wanted, + or vice versa. */ + typex = (TREE_UNSIGNED (TREE_TYPE (expr)) + ? unsigned_type (typex) : signed_type (typex)); + return convert (type, + fold (build (COND_EXPR, typex, + CTreeExprOperand (expr, 0), + convert (typex, arg1), + convert (typex, arg2)))); + } + else + /* It is sometimes worthwhile + to push the narrowing down through the conditional. */ + return fold (build (COND_EXPR, type, + CTreeExprOperand (expr, 0), + convert (type, CTreeExprOperand (expr, 1)), + convert (type, CTreeExprOperand (expr, 2)))); + } +# endif + } + break; + + default: + break; + } + + expr = c_tree_build_unary_expr( C_NOP_EXPR, expr); + CTreeType( expr ) = type; + return expr; + } + + if (form == C_REAL_TYPE) + { + expr = c_tree_build_unary_expr( C_FIX_TRUNC_EXPR, expr ); + CTreeType( expr ) = type; + + return( expr ); + } + + if (form == C_COMPLEX_TYPE) + { + c_tree_node *tmp_type; + + tmp_type = CTreeType( CTreeType( expr ) ); + expr = c_tree_build_unary_expr( C_REALPART_EXPR, expr ); + CTreeType( expr ) = tmp_type; + expr = c_fold( expr ); + expr = c_convert_expr( type, expr ); + + return( expr ); + } + + error ("aggregate value used where an integer was expected"); + + { + c_tree_node *tem = c_tree_build_int_2 (0, 0); + CTreeType(tem) = type; + + return tem; + } +} + +/* Create an expression whose value is that of EXPR, + converted to type TYPE. The TREE_TYPE of the value is always TYPE. This + function implements all reasonable conversions; callers should filter out + those that are not permitted by the language being compiled. */ + +c_tree_node *c_convert_expr( type, expr ) + + c_tree_node *type; + c_tree_node *expr; +{ + c_tree_node *e = expr; + c_tree_node *result = c_error_mark_node; + int type_type = CTreeTypeCode(type); + + if (type == CTreeType(expr) + || CTreeNodeFirstCode(expr) == C_ERROR_NODE) + result = expr; + else + if (CTreeTypeMainVariant(type) == CTreeTypeMainVariant( CTreeType(expr))) + { + e = c_tree_build_unary_expr( C_NOP_EXPR, e); + CTreeType( e ) = type; + + result = c_fold( e ); + } + else + if ( CTreeNodeFirstCode( CTreeType(expr)) == C_ERROR_NODE) + { + result = c_error_mark_node; + } + else + if ( CTreeTypeCode( CTreeType(expr)) == C_VOID_TYPE) + { + error("void value not ignored as it ought to be"); + result = c_error_mark_node; + } + else + if (type_type == C_VOID_TYPE) + { + e = c_tree_build_unary_expr( C_CONVERT_EXPR, e); + CTreeType( e ) = type; + + result = e; + } + else + if (type_type == C_INTEGER_TYPE || type_type == C_ENUMERAL_TYPE) + { + result = c_fold( c_convert_to_integer(type, e) ); + } + else + if (type_type == C_POINTER_TYPE) + { + result = c_fold( c_convert_to_pointer(type, e) ); + } + else + if (type_type == C_REAL_TYPE) + { + result = c_fold( c_convert_to_real(type, e) ); + } + else + if (type_type == C_COMPLEX_TYPE) + { + result = c_fold( c_convert_to_complex(type, e) ); + } + else + { + error("conversion to non-scalar type requested"); + } + + return result; +} + + +/* Return the innermost context enclosing DECL that is + a FUNCTION_DECL, or zero if none. */ + +c_tree_node *c_get_decl_function_context(decl) + c_tree_node *decl; +{ + c_tree_node *context; + + if ( CTreeNodeFirstCode(decl) == C_ERROR_NODE) + return 0; + + if ( CTreeNodeFirstCode(decl) == C_EXPR_NODE && + CTreeDeclCode(decl) == C_SAVE_EXPR ) + context = CTreeExprOperand(decl,1); + else + context = CTreeDeclContext(decl); + + while (context && ( CTreeNodeFirstCode(context) != C_DECL_NODE || + CTreeDeclCode(context) != C_FUNCTION_DECL) ) + { + if ( (CTreeNodeFirstCode(context) == C_TYPE_NODE) && + ( CTreeTypeCode(context) == C_RECORD_TYPE + || CTreeTypeCode(context) == C_UNION_TYPE + || CTreeTypeCode(context) == C_QUAL_UNION_TYPE)) + context = CTreeTypeContext(context); + else if ( CTreeNodeFirstCode(context) == C_DECL_NODE && + CTreeDeclCode(context) == C_TYPE_DECL) + context = CTreeDeclContext(context); + else if ( CTreeNodeFirstCode(context) == C_BLOCK_NODE) + context = CTreeBlockSuperContext(context); + else + /* Unhandled CONTEXT !? */ + abort (); + } + + return context; +} + + +/* Return nonzero if arg is static -- a reference to an object in + static storage. This is not the same as the C meaning of `static'. */ + +int +c_is_staticp(arg) + + c_tree_node *arg; +{ + int code; + + code = CTreeNodeFirstCode(arg); + + if ( code == C_DECL_NODE ) + { + switch ( CTreeDeclCode( arg ) ) + { + case C_FUNCTION_DECL: + /* Nested functions aren't static, since taking their address + involves a trampoline. */ + return c_get_decl_function_context(arg) == 0 || CIsTreeDeclRegister(arg); + case C_VAR_DECL: + return CIsTreeNodeStatic(arg) || CIsTreeDeclExternal(arg); + } + } + else + if ( code == C_EXPR_NODE ) + { + switch ( CTreeExprCode(arg)) + { + case C_CONSTRUCTOR_EXPR: + return CIsTreeNodeStatic(arg); + + /* If we are referencing a bitfield, we can't evaluate an + ADDR_EXPR at compile time and so it isn't a constant. */ + case C_COMPONENT_REF: + return (! CIsTreeDeclBitField( CTreeExprOperand(arg, 1)) + && c_is_staticp( CTreeExprOperand(arg, 0))); + + case C_BIT_FIELD_REF: + return 0; + + case C_ARRAY_REF: + if ( CTreeNodeFirstCode( CTreeTypeSize( CTreeType(arg))) == C_INT_CST_NODE + && CTreeNodeFirstCode( CTreeExprOperand(arg, 1)) == C_INT_CST_NODE) + return c_is_staticp( CTreeExprOperand(arg, 0)); + } + } + else + if ( code == C_STRING_NODE ) + { + return 1; + } + + return 0; +} + +/* Perform default promotions for C data used in expressions. + Arrays and functions are converted to pointers; + enumeral types or short or char, to int. + In addition, manifest constants symbols are replaced by their values. */ + +c_tree_node *c_default_conversion( exp ) + + c_tree_node *exp; +{ + c_tree_node *type = CTreeType(exp); + int code = CTreeTypeCode(type); + + /* Constants can be used directly unless they're not loadable. */ + if ( ( CTreeNodeFirstCode(exp) == C_DECL_NODE ) && + ( CTreeDeclCode(exp) == C_CONST_DECL) ) + { + exp = CTreeDeclInitial(exp); + } + + /* Replace a nonvolatile const static variable with its value unless + it is an array, in which case we must be sure that taking the + address of the array produces consistent results. */ +# ifdef LUDO_DONE + else if (optimize && TREE_CODE (exp) == VAR_DECL && code != ARRAY_TYPE) + { + exp = c_decl_constant_value(exp); + type = TREE_TYPE (exp); + } +# endif + + /* Strip NON_LVALUE_EXPRs and no-op conversions, since we aren't using as + an lvalue. */ + /* Do not use STRIP_NOPS here! It will remove conversions from pointer + to integer and cause infinite recursion. */ + while ( CTreeExprCode(exp) == C_NON_LVALUE_EXPR + || ( CTreeExprCode(exp) == C_NOP_EXPR + && CTreeType( CTreeExprOperand(exp, 0)) == CTreeType(exp))) + { + exp = CTreeExprOperand(exp, 0); + } + + /* Normally convert enums to int, + but convert wide enums to something wider. */ + if (code == C_ENUMERAL_TYPE) + { +#define MAX(X,Y) ((X) > (Y) ? (X) : (Y)) + + type = c_get_type_for_size( + MAX( CTreeTypePrecision(type), + CTreeTypePrecision(c_integer_type_node)), + ((c_flag_traditional + || (CTreeTypePrecision(type) + >= CTreeTypePrecision(c_integer_type_node))) + && CIsTreeNodeUnsigned(type))); + return c_convert_expr(type, exp); + } + + if ( CTreeExprCode(exp) == C_COMPONENT_REF + && CIsTreeDeclCBitField( CTreeExprOperand(exp, 1))) + { + c_tree_node *width = CTreeDeclSize( CTreeExprOperand(exp, 1)); + int low = CTreeIntCstLow(width); + + /* If it's thinner than an int, promote it like a + C_PROMOTING_INTEGER_TYPE_P, otherwise leave it alone. */ + + if (low < CTreeTypePrecision(c_integer_type_node)) + { + if (c_flag_traditional && CIsTreeNodeUnsigned(type)) + { + return c_convert_expr(c_unsigned_type_node, exp); + } + else + { + return c_convert_expr(c_integer_type_node, exp); + } + } + } + +#define C_PROMOTING_INTEGER_TYPE_P(t) \ + ( CTreeTypeCode((t)) == C_INTEGER_TYPE \ + && ( CTreeTypeMainVariant(t) == c_char_type_node \ + || CTreeTypeMainVariant(t) == c_signed_char_type_node \ + || CTreeTypeMainVariant(t) == c_unsigned_char_type_node \ + || CTreeTypeMainVariant(t) == c_short_integer_type_node \ + || CTreeTypeMainVariant(t) == c_short_unsigned_type_node)) + + if (C_PROMOTING_INTEGER_TYPE_P (type)) + { + /* Traditionally, unsignedness is preserved in default promotions. + Also preserve unsignedness if not really getting any wider. */ + if ( CIsTreeNodeUnsigned(type) + && (c_flag_traditional + || CTreeTypePrecision(type) == CTreeTypePrecision(c_integer_type_node))) + return c_convert_expr(c_unsigned_type_node, exp); + return c_convert_expr(c_integer_type_node, exp); + } + if (c_flag_traditional && !c_flag_allow_single_precision + && CTreeTypeMainVariant(type) == c_float_type_node) + return c_convert_expr(c_double_type_node, exp); + + if (code == C_VOID_TYPE) + { + error ("void value not ignored as it ought to be"); + return c_error_mark_node; + } + + if (code == C_FUNCTION_TYPE) + { + return c_parser_build_unary_op( C_ADDR_EXPR, exp, 0); + } + + if (code == C_ARRAY_TYPE) + { + c_tree_node *adr; + c_tree_node *restype = CTreeType(type); + c_tree_node *ptrtype; + int constp = 0; + int volatilep = 0; + + if ( ( CTreeNodeFirstCode(exp) == C_EXPR_NODE && + ( CTreeExprCode(exp) == C_COMPONENT_REF + || CTreeExprCode(exp ) == C_BIT_FIELD_REF + || CTreeExprCode(exp ) == C_INDIRECT_REF + || CTreeExprCode(exp ) == C_BUFFER_REF + || CTreeExprCode(exp ) == C_ARRAY_REF)) + || ( CTreeNodeFirstCode(exp) == C_DECL_NODE ) ) + { + constp = CIsTreeNodeReadOnly(exp); + volatilep = CIsTreeNodeVolatile(exp); + } + + if ( CIsTreeNodeReadOnly(type) || + CIsTreeNodeVolatile(type) + || constp || volatilep) + { + restype = c_tree_build_type_variant(restype, + CIsTreeNodeReadOnly(type) || constp, + CIsTreeNodeVolatile(type) || volatilep); + } + if ( CTreeExprCode(exp) == C_INDIRECT_REF) + { + return c_convert_expr( CTreeTypePointerTo(restype), CTreeExprOperand(exp, 0)); + } + + if ( CTreeExprCode(exp) == C_COMPOUND_EXPR) + { + c_tree_node *op1 = c_default_conversion( CTreeExprOperand(exp, 1)); + + exp = c_tree_build_binary_expr( C_COMPOUND_EXPR, CTreeExprOperand( exp, 0 ), op1 ); + CTreeType( exp ) = CTreeType( op1 ); + + return exp; + } + + if (! c_is_lvalue_p(exp) + && ! ( CTreeExprCode(exp) == C_CONSTRUCTOR_EXPR && CIsTreeNodeStatic(exp))) + { + error ("invalid use of non-lvalue array"); + return c_error_mark_node; + } + + ptrtype = c_tree_build_pointer_type(restype); + + if ( ( CTreeNodeFirstCode(exp) == C_DECL_NODE ) && + ( CTreeDeclCode( exp ) == C_VAR_DECL ) ) + { + /* ??? This is not really quite correct + in that the type of the operand of ADDR_EXPR + is not the target type of the type of the ADDR_EXPR itself. + Question is, can this lossage be avoided? */ + adr = c_tree_build_unary_typed_expr(C_ADDR_EXPR, ptrtype, exp); + if (c_mark_addressable(exp) == 0) + return c_error_mark_node; + if ( c_is_staticp(exp) ) CSetTreeNodeConstant(adr); + CClearTreeNodeSideEffect(adr); /* Default would be, same as EXP. */ + return adr; + } + /* This way is better for a COMPONENT_REF since it can + simplify the offset for a component. */ + adr = c_parser_build_unary_op( C_ADDR_EXPR, exp, 1); + return c_convert_expr (ptrtype, adr); + } + + return exp; +} + +/* Prepare expr to be an argument of a TRUTH_NOT_EXPR, + or validate its data type for an `if' or `while' statement or ?..: exp. + + This preparation consists of taking the ordinary + representation of an expression expr and producing a valid tree + boolean expression describing whether expr is nonzero. We could + simply always do build_binary_op (NE_EXPR, expr, boolean_false_node, 1), + but we optimize comparisons, &&, ||, and !. + + The resulting type should always be `boolean_type_node'. */ + +c_tree_node *c_truthvalue_conversion(expr) + + c_tree_node *expr; +{ + c_tree_node *tmp_node; + + if ( CTreeNodeFirstCode(expr) == C_ERROR_NODE) + { + return expr; + } + + if ( CTreeNodeFirstCode(expr) == C_INT_CST_NODE ) + { + return c_tree_is_integer_zerop(expr) ? c_boolean_false_node : c_boolean_true_node; + } + + if ( CTreeNodeFirstCode(expr) == C_REAL_CST_NODE ) + { + return c_tree_is_real_zerop(expr) ? c_boolean_false_node : c_boolean_true_node; + } + + switch ( CTreeExprCode(expr)) + { + case C_EQ_EXPR: + case C_NE_EXPR: + case C_LE_EXPR: + case C_GE_EXPR: + case C_LT_EXPR: + case C_GT_EXPR: + case C_TRUTH_ANDIF_EXPR: + case C_TRUTH_ORIF_EXPR: + case C_TRUTH_AND_EXPR: + case C_TRUTH_OR_EXPR: + case C_TRUTH_XOR_EXPR: + case C_TRUTH_NOT_EXPR: + + CTreeType(expr) = c_boolean_type_node; + + return expr; + + case C_ADDR_EXPR: + /* If we are taking the address of a external decl, it might be zero + if it is weak, so we cannot optimize. */ + if ( CTreeNodeFirstCode(CTreeExprOperand (expr, 0)) == C_DECL_NODE + && CIsTreeDeclExternal(CTreeExprOperand(expr, 0))) break; + + if (CIsTreeNodeSideEffect( CTreeExprOperand(expr, 0))) + { + tmp_node = c_tree_build_binary_expr( + C_COMPOUND_EXPR, CTreeExprOperand(expr, 0), c_boolean_true_node); + CTreeType( tmp_node ) = c_boolean_type_node; + + return( tmp_node ); + } + else + return c_boolean_true_node; + + case C_COMPLEX_EXPR: + + tmp_node = c_build_binary_op( + ( CIsTreeNodeSideEffect( CTreeExprOperand(expr, 1)) + ? C_TRUTH_OR_EXPR : C_TRUTH_ORIF_EXPR), + c_truthvalue_conversion( CTreeExprOperand(expr, 0)), + c_truthvalue_conversion( CTreeExprOperand(expr, 1)), 0 ); + + case C_NEGATE_EXPR: + case C_ABS_EXPR: + case C_FLOAT_EXPR: + case C_FFS_EXPR: + /* These don't change whether an object is non-zero or zero. */ + return c_truthvalue_conversion( CTreeExprOperand(expr, 0)); + + case C_LROTATE_EXPR: + case C_RROTATE_EXPR: + /* These don't change whether an object is zero or non-zero, but + we can't ignore them if their second arg has side-effects. */ + if ( CIsTreeNodeSideEffect( CTreeExprOperand(expr, 1))) + { + tmp_node = c_tree_build_binary_expr( + C_COMPOUND_EXPR, CTreeExprOperand(expr, 1), + c_truthvalue_conversion( CTreeExprOperand(expr, 0))); + CTreeType( tmp_node ) = c_boolean_type_node; + + return( tmp_node ); + } + else + return c_truthvalue_conversion( CTreeExprOperand(expr, 0)); + + case C_COND_EXPR: + /* Distribute the conversion into the arms of a COND_EXPR. */ + tmp_node = c_tree_build_ternary_expr( + C_COND_EXPR, + CTreeExprOperand(expr, 0), + c_truthvalue_conversion( CTreeExprOperand(expr, 1)), + c_truthvalue_conversion( CTreeExprOperand(expr, 2))); + + CTreeType( tmp_node ) = c_boolean_type_node; + + return( tmp_node ); + + case C_CONVERT_EXPR: + /* Don't cancel the effect of a CONVERT_EXPR from a REFERENCE_TYPE, + since that affects how `default_conversion' will behave. */ + if ( CTreeTypeCode(CTreeType(expr)) == C_REFERENCE_TYPE + || CTreeTypeCode(CTreeType(CTreeExprOperand(expr,0))) == C_REFERENCE_TYPE) + break; + /* fall through... */ + case C_NOP_EXPR: + /* If this is widening the argument, we can ignore it. */ + if ( CTreeTypePrecision(CTreeType(expr)) + >= CTreeTypePrecision(CTreeType( CTreeExprOperand(expr, 0)))) + return c_truthvalue_conversion(CTreeExprOperand(expr, 0)); + break; + + case C_MINUS_EXPR: + /* With IEEE arithmetic, x - x may not equal 0, so we can't optimize + this case. */ +# ifdef LUDO_DONE + if (TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT + && TREE_CODE (CTreeType(expr)) == REAL_TYPE) + break; +# endif + /* fall through... */ + case C_BIT_XOR_EXPR: + /* This and MINUS_EXPR can be changed into a comparison of the + two objects. */ + if (CTreeType(CTreeExprOperand(expr, 0)) + == CTreeType(CTreeExprOperand(expr, 1))) + { + return( c_build_binary_op( + C_NE_EXPR, CTreeExprOperand(expr, 0), + CTreeExprOperand(expr, 1), 1 ) ); + } + + tmp_node = c_tree_build_unary_expr( C_NOP_EXPR, CTreeExprOperand(expr, 1)); + CTreeType( tmp_node ) = CTreeType(CTreeExprOperand(expr, 0)); + + return c_build_binary_op( C_NE_EXPR, CTreeExprOperand(expr, 0), tmp_node, 1 ); + + case C_BIT_AND_EXPR: + + if (c_tree_is_integer_onep(CTreeExprOperand (expr, 1)) + && CTreeType(expr) != c_boolean_type_node) + /* Using convert here would cause infinite recursion. */ + { + tmp_node = c_tree_build_unary_expr( C_NOP_EXPR, expr ); + CTreeType( tmp_node ) = c_boolean_type_node; + + return( tmp_node ); + } + break; + + case C_MODIFY_EXPR: + + if (c_warn_parentheses && CTreeExprComplexity(expr) == C_MODIFY_EXPR) + { + warning ("suggest parentheses around assignment used as truth value"); + } + break; + + default: + break; + } + + if ( CTreeTypeCode(CTreeType(expr)) == C_COMPLEX_TYPE) + { + return ( c_build_binary_op( + (CIsTreeNodeSideEffect(expr) ? C_TRUTH_OR_EXPR : C_TRUTH_ORIF_EXPR), + c_truthvalue_conversion( + c_parser_build_unary_op( C_REALPART_EXPR, expr, 0)), + c_truthvalue_conversion( + c_parser_build_unary_op( C_IMAGPART_EXPR, expr, 0)), 0 )); + } + + return c_build_binary_op( C_NE_EXPR, expr, c_integer_zero_node, 1 ); +} + + +/* Print a warning if a large constant is truncated to unsigned, + or if -Wconversion is used and a constant < 0 is converted to unsigned. + Invoke this function on every expression that might be implicitly + converted to an unsigned type. */ + +void c_unsigned_conversion_warning(result, operand) + c_tree_node *result; + c_tree_node *operand; +{ + if ( CTreeNodeFirstCode(operand) == C_INT_CST_NODE + && CTreeTypeCode(CTreeType(result)) == C_INTEGER_TYPE + && CIsTreeNodeUnsigned(CTreeType(result)) + && c_skip_evaluation == 0 + && !c_int_fits_type_p(operand, CTreeType(result))) + { + if (!c_int_fits_type_p(operand, c_get_signed_type(CTreeType(result)))) + /* This detects cases like converting -129 or 256 to unsigned char. */ + { + warning ("large integer implicitly truncated to unsigned type"); + } + else if (c_warn_conversion) + { + warning ("negative integer implicitly converted to unsigned type"); + } + } +} + +/* Convert EXPR to TYPE, warning about conversion problems with constants. + Invoke this function on every expression that is converted implicitly, + i.e. because of language rules and not because of an explicit cast. */ + +c_tree_node *c_convert_and_check(type, expr) + c_tree_node *type; + c_tree_node *expr; +{ + c_tree_node *t = c_convert_expr(type, expr); + if ( CTreeNodeFirstCode(t) == C_INT_CST_NODE) + { + if (CIsTreeNodeOverflow(t)) + { + CClearTreeNodeOverflow(t); + + /* Do not diagnose overflow in a constant expression merely + because a conversion overflowed. */ + if ( CIsTreeNodeCstOverflow(expr) ) CSetTreeNodeCstOverflow(t); + else CClearTreeNodeCstOverflow(t); + + /* No warning for converting 0x80000000 to int. */ + if (!(CIsTreeNodeUnsigned(type) < CIsTreeNodeUnsigned(CTreeType(expr)) + && CTreeNodeCode(CTreeType(expr)) == C_INTEGER_TYPE + && CTreeTypePrecision(type) == CTreeTypePrecision(CTreeType(expr)))) + /* If EXPR fits in the unsigned version of TYPE, + don't warn unless pedantic. */ + if ((c_pedantic + || CIsTreeNodeUnsigned(type) + || ! c_int_fits_type_p(expr, c_get_unsigned_type(type))) + && c_skip_evaluation == 0) + { + warning ("overflow in implicit constant conversion"); + } + } + else + c_unsigned_conversion_warning(t, expr); + } + return t; +} diff --git a/alliance/src/gcp/src/c_convert.h b/alliance/src/gcp/src/c_convert.h new file mode 100644 index 00000000..d69831d6 --- /dev/null +++ b/alliance/src/gcp/src/c_convert.h @@ -0,0 +1,82 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : C | +| | +| File : c_convert.h | +| | +| Date : 09.07.99 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef C_CONVERT_H +# define C_CONVERT_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern c_tree_node * c_convert_to_pointer __P((c_tree_node *type, c_tree_node *expr)); + extern c_tree_node * c_convert_to_real __P((c_tree_node *type, c_tree_node *expr)); + extern c_tree_node * c_convert_to_complex __P((c_tree_node *type, c_tree_node *expr)); + extern c_tree_node * c_convert_to_integer __P((c_tree_node *type, c_tree_node *expr)); + extern c_tree_node * c_convert_expr __P((c_tree_node *type, c_tree_node *expr)); + extern c_tree_node * c_default_conversion __P((c_tree_node *exp)); + extern c_tree_node * c_truthvalue_conversion __P((c_tree_node *expr)); + extern c_tree_node * c_convert_and_check __P((c_tree_node *type, c_tree_node *expr)); + extern int c_is_staticp __P((c_tree_node *arg)); + + c_tree_node *arg; + +# endif diff --git a/alliance/src/gcp/src/c_ctypeck.c b/alliance/src/gcp/src/c_ctypeck.c new file mode 100644 index 00000000..e9f1b5a4 --- /dev/null +++ b/alliance/src/gcp/src/c_ctypeck.c @@ -0,0 +1,7815 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : C | +| | +| File : c_ctypeck.c | +| | +| Date : 09.07.99 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "aut.h" +# include "gcp.h" + +# include "c_tree.h" +# include "c_treecompat.h" +# include "c_flags.h" +# include "c_cdecl.h" +# include "c_ctypeck.h" +# include "c_convert.h" +# include "c_debug.h" +# include "c_foldconst.h" +# include "c_stmt.h" +# include "c_common.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +/* Type of object we are accumulating a constructor for. + This type is always a RECORD_TYPE, UNION_TYPE or ARRAY_TYPE. */ +static c_tree_node *c_constructor_type; + +/* For a RECORD_TYPE or UNION_TYPE, this is the chain of fields + left to fill. */ +static c_tree_node *c_constructor_fields; + +/* For an ARRAY_TYPE, this is the specified index + at which to store the next element we get. + This is a special INTEGER_CST node that we modify in place. */ +static c_tree_node *c_constructor_index; + +/* For an ARRAY_TYPE, this is the end index of the range + to initialize with the next element, or NULL in the ordinary case + where the element is used just once. */ +static c_tree_node *c_constructor_range_end; + +/* For an ARRAY_TYPE, this is the maximum index. */ +static c_tree_node *c_constructor_max_index; + +/* For a RECORD_TYPE, this is the first field not yet written out. */ +static c_tree_node *c_constructor_unfilled_fields; + +/* For an ARRAY_TYPE, this is the index of the first element + not yet written out. + This is a special INTEGER_CST node that we modify in place. */ +static c_tree_node *c_constructor_unfilled_index; + +/* In a RECORD_TYPE, the byte index of the next consecutive field. + This is so we can generate gaps between fields, when appropriate. + This is a special INTEGER_CST node that we modify in place. */ +static c_tree_node *c_constructor_bit_index; + +/* If we are saving up the elements rather than allocating them, + this is the list of elements so far (in reverse order, + most recent first). */ +static c_tree_node *c_constructor_elements; + +/* 1 if so far this constructor's elements are all compile-time constants. */ +static int c_constructor_constant; + +/* 1 if so far this constructor's elements are all valid address constants. */ +static int c_constructor_simple; + +/* 1 if this constructor is erroneous so far. */ +static int c_constructor_erroneous; + +/* 1 if have called defer_addressed_constants. */ +static int c_constructor_subconstants_deferred; + +/* List of pending elements at this constructor level. + These are elements encountered out of order + which belong at places we haven't reached yet in actually + writing the output. */ +static c_tree_node *c_constructor_pending_elts; + +/* The SPELLING_DEPTH of this constructor. */ +static int c_constructor_depth; + +/* 0 if implicitly pushing constructor levels is allowed. */ +int c_constructor_no_implicit = 0; /* 0 for C; 1 for some other languages. */ + +/* 1 if this constructor level was entered implicitly. */ +# ifdef LUDO_NO_SKIP +static int c_constructor_implicit; +# endif + +static int c_require_constant_value; +static int c_require_constant_elements; + +/* 1 if it is ok to output this constructor as we read it. + 0 means must accumulate a CONSTRUCTOR expression. */ +static int c_constructor_incremental; + +/* DECL node for which an initializer is being read. + 0 means we are reading a constructor expression + such as (struct foo) {...}. */ +static c_tree_node *c_constructor_decl; + +/* start_init saves the ASMSPEC arg here for really_start_incremental_init. */ +static char *c_constructor_asmspec; + +/* Nonzero if this is an initializer for a top-level decl. */ +static int c_constructor_top_level; + +/* When we finish reading a constructor expression + (constructor_decl is 0), the CONSTRUCTOR goes here. */ +# ifdef LUDO_NO_SKIP +static c_tree_node *c_constructor_result; +# endif + +/* This stack has a level for each implicit or explicit level of + structuring in the initializer, including the outermost one. It + saves the values of most of the variables above. */ + +struct constructor_stack +{ + struct constructor_stack *next; + c_tree_node *type; + c_tree_node *fields; + c_tree_node *index; + c_tree_node *range_end; + c_tree_node *max_index; + c_tree_node *unfilled_index; + c_tree_node *unfilled_fields; + c_tree_node *bit_index; + c_tree_node *elements; + int offset; + c_tree_node *pending_elts; + int depth; + /* If nonzero, this value should replace the entire + constructor at this level. */ + c_tree_node *replacement_value; + char constant; + char simple; + char implicit; + char incremental; + char erroneous; + char outer; +}; + +struct constructor_stack *c_constructor_stack; + +/* This stack records separate initializers that are nested. + Nested initializers can't happen in ANSI C, but GNU C allows them + in cases like { ... (struct foo) { ... } ... }. */ + +struct initializer_stack +{ + struct initializer_stack *next; + c_tree_node *decl; + char *asmspec; + struct constructor_stack *constructor_stack; + c_tree_node *elements; + struct spelling *spelling; + struct spelling *spelling_base; + int spelling_size; + char top_level; + char incremental; + char require_constant_value; + char require_constant_elements; + char deferred; +}; + +struct initializer_stack *c_initializer_stack; + + +/* Nonzero if we've already printed a "missing braces around initializer" + message within this initializer. */ +static int c_missing_braces_mentioned; + + +/* Ajoute par Ludo pour obtenir la liste des constantes lors + * d'une initialisation de tableau ou de structure */ +static c_tree_node *c_output_constant_list = (c_tree_node *)0; + + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +/* Methods for storing and printing names for error messages. */ + +/* Implement a spelling stack that allows components of a name to be pushed + and popped. Each element on the stack is this structure. */ + +struct spelling +{ + int kind; + union + { + int i; + char *s; + } u; +}; + +#define SPELLING_STRING 1 +#define SPELLING_MEMBER 2 +#define SPELLING_BOUNDS 3 + +static struct spelling *c_spelling; /* Next stack element (unused). */ +static struct spelling *c_spelling_base; /* Spelling stack base. */ +static int c_spelling_size; /* Size of the spelling stack. */ + +/* Macros to save and restore the spelling stack around push_... functions. + Alternative to SAVE_SPELLING_STACK. */ + +#define SPELLING_DEPTH() (c_spelling - c_spelling_base) +#define RESTORE_SPELLING_DEPTH(depth) (c_spelling = c_spelling_base + depth) + +/* Save and restore the spelling stack around arbitrary C code. */ + +#define SAVE_SPELLING_DEPTH(code) \ +{ \ + int __depth = SPELLING_DEPTH (); \ + code; \ + RESTORE_SPELLING_DEPTH (__depth); \ +} + +/* Push an element on the spelling stack with type KIND and assign VALUE + to MEMBER. */ + +#define PUSH_SPELLING(KIND, VALUE, MEMBER) \ +{ \ + int depth = SPELLING_DEPTH (); \ + \ + if (depth >= c_spelling_size) \ + { \ + c_spelling_size += 10; \ + if (c_spelling_base == 0) \ + c_spelling_base \ + = (struct spelling *)autallocblock(c_spelling_size * sizeof (struct spelling)); \ + else \ + c_spelling_base \ + = (struct spelling *)mbkrealloc(c_spelling_base, \ + c_spelling_size * sizeof (struct spelling)); \ + RESTORE_SPELLING_DEPTH (depth); \ + } \ + \ + c_spelling->kind = (KIND); \ + c_spelling->MEMBER = (VALUE); \ + c_spelling++; \ +} + +/* Push STRING on the stack. Printed literally. */ + +static void +c_push_string (string) + char *string; +{ + PUSH_SPELLING (SPELLING_STRING, string, u.s); +} + +/* Push a member name on the stack. Printed as '.' STRING. */ + +static void +c_push_member_name (decl) + c_tree_node *decl; + +{ + char *string + = CTreeDeclName(decl) ? CTreeIdentPointer(CTreeDeclName(decl)) : ""; + PUSH_SPELLING (SPELLING_MEMBER, string, u.s); +} + +/* Push an array bounds on the stack. Printed as [BOUNDS]. */ + +static void +c_push_array_bounds (bounds) + int bounds; +{ + PUSH_SPELLING (SPELLING_BOUNDS, bounds, u.i); +} + +/* Compute the maximum size in bytes of the printed spelling. */ + +static int +c_spelling_length () +{ + register int size = 0; + register struct spelling *p; + + for (p = c_spelling_base; p < c_spelling; p++) + { + if (p->kind == SPELLING_BOUNDS) + size += 25; + else + size += strlen (p->u.s) + 1; + } + + return size; +} + +/* Print the spelling to BUFFER and return it. */ + +static char * +c_print_spelling (buffer) + register char *buffer; +{ + register char *d = buffer; + register char *s; + register struct spelling *p; + + for (p = c_spelling_base; p < c_spelling; p++) + if (p->kind == SPELLING_BOUNDS) + { + sprintf (d, "[%d]", p->u.i); + d += strlen (d); + } + else + { + if (p->kind == SPELLING_MEMBER) + *d++ = '.'; + for (s = p->u.s; (*d = *s++) != 0; d++) + ; + } + *d++ = '\0'; + return buffer; +} + +/* Provide a means to pass component names derived from the spelling stack. */ + +char c_initialization_message; + +/* Interpret the spelling of the given ERRTYPE message. */ + +static char * +c_get_spelling (errtype) + char *errtype; +{ + static char *buffer; + static int size = -1; + + if (errtype == &c_initialization_message) + { + /* Avoid counting chars */ + static char message[] = "initialization of `%s'"; + register int needed = sizeof (message) + c_spelling_length () + 1; + char *temp; + + if (size < 0) + buffer = (char *) autallocblock(size = needed); + if (needed > size) + buffer = (char *) mbkrealloc(buffer, size = needed); + + temp = (char *) alloca (needed); + sprintf (buffer, message, c_print_spelling (temp)); + return buffer; + } + + return errtype; +} + +/* Issue an error message for a bad initializer component. + FORMAT describes the message. OFWHAT is the name for the component. + LOCAL is a format string for formatting the insertion of the name + into the message. + + If OFWHAT is null, the component name is stored on the spelling stack. + If the component name is a null string, then LOCAL is omitted entirely. */ + +void +c_error_init (format, local, ofwhat) + char *format, *local, *ofwhat; +{ + char *buffer; + + if (ofwhat == 0) + ofwhat = c_print_spelling ((char *) autallocblock(c_spelling_length () + 1)); + buffer = (char *) autallocblock(strlen (local) + strlen (ofwhat) + 2); + + if (*ofwhat) + sprintf (buffer, local, ofwhat); + else + buffer[0] = 0; + + error (format, buffer); +} + +/* Issue a pedantic warning for a bad initializer component. + FORMAT describes the message. OFWHAT is the name for the component. + LOCAL is a format string for formatting the insertion of the name + into the message. + + If OFWHAT is null, the component name is stored on the spelling stack. + If the component name is a null string, then LOCAL is omitted entirely. */ + +void +c_pedwarn_init (format, local, ofwhat) + char *format, *local, *ofwhat; +{ + char *buffer; + + if (ofwhat == 0) + ofwhat = c_print_spelling ((char *) autallocblock(c_spelling_length () + 1)); + buffer = (char *) autallocblock(strlen (local) + strlen (ofwhat) + 2); + + if (*ofwhat) + sprintf (buffer, local, ofwhat); + else + buffer[0] = 0; + + c_pedwarn(format, buffer); +} + +/* Issue a warning for a bad initializer component. + FORMAT describes the message. OFWHAT is the name for the component. + LOCAL is a format string for formatting the insertion of the name + into the message. + + If OFWHAT is null, the component name is stored on the spelling stack. + If the component name is a null string, then LOCAL is omitted entirely. */ + +static void +c_warning_init (format, local, ofwhat) + char *format, *local, *ofwhat; +{ + char *buffer; + + if (ofwhat == 0) + ofwhat = c_print_spelling ((char *) autallocblock(c_spelling_length () + 1)); + buffer = (char *) autallocblock(strlen (local) + strlen (ofwhat) + 2); + + if (*ofwhat) + sprintf (buffer, local, ofwhat); + else + buffer[0] = 0; + + c_warning (format, buffer); +} + + +/* If pedantic, warn about improper lvalue. CODE is either COND_EXPR + COMPOUND_EXPR, or CONVERT_EXPR (for casts). */ + +static void +c_pedantic_lvalue_warning(code) + int code; +{ + if (c_pedantic) + { + c_pedwarn ("ANSI C forbids use of %s expressions as lvalues", + code == C_COND_EXPR ? "conditional" + : code == C_COMPOUND_EXPR ? "compound" : "cast"); + } +} + + +/* Warn about storing in something that is `const'. */ + +void c_readonly_warning(arg, string) + c_tree_node *arg; + char *string; +{ + char buf[80]; + strcpy (buf, string); + + /* Forbid assignments to iterators. */ + if ( CTreeNodeFirstCode(arg) == C_DECL_NODE && + CTreeDeclCode( arg ) == C_VAR_DECL && + CIsTreeDeclIterator(arg)) + { + strcat (buf, " of iterator `%s'"); + pedwarn (buf, CTreeIdentPointer(CTreeDeclName(arg))); + } + + if (CTreeNodeFirstCode(arg ) == C_EXPR_NODE && CTreeExprCode(arg) == C_COMPONENT_REF) + { + if ( CIsTreeNodeReadOnly(CTreeType(CTreeExprOperand(arg, 0)))) + { + c_readonly_warning (CTreeExprOperand(arg, 0), string); + } + else + { + strcat (buf, " of read-only member `%s'"); + pedwarn (buf, CTreeIdentPointer(CTreeDeclName(CTreeExprOperand(arg, 1)))); + } + } + else if ( CTreeNodeFirstCode(arg) == C_DECL_NODE && CTreeDeclCode(arg) == C_VAR_DECL) + { + strcat (buf, " of read-only variable `%s'"); + pedwarn (buf, CTreeIdentPointer(CTreeDeclName(arg))); + } + else + { + pedwarn ("%s of read-only location", buf); + } +} + + +/* Print a warning using MSG. + It gets OPNAME as its one parameter. + If OPNAME is null, it is replaced by "passing arg ARGNUM of `FUNCTION'". + FUNCTION and ARGNUM are handled specially if we are building an + Objective-C selector. */ + +static void +c_warn_for_assignment(msg, opname, function, argnum) + char *msg; + char *opname; + c_tree_node *function; + int argnum; +{ + static char argstring[] = "passing arg %d of `%s'"; + static char argnofun[] = "passing arg %d"; + + if (opname == 0) + { +# ifdef LUDO_NO_SKIP + c_tree_node *selector = maybe_building_objc_message_expr (); +# else + c_tree_node *selector = 0; +# endif + + if (selector && argnum > 2) + { + function = selector; + argnum -= 2; + } + if (function) + { + /* Function name is known; supply it. */ + opname = (char *) autallocblock(CTreeIdentLength(function) + + sizeof (argstring) + 25 /*%d*/ + 1); + sprintf (opname, argstring, argnum, CTreeIdentPointer(function)); + } + else + { + /* Function name unknown (call through ptr); just give arg number. */ + opname = (char *) autallocblock(sizeof (argnofun) + 25 /*%d*/ + 1); + sprintf (opname, argnofun, argnum); + } + } + c_pedwarn (msg, opname); +} + + +/* Apply unary lvalue-demanding operator CODE to the expression ARG + for certain kinds of expressions which are not really lvalues + but which we can accept as lvalues. + + If ARG is not a kind of expression we can handle, return zero. */ + +static c_tree_node *c_unary_complex_lvalue(code, arg) + int code; + c_tree_node *arg; +{ + /* Handle (a, b) used as an "lvalue". */ + if ( CTreeNodeFirstCode(arg) == C_EXPR_NODE && + CTreeExprCode(arg) == C_COMPOUND_EXPR) + { + c_tree_node *real_result = c_parser_build_unary_op(code, CTreeExprOperand(arg, 1), 0); + + /* If this returns a function type, it isn't really being used as + an lvalue, so don't issue a warning about it. */ + if ( CTreeTypeCode(CTreeType(arg)) != C_FUNCTION_TYPE) + { + c_pedantic_lvalue_warning (C_COMPOUND_EXPR); + } + + return c_tree_build_binary_typed_expr( C_COMPOUND_EXPR, CTreeType(real_result), + CTreeExprOperand(arg, 0), real_result); + } + + /* Handle (a ? b : c) used as an "lvalue". */ + if ( CTreeNodeFirstCode(arg) == C_EXPR_NODE && + CTreeExprCode(arg) == C_COND_EXPR) + { + c_pedantic_lvalue_warning(C_COND_EXPR); + if ( CTreeTypeCode(CTreeType(arg)) != C_FUNCTION_TYPE) + { + c_pedantic_lvalue_warning (C_COMPOUND_EXPR); + } + + return (c_parser_build_conditional_expr + (CTreeExprOperand(arg, 0), + c_parser_build_unary_op(code, CTreeExprOperand(arg, 1), 0), + c_parser_build_unary_op(code, CTreeExprOperand(arg, 2), 0))); + } + + return 0; +} + + +/* Subroutine of stabilize_reference; this is called for subtrees of + references. Any expression with side-effects must be put in a SAVE_EXPR + to ensure that it is only evaluated once. + + We don't put SAVE_EXPR nodes around everything, because assigning very + simple expressions to temporaries causes us to miss good opportunities + for optimizations. Among other things, the opportunity to fold in the + addition of a constant into an addressing mode often gets lost, e.g. + "y[i+1] += x;". In general, we take the approach that we should not make + an assignment unless we are forced into it - i.e., that any non-side effect + operator should be allowed, and that cse should take care of coalescing + multiple utterances of the same expression should that prove fruitful. */ + +c_tree_node *c_stabilize_reference_1(e) + c_tree_node *e; +{ + return( e ); +} + +/* Return either DECL or its known constant value (if it has one). */ + +c_tree_node *c_decl_constant_value(decl) + c_tree_node *decl; +{ + if (/* Don't change a variable array bound or initial value to a constant + in a place where a variable is invalid. */ + c_current_function_decl != 0 + && ! c_pedantic + && ! CIsTreeNodeVolatile(decl) + && CIsTreeNodeReadOnly(decl) && ! CIsTreeDeclIterator(decl) + && CTreeDeclInitial(decl) != 0 + && CTreeNodeFirstCode(CTreeDeclInitial(decl)) != C_ERROR_NODE + /* This is invalid if initial value is not constant. + If it has either a function call, a memory reference, + or a variable, then re-evaluating it could give different results. */ + && CIsTreeNodeConstant(CTreeDeclInitial(decl)) + /* Check for cases where this is sub-optimal, even though valid. */ + && ( CTreeNodeFirstCode(CTreeDeclInitial(decl)) != C_EXPR_NODE || + CTreeExprCode(CTreeDeclInitial(decl)) != C_CONSTRUCTOR_EXPR) +# ifdef LUDO_DONE + && CTreeDeclMode(decl) != BLKmode +# endif + ) + return CTreeDeclInitial(decl); + return decl; +} + + +/* Stabilize a reference so that we can use it any number of times + without causing its operands to be evaluated more than once. + Returns the stabilized reference. This works by means of save_expr, + so see the caveats in the comments about save_expr. + + Also allows conversion expressions whose operands are references. + Any other kind of expression is returned unchanged. */ + +c_tree_node *c_stabilize_reference(ref) + c_tree_node *ref; +{ + c_tree_node *result; + int code = CTreeNodeFirstCode(ref); + + if ( code == C_DECL_NODE ) + { + code = CTreeDeclCode( ref ); + + switch (code) + { + case C_VAR_DECL: + case C_PARAM_DECL: + case C_RESULT_DECL: + /* No action is needed in this case. */ + return ref; + } + + return ref; + } + else + if ( code == C_EXPR_NODE ) + { + code = CTreeExprCode( ref ); + + switch (code) + { + case C_NOP_EXPR: + case C_CONVERT_EXPR: + case C_FLOAT_EXPR: + case C_FIX_TRUNC_EXPR: + case C_FIX_FLOOR_EXPR: + case C_FIX_ROUND_EXPR: + case C_FIX_CEIL_EXPR: + result = c_tree_build_unary_expr(code, c_stabilize_reference(CTreeExprOperand(ref, 0))); + break; + + case C_INDIRECT_REF: + result = c_tree_build_unary_expr(C_INDIRECT_REF, + c_stabilize_reference_1 (CTreeExprOperand(ref, 0))); + break; + + case C_COMPONENT_REF: + result = c_tree_build_binary_expr(C_COMPONENT_REF, + c_stabilize_reference (CTreeExprOperand(ref, 0)), + CTreeExprOperand(ref, 1)); + break; + + case C_BIT_FIELD_REF: + result = c_tree_build_ternary_expr(C_BIT_FIELD_REF, + c_stabilize_reference (CTreeExprOperand(ref, 0)), + c_stabilize_reference_1 (CTreeExprOperand(ref, 1)), + c_stabilize_reference_1 (CTreeExprOperand(ref, 2))); + break; + + case C_ARRAY_REF: + result = c_tree_build_binary_expr(C_ARRAY_REF, + c_stabilize_reference (CTreeExprOperand(ref, 0)), + c_stabilize_reference_1 (CTreeExprOperand(ref, 1))); + break; + + case C_COMPOUND_EXPR: + /* We cannot wrap the first expression in a SAVE_EXPR, as then + it wouldn't be ignored. This matters when dealing with + volatiles. */ + return c_stabilize_reference_1 (ref); + + case C_RTL_EXPR: + result = c_tree_build_unary_typed_expr( C_INDIRECT_REF, CTreeType(ref), + c_tree_build_unary_typed_expr( + C_ADDR_EXPR, c_tree_build_pointer_type(CTreeType(ref)), ref)); + break; + + + /* If arg isn't a kind of lvalue we recognize, make no change. + Caller should recognize the error for an invalid lvalue. */ + default: + return ref; + + } + } + else + if ( code == C_ERROR_NODE ) + { + return c_error_mark_node; + } + else + { + return ref; + } + + CTreeType(result) = CTreeType(ref); + if ( CIsTreeNodeReadOnly( ref ) ) CSetTreeNodeReadOnly( result ); + if ( CIsTreeNodeSideEffect( ref ) ) CSetTreeNodeSideEffect( result ); + if ( CIsTreeNodeVolatile( ref ) ) CSetTreeNodeVolatile( result ); + if ( CIsTreeNodeRaises( ref ) ) CSetTreeNodeRaises( result ); + + return result; +} + +/* Return OP, stripped of any conversions to wider types as much as is safe. + Converting the value back to OP's type makes a value equivalent to OP. + + If FOR_TYPE is nonzero, we return a value which, if converted to + type FOR_TYPE, would be equivalent to converting OP to type FOR_TYPE. + + If FOR_TYPE is nonzero, unaligned bit-field references may be changed to the + narrowest type that can hold the value, even if they don't exactly fit. + Otherwise, bit-field references are changed to a narrower type + only if they can be fetched directly from memory in that type. + + OP must have integer, real or enumeral type. Pointers are not allowed! + + There are some cases where the obvious value we could return + would regenerate to OP if converted to OP's type, + but would not extend like OP to wider types. + If FOR_TYPE indicates such extension is contemplated, we eschew such values. + For example, if OP is (unsigned short)(signed char)-1, + we avoid returning (signed char)-1 if FOR_TYPE is int, + even though extending that to an unsigned short would regenerate OP, + since the result of extending (signed char)-1 to (int) + is different from (int) OP. */ + +c_tree_node *c_get_unwidened(op, for_type) + c_tree_node *op; + c_tree_node *for_type; +{ + /* Set UNS initially if converting OP to FOR_TYPE is a zero-extension. */ + /* CTreeTypePrecisionis safe in place of type_precision since + pointer types are not allowed. */ + c_tree_node *type = CTreeType(op); + unsigned final_prec = CTreeTypePrecision(for_type != 0 ? for_type : type); + int uns = (for_type != 0 && for_type != type + && final_prec > CTreeTypePrecision(type) + && CIsTreeNodeUnsigned(type)); + c_tree_node *win = op; + + while ( CTreeExprCode(op) == C_NOP_EXPR) + { + int bitschange + = CTreeTypePrecision(CTreeType(op)) + - CTreeTypePrecision(CTreeType(CTreeExprOperand(op, 0))); + + /* Truncations are many-one so cannot be removed. + Unless we are later going to truncate down even farther. */ + if (bitschange < 0 + && final_prec > CTreeTypePrecision(CTreeType(op))) + break; + + /* See what's inside this conversion. If we decide to strip it, + we will set WIN. */ + op = CTreeExprOperand(op, 0); + + /* If we have not stripped any zero-extensions (uns is 0), + we can strip any kind of extension. + If we have previously stripped a zero-extension, + only zero-extensions can safely be stripped. + Any extension can be stripped if the bits it would produce + are all going to be discarded later by truncating to FOR_TYPE. */ + + if (bitschange > 0) + { + if (! uns || final_prec <= CTreeTypePrecision(CTreeType(op))) + win = op; + /* CIsTreeNodeUnsignedsays whether this is a zero-extension. + Let's avoid computing it if it does not affect WIN + and if UNS will not be needed again. */ + if ((uns || CTreeExprCode(op) == C_NOP_EXPR) + && CIsTreeNodeUnsigned(CTreeType(op))) + { + uns = 1; + win = op; + } + } + } + + if ( CTreeExprCode(op) == C_COMPONENT_REF + /* Since type_for_size always gives an integer type. */ + && CTreeTypeCode(type) != C_REAL_TYPE + /* Don't crash if field not laid out yet. */ + && CTreeDeclSize(CTreeExprOperand(op, 1)) != 0) + { + unsigned innerprec = CTreeIntCstLow( CTreeDeclSize(CTreeExprOperand(op, 1))); + type = c_get_type_for_size(innerprec, CIsTreeNodeUnsigned(CTreeExprOperand(op, 1))); + + /* We can get this structure field in the narrowest type it fits in. + If FOR_TYPE is 0, do this only for a field that matches the + narrower type exactly and is aligned for it + The resulting extension to its nominal type (a fullword type) + must fit the same conditions as for other extensions. */ + + if (innerprec < CTreeTypePrecision(CTreeType(op)) + && (for_type || ! CIsTreeDeclBitField(CTreeExprOperand(op, 1))) + && (! uns || final_prec <= innerprec + || CIsTreeNodeUnsigned(CTreeExprOperand(op, 1))) + && type != 0) + { + win = c_tree_build_binary_expr(C_COMPONENT_REF, + CTreeExprOperand(op, 0), CTreeExprOperand(op, 1)); + CTreeType( win ) = type; + if ( CIsTreeNodeSideEffect(op) ) CSetTreeNodeSideEffect(win); + if ( CIsTreeNodeVolatile(op) ) CSetTreeNodeVolatile(win); + if ( CIsTreeNodeRaises(op) ) CSetTreeNodeRaises( win ); + } + } + return win; +} + + +/* Return OP or a simpler expression for a narrower value + which can be sign-extended or zero-extended to give back OP. + Store in *UNSIGNEDP_PTR either 1 if the value should be zero-extended + or 0 if the value should be sign-extended. */ + +c_tree_node *c_get_narrower(op, unsignedp_ptr) + c_tree_node *op; + int *unsignedp_ptr; +{ + int uns = 0; + int first = 1; + c_tree_node *win = op; + + while ( CTreeExprCode(op) == C_NOP_EXPR) + { + int bitschange + = CTreeTypePrecision(CTreeType(op)) + - CTreeTypePrecision(CTreeType(CTreeExprOperand(op, 0))); + + /* Truncations are many-one so cannot be removed. */ + if (bitschange < 0) + break; + + /* See what's inside this conversion. If we decide to strip it, + we will set WIN. */ + op = CTreeExprOperand(op, 0); + + if (bitschange > 0) + { + /* An extension: the outermost one can be stripped, + but remember whether it is zero or sign extension. */ + if (first) + uns = !! CIsTreeNodeUnsigned(CTreeType(op)); + /* Otherwise, if a sign extension has been stripped, + only sign extensions can now be stripped; + if a zero extension has been stripped, only zero-extensions. */ + else if (uns != !! CIsTreeNodeUnsigned(CTreeType(op))) + break; + first = 0; + } + else /* bitschange == 0 */ + { + /* A change in nominal type can always be stripped, but we must + preserve the unsignedness. */ + if (first) + uns = !! CIsTreeNodeUnsigned(CTreeType(op)); + first = 0; + } + + win = op; + } + + if ( CTreeExprCode(op) == C_COMPONENT_REF + /* Since type_for_size always gives an integer type. */ + && CTreeTypeCode(CTreeType(op)) != C_REAL_TYPE) + { + unsigned innerprec = CTreeIntCstLow( CTreeDeclSize(CTreeExprOperand(op, 1))); + c_tree_node *type = c_get_type_for_size(innerprec, CIsTreeNodeUnsigned(op)); + + /* We can get this structure field in a narrower type that fits it, + but the resulting extension to its nominal type (a fullword type) + must satisfy the same conditions as for other extensions. + + Do this only for fields that are aligned (not bit-fields), + because when bit-field insns will be used there is no + advantage in doing this. */ + + if (innerprec < CTreeTypePrecision(CTreeType(op)) + && ! CIsTreeDeclBitField(CTreeExprOperand(op, 1)) + && (first || uns == CIsTreeNodeUnsigned(CTreeExprOperand(op, 1))) + && type != 0) + { + if (first) + uns = CIsTreeNodeUnsigned(CTreeExprOperand(op, 1)); + win = c_tree_build_binary_expr( + C_COMPONENT_REF, CTreeExprOperand(op, 0), CTreeExprOperand(op, 1)); + CTreeType( win ) = type; + + if ( CIsTreeNodeSideEffect(op) ) CSetTreeNodeSideEffect(win); + if ( CIsTreeNodeVolatile(op) ) CSetTreeNodeVolatile(win); + if ( CIsTreeNodeRaises(op) ) CSetTreeNodeRaises( win ); + } + } + *unsignedp_ptr = uns; + return win; +} + + +/* Make the integer constant T valid for its type + by setting to 0 or 1 all the bits in the constant + that don't belong in the type. + Yield 1 if a signed overflow occurs, 0 otherwise. + If OVERFLOW is nonzero, a signed overflow has already occurred + in calculating T, so propagate it. + + Make the real constant T valid for its type by calling CHECK_FLOAT_VALUE, + if it exists. */ + +int c_force_fit_type(t, overflow) + c_tree_node *t; + int overflow; +{ + int low, high; + int prec; + + if ( CTreeNodeFirstCode(t) == C_REAL_CST_NODE) + { +#ifdef CHECK_FLOAT_VALUE + CHECK_FLOAT_VALUE (CTreeTypeMode(CTreeType(t)), TREE_REAL_CST (t), + overflow); +#endif + return overflow; + } + + else if ( CTreeNodeFirstCode(t) != C_INT_CST_NODE) + return overflow; + + low = CTreeIntCstLow(t); + high = CTreeIntCstHigh(t); + + if (POINTER_TYPE_P (CTreeType(t))) + prec = C_POINTER_SIZE; + else + prec = CTreeTypePrecision(CTreeType(t)); + + /* First clear all bits that are beyond the type's precision. */ + + if (prec == 2 * C_HOST_BITS_PER_WIDE_INT) + ; + else if (prec > C_HOST_BITS_PER_WIDE_INT) + { + CTreeIntCstHigh(t) + &= ~((C_HOST_WIDE_INT) (-1) << (prec - C_HOST_BITS_PER_WIDE_INT)); + } + else + { + CTreeIntCstHigh(t) = 0; + if (prec < C_HOST_BITS_PER_WIDE_INT) + CTreeIntCstLow(t) &= ~((C_HOST_WIDE_INT) (-1) << prec); + } + + /* Unsigned types do not suffer sign extension or overflow. */ + if ( CIsTreeNodeUnsigned(CTreeType(t))) + return overflow; + + /* If the value's sign bit is set, extend the sign. */ + if (prec != 2 * C_HOST_BITS_PER_WIDE_INT + && (prec > C_HOST_BITS_PER_WIDE_INT + ? (CTreeIntCstHigh(t) + & ((C_HOST_WIDE_INT) 1 << (prec - C_HOST_BITS_PER_WIDE_INT - 1))) + : CTreeIntCstLow(t) & ((C_HOST_WIDE_INT) 1 << (prec - 1)))) + { + /* Value is negative: + set to 1 all the bits that are outside this type's precision. */ + if (prec > C_HOST_BITS_PER_WIDE_INT) + { + CTreeIntCstHigh(t) + |= ((C_HOST_WIDE_INT) (-1) << (prec - C_HOST_BITS_PER_WIDE_INT)); + } + else + { + CTreeIntCstHigh(t) = -1; + if (prec < C_HOST_BITS_PER_WIDE_INT) + CTreeIntCstLow(t) |= ((C_HOST_WIDE_INT) (-1) << prec); + } + } + + /* Yield nonzero if signed overflow occurred. */ + return + ((overflow | (low ^ CTreeIntCstLow(t)) | (high ^ CTreeIntCstHigh(t))) + != 0); +} + +/* Return 1 if TTL and TTR are pointers to types that are equivalent, + ignoring their qualifiers. */ + +static int c_is_comp_target_types(ttl, ttr) + c_tree_node *ttl; + c_tree_node *ttr; +{ + int val; + + /* Give maybe_objc_comptypes a crack at letting these types through. */ +# ifdef LUDO_DONE + if (val = maybe_objc_comptypes (ttl, ttr, 1) >= 0) + return val; +# endif + + val = c_is_comptypes(CTreeTypeMainVariant(CTreeType(ttl)), + CTreeTypeMainVariant(CTreeType(ttr))); + + if (val == 2 && c_pedantic) + { + pedwarn ("types are not quite compatible"); + } + return val; +} + +/* Nonzero if the type T promotes to itself. + ANSI C states explicitly the list of types that promote; + in particular, short promotes to int even if they have the same width. */ +#define C_PROMOTING_INTEGER_TYPE_P(t) \ + ( CTreeTypeCode((t)) == C_INTEGER_TYPE \ + && (CTreeTypeMainVariant(t) == c_char_type_node \ + || CTreeTypeMainVariant(t) == c_signed_char_type_node \ + || CTreeTypeMainVariant(t) == c_unsigned_char_type_node \ + || CTreeTypeMainVariant(t) == c_short_integer_type_node \ + || CTreeTypeMainVariant(t) == c_short_unsigned_type_node)) + + +/* Return 1 if TYPE is not affected by default promotions. */ + +static int c_is_self_promoting_type_p(type) + c_tree_node *type; +{ + if (CTreeTypeMainVariant(type) == c_float_type_node) + return 0; + + if (C_PROMOTING_INTEGER_TYPE_P(type)) + return 0; + + return 1; +} + + +/* Check two lists of types for compatibility, + returning 0 for incompatible, 1 for compatible, + or 2 for compatible with warning. */ + +static int c_is_type_lists_compatible_p(args1, args2) + c_tree_node *args1; + c_tree_node *args2; +{ + /* 1 if no need for warning yet, 2 if warning cause has been seen. */ + int val = 1; + int newval = 0; + + while (1) + { + if (args1 == 0 && args2 == 0) + return val; + /* If one list is shorter than the other, + they fail to match. */ + if (args1 == 0 || args2 == 0) + return 0; + /* A null pointer instead of a type + means there is supposed to be an argument + but nothing is specified about what type it has. + So match anything that self-promotes. */ + if ( CTreeListValue(args1) == 0) + { + if (! c_is_self_promoting_type_p( CTreeListValue(args2))) + return 0; + } + else if (CTreeListValue(args2) == 0) + { + if (! c_is_self_promoting_type_p(CTreeListValue(args1))) + return 0; + } + else if (! (newval = c_is_comptypes(CTreeListValue(args1), CTreeListValue(args2)))) + { + /* Allow wait (union {union wait *u; int *i} *) + and wait (union wait *) to be compatible. */ + if ( CTreeTypeCode(CTreeListValue(args1)) == C_UNION_TYPE + && ( CTreeTypeName(CTreeListValue(args1)) == 0 + || CIsTreeTypeTransUnion(CTreeListValue(args1))) + && CTreeNodeFirstCode(CTreeTypeSize(CTreeListValue(args1))) == C_INT_CST_NODE + && c_tree_is_int_cst_equal(CTreeTypeSize(CTreeListValue(args1)), + CTreeTypeSize(CTreeListValue(args2)))) + { + c_tree_node *memb; + for (memb = CTreeTypeValues(CTreeListValue(args1)); + memb; memb = CTreeChain(memb)) + if ( c_is_comptypes(CTreeType(memb), CTreeListValue(args2))) + break; + if (memb == 0) + return 0; + } + else if ( CTreeTypeCode(CTreeListValue(args2)) == C_UNION_TYPE + && ( CTreeTypeName(CTreeListValue(args2)) == 0 + || CIsTreeTypeTransUnion(CTreeListValue(args2))) + && CTreeNodeFirstCode(CTreeTypeSize(CTreeListValue(args2))) == C_INT_CST_NODE + && c_tree_is_int_cst_equal(CTreeTypeSize(CTreeListValue(args2)), + CTreeTypeSize(CTreeListValue(args1)))) + { + c_tree_node *memb; + for (memb = CTreeTypeValues(CTreeListValue(args2)); + memb; memb = CTreeChain(memb)) + if ( c_is_comptypes(CTreeType(memb), CTreeListValue(args1))) + break; + if (memb == 0) + return 0; + } + else + return 0; + } + + /* comptypes said ok, but record if it said to warn. */ + if (newval > val) + val = newval; + + args1 = CTreeChain(args1); + args2 = CTreeChain(args2); + } +} + +/* Return 1 if two function types F1 and F2 are compatible. + If either type specifies no argument types, + the other must specify a fixed number of self-promoting arg types. + Otherwise, if one type specifies only the number of arguments, + the other must specify that number of self-promoting arg types. + Otherwise, the argument types must match. */ + +static int c_is_function_types_compatible_p(f1, f2) + c_tree_node *f1; + c_tree_node *f2; +{ + c_tree_node *args1; + c_tree_node *args2; + /* 1 if no need for warning yet, 2 if warning cause has been seen. */ + int val = 1; + int val1; + + if (!(CTreeType(f1) == CTreeType(f2) + || (val = c_is_comptypes(CTreeType(f1), CTreeType(f2))))) + return 0; + + args1 = CTreeTypeValues(f1); + args2 = CTreeTypeValues(f2); + + /* An unspecified parmlist matches any specified parmlist + whose argument types don't need default promotions. */ + + if (args1 == 0) + { + if (! c_is_self_promoting_args_p(args2)) + return 0; + /* If one of these types comes from a non-prototype fn definition, + compare that with the other type's arglist. + If they don't match, ask for a warning (but no error). */ + if ( CTreeTypeNonCopiedParts(f1) + && 1 != c_is_type_lists_compatible_p(args2, CTreeTypeNonCopiedParts(f1))) + val = 2; + return val; + } + if (args2 == 0) + { + if (! c_is_self_promoting_args_p(args1)) + return 0; + if ( CTreeTypeNonCopiedParts(f2) + && 1 != c_is_type_lists_compatible_p(args1, CTreeTypeNonCopiedParts(f2))) + val = 2; + return val; + } + + /* Both types have argument lists: compare them and propagate results. */ + val1 = c_is_type_lists_compatible_p(args1, args2); + return val1 != 1 ? val1 : val; +} + + +/* Return 1 if TYPE1 and TYPE2 are compatible types for assignment + or various other operations. Return 2 if they are compatible + but a warning may be needed if you use them together. */ + +int c_is_comptypes(type1, type2) + + c_tree_node *type1; + c_tree_node *type2; +{ + c_tree_node *t1 = type1; + c_tree_node *t2 = type2; + int attrval, val; + + /* Suppress errors caused by previously reported errors. */ + + if (t1 == t2 || + CTreeNodeFirstCode(t1) == C_ERROR_NODE || + CTreeNodeFirstCode(t2) == C_ERROR_NODE ) + { + return 1; + } + + /* Treat an enum type as the integer type of the same width and + signedness. */ + + if ( CTreeTypeCode(t1) == C_ENUMERAL_TYPE) + t1 = c_get_type_for_size( CTreeTypePrecision(t1), CIsTreeNodeUnsigned(t1)); + + if ( CTreeTypeCode(t2) == C_ENUMERAL_TYPE) + t2 = c_get_type_for_size(CTreeTypePrecision(t2), CIsTreeNodeUnsigned(t2)); + + if (t1 == t2) + return 1; + + /* Different classes of types can't be compatible. */ + + if ( CTreeTypeCode(t1) != CTreeTypeCode(t2)) return 0; + + /* Qualifiers must match. */ + + if ( CIsTreeNodeReadOnly(t1) != CIsTreeNodeReadOnly(t2)) + return 0; + if ( CIsTreeNodeVolatile(t1) != CIsTreeNodeVolatile(t2)) + return 0; + + /* Allow for two different type nodes which have essentially the same + definition. Note that we already checked for equality of the type + type qualifiers (just above). */ + + if (CTreeTypeMainVariant(t1) == CTreeTypeMainVariant(t2)) + return 1; + +#ifndef COMP_TYPE_ATTRIBUTES +#define COMP_TYPE_ATTRIBUTES(t1,t2) 1 +#endif + + /* 1 if no need for warning yet, 2 if warning cause has been seen. */ + if (! (attrval = COMP_TYPE_ATTRIBUTES(t1, t2))) + return 0; + + /* 1 if no need for warning yet, 2 if warning cause has been seen. */ + val = 0; + + switch ( CTreeTypeCode(t1)) + { + case C_POINTER_TYPE: + val = (CTreeType(t1) == CTreeType(t2) + ? 1 : c_is_comptypes(CTreeType(t1), CTreeType(t2))); + break; + + case C_FUNCTION_TYPE: + val = c_is_function_types_compatible_p(t1, t2); + break; + + case C_ARRAY_TYPE: + { + c_tree_node *d1 = CTreeTypeValues(t1); + c_tree_node *d2 = CTreeTypeValues(t2); + val = 1; + + /* Target types must match incl. qualifiers. */ + if (CTreeType(t1) != CTreeType(t2) + && 0 == (val = c_is_comptypes(CTreeType(t1), CTreeType(t2)))) + return 0; + + /* Sizes must match unless one is missing or variable. */ + if (d1 == 0 || d2 == 0 || d1 == d2 + || CTreeNodeFirstCode( CTreeTypeMinValue(d1)) != C_INT_CST_NODE + || CTreeNodeFirstCode( CTreeTypeMinValue(d2)) != C_INT_CST_NODE + || CTreeNodeFirstCode( CTreeTypeMaxValue(d1)) != C_INT_CST_NODE + || CTreeNodeFirstCode( CTreeTypeMaxValue(d2)) != C_INT_CST_NODE) + break; + + if (! ((CTreeIntCstLow(CTreeTypeMinValue(d1)) + == CTreeIntCstLow(CTreeTypeMinValue(d2))) + && (CTreeIntCstHigh(CTreeTypeMinValue(d1)) + == CTreeIntCstHigh(CTreeTypeMinValue(d2))) + && (CTreeIntCstLow(CTreeTypeMaxValue(d1)) + == CTreeIntCstLow(CTreeTypeMaxValue(d2))) + && (CTreeIntCstHigh(CTreeTypeMaxValue(d1)) + == CTreeIntCstHigh(CTreeTypeMaxValue(d2))))) + val = 0; + break; + } + + case C_RECORD_TYPE: +# ifdef LUDO_DONE + if (maybe_objc_comptypes (t1, t2, 0) == 1) + val = 1; +# endif + break; + + default: + break; + } + return attrval == 2 && val == 1 ? 2 : val; +} + + +/* Convert value RHS to type TYPE as preparation for an assignment + to an lvalue of type TYPE. + The real work of conversion is done by `convert'. + The purpose of this function is to generate error messages + for assignments that are not allowed in C. + ERRTYPE is a string to use in error messages: + "assignment", "return", etc. If it is null, this is parameter passing + for a function call (and different error messages are output). Otherwise, + it may be a name stored in the spelling stack and interpreted by + get_spelling. + + FUNNAME is the name of the function being called, + as an IDENTIFIER_NODE, or null. + PARMNUM is the number of the argument, for printing in error messages. */ + +static c_tree_node *c_convert_for_assignment( + type, rhs, errtype, fundecl, funname, parmnum) + c_tree_node *type; + c_tree_node *rhs; + char *errtype; + c_tree_node *fundecl; + c_tree_node *funname; + int parmnum; +{ + int codel = CTreeTypeCode(type); + c_tree_node *rhstype; + c_tree_node *tmp_node; + int coder; + + /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */ + /* Do not use STRIP_NOPS here. We do not want an enumerator + whose value is 0 to count as a null pointer constant. */ + if ( ( CTreeNodeFirstCode(rhs) == C_EXPR_NODE ) && + ( CTreeExprCode(rhs) == C_NON_LVALUE_EXPR) ) + { + rhs = CTreeExprOperand (rhs, 0); + } + + if ( CTreeTypeCode(CTreeType(rhs)) == C_ARRAY_TYPE + || CTreeTypeCode(CTreeType(rhs)) == C_FUNCTION_TYPE) + { + rhs = c_default_conversion(rhs); + } +# ifdef LUDO_DONE + else if (optimize && TREE_CODE (rhs) == VAR_DECL) + rhs = c_decl_constant_value (rhs); +# endif + + rhstype = CTreeType(rhs); + + if ( CTreeNodeFirstCode( rhstype ) == C_ERROR_NODE) + return c_error_mark_node; + + coder = CTreeTypeCode(rhstype); + + if (CTreeTypeMainVariant(type) == CTreeTypeMainVariant(rhstype)) + { +# ifdef LUDO_DONE + overflow_warning (rhs); + /* Check for Objective-C protocols. This will issue a warning if + there are protocol violations. No need to use the return value. */ + maybe_objc_comptypes (type, rhstype, 0); +# endif + return rhs; + } + + if (coder == C_VOID_TYPE) + { + error ("void value not ignored as it ought to be"); + return c_error_mark_node; + } + /* Arithmetic types all interconvert, and enum is treated like int. */ + if ((codel == C_INTEGER_TYPE || codel == C_REAL_TYPE || codel == C_ENUMERAL_TYPE + || codel == C_COMPLEX_TYPE) + && (coder == C_INTEGER_TYPE || coder == C_REAL_TYPE || coder == C_ENUMERAL_TYPE + || coder == C_COMPLEX_TYPE)) + { + return c_convert_and_check(type, rhs); + } + + /* Conversion to a transparent union from its member types. + This applies only to function arguments. */ + else if (codel == C_UNION_TYPE && CIsTreeTypeTransUnion(type) && ! errtype) + { + c_tree_node *memb_types; + c_tree_node *marginal_memb_type = 0; + + for (memb_types = CTreeTypeValues(type); memb_types; + memb_types = CTreeChain(memb_types)) + { + c_tree_node *memb_type = CTreeType(memb_types); + + if (c_is_comptypes(CTreeTypeMainVariant(memb_type), + CTreeTypeMainVariant(rhstype))) + break; + + if ( CTreeTypeCode(memb_type) != C_POINTER_TYPE) + continue; + + if (coder == C_POINTER_TYPE) + { + c_tree_node *ttl = CTreeType(memb_type); + c_tree_node *ttr = CTreeType(rhstype); + + /* Any non-function converts to a [const][volatile] void * + and vice versa; otherwise, targets must be the same. + Meanwhile, the lhs target must have all the qualifiers of + the rhs. */ + if (CTreeTypeMainVariant(ttl) == c_void_type_node + || CTreeTypeMainVariant(ttr) == c_void_type_node + || c_is_comp_target_types(memb_type, rhstype)) + { + /* If this type won't generate any warnings, use it. */ + if ((CTreeTypeCode(ttr) == C_FUNCTION_TYPE + && CTreeTypeCode(ttl) == C_FUNCTION_TYPE) + ? ((! CIsTreeNodeReadOnly(ttl) | CIsTreeNodeReadOnly(ttr)) + & (! CIsTreeNodeVolatile(ttl) | CIsTreeNodeVolatile(ttr))) + : ((CIsTreeNodeReadOnly(ttl) | ! CIsTreeNodeReadOnly(ttr)) + & (CIsTreeNodeVolatile(ttl) | ! CIsTreeNodeVolatile(ttr)))) + break; + + /* Keep looking for a better type, but remember this one. */ + if (! marginal_memb_type) + marginal_memb_type = memb_type; + } + } + + /* Can convert integer zero to any pointer type. */ + if (c_tree_is_integer_zerop(rhs) + || ( CTreeExprCode(rhs) == C_NOP_EXPR + && c_tree_is_integer_zerop(CTreeExprOperand(rhs, 0)))) + { + rhs = c_null_pointer_node; + break; + } + } + + if (memb_types || marginal_memb_type) + { + if (! memb_types) + { + /* We have only a marginally acceptable member type; + it needs a warning. */ + c_tree_node *ttl = CTreeType(marginal_memb_type); + c_tree_node *ttr = CTreeType(rhstype); + + /* Const and volatile mean something different for function + types, so the usual warnings are not appropriate. */ + if ( CTreeTypeCode(ttr) == C_FUNCTION_TYPE + && CTreeTypeCode(ttl) == C_FUNCTION_TYPE) + { + /* Because const and volatile on functions are + restrictions that say the function will not do + certain things, it is okay to use a const or volatile + function where an ordinary one is wanted, but not + vice-versa. */ + if ( CIsTreeNodeReadOnly(ttl) && ! CIsTreeNodeReadOnly(ttr)) + { + warn_for_assignment( + "%s makes `const *' function pointer from non-const", + c_get_spelling(errtype), funname, parmnum); + } + if ( CIsTreeNodeVolatile(ttl) && ! CIsTreeNodeVolatile(ttr)) + { + warn_for_assignment( + "%s makes `volatile *' function pointer from non-volatile", + c_get_spelling (errtype), funname, parmnum); + } + } + else + { + if (! CIsTreeNodeReadOnly(ttl) && CIsTreeNodeReadOnly(ttr)) + { + warn_for_assignment( + "%s discards `const' from pointer target type", + c_get_spelling (errtype), funname, parmnum); + } + if (! CIsTreeNodeVolatile(ttl) && CIsTreeNodeVolatile(ttr)) + { + warn_for_assignment( + "%s discards `volatile' from pointer target type", + c_get_spelling (errtype), funname, parmnum); + } + } + } + + if (c_pedantic && ! CIsTreeDeclSystemHeader(fundecl)) + { + pedwarn ("ANSI C prohibits argument conversion to union type"); + } + + tmp_node = c_tree_build_unary_expr( C_NOP_EXPR, rhs ); + CTreeType( tmp_node ) = type; + return( tmp_node ); + } + } + + /* Conversions among pointers */ + else if (codel == C_POINTER_TYPE && coder == C_POINTER_TYPE) + { + c_tree_node *ttl = CTreeType(type); + c_tree_node *ttr = CTreeType(rhstype); + + /* Any non-function converts to a [const][volatile] void * + and vice versa; otherwise, targets must be the same. + Meanwhile, the lhs target must have all the qualifiers of the rhs. */ + if (CTreeTypeMainVariant(ttl) == c_void_type_node + || CTreeTypeMainVariant(ttr) == c_void_type_node + || c_is_comp_target_types(type, rhstype) + || (c_get_unsigned_type(CTreeTypeMainVariant(ttl)) + == c_get_unsigned_type(CTreeTypeMainVariant(ttr)))) + { + if (c_pedantic + && ((CTreeTypeMainVariant(ttl) == c_void_type_node + && CTreeTypeCode(ttr) == C_FUNCTION_TYPE) + || + (CTreeTypeMainVariant(ttr) == c_void_type_node + /* Check TREE_CODE to catch cases like (void *) (char *) 0 + which are not ANSI null ptr constants. */ + && (!c_tree_is_integer_zerop(rhs) || CTreeExprCode(rhs) == C_NOP_EXPR) + && CTreeTypeCode(ttl) == C_FUNCTION_TYPE))) + { + warn_for_assignment( "ANSI forbids %s between function pointer and `void *'", + c_get_spelling (errtype), funname, parmnum); + } + /* Const and volatile mean something different for function types, + so the usual warnings are not appropriate. */ + else if ( CTreeTypeCode(ttr) != C_FUNCTION_TYPE + && CTreeTypeCode(ttl) != C_FUNCTION_TYPE) + { + if (! CIsTreeNodeReadOnly(ttl) && CIsTreeNodeReadOnly(ttr)) + { + warn_for_assignment("%s discards `const' from pointer target type", + c_get_spelling (errtype), funname, parmnum); + } + else if (! CIsTreeNodeVolatile(ttl) && CIsTreeNodeVolatile(ttr)) + { + c_warn_for_assignment ("%s discards `volatile' from pointer target type", + c_get_spelling (errtype), funname, parmnum); + } + /* If this is not a case of ignoring a mismatch in signedness, + no warning. */ + else if (CTreeTypeMainVariant(ttl) == c_void_type_node + || CTreeTypeMainVariant(ttr) == c_void_type_node + || c_is_comp_target_types(type, rhstype)) + ; + /* If there is a mismatch, do warn. */ + else if (c_pedantic) + { + warn_for_assignment ("pointer targets in %s differ in signedness", + c_get_spelling (errtype), funname, parmnum); + } + } + else if ( CTreeTypeCode(ttl) == C_FUNCTION_TYPE + && CTreeTypeCode(ttr) == C_FUNCTION_TYPE) + { + /* Because const and volatile on functions are restrictions + that say the function will not do certain things, + it is okay to use a const or volatile function + where an ordinary one is wanted, but not vice-versa. */ + if ( CIsTreeNodeReadOnly(ttl) && ! CIsTreeNodeReadOnly(ttr)) + { + warn_for_assignment ("%s makes `const *' function pointer from non-const", + c_get_spelling (errtype), funname, parmnum); + } + if ( CIsTreeNodeVolatile(ttl) && ! CIsTreeNodeVolatile(ttr)) + { + warn_for_assignment("%s makes `volatile *' function pointer from non-volatile", + c_get_spelling (errtype), funname, parmnum); + } + } + } + else + { + warn_for_assignment("%s from incompatible pointer type", + c_get_spelling (errtype), funname, parmnum); + } + + return c_convert_expr(type, rhs); + } + else if (codel == C_POINTER_TYPE && coder == C_INTEGER_TYPE) + { + /* An explicit constant 0 can convert to a pointer, + or one that results from arithmetic, even including + a cast to integer type. */ + if (! ( CTreeNodeFirstCode(rhs) == C_INT_CST_NODE && c_tree_is_integer_zerop(rhs)) + && + ! ( CTreeExprCode(rhs) == C_NOP_EXPR + && CTreeTypeCode(CTreeType(rhs)) == C_INTEGER_TYPE + && CTreeNodeFirstCode(CTreeExprOperand(rhs, 0)) == C_INT_CST_NODE + && c_tree_is_integer_zerop(CTreeExprOperand(rhs, 0)))) + { + warn_for_assignment("%s makes pointer from integer without a cast", + c_get_spelling (errtype), funname, parmnum); + return c_convert_expr(type, rhs); + } + return c_null_pointer_node; + } + else if (codel == C_INTEGER_TYPE && coder == C_POINTER_TYPE) + { + warn_for_assignment("%s makes integer from pointer without a cast", + c_get_spelling (errtype), funname, parmnum); + return c_convert_expr(type, rhs); + } + + if (!errtype) + { + if (funname) + { +# ifdef LUDO_NO_SKIP + c_tree_node *selector = maybe_building_objc_message_expr (); +# else + c_tree_node *selector = 0; +# endif + + if (selector && parmnum > 2) + { + error ("incompatible type for argument %d of `%s'", + parmnum - 2, CTreeIdentPointer(selector)); + } + else + { + error ("incompatible type for argument %d of `%s'", + parmnum, CTreeIdentPointer(funname)); + } + } + else + { + error ("incompatible type for argument %d of indirect function call", + parmnum); + } + } + else + { + error ("incompatible types in %s", c_get_spelling(errtype)); + } + + return c_error_mark_node; +} + +/*------------------------------------------------------------\ +| | +| C Parser Build Indirect Reference | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_parser_build_indirect_ref( ptr, errorstring) + c_tree_node *ptr; + char *errorstring; +{ + c_tree_node *pointer = c_default_conversion(ptr); + c_tree_node *type = CTreeType(pointer); + + if ( CTreeTypeCode(type) == C_POINTER_TYPE) + { + if ( CTreeExprCode(pointer) == C_ADDR_EXPR + && !c_flag_volatile + && ( CTreeType(CTreeExprOperand(pointer, 0)) + == CTreeType(type))) + { + return CTreeExprOperand(pointer, 0); + } + else + { + c_tree_node *t = CTreeType(type); + c_tree_node *ref = c_tree_build_unary_expr( C_INDIRECT_REF, pointer ); + CTreeType( ref ) = CTreeTypeMainVariant(t); + + if ( CTreeTypeSize(t) == 0 && CTreeTypeCode(t) != C_ARRAY_TYPE) + { + error ("dereferencing pointer to incomplete type"); + return c_error_mark_node; + } + if ( CTreeTypeCode(t) == C_VOID_TYPE && c_skip_evaluation == 0) + { + warning ("dereferencing `void *' pointer"); + } + + /* We *must* set TREE_READONLY when dereferencing a pointer to const, + so that we get the proper error message if the result is used + to assign to. Also, &* is supposed to be a no-op. + And ANSI C seems to specify that the type of the result + should be the const type. */ + /* A de-reference of a pointer to const is not a const. It is valid + to change it via some other pointer. */ + if ( CIsTreeNodeReadOnly(t) ) + { + CSetTreeNodeReadOnly(ref); + } + if ( CIsTreeNodeVolatile(t) || + CIsTreeNodeSideEffect(pointer) || + c_flag_volatile ) CSetTreeNodeSideEffect( ref ); + + if ( CIsTreeNodeVolatile(t) ) CSetTreeNodeVolatile( ref ); + return ref; + } + } + else if ( CTreeNodeFirstCode(pointer) != C_ERROR_NODE) + { + error ("invalid type argument of `%s'", errorstring); + } + return c_error_mark_node; +} + +/*------------------------------------------------------------\ +| | +| C Build Unary Oper | +| | +\------------------------------------------------------------*/ + +/* Return nonzero if REF is an lvalue valid for this language. + Lvalues can be assigned, unless their type has TYPE_READONLY. + Lvalues can have their address taken, unless they have DECL_REGISTER. */ + +int +c_lvalue_p (ref) + c_tree_node *ref; +{ + int code = CTreeNodeFirstCode(ref); + + if ( code == C_STRING_NODE) + { + return 1; + } + else + if ( code == C_DECL_NODE ) + { + code = CTreeExprCode( ref ); + switch (code) + { + case C_VAR_DECL: + case C_PARAM_DECL: + case C_RESULT_DECL: + return ( CTreeTypeCode(CTreeType(ref)) != C_FUNCTION_TYPE + && CTreeTypeCode(CTreeType(ref)) != C_METHOD_TYPE); + } + } + else + if ( code == C_ERROR_NODE ) + { + return ( CTreeTypeCode(CTreeType(ref)) != C_FUNCTION_TYPE + && CTreeTypeCode(CTreeType(ref)) != C_METHOD_TYPE); + } + else + if ( code == C_EXPR_NODE ) + { + code = CTreeExprCode( ref ); + switch (code) + { + case C_REALPART_EXPR: + case C_IMAGPART_EXPR: + case C_COMPONENT_REF: + return c_lvalue_p( CTreeExprOperand(ref, 0)); + + case C_INDIRECT_REF: + case C_ARRAY_REF: + return ( CTreeTypeCode(CTreeType(ref)) != C_FUNCTION_TYPE + && CTreeTypeCode(CTreeType(ref)) != C_METHOD_TYPE); + + case C_BIND_EXPR: + case C_RTL_EXPR: + return CTreeTypeCode(CTreeType(ref)) == C_ARRAY_TYPE; + + default: + return 0; + } + } + + return 0; +} + + +/* Return nonzero if REF is an lvalue valid for this language; + otherwise, print an error message and return zero. */ + +int c_lvalue_or_else (ref, string) + c_tree_node *ref; + char *string; +{ + int win = c_lvalue_p (ref); + if (! win) + { + error ("invalid lvalue in %s", string); + } + return win; +} + + +/* Mark EXP saying that we need to be able to take the + address of it; it should not be allocated in a register. + Value is 1 if successful. */ + +int c_mark_addressable (exp) + c_tree_node *exp; +{ + c_tree_node *x = exp; + while (1) + { + if (CTreeNodeFirstCode(x) == C_EXPR_NODE && + CTreeExprCode(x) == C_COMPONENT_REF ) + { + if ( CIsTreeDeclBitField(CTreeExprOperand(x, 1))) + { + error ("cannot take address of bitfield `%s'", + CTreeIdentPointer(CTreeDeclName(CTreeExprOperand(x, 1)))); + return 0; + } + } + else + /* ... fall through ... */ + if ( CTreeNodeFirstCode(x) == C_EXPR_NODE && + (CTreeExprCode(x) == C_ADDR_EXPR || + CTreeExprCode(x) == C_ARRAY_REF || + CTreeExprCode(x) == C_REALPART_EXPR || + CTreeExprCode(x) == C_IMAGPART_EXPR )) + { + x = CTreeExprOperand(x, 0); continue; + } + else + if ( CTreeNodeFirstCode(x) == C_EXPR_NODE && + CTreeExprCode(x) == C_CONSTRUCTOR_EXPR) + { + CSetTreeNodeAddressable(x); + return 1; + } + else + if ( CTreeNodeFirstCode( x ) == C_DECL_NODE && + (CTreeDeclCode(x ) == C_VAR_DECL || + CTreeDeclCode(x ) == C_CONST_DECL || + CTreeDeclCode(x ) == C_PARAM_DECL || + CTreeDeclCode(x ) == C_RESULT_DECL )) + { + if ( CIsTreeDeclRegister(x) && ! CIsTreeNodeAddressable(x) + && CIsTreeDeclNonLocal(x)) + { + if ( CIsTreeNodePublic(x)) + { + error ("global register variable `%s' used in nested function", + CTreeIdentPointer(CTreeDeclName(x))); + return 0; + } + pedwarn ("register variable `%s' used in nested function", + CTreeIdentPointer(CTreeDeclName(x))); + } + else if ( CIsTreeDeclRegister(x) && ! CIsTreeNodeAddressable(x)) + { + if ( CIsTreeNodePublic(x)) + { + error ("address of global register variable `%s' requested", + CTreeIdentPointer(CTreeDeclName(x))); + return 0; + } + + /* If we are making this addressable due to its having + volatile components, give a different error message. Also + handle the case of an unnamed parameter by not trying + to give the name. */ + + else if (CIsTreeTypeFieldsVolatile(CTreeType(x))) + { + error ("cannot put object with volatile field into register"); + return 0; + } + + pedwarn ("address of register variable `%s' requested", + CTreeIdentPointer(CTreeDeclName(x))); + } +# ifdef LUDO_NO_SKIP + put_var_into_stack (x); +# endif + } + else if ( CTreeNodeFirstCode( x) == C_DECL_NODE && + CTreeDeclCode( x ) == C_FUNCTION_DECL ) + { + CSetTreeNodeAddressable(x); + } + + return 1; + } +} + +/* Construct and perhaps optimize a c_tree_node *representation + for a unary operation. CODE, a tree_code, specifies the operation + and XARG is the operand. NOCONVERT nonzero suppresses + the default promotions (such as from short to int). */ + +c_tree_node *c_parser_build_unary_op(code, xarg, noconvert) + int code; + c_tree_node *xarg; + int noconvert; +{ + /* No default_conversion here. It causes trouble for ADDR_EXPR. */ + c_tree_node *arg = xarg; + c_tree_node *argtype = 0; + int typecode = CTreeTypeCode(CTreeType(arg)); + char *errstring = NULL; + c_tree_node *val; + + if ( CTreeNodeFirstCode( CTreeType(arg) ) == C_ERROR_NODE) + return c_error_mark_node; + if (typecode == C_ENUMERAL_TYPE) + typecode = C_INTEGER_TYPE; + + switch (code) + { + case C_CONVERT_EXPR: + /* This is used for unary plus, because a CONVERT_EXPR + is enough to prevent anybody from looking inside for + associativity, but won't generate any code. */ + if (!(typecode == C_INTEGER_TYPE || + typecode == C_REAL_TYPE || + typecode == C_COMPLEX_TYPE)) + errstring = "wrong type argument to unary plus"; + else if (!noconvert) + arg = c_default_conversion(arg); + break; + + case C_NEGATE_EXPR: + if (!(typecode == C_INTEGER_TYPE || typecode == C_REAL_TYPE + || typecode == C_COMPLEX_TYPE)) + errstring = "wrong type argument to unary minus"; + else if (!noconvert) + arg = c_default_conversion(arg); + break; + + case C_BIT_NOT_EXPR: + if (typecode == C_COMPLEX_TYPE) + { + code = C_CONJ_EXPR; + if (!noconvert) + arg = c_default_conversion(arg); + } + else if (typecode != C_INTEGER_TYPE) + errstring = "wrong type argument to bit-complement"; + else if (!noconvert) + arg = c_default_conversion (arg); + break; + + case C_ABS_EXPR: + if (!(typecode == C_INTEGER_TYPE || typecode == C_REAL_TYPE + || typecode == C_COMPLEX_TYPE)) + errstring = "wrong type argument to abs"; + else if (!noconvert) + arg = c_default_conversion (arg); + break; + + case C_CONJ_EXPR: + /* Conjugating a real value is a no-op, but allow it anyway. */ + if (!(typecode == C_INTEGER_TYPE || typecode == C_REAL_TYPE + || typecode == C_COMPLEX_TYPE)) + errstring = "wrong type argument to conjugation"; + else if (!noconvert) + arg = c_default_conversion (arg); + break; + + case C_TRUTH_NOT_EXPR: + if (typecode != C_INTEGER_TYPE + && typecode != C_REAL_TYPE && typecode != C_POINTER_TYPE + && typecode != C_COMPLEX_TYPE + /* These will convert to a pointer. */ + && typecode != C_ARRAY_TYPE && typecode != C_FUNCTION_TYPE) + { + errstring = "wrong type argument to unary exclamation mark"; + break; + } + arg = c_truthvalue_conversion(arg); + return c_invert_truthvalue(arg); + + case C_NOP_EXPR: + break; + + case C_REALPART_EXPR: + if ( CTreeNodeFirstCode(arg) == C_COMPLEX_NODE) + return CTreeComplexReal(arg); + else if ( CTreeTypeCode(CTreeType(arg)) == C_COMPLEX_TYPE) + { + return c_fold ( c_tree_build_unary_typed_expr ( C_REALPART_EXPR, CTreeType(CTreeType(arg)), arg)); + } + else + return arg; + + case C_IMAGPART_EXPR: + if ( CTreeNodeFirstCode(arg) == C_COMPLEX_NODE) + return CTreeComplexImag(arg); + else if ( CTreeNodeFirstCode(CTreeType(arg)) == C_COMPLEX_TYPE) + { + return c_fold ( c_tree_build_unary_typed_expr (C_IMAGPART_EXPR, CTreeType(CTreeType(arg)), arg)); + } + else + return c_convert_expr(CTreeType(arg), c_integer_zero_node); + + case C_PREINCREMENT_EXPR: + case C_POSTINCREMENT_EXPR: + case C_PREDECREMENT_EXPR: + case C_POSTDECREMENT_EXPR: + /* Handle complex lvalues (when permitted) + by reduction to simpler cases. */ + + val = c_unary_complex_lvalue(code, arg); + if (val != 0) + return val; + + /* Increment or decrement the real part of the value, + and don't change the imaginary part. */ + if (typecode == C_COMPLEX_TYPE) + { + c_tree_node *real; + c_tree_node *imag; + + arg = c_stabilize_reference(arg); + real = c_parser_build_unary_op(C_REALPART_EXPR, arg, 1); + imag = c_parser_build_unary_op(C_IMAGPART_EXPR, arg, 1); + return c_tree_build_binary_typed_expr(C_COMPLEX_EXPR, CTreeType(arg), + c_parser_build_unary_op(code, real, 1), imag); + } + + /* Report invalid types. */ + + if (typecode != C_POINTER_TYPE + && typecode != C_INTEGER_TYPE && typecode != C_REAL_TYPE) + { + if (code == C_PREINCREMENT_EXPR || code == C_POSTINCREMENT_EXPR) + errstring ="wrong type argument to increment"; + else + errstring ="wrong type argument to decrement"; + break; + } + + { + c_tree_node *inc; + c_tree_node *result_type = CTreeType(arg); + + arg = c_get_unwidened(arg, 0); + argtype = CTreeType(arg); + + /* Compute the increment. */ + + if (typecode == C_POINTER_TYPE) + { + /* If pointer target is an undefined struct, + we just cannot know how to do the arithmetic. */ + if (CTreeTypeSize(CTreeType(result_type)) == 0) + { + error ("%s of pointer to unknown structure", + ((code == C_PREINCREMENT_EXPR + || code == C_POSTINCREMENT_EXPR) + ? "increment" : "decrement")); + } + else if ((c_pedantic || c_warn_pointer_arith) + && (CTreeTypeCode(CTreeType(result_type)) == C_FUNCTION_TYPE + || CTreeTypeCode(CTreeType(result_type)) == C_VOID_TYPE)) + { + pedwarn ("wrong type argument to %s", + ((code == C_PREINCREMENT_EXPR + || code == C_POSTINCREMENT_EXPR) + ? "increment" : "decrement")); + } + inc = c_get_size_in_bytes(CTreeType(result_type)); + } + else + inc = c_integer_one_node; + + inc = c_convert_expr(argtype, inc); + + /* Handle incrementing a cast-expression. */ + + while (1) + switch ( CTreeExprCode(arg)) + { + case C_NOP_EXPR: + case C_CONVERT_EXPR: + case C_FLOAT_EXPR: + case C_FIX_TRUNC_EXPR: + case C_FIX_FLOOR_EXPR: + case C_FIX_ROUND_EXPR: + case C_FIX_CEIL_EXPR: + c_pedantic_lvalue_warning(C_CONVERT_EXPR); + /* If the real type has the same machine representation + as the type it is cast to, we can make better output + by adding directly to the inside of the cast. */ + if (( CTreeTypeCode(CTreeType(arg)) + == CTreeTypeCode(CTreeType(CTreeExprOperand(arg, 0)))) + && (CTreeTypeMode(CTreeType(arg)) + == CTreeTypeMode(CTreeType(CTreeExprOperand(arg, 0))))) + arg = CTreeExprOperand(arg, 0); + else + { + c_tree_node *incremented; + c_tree_node *modify; + c_tree_node *value; + arg = c_stabilize_reference (arg); + if (code == C_PREINCREMENT_EXPR || code == C_PREDECREMENT_EXPR) + value = arg; + else +# ifdef LUDO_DONE + value = save_expr (arg); +# else + value = arg; + +# endif + incremented = c_tree_build_binary_typed_expr (((code == C_PREINCREMENT_EXPR + || code == C_POSTINCREMENT_EXPR) + ? C_PLUS_EXPR : C_MINUS_EXPR), + argtype, value, inc); + CSetTreeNodeSideEffect(incremented); + modify = c_parser_build_modify_expr(arg, C_NOP_EXPR, incremented); + value = c_tree_build_binary_typed_expr( + C_COMPOUND_EXPR, CTreeType(arg), modify, value); + CSetTreeNodeUsed(value); + return value; + } + break; + + default: + goto give_up; + } + give_up: + + /* Complain about anything else that is not a true lvalue. */ + if (!c_lvalue_or_else (arg, ((code == C_PREINCREMENT_EXPR + || code == C_POSTINCREMENT_EXPR) + ? "increment" : "decrement"))) + return c_error_mark_node; + + /* Report a read-only lvalue. */ + if ( CIsTreeNodeReadOnly(arg)) + { + c_readonly_warning (arg, + ((code == C_PREINCREMENT_EXPR + || code == C_POSTINCREMENT_EXPR) + ? "increment" : "decrement")); + } + + val = c_tree_build_binary_typed_expr (code, CTreeType(arg), arg, inc); + CSetTreeNodeSideEffect(val); + val = c_convert_expr(result_type, val); + if ( CTreeTypeCode(val) != code) + { + CSetTreeNodeStatic(val); + } + return val; + } + + case C_ADDR_EXPR: + /* Note that this operation never does default_conversion + regardless of NOCONVERT. */ + + /* Let &* cancel out to simplify resulting code. */ + if ( CTreeExprCode(arg) == C_INDIRECT_REF) + { + /* Don't let this be an lvalue. */ + if (c_lvalue_p (CTreeExprOperand(arg, 0))) + return c_non_lvalue (CTreeExprOperand(arg, 0)); + return CTreeExprOperand(arg, 0); + } + + /* For &x[y], return x+y */ + if ( CTreeExprCode(arg) == C_ARRAY_REF) + { + if (c_mark_addressable (CTreeExprOperand(arg, 0)) == 0) + return c_error_mark_node; + return c_build_binary_op(C_PLUS_EXPR, CTreeExprOperand(arg, 0), + CTreeExprOperand(arg, 1), 1); + } + + /* Handle complex lvalues (when permitted) + by reduction to simpler cases. */ + val = c_unary_complex_lvalue(code, arg); + if (val != 0) + return val; + + /* Allow the address of a constructor if all the elements + are constant. */ + if ( CTreeExprCode(arg) == C_CONSTRUCTOR_EXPR && CIsTreeNodeConstant(arg)) + ; + /* Anything not already handled and not a true memory reference + is an error. */ + else if (typecode != C_FUNCTION_TYPE && !c_lvalue_or_else (arg, "unary `&'")) + return c_error_mark_node; + + /* Ordinary case; arg is a COMPONENT_REF or a decl. */ + argtype = CTreeType(arg); + /* If the lvalue is const or volatile, + merge that into the type that the address will point to. */ + if ( (CTreeNodeFirstCode(arg) == C_DECL_NODE) + || (CTreeNodeFirstCode(arg) == C_EXPR_NODE && + (CTreeExprCode(arg) == C_COMPONENT_REF || + CTreeExprCode(arg) == C_BIT_FIELD_REF || + CTreeExprCode(arg) == C_INDIRECT_REF || + CTreeExprCode(arg) == C_BUFFER_REF || + CTreeExprCode(arg) == C_ARRAY_REF + ))) + { + if ( CIsTreeNodeReadOnly(arg) || CIsTreeNodeVolatile(arg)) + argtype = c_tree_build_type_variant( + argtype, CIsTreeNodeReadOnly(arg), + CIsTreeNodeVolatile(arg)); + } + + argtype = c_tree_build_pointer_type(argtype); + + if (c_mark_addressable (arg) == 0) + return c_error_mark_node; + + { + c_tree_node *addr; + + if ( CTreeExprCode(arg) == C_COMPONENT_REF) + { + c_tree_node *field = CTreeExprOperand(arg, 1); + + addr = c_parser_build_unary_op( C_ADDR_EXPR, CTreeExprOperand(arg, 0), 0); + + if ( CIsTreeDeclBitField(field)) + { + error ("attempt to take address of bit-field structure member `%s'", + CTreeIdentPointer(CTreeDeclName(field))); + return c_error_mark_node; + } + + addr = c_convert_expr(argtype, addr); + + if (! c_tree_is_integer_zerop( CTreeDeclArguments(field))) + { + c_tree_node *offset + = c_build_size_binop( C_TRUNC_DIV_EXPR, + CTreeDeclArguments(field), c_tree_get_size_int( C_BITS_PER_UNIT)); + int flag = CIsTreeNodeConstant(addr); + + addr = c_fold (c_tree_build_binary_typed_expr(C_PLUS_EXPR, argtype, + addr, c_convert_expr(argtype, offset))); + if ( flag ) CSetTreeNodeConstant( addr ); + } + } + else + addr = c_tree_build_unary_typed_expr(code, argtype, arg); + + /* Address of a static or external variable or + file-scope function counts as a constant. */ + if (c_is_staticp(arg) + && ! ( CTreeNodeFirstCode(arg) == C_DECL_NODE && + CTreeDeclCode(arg) == C_FUNCTION_DECL && + CTreeDeclContext(arg) != 0)) + { + CSetTreeNodeConstant( addr ); + } + + return addr; + } + + default: + break; + } + + if (!errstring) + { + if (argtype == 0) + argtype = CTreeType(arg); + return c_fold(c_tree_build_unary_typed_expr(code, argtype, arg)); + } + + error (errstring); + return c_error_mark_node; +} +/*------------------------------------------------------------\ +| | +| C Parser Build Binary Oper | +| | +\------------------------------------------------------------*/ + + +/* Return a c_tree_node *for the sum or difference (RESULTCODE says which) + of pointer PTROP and integer INTOP. */ + +static c_tree_node *c_pointer_int_sum(resultcode, ptrop, intop) + int resultcode; + c_tree_node *ptrop; + c_tree_node *intop; +{ + c_tree_node *size_exp; + + c_tree_node *result; + c_tree_node *folded; + + /* The result is a pointer of the same type that is being added. */ + + c_tree_node *result_type = CTreeType(ptrop); + + if ( CTreeTypeCode(CTreeType(result_type)) == C_VOID_TYPE) + { + if (c_pedantic || c_warn_pointer_arith) + { + pedwarn ("pointer of type `void *' used in arithmetic"); + } + size_exp = c_integer_one_node; + } + else if ( CTreeTypeCode(CTreeType(result_type)) == C_FUNCTION_TYPE) + { + if (c_pedantic || c_warn_pointer_arith) + { + pedwarn ("pointer to a function used in arithmetic"); + } + size_exp = c_integer_one_node; + } + else + size_exp = c_get_size_in_bytes(CTreeType(result_type)); + + /* If what we are about to multiply by the size of the elements + contains a constant term, apply distributive law + and multiply that constant term separately. + This helps produce common subexpressions. */ + + if (( CTreeExprCode(intop) == C_PLUS_EXPR || + CTreeExprCode(intop) == C_MINUS_EXPR) + && ! CIsTreeNodeConstant(intop) + && CIsTreeNodeConstant(CTreeExprOperand(intop, 1)) + && CIsTreeNodeConstant(size_exp) + /* If the constant comes from pointer subtraction, + skip this optimization--it would cause an error. */ + && CTreeTypeCode(CTreeType(CTreeExprOperand(intop, 0))) == C_INTEGER_TYPE + /* If the constant is unsigned, and smaller than the pointer size, + then we must skip this optimization. This is because it could cause + an overflow error if the constant is negative but INTOP is not. */ + && (! CIsTreeNodeUnsigned(CTreeType(intop)) + || (CTreeTypePrecision(CTreeType(intop)) + == CTreeTypePrecision(CTreeType(ptrop))))) + { + int subcode = resultcode; + c_tree_node *int_type = CTreeType(intop); + if ( CTreeExprCode(intop) == C_MINUS_EXPR) + subcode = (subcode == C_PLUS_EXPR ? C_MINUS_EXPR : C_PLUS_EXPR); + /* Convert both subexpression types to the type of intop, + because weird cases involving pointer arithmetic + can result in a sum or difference with different type args. */ + ptrop = c_build_binary_op(subcode, ptrop, + c_convert_expr(int_type, CTreeExprOperand(intop, 1)), 1); + intop = c_convert_expr(int_type, CTreeExprOperand(intop, 0)); + } + + /* Convert the integer argument to a type the same size as c_size_type + so the multiply won't overflow spuriously. */ + + if (CTreeTypePrecision(CTreeType(intop)) != CTreeTypePrecision(c_size_type) + || CIsTreeNodeUnsigned(CTreeType(intop)) != CIsTreeNodeUnsigned(c_size_type)) + intop = c_convert_expr(c_get_type_for_size( CTreeTypePrecision(c_size_type), + CIsTreeNodeUnsigned(c_size_type)), intop); + + /* Replace the integer argument with a suitable product by the object size. + Do this multiplication as signed, then convert to the appropriate + pointer type (actually unsigned integral). */ + + intop = c_convert_expr( result_type, + c_build_binary_op( C_MULT_EXPR, intop, + c_convert_expr(CTreeType(intop), size_exp), 1)); + + /* Create the sum or difference. */ + + result = c_tree_build_binary_expr(resultcode, ptrop, intop); + CTreeType( result ) = result_type; + + folded = c_fold (result); + + if (folded == result) + { + if ( CIsTreeNodeConstant( ptrop ) && + CIsTreeNodeConstant( intop ) ) + { + CSetTreeNodeConstant( folded ); + } + } + return folded; +} + + +/* Return a c_tree_node *for the difference of pointers OP0 and OP1. + The resulting c_tree_node *has type int. */ + +static c_tree_node *c_pointer_diff(op0, op1) + c_tree_node *op0; + c_tree_node *op1; +{ + c_tree_node *result; + c_tree_node *folded; + c_tree_node *restype = c_ptrdiff_type_node; + + c_tree_node *target_type = CTreeType(CTreeType(op0)); + + if (c_pedantic || c_warn_pointer_arith) + { + if ( CTreeTypeCode(target_type) == C_VOID_TYPE) + { + pedwarn ("pointer of type `void *' used in subtraction"); + } + if ( CTreeTypeCode(target_type) == C_FUNCTION_TYPE) + { + pedwarn ("pointer to a function used in subtraction"); + } + } + + /* First do the subtraction as integers; + then drop through to build the divide operator. + Do not do default conversions on the minus operator + in case restype is a short type. */ + + op0 = c_build_binary_op( C_MINUS_EXPR, c_convert_expr(restype, op0), + c_convert_expr(restype, op1), 0); + /* This generates an error if op1 is pointer to incomplete type. */ + if (CTreeTypeSize(CTreeType(CTreeType(op1))) == 0) + { + error ("arithmetic on pointer to an incomplete type"); + } + + /* This generates an error if op0 is pointer to incomplete type. */ + op1 = c_get_size_in_bytes(target_type); + + /* Divide by the size, in easiest possible way. */ + + result = c_tree_build_binary_expr( C_EXACT_DIV_EXPR, op0, c_convert_expr(restype, op1)); + CTreeType( result ) = restype; + + folded = c_fold (result); + + if (folded == result) + { + if ( CIsTreeNodeConstant(op0) && + CIsTreeNodeConstant(op1) ) + { + CSetTreeNodeConstant( folded ); + } + } + return folded; +} + +/* Return the common type of two types. + We assume that comptypes has already been done and returned 1; + if that isn't so, this may crash. In particular, we assume that qualifiers + match. + + This is the type for the result of most arithmetic operations + if the operands have the given two types. */ + +c_tree_node *c_get_common_type(t1, t2) + c_tree_node *t1; + c_tree_node *t2; +{ + int code1; + int code2; + c_tree_node *attributes; + + /* Save time if the two types are the same. */ + + if (t1 == t2) return t1; + + /* If one type is nonsense, use the other. */ + if (t1 == c_error_mark_node) + return t2; + if (t2 == c_error_mark_node) + return t1; + +# ifdef LUDO_NO_SKIP + /* Merge the attributes */ + attributes = c_merge_attributes (TYPE_ATTRIBUTES (t1), TYPE_ATTRIBUTES (t2)); +# else + attributes = NULL; +# endif + + /* Treat an enum type as the unsigned integer type of the same width. */ + + if ( CTreeTypeCode (t1) == C_ENUMERAL_TYPE) + t1 = c_get_type_for_size(CTreeTypePrecision(t1), 1); + if ( CTreeTypeCode (t2) == C_ENUMERAL_TYPE) + t2 = c_get_type_for_size(CTreeTypePrecision(t2), 1); + + code1 = CTreeTypeCode(t1); + code2 = CTreeTypeCode(t2); + + /* If one type is complex, form the common type of the non-complex + components, then make that complex. Use T1 or T2 if it is the + required type. */ + if (code1 == C_COMPLEX_TYPE || code2 == C_COMPLEX_TYPE) + { + c_tree_node *subtype1 = code1 == C_COMPLEX_TYPE ? CTreeType(t1) : t1; + c_tree_node *subtype2 = code2 == C_COMPLEX_TYPE ? CTreeType(t2) : t2; + c_tree_node *subtype = c_get_common_type(subtype1, subtype2); + + if (code1 == C_COMPLEX_TYPE && CTreeType(t1) == subtype) + return c_tree_build_type_attribute_variant(t1, attributes); + else if (code2 == C_COMPLEX_TYPE && CTreeType(t2) == subtype) + return c_tree_build_type_attribute_variant(t2, attributes); + else + return c_tree_build_type_attribute_variant( + c_tree_build_complex_type(subtype), attributes); + } + + switch (code1) + { + case C_INTEGER_TYPE: + case C_REAL_TYPE: + /* If only one is real, use it as the result. */ + + if (code1 == C_REAL_TYPE && code2 != C_REAL_TYPE) + return c_tree_build_type_attribute_variant(t1, attributes); + + if (code2 == C_REAL_TYPE && code1 != C_REAL_TYPE) + return c_tree_build_type_attribute_variant(t2, attributes); + + /* Both real or both integers; use the one with greater precision. */ + + if (CTreeTypePrecision(t1) > CTreeTypePrecision(t2)) + return c_tree_build_type_attribute_variant(t1, attributes); + else if (CTreeTypePrecision(t2) > CTreeTypePrecision(t1)) + return c_tree_build_type_attribute_variant(t2, attributes); + + /* Same precision. Prefer longs to ints even when same size. */ + + if (CTreeTypeMainVariant(t1) == c_long_unsigned_type_node + || CTreeTypeMainVariant(t2) == c_long_unsigned_type_node) + return c_tree_build_type_attribute_variant(c_long_unsigned_type_node, + attributes); + + if (CTreeTypeMainVariant(t1) == c_long_integer_type_node + || CTreeTypeMainVariant(t2) == c_long_integer_type_node) + { + /* But preserve unsignedness from the other type, + since long cannot hold all the values of an unsigned int. */ + if (CIsTreeNodeUnsigned (t1) || CIsTreeNodeUnsigned (t2)) + t1 = c_long_unsigned_type_node; + else + t1 = c_long_integer_type_node; + return c_tree_build_type_attribute_variant(t1, attributes); + } + + /* Likewise, prefer long double to double even if same size. */ + if (CTreeTypeMainVariant(t1) == c_long_double_type_node + || CTreeTypeMainVariant(t2) == c_long_double_type_node) + return c_tree_build_type_attribute_variant(c_long_double_type_node, + attributes); + + /* Otherwise prefer the unsigned one. */ + + if (CIsTreeNodeUnsigned (t1)) + return c_tree_build_type_attribute_variant(t1, attributes); + else + return c_tree_build_type_attribute_variant(t2, attributes); + + case C_POINTER_TYPE: + /* For two pointers, do this recursively on the target type, + and combine the qualifiers of the two types' targets. */ + /* This code was turned off; I don't know why. + But ANSI C specifies doing this with the qualifiers. + So I turned it on again. */ + { + c_tree_node *target = c_get_common_type (CTreeTypeMainVariant(CTreeType(t1)), + CTreeTypeMainVariant(CTreeType(t2))); + int constp + = CIsTreeNodeReadOnly (CTreeType(t1)) || CIsTreeNodeReadOnly (CTreeType(t2)); + int volatilep + = CIsTreeNodeVolatile (CTreeType(t1)) || CIsTreeNodeVolatile (CTreeType(t2)); + t1 = c_tree_build_pointer_type(c_tree_build_type_variant(target, constp, + volatilep)); + return c_tree_build_type_attribute_variant(t1, attributes); + } + + case C_ARRAY_TYPE: + { + c_tree_node *elt = c_get_common_type (CTreeType(t1), CTreeType(t2)); + /* Save space: see if the result is identical to one of the args. */ + if (elt == CTreeType(t1) && CTreeTypeValues (t1)) + return c_tree_build_type_attribute_variant(t1, attributes); + if (elt == CTreeType(t2) && CTreeTypeValues (t2)) + return c_tree_build_type_attribute_variant(t2, attributes); + /* Merge the element types, and have a size if either arg has one. */ + t1 = c_tree_build_array_type (elt, CTreeTypeValues(CTreeTypeValues (t1) ? t1 : t2)); + return c_tree_build_type_attribute_variant(t1, attributes); + } + + case C_FUNCTION_TYPE: + /* Function types: prefer the one that specified arg types. + If both do, merge the arg types. Also merge the return types. */ + { + c_tree_node *valtype = c_get_common_type (CTreeType(t1), CTreeType(t2)); + c_tree_node *p1 = CTreeTypeValues (t1); + c_tree_node *p2 = CTreeTypeValues (t2); + int len; + c_tree_node *newargs; + c_tree_node *n; + int i; + + /* Save space: see if the result is identical to one of the args. */ + if (valtype == CTreeType(t1) && ! CTreeTypeValues (t2)) + return c_tree_build_type_attribute_variant(t1, attributes); + if (valtype == CTreeType(t2) && ! CTreeTypeValues (t1)) + return c_tree_build_type_attribute_variant(t2, attributes); + + /* Simple way if one arg fails to specify argument types. */ + if (CTreeTypeValues (t1) == 0) + { + t1 = c_tree_build_function_type (valtype, CTreeTypeValues(t2)); + return c_tree_build_type_attribute_variant(t1, attributes); + } + if (CTreeTypeValues (t2) == 0) + { + t1 = c_tree_build_function_type (valtype, CTreeTypeValues(t1)); + return c_tree_build_type_attribute_variant(t1, attributes); + } + + /* If both args specify argument types, we must merge the two + lists, argument by argument. */ + + len = c_tree_get_list_length(p1); + newargs = 0; + + for (i = 0; i < len; i++) + newargs = c_tree_add_head_list( NULL, NULL, newargs); + + n = newargs; + + for (; p1; + p1 = CTreeChain(p1), p2 = CTreeChain(p2), n = CTreeChain(n)) + { + /* A null type means arg type is not specified. + Take whatever the other function type has. */ + if ( CTreeListValue (p1) == 0) + { + CTreeListValue (n) = CTreeListValue (p2); + goto parm_done; + } + if ( CTreeListValue (p2) == 0) + { + CTreeListValue (n) = CTreeListValue (p1); + goto parm_done; + } + + /* Given wait (union {union wait *u; int *i} *) + and wait (union wait *), + prefer union wait * as type of parm. */ + if ( CTreeTypeCode(CTreeListValue (p1)) == C_UNION_TYPE + && CTreeListValue (p1) != CTreeListValue (p2)) + { + c_tree_node *memb; + for (memb = CTreeTypeValues(CTreeListValue (p1)); + memb; memb = CTreeChain(memb)) + if (c_is_comptypes(CTreeType(memb), CTreeListValue (p2))) + { + CTreeListValue (n) = CTreeListValue (p2); + if (c_pedantic) + { + pedwarn ("function types not truly compatible in ANSI C"); + } + goto parm_done; + } + } + if ( CTreeTypeCode( CTreeListValue (p2)) == C_UNION_TYPE + && CTreeListValue(p2) != CTreeListValue(p1)) + { + c_tree_node *memb; + for (memb = CTreeTypeValues( CTreeListValue (p2)); + memb; memb = CTreeChain(memb)) + if (c_is_comptypes(CTreeType(memb), CTreeListValue (p1))) + { + CTreeListValue (n) = CTreeListValue (p1); + if (c_pedantic) + { + pedwarn ("function types not truly compatible in ANSI C"); + } + goto parm_done; + } + } + CTreeListValue(n) = c_get_common_type( CTreeListValue(p1), CTreeListValue(p2)); + parm_done: ; + } + + t1 = c_tree_build_function_type(valtype, newargs); + /* ... falls through ... */ + } + + default: + return c_tree_build_type_attribute_variant(t1, attributes); + } +} + + +/* Print an error message for invalid operands to arith operation CODE. + NOP_EXPR is used as a special case (see truthvalue_conversion). */ + +void c_binary_op_error (code) + int code; +{ + char *opname; + + switch (code) + { + case C_NOP_EXPR: + error ("invalid truth-value expression"); + return; + + case C_PLUS_EXPR: + opname = "+"; break; + case C_MINUS_EXPR: + opname = "-"; break; + case C_MULT_EXPR: + opname = "*"; break; + case C_MAX_EXPR: + opname = "max"; break; + case C_MIN_EXPR: + opname = "min"; break; + case C_EQ_EXPR: + opname = "=="; break; + case C_NE_EXPR: + opname = "!="; break; + case C_LE_EXPR: + opname = "<="; break; + case C_GE_EXPR: + opname = ">="; break; + case C_LT_EXPR: + opname = "<"; break; + case C_GT_EXPR: + opname = ">"; break; + case C_LSHIFT_EXPR: + opname = "<<"; break; + case C_RSHIFT_EXPR: + opname = ">>"; break; + case C_TRUNC_MOD_EXPR: + case C_FLOOR_MOD_EXPR: + opname = "%"; break; + case C_TRUNC_DIV_EXPR: + case C_FLOOR_DIV_EXPR: + opname = "/"; break; + case C_BIT_AND_EXPR: + opname = "&"; break; + case C_BIT_IOR_EXPR: + opname = "|"; break; + case C_TRUTH_ANDIF_EXPR: + opname = "&&"; break; + case C_TRUTH_ORIF_EXPR: + opname = "||"; break; + case C_BIT_XOR_EXPR: + opname = "^"; break; + case C_LROTATE_EXPR: + case C_RROTATE_EXPR: + opname = "rotate"; break; + default: + opname = "unknown"; break; + } + error ("invalid operands to binary %s", opname); +} + +/* Build a binary-operation expression without default conversions. + CODE is the kind of expression to build. + This function differs from `build' in several ways: + the data type of the result is computed and recorded in it, + warnings are generated if arg data types are invalid, + special handling for addition and subtraction of pointers is known, + and some optimization is done (operations on narrow ints + are done in the narrower type when that gives the same result). + Constant folding is also done before the result is returned. + + Note that the operands will never have enumeral types, or function + or array types, because either they will have the default conversions + performed or they have both just been converted to some other type in which + the arithmetic is to be done. */ + +c_tree_node *c_build_binary_op(code, orig_op0, orig_op1, convert_p) + int code; + c_tree_node *orig_op0; + c_tree_node *orig_op1; + int convert_p; +{ + c_tree_node *type0; + c_tree_node *type1; + int code0, code1; + c_tree_node *op0; + c_tree_node *op1; + + /* Expression code to give to the expression when it is built. + Normally this is CODE, which is what the caller asked for, + but in some special cases we change it. */ + int resultcode = code; + + /* Data type in which the computation is to be performed. + In the simplest cases this is the common type of the arguments. */ + c_tree_node *result_type = NULL; + + /* Nonzero means operands have already been type-converted + in whatever way is necessary. + Zero means they need to be converted to RESULT_TYPE. */ + int converted = 0; + + /* Nonzero means create the expression with this type, rather than + RESULT_TYPE. */ + c_tree_node *build_type = 0; + + /* Nonzero means after finally constructing the expression + convert it to this type. */ + c_tree_node *final_type = 0; + + /* Nonzero if this is an operation like MIN or MAX which can + safely be computed in short if both args are promoted shorts. + Also implies COMMON. + -1 indicates a bitwise operation; this makes a difference + in the exact conditions for when it is safe to do the operation + in a narrower mode. */ + int shorten = 0; + + /* Nonzero if this is a comparison operation; + if both args are promoted shorts, compare the original shorts. + Also implies COMMON. */ + int short_compare = 0; + + /* Nonzero if this is a right-shift operation, which can be computed on the + original short and then promoted if the operand is a promoted short. */ + int short_shift = 0; + + /* Nonzero means set RESULT_TYPE to the common type of the args. */ + int common = 0; + + if (convert_p) + { + op0 = c_default_conversion(orig_op0); + op1 = c_default_conversion(orig_op1); + } + else + { + op0 = orig_op0; + op1 = orig_op1; + } + + type0 = CTreeType(op0); + type1 = CTreeType(op1); + + /* The expression codes of the data types of the arguments tell us + whether the arguments are integers, floating, pointers, etc. */ + code0 = CTreeTypeCode(type0); + code1 = CTreeTypeCode(type1); + + /* Strip NON_LVALUE_EXPRs, etc., since we aren't using as an lvalue. */ + CStripTypeNops(op0); + CStripTypeNops(op1); + + /* If an error was already reported for one of the arguments, + avoid reporting another error. */ + + if ( CTreeNodeFirstCode(type0) == C_ERROR_NODE || + CTreeNodeFirstCode(type1) == C_ERROR_NODE) + { + return c_error_mark_node; + } + + switch (code) + { + case C_PLUS_EXPR: + /* Handle the pointer + int case. */ + if (code0 == C_POINTER_TYPE && code1 == C_INTEGER_TYPE) + return c_pointer_int_sum(C_PLUS_EXPR, op0, op1); + else if (code1 == C_POINTER_TYPE && code0 == C_INTEGER_TYPE) + return c_pointer_int_sum(C_PLUS_EXPR, op1, op0); + else + common = 1; + break; + + case C_MINUS_EXPR: + /* Subtraction of two similar pointers. + We must subtract them as integers, then divide by object size. */ + if (code0 == C_POINTER_TYPE && code1 == C_POINTER_TYPE + && c_is_comp_target_types(type0, type1)) + return c_pointer_diff(op0, op1); + /* Handle pointer minus int. Just like pointer plus int. */ + else if (code0 == C_POINTER_TYPE && code1 == C_INTEGER_TYPE) + return c_pointer_int_sum(C_MINUS_EXPR, op0, op1); + else + common = 1; + break; + + case C_MULT_EXPR: + common = 1; + break; + + case C_TRUNC_DIV_EXPR: + case C_CEIL_DIV_EXPR: + case C_FLOOR_DIV_EXPR: + case C_ROUND_DIV_EXPR: + case C_EXACT_DIV_EXPR: + if ((code0 == C_INTEGER_TYPE || code0 == C_REAL_TYPE + || code0 == C_COMPLEX_TYPE) + && (code1 == C_INTEGER_TYPE || code1 == C_REAL_TYPE + || code1 == C_COMPLEX_TYPE)) + { + if (!(code0 == C_INTEGER_TYPE && code1 == C_INTEGER_TYPE)) + resultcode = C_RDIV_EXPR; + else + { + /* Although it would be tempting to shorten always here, that + loses on some targets, since the modulo instruction is + undefined if the quotient can't be represented in the + computation mode. We shorten only if unsigned or if + dividing by something we know != -1. */ + shorten = ( CIsTreeNodeUnsigned(CTreeType(orig_op0)) + || ( CTreeNodeFirstCode(op1) == C_INT_CST_NODE + && ( CTreeIntCstLow(op1) != -1 + || CTreeIntCstHigh(op1) != -1))); + } + common = 1; + } + break; + + case C_BIT_AND_EXPR: + case C_BIT_ANDTC_EXPR: + case C_BIT_IOR_EXPR: + case C_BIT_XOR_EXPR: + if (code0 == C_INTEGER_TYPE && code1 == C_INTEGER_TYPE) + shorten = -1; + /* If one operand is a constant, and the other is a short type + that has been converted to an int, + really do the work in the short type and then convert the + result to int. If we are lucky, the constant will be 0 or 1 + in the short type, making the entire operation go away. */ + if ( CTreeNodeFirstCode(op0) == C_INT_CST_NODE + && CTreeNodeFirstCode(op1) == C_EXPR_NODE + && CTreeExprCode(op1) == C_NOP_EXPR + && CTreeTypePrecision(type1) > + CTreeTypePrecision(CTreeType(CTreeExprOperand(op1, 0))) + && CIsTreeNodeUnsigned(CTreeType(CTreeExprOperand(op1, 0)))) + { + final_type = result_type; + op1 = CTreeExprOperand(op1, 0); + result_type = CTreeType(op1); + } + if ( CTreeNodeFirstCode(op1) == C_INT_CST_NODE + && CTreeNodeFirstCode(op0) == C_EXPR_NODE + && CTreeExprCode(op0) == C_NOP_EXPR + && CTreeTypePrecision(type0) > + CTreeTypePrecision(CTreeType( CTreeExprOperand(op0, 0))) + && CIsTreeNodeUnsigned(CTreeType( CTreeExprOperand(op0, 0)))) + { + final_type = result_type; + op0 = CTreeExprOperand(op0, 0); + result_type = CTreeType(op0); + } + break; + + case C_TRUNC_MOD_EXPR: + case C_FLOOR_MOD_EXPR: + if (code0 == C_INTEGER_TYPE && code1 == C_INTEGER_TYPE) + { + /* Although it would be tempting to shorten always here, that loses + on some targets, since the modulo instruction is undefined if the + quotient can't be represented in the computation mode. We shorten + only if unsigned or if dividing by something we know != -1. */ + shorten = ( CIsTreeNodeUnsigned(CTreeType(orig_op0)) + || ( CTreeNodeFirstCode(op1) == C_INT_CST_NODE + && ( CTreeIntCstLow(op1) != -1 + || CTreeIntCstHigh(op1) != -1))); + common = 1; + } + break; + + case C_TRUTH_ANDIF_EXPR: + case C_TRUTH_ORIF_EXPR: + case C_TRUTH_AND_EXPR: + case C_TRUTH_OR_EXPR: + case C_TRUTH_XOR_EXPR: + if ((code0 == C_INTEGER_TYPE || code0 == C_POINTER_TYPE + || code0 == C_REAL_TYPE || code0 == C_COMPLEX_TYPE) + && (code1 == C_INTEGER_TYPE || code1 == C_POINTER_TYPE + || code1 == C_REAL_TYPE || code1 == C_COMPLEX_TYPE)) + { + /* Result of these operations is always an int, + but that does not mean the operands should be + converted to ints! */ + result_type = c_integer_type_node; + op0 = c_truthvalue_conversion(op0); + op1 = c_truthvalue_conversion(op1); + converted = 1; + } + break; + + /* Shift operations: result has same type as first operand; + always convert second operand to int. + Also set SHORT_SHIFT if shifting rightward. */ + + case C_RSHIFT_EXPR: + if (code0 == C_INTEGER_TYPE && code1 == C_INTEGER_TYPE) + { + if ( CTreeNodeFirstCode(op1) == C_INT_CST_NODE && c_skip_evaluation == 0) + { + if (c_tree_is_int_cst_sgn(op1) < 0) + { + warning ("right shift count is negative"); + } + else + { + if ( CTreeIntCstLow(op1) | CTreeIntCstHigh(op1)) + { + short_shift = 1; + } + if ( CTreeIntCstHigh(op1) != 0 + || ((unsigned int) CTreeIntCstLow(op1) + >= CTreeTypePrecision(type0))) + { + warning ("right shift count >= width of type"); + } + } + } + /* Use the type of the value to be shifted. + This is what most traditional C compilers do. */ + result_type = type0; + /* Unless traditional, convert the shift-count to an integer, + regardless of size of value being shifted. */ + if (! c_flag_traditional) + { + if (CTreeTypeMainVariant(CTreeType(op1)) != c_integer_type_node) + { + op1 = c_convert_expr( c_integer_type_node, op1); + } + /* Avoid converting op1 to result_type later. */ + converted = 1; + } + } + break; + + case C_LSHIFT_EXPR: + if (code0 == C_INTEGER_TYPE && code1 == C_INTEGER_TYPE) + { + if ( CTreeNodeFirstCode(op1) == C_INT_CST_NODE && c_skip_evaluation == 0) + { + if ( c_tree_is_int_cst_sgn(op1) < 0) + { + warning ("left shift count is negative"); + } + else if ( CTreeIntCstHigh(op1) != 0 + || ((unsigned int) CTreeIntCstLow(op1) + >= CTreeTypePrecision(type0))) + { + warning ("left shift count >= width of type"); + } + } + /* Use the type of the value to be shifted. + This is what most traditional C compilers do. */ + result_type = type0; + /* Unless traditional, convert the shift-count to an integer, + regardless of size of value being shifted. */ + if (! c_flag_traditional) + { + if (CTreeTypeMainVariant(CTreeType(op1)) != c_integer_type_node) + op1 = c_convert_expr(c_integer_type_node, op1); + /* Avoid converting op1 to result_type later. */ + converted = 1; + } + } + break; + + case C_RROTATE_EXPR: + case C_LROTATE_EXPR: + if (code0 == C_INTEGER_TYPE && code1 == C_INTEGER_TYPE) + { + if ( CTreeNodeFirstCode(op1) == C_INT_CST_NODE && c_skip_evaluation == 0) + { + if (c_tree_is_int_cst_sgn (op1) < 0) + { + warning ("shift count is negative"); + } + else if ( CTreeIntCstHigh(op1) != 0 + || ((unsigned int) CTreeIntCstLow(op1) + >= CTreeTypePrecision(type0))) + { + warning ("shift count >= width of type"); + } + } + /* Use the type of the value to be shifted. + This is what most traditional C compilers do. */ + result_type = type0; + /* Unless traditional, convert the shift-count to an integer, + regardless of size of value being shifted. */ + if (! c_flag_traditional) + { + if (CTreeTypeMainVariant(CTreeType(op1)) != c_integer_type_node) + op1 = c_convert_expr(c_integer_type_node, op1); + /* Avoid converting op1 to result_type later. */ + converted = 1; + } + } + break; + + case C_EQ_EXPR: + case C_NE_EXPR: + /* Result of comparison is always int, + but don't convert the args to int! */ + build_type = c_integer_type_node; + if ((code0 == C_INTEGER_TYPE || code0 == C_REAL_TYPE + || code0 == C_COMPLEX_TYPE) + && (code1 == C_INTEGER_TYPE || code1 == C_REAL_TYPE + || code1 == C_COMPLEX_TYPE)) + short_compare = 1; + else if (code0 == C_POINTER_TYPE && code1 == C_POINTER_TYPE) + { + c_tree_node *tt0 = CTreeType(type0); + c_tree_node *tt1 = CTreeType(type1); + /* Anything compares with void *. void * compares with anything. + Otherwise, the targets must be compatible + and both must be object or both incomplete. */ + if ( c_is_comp_target_types(type0, type1)) + { + result_type = c_get_common_type (type0, type1); + } + else if (CTreeTypeMainVariant(tt0) == c_void_type_node) + { + /* op0 != orig_op0 detects the case of something + whose value is 0 but which isn't a valid null ptr const. */ + if (c_pedantic && (! c_tree_is_integer_zerop(op0) || op0 != orig_op0) + && CTreeTypeCode(tt1) == C_FUNCTION_TYPE) + { + pedwarn ("ANSI C forbids comparison of `void *' with function pointer"); + } + } + else if (CTreeTypeMainVariant(tt1) == c_void_type_node) + { + if (c_pedantic && (!c_tree_is_integer_zerop(op1) || op1 != orig_op1) + && CTreeTypeCode(tt0) == C_FUNCTION_TYPE) + { + pedwarn ("ANSI C forbids comparison of `void *' with function pointer"); + } + } + else + { + pedwarn ("comparison of distinct pointer types lacks a cast"); + } + + if (result_type == NULL) + result_type = c_ptr_type_node; + } + else if (code0 == C_POINTER_TYPE && CTreeNodeFirstCode(op1) == C_INT_CST_NODE + && c_tree_is_integer_zerop(op1)) + result_type = type0; + else if (code1 == C_POINTER_TYPE && CTreeNodeFirstCode(op0) == C_INT_CST_NODE + && c_tree_is_integer_zerop(op0)) + result_type = type1; + else if (code0 == C_POINTER_TYPE && code1 == C_INTEGER_TYPE) + { + result_type = type0; + if (! c_flag_traditional) + { + pedwarn ("comparison between pointer and integer"); + } + } + else if (code0 == C_INTEGER_TYPE && code1 == C_POINTER_TYPE) + { + result_type = type1; + if (! c_flag_traditional) + { + pedwarn ("comparison between pointer and integer"); + } + } + break; + + case C_MAX_EXPR: + case C_MIN_EXPR: + if ((code0 == C_INTEGER_TYPE || code0 == C_REAL_TYPE) + && (code1 == C_INTEGER_TYPE || code1 == C_REAL_TYPE)) + shorten = 1; + else if (code0 == C_POINTER_TYPE && code1 == C_POINTER_TYPE) + { + if ( c_is_comp_target_types(type0, type1)) + { + result_type = c_get_common_type(type0, type1); + if (c_pedantic + && CTreeTypeCode(CTreeType(type0)) == C_FUNCTION_TYPE) + { + pedwarn ("ANSI C forbids ordered comparisons of pointers to functions"); + } + } + else + { + result_type = c_ptr_type_node; + pedwarn ("comparison of distinct pointer types lacks a cast"); + } + } + break; + + case C_LE_EXPR: + case C_GE_EXPR: + case C_LT_EXPR: + case C_GT_EXPR: + build_type = c_integer_type_node; + if ((code0 == C_INTEGER_TYPE || code0 == C_REAL_TYPE) + && (code1 == C_INTEGER_TYPE || code1 == C_REAL_TYPE)) + short_compare = 1; + else if (code0 == C_POINTER_TYPE && code1 == C_POINTER_TYPE) + { + if ( c_is_comp_target_types(type0, type1)) + { + result_type = c_get_common_type (type0, type1); + if ((CTreeTypeSize(CTreeType(type0)) != 0) + != (CTreeTypeSize(CTreeType(type1)) != 0)) + { + pedwarn ("comparison of complete and incomplete pointers"); + } + else if (c_pedantic + && CTreeTypeCode(CTreeType(type0)) == C_FUNCTION_TYPE) + { + pedwarn ("ANSI C forbids ordered comparisons of pointers to functions"); + } + } + else + { + result_type = c_ptr_type_node; + pedwarn ("comparison of distinct pointer types lacks a cast"); + } + } + else if (code0 == C_POINTER_TYPE && CTreeNodeFirstCode(op1) == C_INT_CST_NODE + && c_tree_is_integer_zerop (op1)) + { + result_type = type0; + if (c_pedantic || c_extra_warnings) + { + pedwarn ("ordered comparison of pointer with integer zero"); + } + } + else if (code1 == C_POINTER_TYPE && CTreeNodeFirstCode(op0) == C_INT_CST_NODE + && c_tree_is_integer_zerop (op0)) + { + result_type = type1; + if (c_pedantic) + { + pedwarn ("ordered comparison of pointer with integer zero"); + } + } + else if (code0 == C_POINTER_TYPE && code1 == C_INTEGER_TYPE) + { + result_type = type0; + if (! c_flag_traditional) + { + pedwarn ("comparison between pointer and integer"); + } + } + else if (code0 == C_INTEGER_TYPE && code1 == C_POINTER_TYPE) + { + result_type = type1; + if (! c_flag_traditional) + { + pedwarn ("comparison between pointer and integer"); + } + } + break; + + default: + break; + } + + if ((code0 == C_INTEGER_TYPE || code0 == C_REAL_TYPE || code0 == C_COMPLEX_TYPE) + && + (code1 == C_INTEGER_TYPE || code1 == C_REAL_TYPE || code1 == C_COMPLEX_TYPE)) + { + int none_complex = (code0 != C_COMPLEX_TYPE && code1 != C_COMPLEX_TYPE); + + if (shorten || common || short_compare) + result_type = c_get_common_type (type0, type1); + + /* For certain operations (which identify themselves by shorten != 0) + if both args were extended from the same smaller type, + do the arithmetic in that type and then extend. + + shorten !=0 and !=1 indicates a bitwise operation. + For them, this optimization is safe only if + both args are zero-extended or both are sign-extended. + Otherwise, we might change the result. + Eg, (short)-1 | (unsigned short)-1 is (int)-1 + but calculated in (unsigned short) it would be (unsigned short)-1. */ + + if (shorten && none_complex) + { + int unsigned0, unsigned1; + c_tree_node *arg0 = c_get_narrower(op0, &unsigned0); + c_tree_node *arg1 = c_get_narrower(op1, &unsigned1); + /* UNS is 1 if the operation to be done is an unsigned one. */ + int uns = !! CIsTreeNodeUnsigned(result_type); + c_tree_node *type; + + final_type = result_type; + + /* Handle the case that OP0 (or OP1) does not *contain* a conversion + but it *requires* conversion to FINAL_TYPE. */ + + if (( CTreeTypePrecision(CTreeType(op0)) + == CTreeTypePrecision(CTreeType(arg0))) + && CTreeType(op0) != final_type) + unsigned0 = !!CIsTreeNodeUnsigned(CTreeType(op0)); + if (( CTreeTypePrecision(CTreeType(op1)) + == CTreeTypePrecision(CTreeType(arg1))) + && CTreeType(op1) != final_type) + unsigned1 = !!CIsTreeNodeUnsigned(CTreeType(op1)); + + /* Now UNSIGNED0 is 1 if ARG0 zero-extends to FINAL_TYPE. */ + + /* For bitwise operations, signedness of nominal type + does not matter. Consider only how operands were extended. */ + if (shorten == -1) + uns = unsigned0; + + /* Note that in all three cases below we refrain from optimizing + an unsigned operation on sign-extended args. + That would not be valid. */ + + /* Both args variable: if both extended in same way + from same width, do it in that width. + Do it unsigned if args were zero-extended. */ + if ((CTreeTypePrecision(CTreeType(arg0)) + < CTreeTypePrecision(result_type)) + && (CTreeTypePrecision(CTreeType(arg1)) + == CTreeTypePrecision(CTreeType(arg0))) + && unsigned0 == unsigned1 + && (unsigned0 || !uns)) + result_type + = c_get_signed_or_unsigned_type(unsigned0, + c_get_common_type (CTreeType(arg0), CTreeType(arg1))); + else if ( CTreeNodeFirstCode(arg0) == C_INT_CST_NODE + && (unsigned1 || !uns) + && ( CTreeTypePrecision(CTreeType(arg1)) + < CTreeTypePrecision(result_type)) + && (type = c_get_signed_or_unsigned_type(unsigned1, CTreeType(arg1)), + c_int_fits_type_p (arg0, type))) + result_type = type; + else if ( CTreeNodeFirstCode(arg1) == C_INT_CST_NODE + && (unsigned0 || !uns) + && ( CTreeTypePrecision(CTreeType(arg0)) + < CTreeTypePrecision(result_type)) + && (type = c_get_signed_or_unsigned_type(unsigned0, CTreeType(arg0)), + c_int_fits_type_p (arg1, type))) + result_type = type; + } + + /* Shifts can be shortened if shifting right. */ + + if (short_shift) + { + int unsigned_arg; + c_tree_node *arg0 = c_get_narrower(op0, &unsigned_arg); + + final_type = result_type; + + if (arg0 == op0 && final_type == CTreeType(op0)) + unsigned_arg = !!CIsTreeNodeUnsigned(CTreeType(op0)); + + if (CTreeTypePrecision(CTreeType(arg0)) < CTreeTypePrecision(result_type) + /* We can shorten only if the shift count is less than the + number of bits in the smaller type size. */ + && CTreeIntCstHigh(op1) == 0 + && CTreeTypePrecision(CTreeType(arg0)) > CTreeIntCstLow(op1) + /* If arg is sign-extended and then unsigned-shifted, + we can simulate this with a signed shift in arg's type + only if the extended result is at least twice as wide + as the arg. Otherwise, the shift could use up all the + ones made by sign-extension and bring in zeros. + We can't optimize that case at all, but in most machines + it never happens because available widths are 2**N. */ + && (! CIsTreeNodeUnsigned(final_type) + || unsigned_arg + || 2 * CTreeTypePrecision(CTreeType(arg0)) <= CTreeTypePrecision(result_type))) + { + /* Do an unsigned shift if the operand was zero-extended. */ + result_type + = c_get_signed_or_unsigned_type(unsigned_arg, CTreeType(arg0)); + /* Convert value-to-be-shifted to that type. */ + if (CTreeType(op0) != result_type) + op0 = c_convert_expr(result_type, op0); + converted = 1; + } + } + + /* Comparison operations are shortened too but differently. + They identify themselves by setting short_compare = 1. */ + + if (short_compare) + { + /* Don't write &op0, etc., because that would prevent op0 + from being kept in a register. + Instead, make copies of the our local variables and + pass the copies by reference, then copy them back afterward. */ + c_tree_node *xop0 = op0; + c_tree_node *xop1 = op1; + c_tree_node *xresult_type = result_type; + int xresultcode = resultcode; + c_tree_node *val + = c_shorten_compare(&xop0, &xop1, &xresult_type, &xresultcode); + if (val != 0) + return val; + op0 = xop0, op1 = xop1; + converted = 1; + resultcode = xresultcode; + + if ((c_warn_sign_compare < 0 ? c_extra_warnings : c_warn_sign_compare != 0) + && c_skip_evaluation == 0) + { + int op0_signed = ! CIsTreeNodeUnsigned(CTreeType(orig_op0)); + int op1_signed = ! CIsTreeNodeUnsigned(CTreeType(orig_op1)); + + int unsignedp0, unsignedp1; + c_tree_node *primop0 = c_get_narrower(op0, &unsignedp0); + c_tree_node *primop1 = c_get_narrower(op1, &unsignedp1); + + /* Avoid spurious warnings for comparison with enumerators. */ + + xop0 = orig_op0; + xop1 = orig_op1; + CStripTypeNops(xop0); + CStripTypeNops(xop1); + + /* Give warnings for comparisons between signed and unsigned + quantities that may fail. */ + /* Do the checking based on the original operand trees, so that + casts will be considered, but default promotions won't be. */ + + /* Do not warn if the comparison is being done in a signed type, + since the signed type will only be chosen if it can represent + all the values of the unsigned type. */ + if (! CIsTreeNodeUnsigned(result_type)) + /* OK */; + /* Do not warn if both operands are unsigned. */ + else if (op0_signed == op1_signed) + /* OK */; + /* Do not warn if the signed quantity is an unsuffixed + integer literal (or some static constant expression + involving such literals) and it is non-negative. */ + else if ((op0_signed && CTreeNodeFirstCode(xop0) == C_INT_CST_NODE + && c_tree_is_int_cst_sgn(xop0) >= 0) + || (op1_signed && CTreeNodeFirstCode(xop1) == C_INT_CST_NODE + && c_tree_is_int_cst_sgn(xop1) >= 0)) + /* OK */; + /* Do not warn if the comparison is an equality operation, + the unsigned quantity is an integral constant and it does + not use the most significant bit of result_type. */ + else if ((resultcode == C_EQ_EXPR || resultcode == C_NE_EXPR) + && ((op0_signed && CTreeNodeFirstCode(xop1) == C_INT_CST_NODE + && c_int_fits_type_p(xop1, c_get_signed_type(result_type))) + || (op1_signed && CTreeNodeFirstCode(xop0) == C_INT_CST_NODE + && c_int_fits_type_p(xop0, c_get_signed_type(result_type))))) + /* OK */; + else + { + warning ("comparison between signed and unsigned"); + } + + /* Warn if two unsigned values are being compared in a size + larger than their original size, and one (and only one) is the + result of a `~' operator. This comparison will always fail. + + Also warn if one operand is a constant, and the constant + does not have all bits set that are set in the ~ operand + when it is extended. */ + + if (( CTreeNodeFirstCode(primop0) == C_EXPR_NODE && + CTreeExprCode(primop0) == C_BIT_NOT_EXPR) + != + ( CTreeNodeFirstCode(primop0) == C_EXPR_NODE && + CTreeExprCode(primop1) == C_BIT_NOT_EXPR )) + { + if ( CTreeNodeFirstCode(primop0) == C_EXPR_NODE && + CTreeExprCode(primop0) == C_BIT_NOT_EXPR) + primop0 = c_get_narrower(CTreeExprOperand (primop0, 0), + &unsignedp0); + else + primop1 = c_get_narrower(CTreeExprOperand (primop1, 0), + &unsignedp1); + + if ( CTreeNodeFirstCode(primop0) == C_INT_CST_NODE + || CTreeNodeFirstCode(primop1) == C_INT_CST_NODE) + { + c_tree_node *primop; + long constant, mask; + int unsignedp, bits; + + if ( CTreeNodeFirstCode(primop0) == C_INT_CST_NODE) + { + primop = primop1; + unsignedp = unsignedp1; + constant = CTreeIntCstLow(primop0); + } + else + { + primop = primop0; + unsignedp = unsignedp0; + constant = CTreeIntCstLow(primop1); + } + + bits = CTreeTypePrecision(CTreeType(primop)); + if (bits < CTreeTypePrecision(result_type) + && bits < C_HOST_BITS_PER_LONG && unsignedp) + { + mask = (~0L) << bits; + if ((mask & constant) != mask) + { + warning ("comparison of promoted ~unsigned with constant"); + } + } + } + else if (unsignedp0 && unsignedp1 + && (CTreeTypePrecision(CTreeType(primop0)) + < CTreeTypePrecision(result_type)) + && (CTreeTypePrecision(CTreeType(primop1)) + < CTreeTypePrecision(result_type))) + { + warning ("comparison of promoted ~unsigned with unsigned"); + } + } + } + } + } + + /* At this point, RESULT_TYPE must be nonzero to avoid an error message. + If CONVERTED is zero, both args will be converted to type RESULT_TYPE. + Then the expression will be built. + It will be given type FINAL_TYPE if that is nonzero; + otherwise, it will be given type RESULT_TYPE. */ + + if (!result_type) + { + c_binary_op_error(code); + return c_error_mark_node; + } + + if (! converted) + { + if (CTreeType(op0) != result_type) + op0 = c_convert_expr(result_type, op0); + if (CTreeType(op1) != result_type) + op1 = c_convert_expr(result_type, op1); + } + + if (build_type == NULL) + build_type = result_type; + + { + c_tree_node *result; + c_tree_node *folded; + + result = c_tree_build_binary_expr(resultcode, op0, op1); + CTreeType( result ) = result_type; + + + folded = c_fold (result); + if (folded == result) + { + if ( CIsTreeNodeConstant( op0 ) && + CIsTreeNodeConstant( op1 ) ) + { + CSetTreeNodeConstant( folded ); + } + } + if (final_type != 0) + { + return c_convert_expr(final_type, folded); + } + return folded; + } +} + + +/* This is the entry point used by the parser + for binary operators in the input. + In addition to constructing the expression, + we check for operands that were written with other binary operators + in a way that is likely to confuse the user. */ + +c_tree_node *c_parser_build_binary_op(code, arg1, arg2) + int code; + c_tree_node *arg1; + c_tree_node *arg2; +{ + c_tree_node *result = c_build_binary_op(code, arg1, arg2, 1); + +# ifdef LUDO_NO_SKIP + char class; + char class1 = TREE_CODE_CLASS (TREE_CODE (arg1)); + char class2 = TREE_CODE_CLASS (TREE_CODE (arg2)); + int code1 = C_ERROR_NODE; + int code2 = C_ERROR_NODE; + + if (class1 == 'e' || class1 == '1' + || class1 == '2' || class1 == '<') + code1 = CTreeExprComplexity(arg1); + if (class2 == 'e' || class2 == '1' + || class2 == '2' || class2 == '<') + code2 = CTreeExprComplexity(arg2); + + /* Check for cases such as x+y<= CTreeTypePrecision(CTreeType(CTreeExprOperand(value, 0))))) + return c_is_initializer_constant_valid_p(CTreeExprOperand(value, 0), + endtype); + + /* Likewise conversions from int to pointers. */ + if ( CTreeTypeCode(CTreeType(value)) == C_POINTER_TYPE + && CTreeTypeCode(CTreeType(CTreeExprOperand(value, 0))) == C_INTEGER_TYPE + && (CTreeTypePrecision(CTreeType(value)) + <= CTreeTypePrecision(CTreeType(CTreeExprOperand(value, 0))))) + return c_is_initializer_constant_valid_p(CTreeExprOperand(value, 0), + endtype); + + /* Allow conversions to union types if the value inside is okay. */ + if ( CTreeTypeCode(CTreeType(value)) == C_UNION_TYPE) + return c_is_initializer_constant_valid_p(CTreeExprOperand(value, 0), + endtype); + return 0; + + case C_PLUS_EXPR: + if ( CTreeTypeCode(endtype) == C_INTEGER_TYPE + && CTreeTypePrecision(endtype) < C_POINTER_SIZE) + return 0; + { + c_tree_node *valid0 = c_is_initializer_constant_valid_p(CTreeExprOperand(value, 0), + endtype); + c_tree_node *valid1 = c_is_initializer_constant_valid_p(CTreeExprOperand(value, 1), + endtype); + /* If either term is absolute, use the other terms relocation. */ + if (valid0 == c_null_pointer_node) + return valid1; + if (valid1 == c_null_pointer_node) + return valid0; + return 0; + } + + case C_MINUS_EXPR: + if ( CTreeTypeCode(endtype) == C_INTEGER_TYPE + && CTreeTypePrecision(endtype) < C_POINTER_SIZE) + return 0; + { + c_tree_node *valid0 = c_is_initializer_constant_valid_p(CTreeExprOperand(value, 0), + endtype); + c_tree_node *valid1 = c_is_initializer_constant_valid_p(CTreeExprOperand(value, 1), + endtype); + /* Win if second argument is absolute. */ + if (valid1 == c_null_pointer_node) + return valid0; + /* Win if both arguments have the same relocation. + Then the value is absolute. */ + if (valid0 == valid1) + return c_null_pointer_node; + return 0; + } + + default: + return 0; + } + } + + return 0; +} + + +/* If VALUE is a compound expr all of whose expressions are constant, then + return its value. Otherwise, return error_mark_node. + + This is for handling COMPOUND_EXPRs as initializer elements + which is allowed with a warning when -pedantic is specified. */ + +static c_tree_node *c_is_valid_compound_expr_initializer(value, endtype) + c_tree_node *value; + c_tree_node *endtype; +{ + if ( CTreeExprCode(value) == C_COMPOUND_EXPR) + { + if ( c_is_valid_compound_expr_initializer(CTreeExprOperand(value, 0), endtype) + == c_error_mark_node) + return c_error_mark_node; + return c_is_valid_compound_expr_initializer(CTreeExprOperand (value, 1), endtype); + } + else if (! CIsTreeNodeConstant(value) + && ! c_is_initializer_constant_valid_p(value, endtype)) + return c_error_mark_node; + else + return value; +} + +/* Digest the parser output INIT as an initializer for type TYPE. + Return a C expression of type TYPE to represent the initial value. + + The arguments REQUIRE_CONSTANT and CONSTRUCTOR_CONSTANT request errors + if non-constant initializers or elements are seen. CONSTRUCTOR_CONSTANT + applies only to elements of constructors. */ + +static c_tree_node *c_digest_init( type, init, require_constant, constructor_constant ) + c_tree_node *type; + c_tree_node *init; + int require_constant, constructor_constant; +{ + int code = CTreeTypeCode(type); + c_tree_node *inside_init = init; + + if (init == c_error_mark_node) + return init; + + /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */ + /* Do not use STRIP_NOPS here. We do not want an enumerator + whose value is 0 to count as a null pointer constant. */ + if ( CTreeExprCode(init) == C_NON_LVALUE_EXPR) + { + inside_init = CTreeExprOperand (init, 0); + } + + /* Initialization of an array of chars from a string constant + optionally enclosed in braces. */ + + if (code == C_ARRAY_TYPE) + { + c_tree_node *typ1 = CTreeTypeMainVariant(CTreeType(type)); + if ((typ1 == c_char_type_node + || typ1 == c_signed_char_type_node + || typ1 == c_unsigned_char_type_node + || typ1 == c_unsigned_wchar_type_node + || typ1 == c_signed_wchar_type_node) + && ((inside_init && CTreeNodeFirstCode(inside_init) == C_STRING_NODE))) + { + if (c_is_comptypes(CTreeTypeMainVariant(CTreeType(inside_init)), + CTreeTypeMainVariant(type))) + { + return inside_init; + } + + if ((CTreeTypeMainVariant(CTreeType(CTreeType(inside_init))) + != c_char_type_node) + && CTreeTypePrecision(typ1) == CTreeTypePrecision(c_char_type_node)) + { + error("char-array initialized from wide string" ); + return c_error_mark_node; + } + if ((CTreeTypeMainVariant(CTreeType(CTreeType(inside_init))) + == c_char_type_node) + && CTreeTypePrecision(typ1) != CTreeTypePrecision(c_char_type_node)) + { + error("int-array initialized from non-wide string"); + return c_error_mark_node; + } + + CTreeType(inside_init) = type; + if ( CTreeTypeValues(type) != 0 + && CTreeNodeFirstCode(CTreeTypeSize(type)) == C_INT_CST_NODE) + { + register int size = CTreeIntCstLow(CTreeTypeSize(type)); + size = (size + C_BITS_PER_UNIT - 1) / C_BITS_PER_UNIT; + /* Subtract 1 (or sizeof (wchar_t)) + because it's ok to ignore the terminating null char + that is counted in the length of the constant. */ + if (size < CTreeStringLength(inside_init) + - (CTreeTypePrecision(typ1) != CTreeTypePrecision(c_char_type_node) + ? CTreeTypePrecision(c_wchar_type_node) / C_BITS_PER_UNIT + : 1)) + pedwarn( "initializer-string for array of chars is too long"); + } + return inside_init; + } + } + + /* Any type can be initialized + from an expression of the same type, optionally with braces. */ + + if (inside_init && CTreeType(inside_init) != 0 + && (c_is_comptypes(CTreeTypeMainVariant(CTreeType(inside_init)), + CTreeTypeMainVariant(type)) + || (code == C_ARRAY_TYPE + && c_is_comptypes(CTreeType(inside_init), type)) + || (code == C_POINTER_TYPE + && ( CTreeNodeFirstCode(CTreeType(inside_init)) == C_ARRAY_TYPE + || CTreeNodeFirstCode(CTreeType(inside_init)) == C_FUNCTION_TYPE) + && c_is_comptypes(CTreeType(CTreeType(inside_init)), + CTreeType(type))))) + { + if (code == C_POINTER_TYPE + && ( CTreeNodeFirstCode(CTreeType(inside_init)) == C_ARRAY_TYPE + || CTreeNodeFirstCode(CTreeType(inside_init)) == C_FUNCTION_TYPE)) + { + inside_init = c_default_conversion(inside_init); + } + else if (code == C_ARRAY_TYPE && CTreeNodeFirstCode(inside_init) != C_STRING_NODE + && + ( CTreeNodeFirstCode(inside_init) != C_EXPR_NODE || + CTreeExprCode(inside_init) != C_CONVERT_EXPR) ) + { + error("array initialized from non-constant array expression" ); + return c_error_mark_node; + } + +# ifdef LUDO_DONE + if (optimize && CTreeDeclCode(inside_init) == C_VAR_DECL) + { + inside_init = c_decl_constant_value(inside_init); + } +# endif + + /* Compound expressions can only occur here if -pedantic or + -pedantic-errors is specified. In the later case, we always want + an error. In the former case, we simply want a warning. */ + if (require_constant && c_pedantic + && CTreeExprCode(inside_init) == C_COMPOUND_EXPR) + { + inside_init + = c_is_valid_compound_expr_initializer(inside_init, + CTreeType(inside_init)); + if (inside_init == c_error_mark_node) + { + error("initializer element is not constant"); + } + else + { + pedwarn("initializer element is not constant" ); + } + + if (c_flag_pedantic_errors) + { + inside_init = c_error_mark_node; + } + } + else if (require_constant && ! CIsTreeNodeConstant(inside_init)) + { + error("initializer element is not constant" ); + inside_init = c_error_mark_node; + } + else if (require_constant + && c_is_initializer_constant_valid_p(inside_init, CTreeType(inside_init)) == 0) + { + error("initializer element is not computable at load time" ); + inside_init = c_error_mark_node; + } + + return inside_init; + } + + /* Handle scalar types, including conversions. */ + + if (code == C_INTEGER_TYPE || code == C_REAL_TYPE || code == C_POINTER_TYPE + || code == C_ENUMERAL_TYPE || code == C_COMPLEX_TYPE) + { + /* Note that convert_for_assignment calls default_conversion + for arrays and functions. We must not call it in the + case where inside_init is a null pointer constant. */ + inside_init + = c_convert_for_assignment(type, init, "initialization", NULL, NULL, 0); + + if (require_constant && ! CIsTreeNodeConstant(inside_init)) + { + error("initializer element is not constant" ); + inside_init = c_error_mark_node; + } + else if (require_constant + && c_is_initializer_constant_valid_p(inside_init, CTreeType(inside_init)) == 0) + { + error("initializer element is not computable at load time" ); + inside_init = c_error_mark_node; + } + + return inside_init; + } + + /* Come here only for records and arrays. */ + + if (CTreeTypeSize(type) && CTreeNodeFirstCode(CTreeTypeSize(type)) != C_INT_CST_NODE) + { + error("variable-sized object may not be initialized" ); + return c_error_mark_node; + } + + /* Traditionally, you can write struct foo x = 0; + and it initializes the first element of x to 0. */ + if (c_flag_traditional) + { + c_tree_node *top = 0; + c_tree_node *prev = 0; + c_tree_node *otype = type; + + while ( CTreeTypeCode(type) == C_RECORD_TYPE + || CTreeTypeCode(type) == C_ARRAY_TYPE + || CTreeTypeCode(type) == C_QUAL_UNION_TYPE + || CTreeTypeCode(type) == C_UNION_TYPE) + { + c_tree_node *temp = c_tree_build_unary_expr( C_CONSTRUCTOR_EXPR, NULL ); + CTreeType( temp ) = type; + + if (prev == 0) + { + top = temp; + } + else + { + CTreeExprOperand(prev, 1) = c_tree_build_list(NULL, temp); + } + prev = temp; + if ( CTreeTypeCode(type) == C_ARRAY_TYPE) + { + type = CTreeType(type); + } + else if ( CTreeTypeValues(type)) + { + type = CTreeType( CTreeTypeValues(type)); + } + else + { + error("invalid initializer" ); + return c_error_mark_node; + } + } + + if (otype != type) + { + CTreeExprOperand(prev, 1) + = c_tree_build_list( NULL, + c_digest_init(type, init, require_constant, + constructor_constant)); + return top; + } + else + return c_error_mark_node; + } + error("invalid initializer"); + return c_error_mark_node; +} + +/*------------------------------------------------------------\ +| | +| C Store Init Value | +| | +\------------------------------------------------------------*/ + + +/* Perform appropriate conversions on the initial value of a variable, + store it in the declaration DECL, + and print any error messages that are appropriate. + If the init is invalid, store an ERROR_MARK. */ + +void c_store_init_value (decl, init) + + c_tree_node *decl; + c_tree_node *init; +{ + c_tree_node *value; + c_tree_node *type; + + /* If variable's type was invalidly declared, just ignore it. */ + + type = CTreeType(decl); + if ( CTreeNodeFirstCode(type) == C_ERROR_NODE) return; + + /* Digest the specified initializer into an expression. */ + + value = c_digest_init(type, init, CIsTreeNodeStatic(decl), + CIsTreeNodeStatic(decl) || c_pedantic); + + /* Store the expression if valid; else report error. */ + CTreeDeclInitial(decl) = value; + + /* ANSI wants warnings about out-of-range constant initializers. */ + CStripTypeNops(value); + c_constant_expression_warning(value); +} + +/*------------------------------------------------------------\ +| | +| C Get Signed Or Unsigned Type | +| | +\------------------------------------------------------------*/ + +/* Return a type the same as TYPE except unsigned or + signed according to UNSIGNEDP. */ + +c_tree_node *c_get_signed_or_unsigned_type( unsignedp, type ) + int unsignedp; + c_tree_node *type; +{ + int Precision; + + if ((! INTEGRAL_TYPE_P (type) && ! POINTER_TYPE_P (type)) + || !!CIsTreeNodeUnsigned(type) == unsignedp) + return type; + + Precision = CTreeTypePrecision(type); + + if ( Precision == CTreeTypePrecision( c_signed_char_type_node)) + { + return unsignedp ? c_unsigned_char_type_node : c_signed_char_type_node; + } + if ( Precision == CTreeTypePrecision( c_integer_type_node)) + { + return unsignedp ? c_unsigned_type_node : c_integer_type_node; + } + if ( Precision == CTreeTypePrecision( c_short_integer_type_node)) + { + return unsignedp ? c_short_unsigned_type_node : c_short_integer_type_node; + } + if ( Precision == CTreeTypePrecision( c_long_integer_type_node)) + { + return unsignedp ? c_long_unsigned_type_node : c_long_integer_type_node; + } + if ( Precision == CTreeTypePrecision( c_long_long_integer_type_node)) + { + return (unsignedp ? c_long_long_unsigned_type_node : c_long_long_integer_type_node); + } + + return type; +} + +/*------------------------------------------------------------\ +| | +| C Get Signed Type | +| | +\------------------------------------------------------------*/ + +/* Return a signed type the same as TYPE in other respects. */ + +c_tree_node *c_get_signed_type( type ) + + c_tree_node *type; +{ + c_tree_node *type1 = CTreeTypeMainVariant(type); + + if (type1 == c_unsigned_char_type_node || type1 == c_char_type_node) + return c_signed_char_type_node; + if (type1 == c_unsigned_type_node) + return c_integer_type_node; + if (type1 == c_short_unsigned_type_node) + return c_short_integer_type_node; + if (type1 == c_long_unsigned_type_node) + return c_long_integer_type_node; + if (type1 == c_long_long_unsigned_type_node) + return c_long_long_integer_type_node; +# ifdef LUDO_NO_SKIP + if (type1 == c_unsigned_intDI_type_node) + return c_intDI_type_node; + if (type1 == c_unsigned_intSI_type_node) + return c_intSI_type_node; + if (type1 == c_unsigned_intHI_type_node) + return c_intHI_type_node; + if (type1 == c_unsigned_intQI_type_node) + return c_intQI_type_node; +# endif + + return c_get_signed_or_unsigned_type(0, type); +} + +/* Return an unsigned type the same as TYPE in other respects. */ + +c_tree_node *c_get_unsigned_type( type ) + + c_tree_node *type; +{ + c_tree_node *type1 = CTreeTypeMainVariant(type); + + if (type1 == c_signed_char_type_node || type1 == c_char_type_node) + return c_unsigned_char_type_node; + if (type1 == c_integer_type_node) + return c_unsigned_type_node; + if (type1 == c_short_integer_type_node) + return c_short_unsigned_type_node; + if (type1 == c_long_integer_type_node) + return c_long_unsigned_type_node; + if (type1 == c_long_long_integer_type_node) + return c_long_long_unsigned_type_node; +# ifdef LUDO_NO_SKIP + if (type1 == intDI_type_node) + return unsigned_intDI_type_node; + if (type1 == intSI_type_node) + return unsigned_intSI_type_node; + if (type1 == intHI_type_node) + return unsigned_intHI_type_node; + if (type1 == intQI_type_node) + return unsigned_intQI_type_node; +# endif + + return c_get_signed_or_unsigned_type(1, type); +} + +/* Nonzero if integer constant C has a value that is permissible + for type TYPE (an INTEGER_TYPE). */ + +int c_int_fits_type_p(c, type) + c_tree_node *c; + c_tree_node *type; +{ + if (CIsTreeNodeUnsigned(type)) + { + return (! (CTreeNodeFirstCode( CTreeTypeMaxValue(type)) == C_INT_CST_NODE + && INT_CST_LT_UNSIGNED( CTreeTypeMaxValue(type), c)) + && ! ( CTreeNodeFirstCode( CTreeTypeMinValue(type)) == C_INT_CST_NODE + && INT_CST_LT_UNSIGNED(c, CTreeTypeMinValue(type))) + /* Negative ints never fit unsigned types. */ + && ! ( CTreeIntCstHigh(c) < 0 + && ! CIsTreeNodeUnsigned( CTreeType(c)))); + } + else + { + return (! ( CTreeNodeFirstCode(CTreeTypeMaxValue(type)) == C_INT_CST_NODE + && INT_CST_LT( CTreeTypeMaxValue(type), c)) + && ! ( CTreeNodeFirstCode( CTreeTypeMinValue(type)) == C_INT_CST_NODE + && INT_CST_LT(c, CTreeTypeMinValue(type))) + /* Unsigned ints with top bit set never fit signed types. */ + && ! ( CTreeIntCstHigh(c) < 0 + && CIsTreeNodeUnsigned(CTreeType(c)))); + } +} + +/* Return an integer type with BITS bits of precision, + that is unsigned if UNSIGNEDP is nonzero, otherwise signed. */ + +c_tree_node *c_get_type_for_size( bits, unsignedp ) + unsigned bits; + int unsignedp; +{ + if (bits == CTreeTypePrecision( c_integer_type_node)) + return unsignedp ? c_unsigned_type_node : c_integer_type_node; + + if (bits == CTreeTypePrecision( c_signed_char_type_node)) + return unsignedp ? c_unsigned_char_type_node : c_signed_char_type_node; + + if (bits == CTreeTypePrecision( c_short_integer_type_node)) + return unsignedp ? c_short_unsigned_type_node : c_short_integer_type_node; + + if (bits == CTreeTypePrecision( c_long_integer_type_node)) + return unsignedp ? c_long_unsigned_type_node : c_long_integer_type_node; + + if (bits == CTreeTypePrecision( c_long_long_integer_type_node)) + return (unsignedp ? c_long_long_unsigned_type_node + : c_long_long_integer_type_node); + +# ifdef LUDO_NO_SKIP + if (bits <= CTreeTypePrecision(intQI_type_node)) + return unsignedp ? unsigned_intQI_type_node : intQI_type_node; + + if (bits <= CTreeTypePrecision(intHI_type_node)) + return unsignedp ? unsigned_intHI_type_node : intHI_type_node; + + if (bits <= CTreeTypePrecision(intSI_type_node)) + return unsignedp ? unsigned_intSI_type_node : intSI_type_node; + + if (bits <= CTreeTypePrecision(intDI_type_node)) + return unsignedp ? unsigned_intDI_type_node : intDI_type_node; +# endif + + return (c_tree_node *)0; +} + +/* Return the precision of a type, for arithmetic purposes. + Supports all types on which arithmetic is possible + (including pointer types). + It's not clear yet what will be right for complex types. */ + +int c_type_precision(type) + + c_tree_node *type; +{ + int TypeType; + + TypeType = CTreeTypeCode( type ); + + return (( TypeType == C_INTEGER_TYPE || + TypeType == C_ENUMERAL_TYPE || + TypeType == C_REAL_TYPE) + ? CTreeTypePrecision(type) : C_POINTER_TYPE_SIZE); +} + +/* Make a variant type in the proper way for C/C++, propagating qualifiers + down to the element type of an array. */ + +c_tree_node *c_c_build_type_variant(type, constp, volatilep) + c_tree_node *type; + int constp, volatilep; +{ + if ( CTreeTypeCode(type) == C_ARRAY_TYPE) + { + return c_tree_build_array_type( + c_c_build_type_variant( CTreeType(type), constp, volatilep), + CTreeTypeValues(type)); + } + return c_tree_build_type_variant(type, constp, volatilep); +} + + +/* Within a struct initializer, specify the next field to be initialized. */ + +void c_set_init_label(fieldname) + + c_tree_node *fieldname; +{ + c_tree_node *tail; + int passed = 0; + + /* Don't die if an entire brace-pair level is superfluous + in the containing level. */ + if (c_constructor_type == 0) return; + + for (tail = CTreeTypeValues(c_constructor_type); tail; + tail = CTreeChain(tail)) + { + if (tail == c_constructor_unfilled_fields) + { + passed = 1; + } + if (CTreeDeclName(tail) == fieldname) break; + } + + if (tail == 0) + { + error ("unknown field `%s' specified in initializer", CTreeIdentPointer(fieldname)); + } + else if (!passed) + { + error ("field `%s' already initialized", CTreeIdentPointer(fieldname)); + } + else + { + c_constructor_fields = tail; + + if (c_pedantic) + { + pedwarn ("ANSI C forbids specifying structure member to initialize"); + } + } +} + + +/* Within an array initializer, specify the next index to be initialized. + FIRST is that index. If LAST is nonzero, then initialize a range + of indices, running from FIRST through LAST. */ + +void c_set_init_index(first, last) + c_tree_node *first; + c_tree_node *last; +{ + while (( CTreeExprCode(first) == C_NOP_EXPR + || CTreeExprCode(first) == C_CONVERT_EXPR + || CTreeExprCode(first) == C_NON_LVALUE_EXPR) + && (CTreeTypeMode(CTreeType(first)) + == CTreeTypeMode(CTreeType( CTreeExprOperand(first, 0))))) + { + (first) = CTreeExprOperand(first, 0); + } + + if (last) + { + while (( CTreeExprCode(last) == C_NOP_EXPR + || CTreeExprCode(last) == C_CONVERT_EXPR + || CTreeExprCode(last) == C_NON_LVALUE_EXPR) + && (CTreeTypeMode(CTreeType(last)) + == CTreeTypeMode(CTreeType( CTreeExprOperand(last, 0))))) + { + (last) = CTreeExprOperand(last, 0); + } + } + + if ( CTreeNodeFirstCode(first) != C_INT_CST_NODE) + { + error("nonconstant array index in initializer"); + } + else if (last != 0 && CTreeNodeFirstCode(last) != C_INT_CST_NODE) + { + error("nonconstant array index in initializer" ); + } + else if (! c_constructor_unfilled_index) + { + error("array index in non-array initializer" ); + } + else if (c_tree_is_int_cst_lt(first, c_constructor_unfilled_index)) + { + error("duplicate array index in initializer" ); + } + else + { + CTreeIntCstLow(c_constructor_index) = CTreeIntCstLow(first); + CTreeIntCstHigh(c_constructor_index) = CTreeIntCstHigh(first); + + if (last != 0 && c_tree_is_int_cst_lt(last, first)) + { + error("empty index range in initializer" ); + } + else + { + if (c_pedantic) + { + pedwarn ("ANSI C forbids specifying element to initialize"); + } + + c_constructor_range_end = last; + } + } +} + + +/* Build an expression representing a cast to type TYPE of expression EXPR. */ + +c_tree_node *c_build_c_cast(type, expr) + + c_tree_node *type; + c_tree_node *expr; +{ + c_tree_node *value = expr; + + if (type == c_error_mark_node || expr == c_error_mark_node) + { + return c_error_mark_node; + } + + type = CTreeTypeMainVariant(type); + + if ( CTreeTypeCode(type) == C_ARRAY_TYPE) + { + error ("cast specifies array type"); + return c_error_mark_node; + } + + if ( CTreeTypeCode(type) == C_FUNCTION_TYPE) + { + error ("cast specifies function type"); + return c_error_mark_node; + } + + if (type == CTreeType(value)) + { + if (c_pedantic) + { + if ( CTreeTypeCode(type) == C_RECORD_TYPE + || CTreeTypeCode(type) == C_UNION_TYPE) + { + pedwarn ("ANSI C forbids casting nonscalar to the same type"); + } + } + } + else if ( CTreeTypeCode(type) == C_UNION_TYPE) + { + c_tree_node *field; + + if ( CTreeTypeCode(CTreeType(value)) == C_ARRAY_TYPE + || CTreeTypeCode(CTreeType(value)) == C_FUNCTION_TYPE) + { + value = c_default_conversion(value); + } + + for (field = CTreeTypeValues(type); field; field = CTreeChain(field)) + { + if (c_is_comptypes( + CTreeTypeMainVariant(CTreeType(field)), + CTreeTypeMainVariant(CTreeType(value)))) break; + } + + if (field) + { + char *name; + c_tree_node *t; + + if (c_pedantic) + { + pedwarn ("ANSI C forbids casts to union type"); + } + + if ( CTreeTypeName(type) != 0) + { + if ( CTreeNodeFirstCode( CTreeTypeName(type)) == C_IDENTIFIER_NODE) + { + name = CTreeIdentPointer( CTreeTypeName(type)); + } + else + { + name = CTreeIdentPointer(CTreeDeclName( CTreeTypeName(type))); + } + } + else + { + name = ""; + } + + t = c_tree_build_list(field, value); + t = c_tree_build_binary_expr( C_CONSTRUCTOR_EXPR, NULL, t ); + CTreeType( t ) = type; + + t = c_digest_init(type, t, 0, 0 ); + + if ( CIsTreeNodeConstant( value ) ) + { + CSetTreeNodeConstant(t); + } + return t; + } + + error("cast to union type from type not present in union"); + return c_error_mark_node; + } + else + { + c_tree_node *otype; + c_tree_node *ovalue; + + /* If casting to void, avoid the error that would come + from default_conversion in the case of a non-lvalue array. */ + if (type == c_void_type_node) + { + value = c_tree_build_unary_expr( C_CONVERT_EXPR, value ); + CTreeType( value ) = type; + return value; + } + + /* Convert functions and arrays to pointers, + but don't convert any other types. */ + if ( CTreeTypeCode(CTreeType(value)) == C_FUNCTION_TYPE + || CTreeTypeCode(CTreeType(value)) == C_ARRAY_TYPE) + { + value = c_default_conversion(value); + } + + otype = CTreeType(value); + + /* Optionally warn about potentially worrisome casts. */ + + if (c_warn_cast_qual + && CTreeTypeCode(type) == C_POINTER_TYPE + && CTreeTypeCode(otype) == C_POINTER_TYPE) + { + if ( CIsTreeNodeVolatile(CTreeType(otype)) + && ! CIsTreeNodeVolatile(CTreeType(type))) + { + pedwarn("cast discards `volatile' from pointer target type"); + } + if ( CIsTreeNodeReadOnly(CTreeType(otype)) + && ! CIsTreeNodeReadOnly(CTreeType(type))) + { + pedwarn("cast discards `const' from pointer target type"); + } + } + +# ifdef LUDO_NO_SKIP + /* Warn about possible alignment problems. */ + if (STRICT_ALIGNMENT && warn_cast_align + && TREE_CODE (type) == POINTER_TYPE + && TREE_CODE (otype) == POINTER_TYPE + && TREE_CODE (CTreeType(otype)) != VOID_TYPE + && TREE_CODE (CTreeType(otype)) != FUNCTION_TYPE + /* Don't warn about opaque types, where the actual alignment + restriction is unknown. */ + && !((TREE_CODE (CTreeType(otype)) == UNION_TYPE + || TREE_CODE (CTreeType(otype)) == RECORD_TYPE) + && CTreeTypeMode(CTreeType(otype)) == VOIDmode) + && TYPE_ALIGN (CTreeType(type)) > TYPE_ALIGN (CTreeType(otype))) + warning ("cast increases required alignment of target type"); +# endif + + if ( CTreeTypeCode(type) == C_INTEGER_TYPE + && CTreeTypeCode(otype) == C_POINTER_TYPE + && CTreeTypePrecision(type) != CTreeTypePrecision(otype) + && ! CIsTreeNodeConstant(value)) + { + warning ("cast from pointer to integer of different size"); + } + + if (c_warn_bad_function_cast + && ( CTreeNodeFirstCode(value) == C_EXPR_NODE && CTreeExprCode(value) == C_CALL_EXPR) + && CTreeTypeCode(type) != CTreeTypeCode(otype)) + { + warning ("cast does not match function type"); + } + + if ( CTreeTypeCode(type) == C_POINTER_TYPE + && CTreeTypeCode(otype) == C_INTEGER_TYPE + && CTreeTypePrecision(type) != CTreeTypePrecision(otype) + /* Don't warn about converting any constant. */ + && ! CIsTreeNodeConstant(value)) + { + warning ("cast to pointer from integer of different size"); + } + + ovalue = value; + value = c_convert_expr(type, value); + + /* Ignore any integer overflow caused by the cast. */ + if ( CTreeNodeFirstCode(value) == C_INT_CST_NODE) + { + if ( CIsTreeNodeOverflow(ovalue) ) CSetTreeNodeOverflow(value); + if ( CIsTreeNodeStatic(ovalue) ) CSetTreeNodeStatic(value); + } + } + + /* Pedantically, don't ley (void *) (FOO *) 0 be a null pointer constant. */ + if (c_pedantic && CTreeNodeFirstCode(value) == C_INT_CST_NODE + && CTreeNodeFirstCode(expr) == C_INT_CST_NODE + && CTreeTypeCode(CTreeType(expr)) != C_INTEGER_TYPE) + { + value = c_get_non_lvalue(value); + } + + /* If pedantic, don't let a cast be an lvalue. */ + if (value == expr && c_pedantic) + { + value = c_get_non_lvalue(value); + } + + return value; +} + +/* Compute the value of the `sizeof' operator. */ + +c_tree_node *c_get_c_sizeof(type) + + c_tree_node *type; +{ + int code; + c_tree_node *t; + + if ( CTreeNodeFirstCode( type ) == C_ERROR_NODE ) + { + return c_tree_get_size_int(1); + } + + code = CTreeTypeCode(type); + + if (code == C_FUNCTION_TYPE) + { + if (c_pedantic || c_warn_pointer_arith) + { + pedwarn ("sizeof applied to a function type"); + } + + return c_tree_get_size_int(1); + } + + if (code == C_VOID_TYPE) + { + if (c_pedantic || c_warn_pointer_arith) + { + pedwarn ("sizeof applied to a void type"); + } + + return c_tree_get_size_int(1); + } + + if (CTreeTypeSize(type) == 0) + { + error ("sizeof applied to an incomplete type"); + + return c_tree_get_size_int(0); + } + + /* Convert in case a char is more than one unit. */ + t = c_tree_build_binary_expr( + C_CEIL_DIV_EXPR, + CTreeTypeSize(type), + c_tree_get_size_int( CTreeTypePrecision(c_char_type_node))); + CTreeType( t ) = c_size_type; + + /* size_binop does not put the constant in range, so do it now. */ + if (CTreeNodeFirstCode(t) == C_INT_CST_NODE && c_force_fit_type(t, 0)) + { + CSetTreeNodeStatic(t); + CSetTreeNodeOverflow(t); + } + + return t; +} + + +/* Implement the __alignof keyword: Return the minimum required + alignment of TYPE, measured in bytes. */ + +c_tree_node *c_get_c_alignof(type) + + c_tree_node *type; +{ + int code; + + if ( CTreeNodeFirstCode( type ) == C_ERROR_NODE ) + { + return c_tree_get_size_int(1); + } + + code = CTreeTypeCode(type); + +# ifdef LUDO_NO_SKIP + if (code == C_FUNCTION_TYPE) + { + return c_tree_get_size_int( FUNCTION_BOUNDARY / C_BITS_PER_UNIT); + } +# endif + + if (code == C_VOID_TYPE) + { + return c_tree_get_size_int(1); + } + + return c_tree_get_size_int( CTreeTypeAlign(type) / C_BITS_PER_UNIT); +} + +/* Implement the __alignof keyword: Return the minimum required + alignment of EXPR, measured in bytes. For VAR_DECL's and + FIELD_DECL's return DECL_ALIGN (which can be set from an + "aligned" __attribute__ specification). */ + +c_tree_node *c_get_c_alignof_expr(expr) + + c_tree_node *expr; +{ + if ( ( CTreeNodeFirstCode(expr) == C_DECL_NODE ) && + ( CTreeDeclCode( expr ) == C_VAR_DECL ) ) + { +# ifdef LUDO_NO_SKIP + return c_tree_get_size_int(DECL_ALIGN (expr) / C_BITS_PER_UNIT); +# else + return c_get_c_alignof(CTreeType(expr)); + +# endif + } + + if ( CTreeExprCode(expr) == C_COMPONENT_REF + && CIsTreeDeclCBitField( CTreeExprOperand(expr, 1))) + { + error("`__alignof' applied to a bit-field"); + return c_tree_get_size_int(1); + } + else if ( CTreeExprCode(expr) == C_COMPONENT_REF + && CTreeDeclCode( CTreeExprOperand(expr, 1)) == C_FIELD_DECL) + { +# ifdef LUDO_NO_SKIP + return c_tree_get_size_int( + DECL_ALIGN( CTreeExprOperand(expr, 1)) / C_BITS_PER_UNIT); +# else + return c_tree_get_size_int(1); +# endif + } + + if ( CTreeExprCode(expr) == C_INDIRECT_REF) + { + c_tree_node *t = CTreeExprOperand(expr, 0); + c_tree_node *best = t; + int bestalign = CTreeTypeAlign(CTreeType(CTreeType(t))); + + while ( CTreeExprCode(t) == C_NOP_EXPR + && CTreeTypeCode(CTreeType( CTreeExprOperand(t, 0))) == C_POINTER_TYPE) + { + int thisalign; + + t = CTreeExprOperand(t, 0); + thisalign = CTreeTypeAlign(CTreeType(CTreeType(t))); + + if (thisalign > bestalign) best = t, bestalign = thisalign; + } + + return c_get_c_alignof(CTreeType(CTreeType(best))); + } + else + { + return c_get_c_alignof(CTreeType(expr)); + } +} + +/* Return the size of TYPE (in bytes) as a wide integer + or return -1 if the size can vary or is larger than an integer. */ + +int c_get_int_size_in_bytes(type) + c_tree_node *type; +{ + c_tree_node *t; + + if (type == c_error_mark_node) + { + return 0; + } + + type = CTreeTypeMainVariant(type); + if (CTreeTypeSize(type) == 0 + || CTreeNodeFirstCode(CTreeTypeSize(type)) != C_INT_CST_NODE) + { + return -1; + } + + if ( CTreeIntCstHigh(CTreeTypeSize(type)) == 0) + return (( CTreeIntCstLow(CTreeTypeSize(type)) + C_BITS_PER_UNIT - 1) + / C_BITS_PER_UNIT); + + t = c_tree_build_binary_expr( + C_CEIL_DIV_EXPR, + CTreeTypeSize(type), + c_tree_get_size_int( C_BITS_PER_UNIT )); + CTreeType( t ) = c_size_type; + + if ( CTreeNodeFirstCode(t) != C_INT_CST_NODE || CTreeIntCstHigh(t) != 0) + { + return -1; + } + + return CTreeIntCstLow(t); +} + + + +/* Compute the size to increment a pointer by. */ + +c_tree_node *c_get_size_in_bytes(type) + c_tree_node *type; +{ + int code = CTreeTypeCode(type); + c_tree_node *t; + + if ( CTreeNodeFirstCode(type) == C_ERROR_NODE) + { + return c_tree_get_size_int (1); + } + + if (code == C_FUNCTION_TYPE) + return c_tree_get_size_int (1); + if (code == C_VOID_TYPE) + return c_tree_get_size_int (1); + + if (CTreeTypeSize(type) == 0) + { + error("arithmetic on pointer to an incomplete type"); + return c_tree_get_size_int(1); + } + + /* Convert in case a char is more than one unit. */ + t = c_build_size_binop(C_CEIL_DIV_EXPR, CTreeTypeSize(type), + c_tree_get_size_int(C_BITS_PER_UNIT)); + c_force_fit_type(t, 0); + return t; +} + + +/* Convert the argument expressions in the list VALUES + to the types in the list TYPELIST. The result is a list of converted + argument expressions. + + If TYPELIST is exhausted, or when an element has NULL as its type, + perform the default conversions. + + PARMLIST is the chain of parm decls for the function being called. + It may be 0, if that info is not available. + It is used only for generating error messages. + + NAME is an IDENTIFIER_NODE or 0. It is used only for error messages. + + This is also where warnings about wrong number of args are generated. + + Both VALUES and the returned value are chains of TREE_LIST nodes + with the elements of the list in the TREE_VALUE slots of those nodes. */ + +static c_tree_node *c_convert_arguments(typelist, values, name, fundecl) + c_tree_node *typelist; + c_tree_node *values; + c_tree_node *name; + c_tree_node *fundecl; +{ + c_tree_node *typetail; + c_tree_node *valtail; + c_tree_node *result = NULL; + int parmnum; + + /* Scan the given expressions and types, producing individual + converted arguments and pushing them on RESULT in reverse order. */ + + for (valtail = values, typetail = typelist, parmnum = 0; + valtail; + valtail = CTreeChain(valtail), parmnum++) + { + c_tree_node *type = typetail ? CTreeListValue(typetail) : 0; + c_tree_node *val = CTreeListValue(valtail); + + if (type == c_void_type_node) + { + if (name) + { + error ("too many arguments to function `%s'", + CTreeIdentPointer(name)); + } + else + { + error ("too many arguments to function"); + } + break; + } + + /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */ + /* Do not use STRIP_NOPS here! We do not want an enumerator with value 0 + to convert automatically to a pointer. */ + if ( CTreeExprCode(val) == C_NON_LVALUE_EXPR) + { + val = CTreeExprOperand(val, 0); + } + + if ( CTreeTypeCode(CTreeType(val)) == C_ARRAY_TYPE + || CTreeTypeCode(CTreeType(val)) == C_FUNCTION_TYPE) + { + val = c_default_conversion(val); + } + + val = c_require_complete_type(val); + + if (type != 0) + { + /* Formal parm type is specified by a function prototype. */ + c_tree_node *parmval; + + if (CTreeTypeSize(type) == 0) + { + error ("type of formal parameter %d is incomplete", parmnum + 1); + parmval = val; + } + else + { + /* Optionally warn about conversions that + differ from the default conversions. */ + if (c_warn_conversion) + { + int formal_prec = CTreeTypePrecision(type); + + if (INTEGRAL_TYPE_P (type) + && CTreeTypeCode(CTreeType(val)) == C_REAL_TYPE) + { + warn_for_assignment( + "%s as integer rather than floating due to prototype", + (char *) 0, name, parmnum + 1); + } + else if ( CTreeTypeCode(type) == C_COMPLEX_TYPE + && CTreeTypeCode(CTreeType(val)) == C_REAL_TYPE) + { + warn_for_assignment( + "%s as complex rather than floating due to prototype", + (char *) 0, name, parmnum + 1); + } + else if (CTreeTypeCode(type) == C_REAL_TYPE + && INTEGRAL_TYPE_P (CTreeType(val))) + { + warn_for_assignment( + "%s as floating rather than integer due to prototype", + (char *) 0, name, parmnum + 1); + } + else if (CTreeTypeCode(type) == C_REAL_TYPE + && CTreeTypeCode(CTreeType(val)) == C_COMPLEX_TYPE) + { + warn_for_assignment ( + "%s as floating rather than complex due to prototype", + (char *) 0, name, parmnum + 1); + } + /* ??? At some point, messages should be written about + conversions between complex types, but that's too messy + to do now. */ + else if (CTreeTypeCode(type) == C_REAL_TYPE + && CTreeTypeCode(CTreeType(val)) == C_REAL_TYPE) + { + /* Warn if any argument is passed as `float', + since without a prototype it would be `double'. */ + if (formal_prec == CTreeTypePrecision(c_float_type_node)) + { + warn_for_assignment ( + "%s as `float' rather than `double' due to prototype", + (char *) 0, name, parmnum + 1); + } + } + /* Detect integer changing in width or signedness. */ + else if (INTEGRAL_TYPE_P (type) + && INTEGRAL_TYPE_P (CTreeType(val))) + { + c_tree_node *would_have_been = c_default_conversion (val); + c_tree_node *type1 = CTreeType(would_have_been); + + if (CTreeTypeCode(type) == C_ENUMERAL_TYPE + && type == CTreeType(val)) + /* No warning if function asks for enum + and the actual arg is that enum type. */ + ; + else if (formal_prec != CTreeTypePrecision(type1)) + { + warn_for_assignment ( + "%s with different width due to prototype", + (char *) 0, name, parmnum + 1); + } + else if ( CIsTreeNodeUnsigned(type) == CIsTreeNodeUnsigned(type1)) + ; + /* Don't complain if the formal parameter type + is an enum, because we can't tell now whether + the value was an enum--even the same enum. */ + else if (CTreeTypeCode(type) == C_ENUMERAL_TYPE) + ; + else if ( CTreeNodeFirstCode(val) == C_INT_CST_NODE + && c_int_fits_type_p(val, type)) + /* Change in signedness doesn't matter + if a constant value is unaffected. */ + ; + /* Likewise for a constant in a NOP_EXPR. */ + else if ( CTreeNodeFirstCode(val) == C_EXPR_NODE && + CTreeExprCode(val) == C_NOP_EXPR + && CTreeNodeFirstCode(CTreeExprOperand (val, 0)) == C_INT_CST_NODE + && c_int_fits_type_p(CTreeExprOperand (val, 0), type)) + ; + /* If the value is extended from a narrower + unsigned type, it doesn't matter whether we + pass it as signed or unsigned; the value + certainly is the same either way. */ + else if (CTreeTypePrecision(CTreeType(val)) < CTreeTypePrecision(type) + && CIsTreeNodeUnsigned(CTreeType(val))) + ; + else if ( CIsTreeNodeUnsigned(type)) + { + warn_for_assignment ( + "%s as unsigned due to prototype", + (char *) 0, name, parmnum + 1); + } + else + { + warn_for_assignment ( + "%s as signed due to prototype", + (char *) 0, name, parmnum + 1); + } + } + } + + parmval = c_convert_for_assignment(type, val, + (char *) 0, /* arg passing */ + fundecl, name, parmnum + 1); + +#ifdef PROMOTE_PROTOTYPES + if ((TREE_CODE (type) == INTEGER_TYPE + || TREE_CODE (type) == ENUMERAL_TYPE) + && (CTreeTypePrecision(type) < CTreeTypePrecision(integer_type_node))) + parmval = default_conversion (parmval); +#endif + } + result = c_tree_add_head_list( NULL, parmval, result); + } + else if ( CTreeTypeCode(CTreeType(val)) == C_REAL_TYPE + && ( CTreeTypePrecision(CTreeType(val)) + < CTreeTypePrecision(c_double_type_node))) + { + /* Convert `float' to `double'. */ + result = c_tree_add_head_list( NULL, + c_convert_expr(c_double_type_node, val), result); + } + else + { + /* Convert `short' and `char' to full-size `int'. */ + result = c_tree_add_head_list( NULL, c_default_conversion(val), result); + } + + if (typetail) + { + typetail = CTreeChain(typetail); + } + } + + if (typetail != 0 && CTreeListValue(typetail) != c_void_type_node) + { + if (name) + { + error ("too few arguments to function `%s'", CTreeIdentPointer(name)); + } + else + { + error ("too few arguments to function"); + } + } + + return c_tree_reverse_list(result); +} + + +/* Build a function call to function FUNCTION with parameters PARAMS. + PARAMS is a list--a chain of TREE_LIST nodes--in which the + TREE_VALUE of each node is a parameter-expression. + FUNCTION's data type may be a function type or a pointer-to-function. */ + +c_tree_node *c_parser_build_function_call(function, params) + c_tree_node *function; + c_tree_node *params; +{ + c_tree_node *fntype = NULL; + c_tree_node *fundecl = NULL; + c_tree_node *coerced_params; + c_tree_node *name = NULL; +# ifdef LUDO_NO_SKIP + c_tree_node *assembler_name = NULL; +# endif + + /* Strip NON_LVALUE_EXPRs, etc., since we aren't using as an lvalue. */ + CStripTypeNops(function); + + /* Convert anything with function type to a pointer-to-function. */ + if ( CTreeDeclCode(function) == C_FUNCTION_DECL) + { + name = CTreeDeclName(function); +# ifdef LUDO_NO_SKIP + assembler_name = DECL_ASSEMBLER_NAME (function); +# endif + + /* Differs from default_conversion by not setting TREE_ADDRESSABLE + (because calling an inline function does not mean the function + needs to be separately compiled). */ + fntype = c_tree_build_type_variant(CTreeType(function), + CIsTreeNodeReadOnly(function), + CIsTreeNodeVolatile(function)); + fundecl = function; + function = c_tree_build_unary_expr( C_ADDR_EXPR, function); + CTreeType( function ) = c_tree_build_pointer_type(fntype); + } + else + { + function = c_default_conversion(function); + } + + fntype = CTreeType(function); + + if ( CTreeNodeFirstCode(fntype) == C_ERROR_NODE) + { + return c_error_mark_node; + } + + if (!( CTreeTypeCode(fntype) == C_POINTER_TYPE + && CTreeTypeCode(CTreeType(fntype)) == C_FUNCTION_TYPE)) + { + error ("called object is not a function"); + return c_error_mark_node; + } + + /* fntype now gets the type of function pointed to. */ + fntype = CTreeType(fntype); + + /* Convert the parameters to the types declared in the + function prototype, or apply default promotions. */ + + coerced_params + = c_convert_arguments( CTreeTypeValues(fntype), params, name, fundecl); + + /* Check for errors in format strings. */ + +# ifdef LUDO_NO_SKIP + if (c_warn_format && (name || assembler_name)) + { + c_check_function_format(name, assembler_name, coerced_params); + } +# endif + + /* Recognize certain built-in functions so we can make tree-codes + other than CALL_EXPR. We do this when it enables fold-const.c + to do something useful. */ + +# ifdef LUDO_NO_SKIP + if ( CTreeNodeFirstCode( function ) == C_EXPR_NODE + && CTreeExprCode(function) == C_ADDR_EXPR + && CTreeDeclCode(CTreeExprOperand(function, 0)) == C_FUNCTION_DECL + && CIsTreeDeclBuiltIn( CTreeExprOperand(function, 0))) + { + switch (DECL_FUNCTION_CODE ( CTreeExprOperand(function, 0))) + { + case BUILT_IN_ABS: + case BUILT_IN_LABS: + case BUILT_IN_FABS: + if (coerced_params == 0) + return integer_zero_node; + return build_unary_op (ABS_EXPR, TREE_VALUE (coerced_params), 0); + default: + break; + } + + } +# endif + { + c_tree_node *result + = c_tree_build_binary_expr( C_CALL_EXPR, function, coerced_params ); + + CTreeType( result ) = CTreeType(fntype), + + CSetTreeNodeSideEffect( result); + + if (CTreeType(result) == c_void_type_node) + { + return result; + } + return c_require_complete_type(result); + } +} + +/* Print an error message for invalid use of an incomplete type. + VALUE is the expression that was used (or 0 if that isn't known) + and TYPE is the type that was invalid. */ + +void c_incomplete_type_error(value, type) + c_tree_node *value; + c_tree_node *type; +{ + char *errmsg; + + /* Avoid duplicate error message. */ + if ( CTreeNodeFirstCode(type) == C_ERROR_NODE) + return; + + if (value != 0 && ( CTreeDeclCode(value) == C_VAR_DECL + || CTreeDeclCode(value) == C_PARAM_DECL)) + { + error ("`%s' has an incomplete type", CTreeIdentPointer(CTreeDeclName(value))); + } + else + { + retry: + /* We must print an error message. Be clever about what it says. */ + + switch ( CTreeTypeCode(type)) + { + case C_RECORD_TYPE: + errmsg = "invalid use of undefined type `struct %s'"; + break; + + case C_UNION_TYPE: + errmsg = "invalid use of undefined type `union %s'"; + break; + + case C_ENUMERAL_TYPE: + errmsg = "invalid use of undefined type `enum %s'"; + break; + + case C_VOID_TYPE: + error ("invalid use of void expression"); + return; + + case C_ARRAY_TYPE: + if ( CTreeTypeValues(type)) + { + type = CTreeType(type); + goto retry; + } + error ("invalid use of array with unspecified bounds"); + return; + + default: + abort (); + } + + if ( CTreeNodeFirstCode( CTreeTypeName(type)) == C_IDENTIFIER_NODE) + { + error (errmsg, CTreeIdentPointer( CTreeTypeName(type))); + } + else + { + /* If this type has a typedef-name, the TYPE_NAME is a TYPE_DECL. */ + error ("invalid use of incomplete typedef `%s'", + CTreeIdentPointer(CTreeDeclName( CTreeTypeName(type)))); + } + } +} + +/* Do `exp = require_complete_type (exp);' to make sure exp + does not have an incomplete type. (That includes void types.) */ + +c_tree_node *c_require_complete_type(value) + c_tree_node *value; +{ + c_tree_node *type = CTreeType(value); + + /* First, detect a valid value with a complete type. */ + if (CTreeTypeSize(type) != 0 + && type != c_void_type_node) + return value; + + c_incomplete_type_error(value, type); + return c_error_mark_node; +} + + +/* Return nonzero if REF is an lvalue valid for this language. + Lvalues can be assigned, unless their type has TYPE_READONLY. + Lvalues can have their address taken, unless they have DECL_REGISTER. */ + +int c_is_lvalue_p(ref) + c_tree_node *ref; +{ + int code; + + if ( CTreeNodeFirstCode(ref) == C_STRING_NODE) + { + return 1; + } + + if ( CTreeNodeFirstCode(ref) == C_ERROR_NODE) + { + return ( CTreeTypeCode(CTreeType(ref)) != C_FUNCTION_TYPE + && CTreeTypeCode(CTreeType(ref)) != C_METHOD_TYPE); + } + + if ( CTreeNodeFirstCode(ref) == C_DECL_NODE) + { + code = CTreeDeclCode(ref); + + if (code == C_VAR_DECL || + code == C_PARAM_DECL || + code == C_RESULT_DECL ) + { + return ( CTreeTypeCode(CTreeType(ref)) != C_FUNCTION_TYPE + && CTreeTypeCode(CTreeType(ref)) != C_METHOD_TYPE); + } + + return 0; + } + + if ( CTreeNodeFirstCode(ref) == C_EXPR_NODE) + { + code = CTreeExprCode(ref); + + switch (code) + { + case C_REALPART_EXPR: + case C_IMAGPART_EXPR: + case C_COMPONENT_REF: + return c_is_lvalue_p(CTreeExprOperand(ref, 0)); + + case C_INDIRECT_REF: + case C_ARRAY_REF: + return ( CTreeTypeCode(CTreeType(ref)) != C_FUNCTION_TYPE + && CTreeTypeCode(CTreeType(ref)) != C_METHOD_TYPE); + + case C_BIND_EXPR: + case C_RTL_EXPR: + return CTreeTypeCode(CTreeType(ref)) == C_ARRAY_TYPE; + + } + } + + return 0; +} + +/* This handles expressions of the form "a[i]", which denotes + an array reference. + + This is logically equivalent in C to *(a+i), but we may do it differently. + If A is a variable or a member, we generate a primitive ARRAY_REF. + This avoids forcing the array out of registers, and can work on + arrays that are not lvalues (for example, members of structures returned + by functions). */ + +c_tree_node *c_parser_build_array_ref(array, index) + + c_tree_node *array; + c_tree_node *index; +{ + if (index == 0) + { + error ("subscript missing in array reference"); + return c_error_mark_node; + } + + if (CTreeType(array) == c_error_mark_node + || CTreeType(index) == c_error_mark_node) + return c_error_mark_node; + + if ( CTreeTypeCode(CTreeType(array)) == C_ARRAY_TYPE + && CTreeExprCode(array) != C_INDIRECT_REF) + { + c_tree_node *rval; + c_tree_node *type; + + /* Subscripting with type char is likely to lose + on a machine where chars are signed. + So warn on any machine, but optionally. + Don't warn for unsigned char since that type is safe. + Don't warn for signed char because anyone who uses that + must have done so deliberately. */ + if (c_warn_char_subscripts + && CTreeTypeMainVariant(CTreeType(index)) == c_char_type_node) + { + warning ("array subscript has type `char'"); + } + + /* Apply default promotions *after* noticing character types. */ + index = c_default_conversion(index); + + /* Require integer *after* promotion, for sake of enums. */ + if ( CTreeTypeCode(CTreeType(index)) != C_INTEGER_TYPE) + { + error ("array subscript is not an integer"); + return c_error_mark_node; + } + + /* An array that is indexed by a non-constant + cannot be stored in a register; we must be able to do + address arithmetic on its address. + Likewise an array of elements of variable size. */ + if ( CTreeNodeFirstCode(index) != C_INT_CST_NODE + || (CTreeTypeSize(CTreeType(CTreeType(array))) != 0 + && + CTreeNodeFirstCode(CTreeTypeSize(CTreeType(CTreeType(array)))) != C_INT_CST_NODE)) + { + if ( c_mark_addressable (array) == 0) + return c_error_mark_node; + } + /* An array that is indexed by a constant value which is not within + the array bounds cannot be stored in a register either; because we + would get a crash in store_bit_field/extract_bit_field when trying + to access a non-existent part of the register. */ + if ( CTreeNodeFirstCode(index) == C_INT_CST_NODE + && CTreeTypeValues(CTreeType(array)) + && ! c_int_fits_type_p(index, CTreeTypeValues(CTreeType(array)))) + { + if (c_mark_addressable (array) == 0) + return c_error_mark_node; + } + + if (c_pedantic && ! c_is_lvalue_p(array)) + { + if ( CIsTreeDeclRegister(array)) + { + pedwarn ("ANSI C forbids subscripting `register' array"); + } + else + { + pedwarn ("ANSI C forbids subscripting non-lvalue array"); + } + } + + if (c_pedantic) + { + c_tree_node *foo = array; + + while ( CTreeNodeFirstCode(foo) == C_EXPR_NODE && + CTreeExprCode(foo) == C_COMPONENT_REF ) + { + foo = CTreeExprOperand(foo, 0); + } + + if ( CTreeNodeFirstCode(foo) == C_DECL_NODE && CTreeDeclCode(foo) == C_VAR_DECL && + CIsTreeDeclRegister(foo)) + { + pedwarn ("ANSI C forbids subscripting non-lvalue array"); + } + } + + type = CTreeTypeMainVariant(CTreeType(CTreeType(array))); + rval = c_tree_build_binary_expr(C_ARRAY_REF, array, index); + CTreeType( rval ) = type; + + /* Array ref is const/volatile if the array elements are + or if the array is. */ + if ( CIsTreeNodeReadOnly(CTreeType(CTreeType(array))) + | CIsTreeNodeReadOnly(array)) + { + CSetTreeNodeReadOnly(rval); + } + + if (CIsTreeNodeVolatile(CTreeType(CTreeType(array))) + | CIsTreeNodeSideEffect(array)) + { + CSetTreeNodeSideEffect(rval); + } + + if ( CIsTreeNodeVolatile(CTreeType(CTreeType(array))) + /* This was added by rms on 16 Nov 91. + It fixes vol struct foo *a; a->elts[1] + in an inline function. + Hope it doesn't break something else. */ + | CIsTreeNodeVolatile(array)) + { + CSetTreeNodeVolatile(rval); + } + + return c_require_complete_type( c_fold(rval)); + } + + { + c_tree_node *ar = c_default_conversion(array); + c_tree_node *ind = c_default_conversion(index); + + /* Do the same warning check as above, but only on the part that's + syntactically the index and only if it is also semantically + the index. */ + if (c_warn_char_subscripts + && CTreeTypeCode(CTreeType(index)) == C_INTEGER_TYPE + && CTreeTypeMainVariant(CTreeType(index)) == c_char_type_node) + { + warning ("subscript has type `char'"); + } + + /* Put the integer in IND to simplify error checking. */ + if ( CTreeTypeCode(CTreeType(ar)) == C_INTEGER_TYPE) + { + c_tree_node *temp = ar; + ar = ind; + ind = temp; + } + + if (ar == c_error_mark_node) + return ar; + + if (CTreeTypeCode(CTreeType(ar)) != C_POINTER_TYPE + || CTreeTypeCode(CTreeType(CTreeType(ar))) == C_FUNCTION_TYPE) + { + error ("subscripted value is neither array nor pointer"); + return c_error_mark_node; + } + if ( CTreeTypeCode(CTreeType(ind)) != C_INTEGER_TYPE) + { + error ("array subscript is not an integer"); + return c_error_mark_node; + } + + return c_parser_build_indirect_ref( + c_build_binary_op( C_PLUS_EXPR, ar, ind, 0), "array indexing"); + } +} + + +/* Look up component name in the structure type definition. + + If this component name is found indirectly within an anonymous union, + store in *INDIRECT the component which directly contains + that anonymous union. Otherwise, set *INDIRECT to 0. */ + +static c_tree_node *c_lookup_field(type, component, indirect) + c_tree_node *type; + c_tree_node *component; + c_tree_node **indirect; +{ + c_tree_node *field; + + /* If TYPE_LANG_SPECIFIC is set, then it is a sorted array of pointers + to the field elements. Use a binary search on this array to quickly + find the element. Otherwise, do a linear search. TYPE_LANG_SPECIFIC + will always be set for structures which have many elements. */ + +# ifdef LUDO_NO_SKIP + if (TYPE_LANG_SPECIFIC (type)) + { + int bot, top, half; + c_tree_node **field_array = &TYPE_LANG_SPECIFIC (type)->elts[0]; + + field = TYPE_FIELDS (type); + bot = 0; + top = TYPE_LANG_SPECIFIC (type)->len; + while (top - bot > 1) + { + half = (top - bot + 1) >> 1; + field = field_array[bot+half]; + + if (CTreeDeclName(field) == NULL) + { + /* Step through all anon unions in linear fashion. */ + while (CTreeDeclName(field_array[bot]) == NULL) + { + c_tree_node *anon = 0, junk; + + field = field_array[bot++]; + if (TREE_CODE (CTreeType(field)) == RECORD_TYPE + || TREE_CODE (CTreeType(field)) == UNION_TYPE) + anon = lookup_field (CTreeType(field), component, &junk); + + if (anon != NULL) + { + *indirect = field; + return anon; + } + } + + /* Entire record is only anon unions. */ + if (bot > top) + return NULL; + + /* Restart the binary search, with new lower bound. */ + continue; + } + + if (CTreeDeclName(field) == component) + break; + if (CTreeDeclName(field) < component) + bot += half; + else + top = bot + half; + } + + if (CTreeDeclName(field_array[bot]) == component) + field = field_array[bot]; + else if (CTreeDeclName(field) != component) + field = 0; + } + else +# endif + { + for (field = CTreeTypeValues(type); field; field = CTreeChain(field)) + { + if (CTreeDeclName(field) == NULL) + { + c_tree_node *junk; + c_tree_node *anon = 0; + + if ( CTreeTypeCode(CTreeType(field)) == C_RECORD_TYPE + || CTreeTypeCode(CTreeType(field)) == C_UNION_TYPE) + { + anon = c_lookup_field(CTreeType(field), component, &junk); + } + + if (anon != NULL) + { + *indirect = field; + return anon; + } + } + + if (CTreeDeclName(field) == component) + break; + } + } + + *indirect = NULL; + return field; +} + + +/* Make an expression to refer to the COMPONENT field of + structure or union value DATUM. COMPONENT is an IDENTIFIER_NODE. */ + +c_tree_node *c_parser_build_component_ref(datum, component) + c_tree_node *datum; + c_tree_node *component; +{ + c_tree_node *type = CTreeType(datum); + int code = CTreeTypeCode(type); + c_tree_node *field = NULL; + c_tree_node *ref; + c_tree_node *tmp_node; + + /* If DATUM is a COMPOUND_EXPR or COND_EXPR, move our reference inside it + unless we are not to support things not strictly ANSI. */ + switch ( CTreeExprCode(datum)) + { + case C_COMPOUND_EXPR: + { + + c_tree_node *value = c_parser_build_component_ref( + CTreeExprOperand(datum, 1), component); + + tmp_node = c_tree_build_binary_expr( C_COMPOUND_EXPR, + CTreeExprOperand(datum, 0), value); + CTreeType( tmp_node ) = CTreeType( value ); + } + case C_COND_EXPR: + return + c_parser_build_conditional_expr( + CTreeExprOperand(datum, 0), + c_parser_build_component_ref(CTreeExprOperand (datum, 1), component), + c_parser_build_component_ref(CTreeExprOperand (datum, 2), component)); + + default: + break; + } + + /* See if there is a field or component with name COMPONENT. */ + + if (code == C_RECORD_TYPE || code == C_UNION_TYPE) + { + c_tree_node *indirect = 0; + + if (CTreeTypeSize(type) == 0) + { + c_incomplete_type_error(NULL, type); + return c_error_mark_node; + } + + field = c_lookup_field(type, component, &indirect); + + if (!field) + { + error (code == C_RECORD_TYPE + ? "structure has no member named `%s'" + : "union has no member named `%s'", + CTreeIdentPointer(component)); + return c_error_mark_node; + } + if (CTreeType(field) == c_error_mark_node) + { + return c_error_mark_node; + } + + /* If FIELD was found buried within an anonymous union, + make one COMPONENT_REF to get that anonymous union, + then fall thru to make a second COMPONENT_REF to get FIELD. */ + if (indirect != 0) + { + ref = c_tree_build_binary_expr( C_COMPONENT_REF,datum, indirect ); + CTreeType( ref ) = CTreeType(indirect); + + if ( CIsTreeNodeReadOnly(datum) || CIsTreeNodeReadOnly(indirect)) + { + CSetTreeNodeReadOnly(ref); + } + + if ( CIsTreeNodeVolatile(datum) || CIsTreeNodeVolatile(indirect)) + { + CSetTreeNodeVolatile(ref); + } + datum = ref; + } + + ref = c_tree_build_binary_expr( C_COMPONENT_REF, datum, field); + CTreeType( ref ) = CTreeType(field); + + if ( CIsTreeNodeReadOnly(datum) || CIsTreeNodeReadOnly(field)) + { + CSetTreeNodeReadOnly(ref); + } + + if ( CIsTreeNodeVolatile(datum) || CIsTreeNodeVolatile(field)) + { + CSetTreeNodeVolatile(ref); + } + + return ref; + } + else if ( CTreeNodeFirstCode(type) != C_ERROR_NODE) + { + error ("request for member `%s' in something not a structure or union", + CTreeIdentPointer(component)); + } + + return c_error_mark_node; +} + + +/* Prepare to parse and output the initializer for variable DECL. */ + +void c_start_init(decl, asmspec_tree, top_level) + c_tree_node *decl; + c_tree_node *asmspec_tree; + int top_level; +{ + char *locus; + struct initializer_stack *p + = (struct initializer_stack *) autallocblock (sizeof (struct initializer_stack)); + char *asmspec = 0; + + if (asmspec_tree) + asmspec = CTreeStringPointer(asmspec_tree); + + p->decl = c_constructor_decl; + p->asmspec = c_constructor_asmspec; + p->incremental = c_constructor_incremental; + p->require_constant_value = c_require_constant_value; + p->require_constant_elements = c_require_constant_elements; + p->constructor_stack = c_constructor_stack; + p->elements = c_constructor_elements; + p->spelling = c_spelling; + p->spelling_base = c_spelling_base; + p->spelling_size = c_spelling_size; + p->deferred = c_constructor_subconstants_deferred; + p->top_level = c_constructor_top_level; + p->next = c_initializer_stack; + c_initializer_stack = p; + + c_constructor_decl = decl; + c_constructor_incremental = top_level; + c_constructor_asmspec = asmspec; + c_constructor_subconstants_deferred = 0; + c_constructor_top_level = top_level; + + if (decl != 0) + { + c_require_constant_value = CIsTreeNodeConstant(decl); + c_require_constant_elements + = ((CIsTreeNodeStatic(decl) || c_pedantic) + /* For a scalar, you can always use any value to initialize, + even within braces. */ + && ( CTreeTypeCode(CTreeType(decl)) == C_ARRAY_TYPE + || CTreeTypeCode(CTreeType(decl)) == C_RECORD_TYPE + || CTreeTypeCode(CTreeType(decl)) == C_UNION_TYPE + || CTreeTypeCode(CTreeType(decl)) == C_QUAL_UNION_TYPE)); + locus = CTreeIdentPointer(CTreeDeclName(decl)); + c_constructor_incremental |= CIsTreeNodeStatic(decl); + } + else + { + c_require_constant_value = 0; + c_require_constant_elements = 0; + locus = "(anonymous)"; + } + + c_constructor_stack = 0; + + c_missing_braces_mentioned = 0; + + c_spelling_base = 0; + c_spelling_size = 0; + RESTORE_SPELLING_DEPTH (0); + + if (locus) + c_push_string(locus); +} + +c_tree_node *c_finish_init() +{ + struct initializer_stack *p = c_initializer_stack; + c_tree_node *tmp_node; + + /* Output subconstants (string constants, usually) + that were referenced within this initializer and saved up. + Must do this if and only if we called defer_addressed_constants. */ +# ifdef LUDO_NO_SKIP + if (c_constructor_subconstants_deferred) + c_output_deferred_addressed_constants(); +# endif + + /* Free the whole constructor stack of this initializer. */ + while (c_constructor_stack) + { + struct constructor_stack *q = c_constructor_stack; + c_constructor_stack = q->next; + autfreeblock (q); + } + + /* Pop back to the data of the outer initializer (if any). */ + c_constructor_decl = p->decl; + c_constructor_asmspec = p->asmspec; + c_constructor_incremental = p->incremental; + c_require_constant_value = p->require_constant_value; + c_require_constant_elements = p->require_constant_elements; + c_constructor_stack = p->constructor_stack; + c_constructor_elements = p->elements; + c_spelling = p->spelling; + c_spelling_base = p->spelling_base; + c_spelling_size = p->spelling_size; + c_constructor_subconstants_deferred = p->deferred; + c_constructor_top_level = p->top_level; + c_initializer_stack = p->next; + autfreeblock (p); + + tmp_node = c_tree_reverse_list( c_output_constant_list ); + c_output_constant_list = (c_tree_node *)0; + + return( tmp_node ); +} + + +/* Don't read a struct incrementally if it has any bitfields, + because the incremental reading code doesn't know how to + handle bitfields yet. */ + +static void c_check_init_type_bitfields (type) + c_tree_node *type; +{ + if ( CTreeTypeCode(type) == C_RECORD_TYPE) + { + c_tree_node *tail; + for (tail = CTreeTypeValues(type); tail; + tail = CTreeChain(tail)) + { + if ( CIsTreeDeclCBitField(tail) + /* This catches cases like `int foo : 8;'. */ + || CTreeDeclMode(tail) != CTreeTypeMode(CTreeType(tail))) + { + c_constructor_incremental = 0; + break; + } + + c_check_init_type_bitfields (CTreeType(tail)); + } + } + + else if ( CTreeTypeCode(type) == C_ARRAY_TYPE) + { + c_check_init_type_bitfields (CTreeType(type)); + } +} + +/* Call here when we see the initializer is surrounded by braces. + This is instead of a call to push_init_level; + it is matched by a call to pop_init_level. + + TYPE is the type to initialize, for a constructor expression. + For an initializer for a decl, TYPE is zero. */ + +void +c_really_start_incremental_init (type) + c_tree_node *type; +{ + struct constructor_stack *p + = (struct constructor_stack *)autallocblock(sizeof (struct constructor_stack)); + + if (type == 0) + type = CTreeType(c_constructor_decl); + + /* Turn off constructor_incremental if type is a struct with bitfields. + Do this before the first push, so that the corrected value + is available in c_finish_init. */ + c_check_init_type_bitfields (type); + + p->type = c_constructor_type; + p->fields = c_constructor_fields; + p->index = c_constructor_index; + p->range_end = c_constructor_range_end; + p->max_index = c_constructor_max_index; + p->unfilled_index = c_constructor_unfilled_index; + p->unfilled_fields = c_constructor_unfilled_fields; + p->bit_index = c_constructor_bit_index; + p->elements = c_constructor_elements; + p->constant = c_constructor_constant; + p->simple = c_constructor_simple; + p->erroneous = c_constructor_erroneous; + p->pending_elts = c_constructor_pending_elts; + p->depth = c_constructor_depth; + p->replacement_value = 0; + p->implicit = 0; + p->incremental = c_constructor_incremental; + p->outer = 0; + p->next = 0; + c_constructor_stack = p; + + c_constructor_constant = 1; + c_constructor_simple = 1; + c_constructor_depth = SPELLING_DEPTH (); + c_constructor_elements = 0; + c_constructor_pending_elts = 0; + c_constructor_type = type; + + if ( CTreeTypeCode(c_constructor_type) == C_RECORD_TYPE + || CTreeTypeCode(c_constructor_type) == C_UNION_TYPE) + { + c_constructor_fields = CTreeTypeValues(c_constructor_type); + /* Skip any nameless bit fields at the beginning. */ + while (c_constructor_fields != 0 && CIsTreeDeclCBitField(c_constructor_fields) + && CTreeDeclName(c_constructor_fields) == 0) + c_constructor_fields = CTreeChain(c_constructor_fields); + c_constructor_unfilled_fields = c_constructor_fields; + c_constructor_bit_index = c_tree_copy_node(c_integer_zero_node); + } + else if ( CTreeTypeCode(c_constructor_type) == C_ARRAY_TYPE) + { + c_constructor_range_end = 0; + if ( CTreeTypeValues(c_constructor_type)) + { + c_constructor_max_index + = CTreeTypeMaxValue( CTreeTypeValues(c_constructor_type)); + c_constructor_index + = c_tree_copy_node( CTreeTypeMinValue(CTreeTypeValues(c_constructor_type))); + } + else + { + c_constructor_index = c_tree_copy_node(c_integer_zero_node); + } + c_constructor_unfilled_index = c_tree_copy_node(c_constructor_index); + } + else + { + /* Handle the case of int x = {5}; */ + c_constructor_fields = c_constructor_type; + c_constructor_unfilled_fields = c_constructor_type; + } + + if (c_constructor_incremental) + { +# ifdef LUDO_NO_SKIP + int momentary = suspend_momentary (); + push_obstacks_nochange (); + if ( CIsTreeNodePermanent(c_constructor_decl)) + end_temporary_allocation (); + make_decl_rtl (constructor_decl, constructor_asmspec, + constructor_top_level); + assemble_variable(c_constructor_decl, c_constructor_top_level, 0, 1); + pop_obstacks (); + resume_momentary (momentary); +# endif + } + + if (c_constructor_incremental) + { +# ifdef LUDO_NO_SKIP + c_defer_addressed_constants (); +# endif + c_constructor_subconstants_deferred = 1; + } +} + +static void c_assemble_zeros( Size ) + + int Size; +{ + c_tree_node *size_node; + + if ( Size > 0 ) + { + size_node = c_tree_build_int_2( Size, Size ); + + c_output_constant_list = + c_tree_add_head_list( size_node, c_integer_zero_node, c_output_constant_list ); + } +} + +static void c_output_constant( TreeCst, Size ) + + c_tree_node *TreeCst; + int Size; +{ + c_output_constant_list = + c_tree_add_head_list( (c_tree_node *)0, TreeCst, c_output_constant_list ); +} + +/* Push down into a subobject, for initialization. + If this is for an explicit set of braces, IMPLICIT is 0. + If it is because the next element belongs at a lower level, + IMPLICIT is 1. */ + +void +c_push_init_level(implicit) + int implicit; +{ + struct constructor_stack *p; + + /* If we've exhausted any levels that didn't have braces, + pop them now. */ + while (c_constructor_stack->implicit) + { + if (( CTreeTypeCode(c_constructor_type) == C_RECORD_TYPE + || CTreeTypeCode(c_constructor_type) == C_UNION_TYPE) + && c_constructor_fields == 0) + { + c_process_init_element(c_pop_init_level(1)); + } + else if (CTreeTypeCode(c_constructor_type) == C_ARRAY_TYPE + && c_tree_is_int_cst_lt(c_constructor_max_index, c_constructor_index)) + { + c_process_init_element( c_pop_init_level(1)); + } + else + break; + } + + /* Structure elements may require alignment. Do this now if necessary + for the subaggregate, and if it comes next in sequence. Don't do + this for subaggregates that will go on the pending list. */ + if (c_constructor_incremental && c_constructor_type != 0 + && CTreeTypeCode(c_constructor_type) == C_RECORD_TYPE && c_constructor_fields + && c_constructor_fields == c_constructor_unfilled_fields) + { + /* Advance to offset of this element. */ + if (! c_tree_is_int_cst_equal(c_constructor_bit_index, + CTreeDeclArguments(c_constructor_fields))) + { + int next = (CTreeIntCstLow(CTreeDeclArguments(c_constructor_fields)) + / C_BITS_PER_UNIT); + int here = (CTreeIntCstLow(c_constructor_bit_index) + / C_BITS_PER_UNIT); + c_assemble_zeros(next - here); + } + /* Indicate that we have now filled the structure up to the current + field. */ + c_constructor_unfilled_fields = c_constructor_fields; + } + + p = (struct constructor_stack *)autallocblock(sizeof (struct constructor_stack)); + p->type = c_constructor_type; + p->fields = c_constructor_fields; + p->index = c_constructor_index; + p->range_end = c_constructor_range_end; + p->max_index = c_constructor_max_index; + p->unfilled_index = c_constructor_unfilled_index; + p->unfilled_fields = c_constructor_unfilled_fields; + p->bit_index = c_constructor_bit_index; + p->elements = c_constructor_elements; + p->constant = c_constructor_constant; + p->simple = c_constructor_simple; + p->erroneous = c_constructor_erroneous; + p->pending_elts = c_constructor_pending_elts; + p->depth = c_constructor_depth; + p->replacement_value = 0; + p->implicit = implicit; + p->incremental = c_constructor_incremental; + p->outer = 0; + p->next = c_constructor_stack; + c_constructor_stack = p; + + c_constructor_constant = 1; + c_constructor_simple = 1; + c_constructor_depth = SPELLING_DEPTH (); + c_constructor_elements = 0; + c_constructor_pending_elts = 0; + + /* Don't die if an entire brace-pair level is superfluous + in the containing level. */ + if (c_constructor_type == 0) + ; + else if ( CTreeTypeCode(c_constructor_type) == C_RECORD_TYPE + || CTreeTypeCode(c_constructor_type) == C_UNION_TYPE) + { + /* Don't die if there are extra init elts at the end. */ + if (c_constructor_fields == 0) + c_constructor_type = 0; + else + { + c_constructor_type = CTreeType(c_constructor_fields); + c_push_member_name (c_constructor_fields); + c_constructor_depth++; + if (c_constructor_fields != c_constructor_unfilled_fields) + c_constructor_incremental = 0; + } + } + else if ( CTreeTypeCode(c_constructor_type) == C_ARRAY_TYPE) + { + c_constructor_type = CTreeType(c_constructor_type); + c_push_array_bounds (CTreeIntCstLow(c_constructor_index)); + c_constructor_depth++; + if (! c_tree_is_int_cst_equal(c_constructor_index, c_constructor_unfilled_index) + || c_constructor_range_end != 0) + c_constructor_incremental = 0; + } + + if (c_constructor_type == 0) + { + error_init ("extra brace group at end of initializer%s", + " for `%s'", NULL); + c_constructor_fields = 0; + c_constructor_unfilled_fields = 0; + return; + } + + /* Turn off constructor_incremental if type is a struct with bitfields. */ + c_check_init_type_bitfields(c_constructor_type); + + if (implicit && c_warn_missing_braces && !c_missing_braces_mentioned) + { + c_missing_braces_mentioned = 1; + warning_init ("missing braces around initializer%s", " for `%s'", NULL); + } + + if ( CTreeTypeCode(c_constructor_type) == C_RECORD_TYPE + || CTreeTypeCode(c_constructor_type) == C_UNION_TYPE) + { + c_constructor_fields = CTreeTypeValues(c_constructor_type); + /* Skip any nameless bit fields at the beginning. */ + while (c_constructor_fields != 0 && CIsTreeDeclCBitField(c_constructor_fields) + && CTreeDeclName(c_constructor_fields) == 0) + c_constructor_fields = CTreeChain(c_constructor_fields); + c_constructor_unfilled_fields = c_constructor_fields; + c_constructor_bit_index = c_tree_copy_node(c_integer_zero_node); + } + else if ( CTreeTypeCode(c_constructor_type) == C_ARRAY_TYPE) + { + c_constructor_range_end = 0; + if ( CTreeTypeValues(c_constructor_type)) + { + c_constructor_max_index + = CTreeTypeMaxValue( CTreeTypeValues(c_constructor_type)); + c_constructor_index + = c_tree_copy_node( CTreeTypeMinValue( CTreeTypeValues(c_constructor_type))); + } + else + c_constructor_index = c_tree_copy_node(c_integer_zero_node); + c_constructor_unfilled_index = c_tree_copy_node(c_constructor_index); + } + else + { + warning_init ("braces around scalar initializer%s", " for `%s'", NULL); + c_constructor_fields = c_constructor_type; + c_constructor_unfilled_fields = c_constructor_type; + } +} + +static void c_output_init_element(); + +/* Output any pending elements which have become next. + As we output elements, constructor_unfilled_{fields,index} + advances, which may cause other elements to become next; + if so, they too are output. + + If ALL is 0, we return when there are + no more pending elements to output now. + + If ALL is 1, we output space as necessary so that + we can output all the pending elements. */ + +static void c_output_pending_init_elements (all) + int all; +{ + c_tree_node *tail; + c_tree_node *next; + + retry: + + /* Look thru the whole pending list. + If we find an element that should be output now, + output it. Otherwise, set NEXT to the element + that comes first among those still pending. */ + + next = 0; + for (tail = c_constructor_pending_elts; tail; + tail = CTreeChain(tail)) + { + if ( CTreeTypeCode(c_constructor_type) == C_ARRAY_TYPE) + { + if (c_tree_is_int_cst_equal(CTreeListPurpose(tail), + c_constructor_unfilled_index)) + { + c_output_init_element(CTreeListValue(tail), + CTreeType(c_constructor_type), + c_constructor_unfilled_index, 0); + goto retry; + } + else if (c_tree_is_int_cst_lt(CTreeListPurpose(tail), + c_constructor_unfilled_index)) + ; + else if (next == 0 + || c_tree_is_int_cst_lt(CTreeListPurpose(tail), next)) + next = CTreeListPurpose(tail); + } + else if ( CTreeTypeCode(c_constructor_type) == C_RECORD_TYPE + || CTreeTypeCode(c_constructor_type) == C_UNION_TYPE) + { + if (CTreeListPurpose(tail) == c_constructor_unfilled_fields) + { + c_output_init_element(CTreeListValue(tail), + CTreeType(c_constructor_unfilled_fields), + c_constructor_unfilled_fields, + 0); + goto retry; + } + else if (c_constructor_unfilled_fields == 0 + || c_tree_is_int_cst_lt( CTreeDeclArguments(CTreeListPurpose(tail)), + CTreeDeclArguments(c_constructor_unfilled_fields))) + ; + else if (next == 0 + || c_tree_is_int_cst_lt( CTreeDeclArguments(CTreeListPurpose(tail)), + CTreeDeclArguments(next))) + next = CTreeListPurpose(tail); + } + } + + /* Ordinarily return, but not if we want to output all + and there are elements left. */ + if (! (all && next != 0)) + return; + + /* Generate space up to the position of NEXT. */ + if (c_constructor_incremental) + { + c_tree_node *filled; + c_tree_node *nextpos_tree = c_tree_get_size_int(0); + + if ( CTreeTypeCode(c_constructor_type) == C_RECORD_TYPE + || CTreeTypeCode(c_constructor_type) == C_UNION_TYPE) + { + /* Find the last field written out, if any. */ + for (tail = CTreeTypeValues(c_constructor_type); tail; + tail = CTreeChain(tail)) + if (CTreeChain(tail) == c_constructor_unfilled_fields) + break; + + if (tail) + /* Find the offset of the end of that field. */ + filled = c_build_size_binop(C_CEIL_DIV_EXPR, + c_build_size_binop(C_PLUS_EXPR, + CTreeDeclArguments(tail), + CTreeDeclSize(tail)), + c_tree_get_size_int(C_BITS_PER_UNIT)); + else + filled = c_tree_get_size_int(0); + + nextpos_tree = c_build_size_binop(C_CEIL_DIV_EXPR, + CTreeDeclArguments(next), + c_tree_get_size_int(C_BITS_PER_UNIT)); + + CTreeIntCstHigh(c_constructor_bit_index) + = CTreeIntCstHigh(CTreeDeclArguments(next)); + CTreeIntCstLow(c_constructor_bit_index) + = CTreeIntCstLow(CTreeDeclArguments(next)); + c_constructor_unfilled_fields = next; + } + else if (CTreeTypeCode(c_constructor_type) == C_ARRAY_TYPE) + { + filled = c_build_size_binop(C_MULT_EXPR, c_constructor_unfilled_index, + c_get_size_in_bytes(CTreeType(c_constructor_type))); + nextpos_tree + = c_build_size_binop(C_MULT_EXPR, next, + c_get_size_in_bytes(CTreeType(c_constructor_type))); + CTreeIntCstLow(c_constructor_unfilled_index) + = CTreeIntCstLow(next); + CTreeIntCstHigh(c_constructor_unfilled_index) + = CTreeIntCstHigh(next); + } + else + filled = 0; + + if (filled) + { + int nextpos = CTreeIntCstLow(nextpos_tree); + + c_assemble_zeros(nextpos - CTreeIntCstLow(filled)); + } + } + else + { + /* If it's not incremental, just skip over the gap, + so that after jumping to retry we will output the next + successive element. */ + if ( CTreeTypeCode(c_constructor_type) == C_RECORD_TYPE + || CTreeTypeCode(c_constructor_type) == C_UNION_TYPE) + c_constructor_unfilled_fields = next; + else if ( CTreeTypeCode(c_constructor_type) == C_ARRAY_TYPE) + { + CTreeIntCstLow(c_constructor_unfilled_index) + = CTreeIntCstLow(next); + CTreeIntCstHigh(c_constructor_unfilled_index) + = CTreeIntCstHigh(next); + } + } + + goto retry; +} + +/* "Output" the next constructor element. + At top level, really output it to assembler code now. + Otherwise, collect it in a list from which we will make a CONSTRUCTOR. + TYPE is the data type that the containing data type wants here. + FIELD is the field (a FIELD_DECL) or the index that this element fills. + + PENDING if non-nil means output pending elements that belong + right after this element. (PENDING is normally 1; + it is 0 while outputting pending elements, to avoid recursion.) */ + +static void +c_output_init_element (value, type, field, pending) + c_tree_node *value; + c_tree_node *type; + c_tree_node *field; + int pending; +{ + int duplicate = 0; + + if ( CTreeTypeCode(CTreeType(value)) == C_FUNCTION_TYPE + || ( CTreeTypeCode(CTreeType(value)) == C_ARRAY_TYPE + && !( CTreeNodeFirstCode(value) == C_STRING_NODE + && CTreeTypeCode(type) == C_ARRAY_TYPE + && CTreeTypeCode(CTreeType(type)) == C_INTEGER_TYPE) + && !c_is_comptypes(CTreeTypeMainVariant(CTreeType(value)), + CTreeTypeMainVariant(type)))) + { + value = c_default_conversion(value); + } + + if (value == c_error_mark_node) + c_constructor_erroneous = 1; + else if (! CIsTreeNodeConstant(value)) + c_constructor_constant = 0; + else if (c_is_initializer_constant_valid_p(value, CTreeType(value)) == 0 + || (( CTreeTypeCode(c_constructor_type) == C_RECORD_TYPE + || CTreeTypeCode(c_constructor_type) == C_UNION_TYPE) + && CIsTreeDeclCBitField(field) + && CTreeNodeFirstCode(value) != C_INT_CST_NODE)) + c_constructor_simple = 0; + + if (c_require_constant_value && ! CIsTreeNodeConstant(value)) + { + error_init ("initializer element%s is not constant", + " for `%s'", NULL); + value = c_error_mark_node; + } + else if (c_require_constant_elements + && c_is_initializer_constant_valid_p(value, CTreeType(value)) == 0) + { + error_init ("initializer element%s is not computable at load time", + " for `%s'", NULL); + value = c_error_mark_node; + } + + /* If this element duplicates one on constructor_pending_elts, + print a message and ignore it. Don't do this when we're + processing elements taken off constructor_pending_elts, + because we'd always get spurious errors. */ + if (pending) + { + if ( CTreeTypeCode(c_constructor_type) == C_RECORD_TYPE + || CTreeTypeCode(c_constructor_type) == C_UNION_TYPE) + { + if (c_tree_get_purpose_member(field, c_constructor_pending_elts)) + { + error_init ("duplicate initializer%s", " for `%s'", NULL); + duplicate = 1; + } + } + if ( CTreeTypeCode(c_constructor_type) == C_ARRAY_TYPE) + { + c_tree_node *tail; + for (tail = c_constructor_pending_elts; tail; + tail = CTreeChain(tail)) + if (CTreeListPurpose(tail) != 0 + && CTreeNodeFirstCode(CTreeListPurpose(tail)) == C_INT_CST_NODE + && c_tree_is_int_cst_equal(CTreeListPurpose(tail), c_constructor_index)) + break; + + if (tail != 0) + { + error_init ("duplicate initializer%s", " for `%s'", NULL); + duplicate = 1; + } + } + } + + /* If this element doesn't come next in sequence, + put it on constructor_pending_elts. */ + if ( CTreeTypeCode(c_constructor_type) == C_ARRAY_TYPE + && !c_tree_is_int_cst_equal(field, c_constructor_unfilled_index)) + { + if (! duplicate) + /* The copy_node is needed in case field is actually + constructor_index, which is modified in place. */ + c_constructor_pending_elts + = c_tree_add_head_list(c_tree_copy_node(field), + c_digest_init(type, value, c_require_constant_value, + c_require_constant_elements), + c_constructor_pending_elts); + } + else if ( CTreeTypeCode(c_constructor_type) == C_RECORD_TYPE + && field != c_constructor_unfilled_fields) + { + /* We do this for records but not for unions. In a union, + no matter which field is specified, it can be initialized + right away since it starts at the beginning of the union. */ + if (!duplicate) + c_constructor_pending_elts + = c_tree_add_head_list(field, + c_digest_init(type, value, c_require_constant_value, + c_require_constant_elements), + c_constructor_pending_elts); + } + else + { + /* Otherwise, output this element either to + constructor_elements or to the assembler file. */ + + if (!duplicate) + { + if (! c_constructor_incremental) + { + if (field && CTreeNodeFirstCode(field) == C_INT_CST_NODE) + field = c_tree_copy_node (field); + c_constructor_elements + = c_tree_add_head_list(field, c_digest_init(type, value, + c_require_constant_value, + c_require_constant_elements), + c_constructor_elements); + } + else + { + /* Structure elements may require alignment. + Do this, if necessary. */ + if ( CTreeTypeCode(c_constructor_type) == C_RECORD_TYPE) + { + /* Advance to offset of this element. */ + if (! c_tree_is_int_cst_equal(c_constructor_bit_index, + CTreeDeclArguments(field))) + { + int next = (CTreeIntCstLow(CTreeDeclArguments(field)) + / C_BITS_PER_UNIT); + int here = (CTreeIntCstLow(c_constructor_bit_index) + / C_BITS_PER_UNIT); + + c_assemble_zeros(next - here); + } + } + { + c_tree_node *tmp_node; + tmp_node = c_digest_init(type, value, c_require_constant_value, + c_require_constant_elements); + c_output_constant( tmp_node, c_get_int_size_in_bytes(type)); + + /* For a record or union, + keep track of end position of last field. */ + if ( CTreeTypeCode(c_constructor_type) == C_RECORD_TYPE + || CTreeTypeCode(c_constructor_type) == C_UNION_TYPE) + { + c_tree_node *temp = c_build_size_binop( + C_PLUS_EXPR, CTreeDeclArguments(field), CTreeDeclSize(field)); + CTreeIntCstLow(c_constructor_bit_index) + = CTreeIntCstLow(temp); + CTreeIntCstHigh(c_constructor_bit_index) + = CTreeIntCstHigh(temp); + } + } + } + } + + /* Advance the variable that indicates sequential elements output. */ + if ( CTreeTypeCode(c_constructor_type) == C_ARRAY_TYPE) + { + c_tree_node *tem = c_build_size_binop(C_PLUS_EXPR, + c_constructor_unfilled_index, c_integer_one_node); + CTreeIntCstLow(c_constructor_unfilled_index) + = CTreeIntCstLow(tem); + CTreeIntCstHigh(c_constructor_unfilled_index) + = CTreeIntCstHigh(tem); + } + else if ( CTreeTypeCode(c_constructor_type) == C_RECORD_TYPE) + c_constructor_unfilled_fields = CTreeChain(c_constructor_unfilled_fields); + else if ( CTreeTypeCode(c_constructor_type) == C_UNION_TYPE) + c_constructor_unfilled_fields = 0; + + /* Now output any pending elements which have become next. */ + if (pending) + c_output_pending_init_elements(0); + } +} + + +/* At the end of an implicit or explicit brace level, + finish up that level of constructor. + If we were outputting the elements as they are read, return 0 + from inner levels (process_init_element ignores that), + but return error_mark_node from the outermost level + (that's what we want to put in DECL_INITIAL). + Otherwise, return a CONSTRUCTOR expression. */ + +c_tree_node *c_pop_init_level(implicit) + int implicit; +{ + struct constructor_stack *p; + int size = 0; + c_tree_node *constructor = 0; + + if (implicit == 0) + { + /* When we come to an explicit close brace, + pop any inner levels that didn't have explicit braces. */ + while (c_constructor_stack->implicit) + { + c_process_init_element(c_pop_init_level(1)); + } + } + + p = c_constructor_stack; + + if (c_constructor_type != 0) + size = c_get_int_size_in_bytes(c_constructor_type); + + /* Now output all pending elements. */ + c_output_pending_init_elements(1); + + /* Pad out the end of the structure. */ + + if (p->replacement_value) + { + /* If this closes a superfluous brace pair, + just pass out the element between them. */ + constructor = p->replacement_value; + /* If this is the top level thing within the initializer, + and it's for a variable, then since we already called + assemble_variable, we must output the value now. */ + if (p->next == 0 && c_constructor_decl != 0 + && c_constructor_incremental) + { + constructor = c_digest_init(c_constructor_type, constructor, + c_require_constant_value, + c_require_constant_elements); + + /* If initializing an array of unknown size, + determine the size now. */ + if ( CTreeTypeCode(c_constructor_type) == C_ARRAY_TYPE + && CTreeTypeValues(c_constructor_type) == 0) + { + int failure; + +# ifdef LUDO_NO_SKIP + int momentary_p; + push_obstacks_nochange (); + if (TREE_PERMANENT (constructor_type)) + end_temporary_allocation (); + + momentary_p = suspend_momentary (); +# endif + + /* We shouldn't have an incomplete array type within + some other type. */ + if (c_constructor_stack->next) + abort (); + + failure + = c_complete_array_type(c_constructor_type, constructor, 0); + if (failure) + abort (); + + size = c_get_int_size_in_bytes(c_constructor_type); +# ifdef LUDO_NO_SKIP + resume_momentary (momentary_p); + pop_obstacks (); +# endif + } + +# ifdef LUDO_NO_SKIP + c_output_constant(constructor, size); +# endif + } + } + else if (c_constructor_type == 0) + ; + else if ( CTreeTypeCode(c_constructor_type) != C_RECORD_TYPE + && CTreeTypeCode(c_constructor_type) != C_UNION_TYPE + && CTreeTypeCode(c_constructor_type) != C_ARRAY_TYPE + && ! c_constructor_incremental) + { + /* A nonincremental scalar initializer--just return + the element, after verifying there is just one. */ + if (c_constructor_elements == 0) + { + error_init ("empty scalar initializer%s", + " for `%s'", NULL); + constructor = c_error_mark_node; + } + else if (CTreeChain(c_constructor_elements) != 0) + { + error_init("extra elements in scalar initializer%s", " for `%s'", NULL); + constructor = CTreeListValue(c_constructor_elements); + } + else + constructor = CTreeListValue(c_constructor_elements); + } + else if (! c_constructor_incremental) + { + if (c_constructor_erroneous) + constructor = c_error_mark_node; + else + { +# ifdef LUDO_NO_SKIP + int momentary = suspend_momentary (); +# endif + + constructor = c_tree_build_binary_typed_expr( + C_CONSTRUCTOR_EXPR, c_constructor_type, NULL, + c_tree_reverse_list(c_constructor_elements)); + if (c_constructor_constant) + CSetTreeNodeConstant(constructor); + if (c_constructor_constant && c_constructor_simple) + CSetTreeNodeStatic(constructor); + +# ifdef LUDO_NO_SKIP + resume_momentary (momentary); +# endif + } + } + else + { + c_tree_node *filled; +# ifdef LUDO_NO_SKIP + int momentary = suspend_momentary (); +# endif + + if ( CTreeTypeCode(c_constructor_type) == C_RECORD_TYPE + || CTreeTypeCode(c_constructor_type) == C_UNION_TYPE) + { + /* Find the offset of the end of that field. */ + filled = c_build_size_binop(C_CEIL_DIV_EXPR, + c_constructor_bit_index, + c_tree_get_size_int(C_BITS_PER_UNIT)); + } + else if ( CTreeTypeCode(c_constructor_type) == C_ARRAY_TYPE) + { + /* If initializing an array of unknown size, + determine the size now. */ + if ( CTreeTypeCode(c_constructor_type) == C_ARRAY_TYPE + && CTreeTypeValues(c_constructor_type) == 0) + { + c_tree_node *maxindex + = c_build_size_binop(C_MINUS_EXPR, + c_constructor_unfilled_index, + c_integer_one_node); + +# ifdef LUDO_NO_SKIP + push_obstacks_nochange (); + if (CIsTreeNodePermanent(c_constructor_type)) + end_temporary_allocation (); +# endif + maxindex = c_tree_copy_node(maxindex); + CTreeTypeValues(c_constructor_type) = c_tree_build_index_type(maxindex); + CTreeType(maxindex) = CTreeTypeValues(c_constructor_type); + + /* TYPE_MAX_VALUE is always one less than the number of elements + in the array, because we start counting at zero. Therefore, + warn only if the value is less than zero. */ + if (c_pedantic + && (c_tree_is_int_cst_sgn( + CTreeTypeMaxValue(CTreeTypeValues(c_constructor_type))) < 0)) + { + error_with_decl(c_constructor_decl, "zero or negative array size `%s'"); + } + c_layout_type(c_constructor_type); + size = c_get_int_size_in_bytes(c_constructor_type); +# ifdef LUDO_NO_SKIP + pop_obstacks (); +# endif + } + + filled = c_build_size_binop(C_MULT_EXPR, c_constructor_unfilled_index, + c_get_size_in_bytes(CTreeType(c_constructor_type))); + } + else + filled = 0; + + if (filled != 0) + { + c_assemble_zeros(size - CTreeIntCstLow(filled)); + } + +# ifdef LUDO_NO_SKIP + resume_momentary (momentary); +# endif + } + + + c_constructor_type = p->type; + c_constructor_fields = p->fields; + c_constructor_index = p->index; + c_constructor_range_end = p->range_end; + c_constructor_max_index = p->max_index; + c_constructor_unfilled_index = p->unfilled_index; + c_constructor_unfilled_fields = p->unfilled_fields; + c_constructor_bit_index = p->bit_index; + c_constructor_elements = p->elements; + c_constructor_constant = p->constant; + c_constructor_simple = p->simple; + c_constructor_erroneous = p->erroneous; + c_constructor_pending_elts = p->pending_elts; + c_constructor_depth = p->depth; + c_constructor_incremental = p->incremental; + RESTORE_SPELLING_DEPTH(c_constructor_depth); + + c_constructor_stack = p->next; + autfreeblock(p); + + if (constructor == 0) + { + if (c_constructor_stack == 0) + return c_error_mark_node; + return NULL; + } + return constructor; +} + +/* Add one non-braced element to the current constructor level. + This adjusts the current position within the constructor's type. + This may also start or terminate implicit levels + to handle a partly-braced initializer. + + Once this has found the correct level for the new element, + it calls output_init_element. + + Note: if we are incrementally outputting this constructor, + this function may be called with a null argument + representing a sub-constructor that was already incrementally output. + When that happens, we output nothing, but we do the bookkeeping + to skip past that element of the current constructor. */ + +void c_process_init_element(value) + c_tree_node *value; +{ + c_tree_node *orig_value = value; + int string_flag = value != 0 && CTreeNodeFirstCode(value) == C_STRING_NODE; + + /* Handle superfluous braces around string cst as in + char x[] = {"foo"}; */ + if (string_flag + && c_constructor_type + && CTreeTypeCode(c_constructor_type) == C_ARRAY_TYPE + && CTreeTypeCode(CTreeType(c_constructor_type)) == C_INTEGER_TYPE + && c_tree_is_integer_zerop(c_constructor_unfilled_index)) + { + c_constructor_stack->replacement_value = value; + return; + } + + if (c_constructor_stack->replacement_value != 0) + { + error_init("excess elements in struct initializer%s", " after `%s'", NULL); + return; + } + + /* Ignore elements of a brace group if it is entirely superfluous + and has already been diagnosed. */ + if (c_constructor_type == 0) + return; + + /* If we've exhausted any levels that didn't have braces, + pop them now. */ + while (c_constructor_stack->implicit) + { + if ((CTreeTypeCode(c_constructor_type) == C_RECORD_TYPE + || CTreeTypeCode(c_constructor_type) == C_UNION_TYPE) + && c_constructor_fields == 0) + { + c_process_init_element(c_pop_init_level(1)); + } + else if (CTreeTypeCode(c_constructor_type) == C_ARRAY_TYPE + && (c_constructor_max_index == 0 + || c_tree_is_int_cst_lt(c_constructor_max_index, c_constructor_index))) + { + c_process_init_element( c_pop_init_level(1)); + } + else + break; + } + + while (1) + { + if ( CTreeTypeCode(c_constructor_type) == C_RECORD_TYPE) + { + c_tree_node *fieldtype; + int fieldcode; + + if (c_constructor_fields == 0) + { + pedwarn_init ("excess elements in struct initializer%s", + " after `%s'", NULL); + break; + } + + fieldtype = CTreeType(c_constructor_fields); + if (fieldtype != c_error_mark_node) + { + fieldtype = CTreeTypeMainVariant(fieldtype); + } + fieldcode = CTreeTypeCode(fieldtype); + + /* Accept a string constant to initialize a subarray. */ + if (value != 0 + && fieldcode == C_ARRAY_TYPE + && CTreeTypeCode(CTreeType(fieldtype)) == C_INTEGER_TYPE + && string_flag) + { + value = orig_value; + } + /* Otherwise, if we have come to a subaggregate, + and we don't have an element of its type, push into it. */ + else if (value != 0 && !c_constructor_no_implicit + && value != c_error_mark_node + && CTreeTypeMainVariant(CTreeType(value)) != fieldtype + && (fieldcode == C_RECORD_TYPE || fieldcode == C_ARRAY_TYPE + || fieldcode == C_UNION_TYPE)) + { + c_push_init_level(1); + continue; + } + + if (value) + { + c_push_member_name(c_constructor_fields); + c_output_init_element(value, fieldtype, c_constructor_fields, 1); + RESTORE_SPELLING_DEPTH(c_constructor_depth); + } + else + /* Do the bookkeeping for an element that was + directly output as a constructor. */ + { + /* For a record, keep track of end position of last field. */ + c_tree_node *temp = c_build_size_binop(C_PLUS_EXPR, + CTreeDeclArguments(c_constructor_fields), + CTreeDeclSize(c_constructor_fields)); + CTreeIntCstLow(c_constructor_bit_index) + = CTreeIntCstLow(temp); + CTreeIntCstHigh(c_constructor_bit_index) + = CTreeIntCstHigh(temp); + + c_constructor_unfilled_fields = CTreeChain(c_constructor_fields); + } + + c_constructor_fields = CTreeChain(c_constructor_fields); + /* Skip any nameless bit fields at the beginning. */ + while (c_constructor_fields != 0 + && CIsTreeDeclCBitField(c_constructor_fields) + && CTreeDeclName(c_constructor_fields) == 0) + { + c_constructor_fields = CTreeChain(c_constructor_fields); + } + break; + } + if ( CTreeTypeCode(c_constructor_type) == C_UNION_TYPE) + { + c_tree_node *fieldtype; + int fieldcode; + + if (c_constructor_fields == 0) + { + pedwarn_init ("excess elements in union initializer%s", " after `%s'", NULL); + break; + } + + fieldtype = CTreeType(c_constructor_fields); + if (fieldtype != c_error_mark_node) + fieldtype = CTreeTypeMainVariant(fieldtype); + fieldcode = CTreeTypeCode(fieldtype); + + /* Accept a string constant to initialize a subarray. */ + if (value != 0 + && fieldcode == C_ARRAY_TYPE + && CTreeTypeCode(CTreeType(fieldtype)) == C_INTEGER_TYPE + && string_flag) + { + value = orig_value; + } + /* Otherwise, if we have come to a subaggregate, + and we don't have an element of its type, push into it. */ + else if (value != 0 && !c_constructor_no_implicit + && value != c_error_mark_node + && CTreeTypeMainVariant(CTreeType(value)) != fieldtype + && (fieldcode == C_RECORD_TYPE || fieldcode == C_ARRAY_TYPE + || fieldcode == C_UNION_TYPE)) + { + c_push_init_level(1); + continue; + } + + if (value) + { + c_push_member_name(c_constructor_fields); + c_output_init_element(value, fieldtype, c_constructor_fields, 1); + RESTORE_SPELLING_DEPTH(c_constructor_depth); + } + else + /* Do the bookkeeping for an element that was + directly output as a constructor. */ + { + CTreeIntCstLow(c_constructor_bit_index) + = CTreeIntCstLow( CTreeDeclSize(c_constructor_fields)); + CTreeIntCstHigh(c_constructor_bit_index) + = CTreeIntCstHigh( CTreeDeclSize(c_constructor_fields)); + + c_constructor_unfilled_fields = CTreeChain(c_constructor_fields); + } + + c_constructor_fields = 0; + break; + } + if ( CTreeTypeCode(c_constructor_type) == C_ARRAY_TYPE) + { + c_tree_node *elttype = CTreeTypeMainVariant(CTreeType(c_constructor_type)); + int eltcode = CTreeTypeCode(elttype); + + /* Accept a string constant to initialize a subarray. */ + if (value != 0 + && eltcode == C_ARRAY_TYPE + && CTreeTypeCode(CTreeType(elttype)) == C_INTEGER_TYPE + && string_flag) + { + value = orig_value; + } + /* Otherwise, if we have come to a subaggregate, + and we don't have an element of its type, push into it. */ + else if (value != 0 && !c_constructor_no_implicit + && value != c_error_mark_node + && CTreeTypeMainVariant(CTreeType(value)) != elttype + && (eltcode == C_RECORD_TYPE || eltcode == C_ARRAY_TYPE + || eltcode == C_UNION_TYPE)) + { + c_push_init_level(1); + continue; + } + + if (c_constructor_max_index != 0 + && c_tree_is_int_cst_lt(c_constructor_max_index, c_constructor_index)) + { + pedwarn_init ("excess elements in array initializer%s", " after `%s'", NULL); + break; + } + + /* In the case of [LO .. HI] = VALUE, only evaluate VALUE once. */ + if (c_constructor_range_end) + { + if (c_constructor_max_index != 0 + && c_tree_is_int_cst_lt(c_constructor_max_index, c_constructor_range_end)) + { + pedwarn_init ("excess elements in array initializer%s", + " after `%s'", NULL); + CTreeIntCstHigh(c_constructor_range_end) + = CTreeIntCstHigh(c_constructor_max_index); + CTreeIntCstLow(c_constructor_range_end) + = CTreeIntCstLow(c_constructor_max_index); + } + +# ifdef LUDO_NO_SKIP + value = save_expr (value); +# endif + } + + /* Now output the actual element. + Ordinarily, output once. + If there is a range, repeat it till we advance past the range. */ + do + { + c_tree_node *tem; + + if (value) + { + c_push_array_bounds (CTreeIntCstLow(c_constructor_index)); + c_output_init_element(value, elttype, c_constructor_index, 1); + RESTORE_SPELLING_DEPTH(c_constructor_depth); + } + + tem = c_build_size_binop(C_PLUS_EXPR, c_constructor_index, + c_integer_one_node); + CTreeIntCstLow(c_constructor_index) = CTreeIntCstLow(tem); + CTreeIntCstHigh(c_constructor_index) = CTreeIntCstHigh(tem); + + if (!value) + /* If we are doing the bookkeeping for an element that was + directly output as a constructor, + we must update constructor_unfilled_index. */ + { + CTreeIntCstLow(c_constructor_unfilled_index) + = CTreeIntCstLow(c_constructor_index); + CTreeIntCstHigh(c_constructor_unfilled_index) + = CTreeIntCstHigh(c_constructor_index); + } + } + while (! (c_constructor_range_end == 0 + || c_tree_is_int_cst_lt(c_constructor_range_end, + c_constructor_index))); + + break; + } + + /* Handle the sole element allowed in a braced initializer + for a scalar variable. */ + if (c_constructor_fields == 0) + { + pedwarn_init ("excess elements in scalar initializer%s", + " after `%s'", NULL); + break; + } + + if (value) + { + c_output_init_element(value, c_constructor_type, NULL, 1); + } + c_constructor_fields = 0; + break; + } + + /* If the (lexically) previous elments are not now saved, + we can discard the storage for them. */ +# ifdef LUDO_NO_SKIP + if (c_constructor_incremental && c_constructor_pending_elts == 0 && value != 0 + && c_constructor_stack == 0) + clear_momentary (); +# endif +} diff --git a/alliance/src/gcp/src/c_ctypeck.h b/alliance/src/gcp/src/c_ctypeck.h new file mode 100644 index 00000000..21a61659 --- /dev/null +++ b/alliance/src/gcp/src/c_ctypeck.h @@ -0,0 +1,116 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : C | +| | +| File : c_ctypeck.h | +| | +| Date : 09.07.99 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef C_CTYPECK_H +# define C_CTYPECK_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern int c_is_comptypes __P((c_tree_node *type1, c_tree_node *type2)); + extern c_tree_node * c_parser_build_indirect_ref __P((c_tree_node *ptr, char *errorstring)); + extern c_tree_node * c_parser_build_conditional_expr __P((c_tree_node *TreeIf, c_tree_node *TreeArg1, c_tree_node *TreeArg2)); + extern c_tree_node * c_parser_build_modify_expr __P(( c_tree_node *lhs, int modifycode, c_tree_node *rhs)); + extern c_tree_node * c_get_non_lvalue __P((c_tree_node *x)); + extern c_tree_node * c_parser_build_compound_expr __P((c_tree_node *list)); + extern c_tree_node * c_is_initializer_constant_valid_p __P((c_tree_node *value, c_tree_node *endtype)); + extern void c_store_init_value __P((c_tree_node *decl, c_tree_node *init)); + extern c_tree_node * c_get_signed_or_unsigned_type __P((int unsignedp, c_tree_node *type)); + extern c_tree_node * c_get_signed_type __P((c_tree_node *type)); + extern c_tree_node * c_get_unsigned_type __P((c_tree_node *type)); + extern int c_int_fits_type_p __P((c_tree_node *c, c_tree_node *type)); + extern int c_is_tree_int_cst_lt __P((c_tree_node *t1, c_tree_node *t2)); + extern c_tree_node * c_get_type_for_size __P((unsigned bits, int unsignedp)); + extern int c_type_precision __P((c_tree_node *type)); + extern c_tree_node * c_c_build_type_variant __P((c_tree_node *type, int constp, int volatilep)); + extern void c_set_init_label __P((c_tree_node *fieldname)); + extern void c_set_init_index __P((c_tree_node *first, c_tree_node *last)); + extern c_tree_node * c_build_c_cast __P((c_tree_node *type, c_tree_node *expr)); + extern c_tree_node * c_get_c_sizeof __P((c_tree_node *type)); + extern c_tree_node * c_get_c_alignof __P((c_tree_node *type)); + extern c_tree_node * c_get_c_alignof_expr __P((c_tree_node *expr)); + extern int c_get_int_size_in_bytes __P((c_tree_node *type)); + extern c_tree_node * c_parser_build_function_call __P((c_tree_node *function, c_tree_node *params)); + extern void c_incomplete_type_error __P((c_tree_node *value, c_tree_node *type)); + extern c_tree_node * c_require_complete_type __P((c_tree_node *value)); + extern int c_is_lvalue_p __P((c_tree_node *ref)); + extern c_tree_node * c_parser_build_array_ref __P((c_tree_node *array, c_tree_node *index)); + extern c_tree_node * c_parser_build_component_ref __P((c_tree_node *datum, c_tree_node *component)); + extern c_tree_node * c_get_size_in_bytes __P((c_tree_node *type)); + + extern c_tree_node * c_build_binary_op __P(( int code, c_tree_node *orig_op0, c_tree_node *orig_op1, int convert_p)); + extern c_tree_node * c_parser_build_binary_op __P(( int code, c_tree_node *arg1, c_tree_node *arg2)); + extern c_tree_node * c_parser_build_unary_op __P((int code, c_tree_node *xarg, int noconvert)); + extern c_tree_node * c_get_narrower __P((c_tree_node *op, int *unsignedp_ptr)); + extern c_tree_node * c_get_unwidened __P((c_tree_node *op, c_tree_node *for_type)); + extern int c_mark_addressable __P((c_tree_node *exp)); + extern void c_process_init_element __P((c_tree_node *value)); + extern c_tree_node * c_pop_init_level __P((int implicit)); + extern void c_push_init_level __P((int implicit)); + extern void c_really_start_incremental_init __P((c_tree_node *type)); + extern c_tree_node * c_finish_init __P(()); + extern void c_start_init __P((c_tree_node *decl, c_tree_node *asmspec_tree, int top_level)); + extern c_tree_node * c_get_common_type __P((c_tree_node *t1, c_tree_node *t2)); + extern int c_force_fit_type __P((c_tree_node *t, int overflow )); + +# endif diff --git a/alliance/src/gcp/src/c_debug.c b/alliance/src/gcp/src/c_debug.c new file mode 100644 index 00000000..6ca354f2 --- /dev/null +++ b/alliance/src/gcp/src/c_debug.c @@ -0,0 +1,712 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : C | +| | +| File : c_debug.c | +| | +| Date : 09.07.99 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + + +# include "mut.h" +# include "aut.h" +# include "gcp.h" + +# include "c_tree.h" +# include "c_treecompat.h" +# include "c_flags.h" +# include "c_cdecl.h" +# include "c_ctypeck.h" +# include "c_convert.h" +# include "c_debug.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +#ifndef VPROTO +#ifdef __STDC__ +#define PVPROTO(ARGS) ARGS +#define VPROTO(ARGS) ARGS +#define VA_START(va_list,var) va_start(va_list,var) +#else +#define PVPROTO(ARGS) () +#define VPROTO(ARGS) (va_alist) va_dcl +#define VA_START(va_list,var) va_start(va_list) +#endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +static int c_need_error_newline; + +/* Function of last error message; + more generally, function such that if next error message is in it + then we don't have to mention the function name. */ +static c_tree_node *c_last_error_function = NULL; + +/* Used to detect when input_file_stack has changed since last described. */ +static int c_last_error_tick; + +/* Called when the start of a function definition is parsed, + this function prints on stdout the name of the function. */ + +/* Number of error messages and warning messages so far. */ + + int c_errorcount = 0; + int c_warningcount = 0; + int c_sorrycount = 0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +/* Count an error or warning. Return 1 if the message should be printed. */ + +int c_count_error(warningp) + int warningp; +{ + if (warningp && c_inhibit_warnings) + return 0; + + if (warningp && !c_warnings_are_errors) + c_warningcount++; + else + { + static int warning_message = 0; + + if (warningp && !warning_message) + { + fprintf (stdout, "warnings being treated as errors\n" ); + warning_message = 1; + } + c_errorcount++; + } + + return 1; +} + +static char *c_print_decl_name(decl, verbosity) + c_tree_node *decl; + int verbosity; +{ + return CTreeIdentPointer( CTreeDeclName(decl)); +} + +static void c_default_print_error_function(file) + char *file; +{ + if (c_last_error_function != c_current_function_decl) + { + char *kind = "function"; + if (c_current_function_decl != 0 + && CTreeTypeCode( CTreeType(c_current_function_decl)) == C_METHOD_TYPE) + { + kind = "method"; + } + + if (file) + { + fprintf (stdout, "%s: ", file); + } + + if (c_current_function_decl == NULL) + { + fprintf (stdout, "At top level:\n"); + } + else + { + char *name = c_print_decl_name(c_current_function_decl, 2); + fprintf (stdout, "In %s `%s':\n", kind, name); + } + + c_last_error_function = c_current_function_decl; + } +} + +/* Prints out, if necessary, the name of the current function + that caused an error. Called from all error and warning functions. */ + +void c_report_error_function(file) + char *file; +{ + c_file_stack *p; + + if (c_need_error_newline) + { + fprintf (stdout, "\n"); + c_need_error_newline = 0; + } + + c_default_print_error_function(file); + + if (c_input_file_stack && c_input_file_stack->NEXT != 0 + && c_input_file_stack_tick != c_last_error_tick + && file == c_input_filename) + { + fprintf (stdout, "In file included"); + for (p = c_input_file_stack->NEXT; p; p = p->NEXT) + { + fprintf (stdout, " from %s:%d", p->NAME, p->LINE); + if (p->NEXT) + fprintf (stdout, ",\n "); + } + fprintf (stdout, ":\n"); + c_last_error_tick = c_input_file_stack_tick; + } +} + +/* Print a message. */ + +static void +c_vmessage(prefix, s, ap) + char *prefix; + char *s; + va_list ap; +{ + if (prefix) + fprintf (stdout, "%s: ", prefix); + +#ifdef HAVE_VPRINTF + vfprintf (stdout, s, ap); +#else + { + int v1 = va_arg(ap, int); + int v2 = va_arg(ap, int); + int v3 = va_arg(ap, int); + int v4 = va_arg(ap, int); + fprintf (stdout, s, v1, v2, v3, v4); + } +#endif +} + +/* Print a message relevant to line LINE of file FILE. */ + +static void +c_v_message_with_file_and_line(file, line, prefix, s, ap) + char *file; + int line; + char *prefix; + char *s; + va_list ap; +{ + if (file) + fprintf (stdout, "%s:%d: ", file, line); + + c_vmessage(prefix, s, ap); + fputc('\n', stdout); +} + +/* Print a message relevant to the given DECL. */ + +static void +c_v_message_with_decl(decl, prefix, s, ap) + c_tree_node *decl; + char *prefix; + char *s; + va_list ap; +{ + char *p; + + fprintf (stdout, "%s:%d: ", + CTreeDeclFileName(decl), CTreeDeclLineNum(decl)); + + if (prefix) + fprintf (stdout, "%s: ", prefix); + + /* Do magic to get around lack of varargs support for insertion + of arguments into existing list. We know that the decl is first; + we ass_u_me that it will be printed with "%s". */ + + for (p = s; *p; ++p) + { + if (*p == '%') + { + if (*(p + 1) == '%') + ++p; + else + break; + } + } + + if (p > s) /* Print the left-hand substring. */ + { + char fmt[sizeof "%.255s"]; + long width = p - s; + + if (width > 255L) width = 255L; /* arbitrary */ + sprintf (fmt, "%%.%lds", width); + fprintf (stdout, fmt, s); + } + + if (*p == '%') /* Print the name. */ + { + char *n = (CTreeDeclName(decl) + ? c_print_decl_name(decl, 2) + : "((anonymous))"); + fputs (n, stdout); + while (*p) + { + ++p; + if (isalpha (*(p - 1) & 0xFF)) + break; + } + } + + if (*p) /* Print the rest of the message. */ + c_vmessage((char *)NULL, p, ap); + + fputc ('\n', stdout); +} + +/* Report an error at line LINE of file FILE. */ + +static void +c_v_error_with_file_and_line(file, line, s, ap) + char *file; + int line; + char *s; + va_list ap; +{ + c_count_error(0); + c_report_error_function(file); + c_v_message_with_file_and_line(file, line, (char *)NULL, s, ap); +} + +void +c_error_with_file_and_line(char *file, int line, char *s, ...) +{ +#ifndef __STDC__ + char *file; + int line; + char *s; +#endif + va_list ap; + + VA_START (ap, s); + +#ifndef __STDC__ + file = va_arg (ap, char *); + line = va_arg (ap, int); + s = va_arg (ap, char *); +#endif + + c_v_error_with_file_and_line (file, line, s, ap); + va_end (ap); +} + +/* Report an error at the declaration DECL. + S is a format string which uses %s to substitute the declaration + name; subsequent substitutions are a la printf. */ + +static void c_v_error_with_decl (decl, s, ap) + c_tree_node *decl; + char *s; + va_list ap; +{ + c_count_error(0); + c_report_error_function( CTreeDeclFileName(decl)); + c_v_message_with_decl(decl, (char *)NULL, s, ap); +} + +void +c_error_with_decl (tree decl, char *s, ...) +{ +#ifndef __STDC__ + c_tree_node *decl; + char *s; +#endif + va_list ap; + + VA_START (ap, s); + +#ifndef __STDC__ + decl = va_arg (ap, tree); + s = va_arg (ap, char *); +#endif + + c_v_error_with_decl (decl, s, ap); + va_end (ap); +} + +/* Report an error at the line number of the insn INSN. + This is used only when INSN is an `asm' with operands, + and each ASM_OPERANDS records its own source file and line. */ + +static void +c_verror (s, ap) + char *s; + va_list ap; +{ + c_v_error_with_file_and_line(c_input_filename, c_lineno, s, ap); +} + +void c_error(char *s, ...) +{ +#ifndef __STDC__ + char *s; +#endif + va_list ap; + + VA_START (ap, s); + +#ifndef __STDC__ + s = va_arg (ap, char *); +#endif + + c_verror(s, ap); + va_end (ap); +} + +/* Report a fatal error at the current line number. */ + +static void +c_vfatal (s, ap) + char *s; + va_list ap; +{ + c_verror (s, ap); + gcpexit( 1 ); +} + +void +c_fatal (char *s, ...) +{ +#ifndef __STDC__ + char *s; +#endif + va_list ap; + + VA_START (ap, s); + +#ifndef __STDC__ + s = va_arg (ap, char *); +#endif + + c_vfatal (s, ap); + va_end (ap); +} + +/* Report a warning at line LINE of file FILE. */ + +static void +c_v_warning_with_file_and_line (file, line, s, ap) + char *file; + int line; + char *s; + va_list ap; +{ + if (c_count_error(1)) + { + c_report_error_function(file); + c_v_message_with_file_and_line(file, line, "warning", s, ap); + } +} + +void +c_warning_with_file_and_line (char *file, int line, char *s, ...) +{ +#ifndef __STDC__ + char *file; + int line; + char *s; +#endif + va_list ap; + + VA_START (ap, s); + +#ifndef __STDC__ + file = va_arg (ap, char *); + line = va_arg (ap, int); + s = va_arg (ap, char *); +#endif + + c_v_warning_with_file_and_line (file, line, s, ap); + va_end (ap); +} + +/* Report a warning at the declaration DECL. + S is a format string which uses %s to substitute the declaration + name; subsequent substitutions are a la printf. */ + +static void c_v_warning_with_decl (decl, s, ap) + c_tree_node *decl; + char *s; + va_list ap; +{ + if (c_count_error(1)) + { + c_report_error_function ( CTreeDeclFileName(decl)); + c_v_message_with_decl(decl, "warning", s, ap); + } +} + +void c_warning_with_decl (tree decl, char *s, ...) +{ +#ifndef __STDC__ + c_tree_node *decl; + char *s; +#endif + va_list ap; + + VA_START (ap, s); + +#ifndef __STDC__ + decl = va_arg (ap, tree); + s = va_arg (ap, char *); +#endif + + c_v_warning_with_decl (decl, s, ap); + va_end (ap); +} + +/* Report a warning at the current line number. */ + +static void +c_vwarning (s, ap) + char *s; + va_list ap; +{ + c_v_warning_with_file_and_line(c_input_filename, c_lineno, s, ap); +} + +void +c_warning (char *s, ...) +{ +#ifndef __STDC__ + char *s; +#endif + va_list ap; + + VA_START (ap, s); + +#ifndef __STDC__ + s = va_arg (ap, char *); +#endif + + c_vwarning(s, ap); + va_end (ap); +} + +/* These functions issue either warnings or errors depending on + -pedantic-errors. */ + +static void +c_vpedwarn (s, ap) + char *s; + va_list ap; +{ + if (c_flag_pedantic_errors) + c_verror (s, ap); + else + c_vwarning (s, ap); +} + +void c_pedwarn (char *s, ...) +{ +#ifndef __STDC__ + char *s; +#endif + va_list ap; + + VA_START (ap, s); + +#ifndef __STDC__ + s = va_arg (ap, char *); +#endif + + c_vpedwarn (s, ap); + va_end (ap); +} + +static void +c_v_pedwarn_with_decl(decl, s, ap) + c_tree_node *decl; + char *s; + va_list ap; +{ + /* We don't want -pedantic-errors to cause the compilation to fail from + "errors" in system header files. Sometimes fixincludes can't fix what's + broken (eg: unsigned char bitfields - fixing it may change the alignment + which will cause programs to mysteriously fail because the C library + or kernel uses the original layout). There's no point in issuing a + warning either, it's just unnecessary noise. */ + + if (! CIsTreeDeclSystemHeader(decl)) + { + if (c_flag_pedantic_errors) + c_v_error_with_decl(decl, s, ap); + else + c_v_warning_with_decl(decl, s, ap); + } +} + +void +c_pedwarn_with_decl (tree decl, char *s, ...) +{ +#ifndef __STDC__ + c_tree_node *decl; + char *s; +#endif + va_list ap; + + VA_START (ap, s); + +#ifndef __STDC__ + decl = va_arg (ap, tree); + s = va_arg (ap, char *); +#endif + + c_v_pedwarn_with_decl (decl, s, ap); + va_end (ap); +} + +static void +c_v_pedwarn_with_file_and_line (file, line, s, ap) + char *file; + int line; + char *s; + va_list ap; +{ + if (c_flag_pedantic_errors) + c_v_error_with_file_and_line (file, line, s, ap); + else + c_v_warning_with_file_and_line (file, line, s, ap); +} + +void +c_pedwarn_with_file_and_line (char *file, int line, char *s, ...) +{ +#ifndef __STDC__ + char *file; + int line; + char *s; +#endif + va_list ap; + + VA_START (ap, s); + +#ifndef __STDC__ + file = va_arg (ap, char *); + line = va_arg (ap, int); + s = va_arg (ap, char *); +#endif + + c_v_pedwarn_with_file_and_line (file, line, s, ap); + va_end (ap); +} + +/* Apologize for not implementing some feature. */ + +static void c_vsorry(s, ap) + char *s; + va_list ap; +{ + c_sorrycount++; + if (c_input_filename) + fprintf (stdout, "%s:%d: ", c_input_filename, c_lineno); + else + c_vmessage ("sorry, not implemented", s, ap); + fputc ('\n', stdout); +} + +void c_sorry(char *s, ...) +{ +#ifndef __STDC__ + char *s; +#endif + va_list ap; + + VA_START (ap, s); + +#ifndef __STDC__ + s = va_arg (ap, char *); +#endif + + c_vsorry (s, ap); + va_end (ap); +} + +/* Apologize for not implementing some feature, then quit. */ + +static void +c_v_really_sorry (s, ap) + char *s; + va_list ap; +{ + c_sorrycount++; + if (c_input_filename) + fprintf (stdout, "%s:%d: ", c_input_filename, c_lineno); + else + c_vmessage ("sorry, not implemented", s, ap); + c_fatal (" (fatal)\n"); +} + +void c_really_sorry (char *s, ...) +{ +#ifndef __STDC__ + char *s; +#endif + va_list ap; + + VA_START (ap, s); + +#ifndef __STDC__ + s = va_arg (ap, char *); +#endif + + c_v_really_sorry (s, ap); + va_end (ap); +} diff --git a/alliance/src/gcp/src/c_debug.h b/alliance/src/gcp/src/c_debug.h new file mode 100644 index 00000000..747e0b96 --- /dev/null +++ b/alliance/src/gcp/src/c_debug.h @@ -0,0 +1,82 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : C | +| | +| File : c_debug.h | +| | +| Date : 09.07.99 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef C_DEBUG_H +# define C_DEBUG_H + +# define c_header_debug() fprintf( stdout, "%s:%d: *%s*\n", \ + __FILE__,__LINE__, __FUNCTION__) +# define c_fprintf c_header_debug(); fprintf +# define loc_c_tree_view_node c_header_debug(); fprintf( stdout, "\n" ); c_tree_view_node +# define loc_c_tree_view_node_list c_header_debug(); fprintf( stdout, "\n" ); c_tree_view_node_list +# define loc_c_view_binding c_header_debug(); fprintf( stdout, "\n" ); c_view_binding + +# define warning c_header_debug(); c_warning +# define pedwarn c_header_debug(); c_pedwarn +# define error c_header_debug(); c_error +# define warning_with_decl c_header_debug(); c_warning_with_decl +# define error_with_decl c_header_debug(); c_error_with_decl +# define pedwarn_with_decl c_header_debug(); c_pedwarn_with_decl +# define warning_with_file_and_line c_header_debug(); c_warning_with_file_and_line +# define error_with_file_and_line c_header_debug(); c_error_with_file_and_line +# define pedwarn_with_file_and_line c_header_debug(); c_pedwarn_with_file_and_line +# define warning_init c_header_debug(); c_warning_init +# define pedwarn_init c_header_debug(); c_pedwarn_init +# define error_init c_header_debug(); c_error_init +# define warn_for_assignment c_header_debug(); c_warn_for_assignment + + extern void c_error __P((char *s, ...)); + extern void c_pedwarn __P((char *s, ...)); + extern void c_warning __P((char *s, ...)); + + extern void c_warning_with_file_and_line __P((char *file, int line, char *s, ...)); + extern void c_pedwarn_with_file_and_line __P((char *file, int line, char *s, ...)); + extern void c_error_with_file_and_line __P((char *file, int line, char *s, ...)); + + extern void c_error_with_decl __P((c_tree_node *decl, char *s, ...)); + extern void c_warning_with_decl __P((c_tree_node *decl, char *s, ...)); + extern void c_pedwarn_with_decl __P((c_tree_node *decl, char *s, ...)); + +# endif diff --git a/alliance/src/gcp/src/c_expand.c b/alliance/src/gcp/src/c_expand.c new file mode 100644 index 00000000..ba1be100 --- /dev/null +++ b/alliance/src/gcp/src/c_expand.c @@ -0,0 +1,106 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : C | +| | +| File : c_expand.c | +| | +| Date : 09.07.99 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include + +# include "mut.h" +# include "aut.h" +# include "gcp.h" + +# include "c_flags.h" +# include "c_tree.h" +# include "c_treecompat.h" +# include "c_cdecl.h" +# include "c_convert.h" +# include "c_ctypeck.h" +# include "c_expand.h" +# include "c_debug.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +/* + ITERATOR RTL EXPANSIONS + + Expanding simple statements with iterators is straightforward: + collect the list of all free iterators in the statement, and + generate a loop for each of them. + + An iterator is "free" if it has not been "bound" by a FOR + operator. The DECL_RTL of the iterator is the loop counter. */ + +/* Expand a statement STMT, possibly containing iterator usage, into RTL. */ + +void c_iterator_expand (stmt) + c_tree_node *stmt; +{ +# ifdef LUDO_NO_SKIP + c_tree_node *iter_list; + save_exprs = NULL_TREE; + iter_list = collect_iterators (stmt, NULL_TREE); + expand_stmt_with_iterators_1 (stmt, iter_list); + istack_sublevel_to_current (); +# endif + + /* + loc_c_tree_view_node( stmt ); + */ +} diff --git a/alliance/src/gcp/src/c_expand.h b/alliance/src/gcp/src/c_expand.h new file mode 100644 index 00000000..bc67ad9f --- /dev/null +++ b/alliance/src/gcp/src/c_expand.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : C | +| | +| File : c_expand.h | +| | +| Date : 09.07.99 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef C_EXPAND_H +# define C_EXPAND_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern void c_iterator_expand __P((c_tree_node *stmt)); + +# endif diff --git a/alliance/src/gcp/src/c_flags.c b/alliance/src/gcp/src/c_flags.c new file mode 100644 index 00000000..12f59a29 --- /dev/null +++ b/alliance/src/gcp/src/c_flags.c @@ -0,0 +1,740 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : C | +| | +| File : c_flags.c | +| | +| Date : 09.07.99 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include + +# include "mut.h" +# include "aut.h" +# include "gcp.h" + +# include "c_flags.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +/* Nonzero for -pedantic switch: warn about anything that standard C forbids. */ + int c_pedantic = 0; + +/* Nonzero means try to imitate old fashioned non-ANSI preprocessor. */ + int c_flag_traditional = 0; + +/* Nonzero means `$' can be in an identifier. */ + int c_dollars_in_ident = 0; + +/* Nonzero enables objc features. */ + int c_doing_objc_thang = 0; + +/* Nonzero means don't recognize the keyword `asm'. */ + int c_flag_no_asm = 0; + +/* Nonzero means warn about any identifiers that match in the first N + characters. The value N is in `id_clash_len'. */ + int c_warn_id_clash; + unsigned c_id_clash_len; + +/* Nonzero for -fwritable-strings: + store string constants in data segment and don't uniquize them. */ + int c_flag_writable_strings; + +/* Nonzero means `char' should be signed. */ + int c_flag_signed_char; + +/* Nonzero means give an enum type only as many bytes as it needs. */ + int c_flag_short_enums; + +/* Nonzero means warn about function definitions that default the return type + or that use a null return and have a return-type other than void. */ + int c_warn_return_type; + +/* Nonzero to warn about variables used before they are initialized. */ + int c_warn_uninitialized; + +/* Nonzero to warn about unused local variables. */ + int c_warn_unused; + +/* Warn if a switch on an enum fails to have a case for every enum value. */ + int c_warn_switch; + +/* Nonzero means warn about all declarations which shadow others. */ + int c_warn_shadow; + +/* Nonzero means don't place uninitialized global data in common storage + by default. */ + int c_flag_no_common; + +/* Nonzero means warn about any objects definitions whose size is larger + than N bytes. Also want about function definitions whose returned + values are larger than N bytes. The value N is in `larger_than_size'. */ + + int c_warn_larger_than; + unsigned c_larger_than_size; + +/* Nonzero means change certain warnings into errors. + Usually these are warnings about failure to conform to some standard. */ + int c_flag_pedantic_errors = 0; + +/* Tag all structures with __attribute__(packed) */ + int c_flag_pack_struct = 0; + +/* Warn about traditional constructs whose meanings changed in ANSI C. */ + int c_warn_traditional; + +/* Nonzero means that we have builtin functions, and main is an int */ + int c_flag_hosted = 1; + +/* Nonzero means don't recognize any builtin functions. */ + int c_flag_no_builtin; + +/* Nonzero means to allow single precision math even if we're generally + being traditional. */ + int flag_allow_single_precision = 0; + +/* Warn if main is suspicious. */ + int c_warn_main; + +/* Nonzero means to treat bitfields as signed unless they say `unsigned'. */ + int c_flag_signed_bitfields = 1; + int c_explicit_flag_signed_bitfields = 0; + +/* Nonzero means allow type mismatches in conditional expressions; + just make their values `void'. */ + int c_flag_cond_mismatch; + +/* Nonzero means give `double' the same size as `float'. */ + int c_flag_short_double; + +/* Nonzero means handle `#ident' directives. 0 means ignore them. */ + int c_flag_no_ident = 0; + +/* Nonzero means don't recognize the non-ANSI builtin functions. + -ansi sets this. */ + int c_flag_no_nonansi_builtin; + +/* Nonzero means message about use of implicit function declarations; + 1 means warning; 2 means error. */ + int c_mesg_implicit_function_declaration; + +/* Nonzero means warn about use of implicit int. */ + int c_warn_implicit_int; + +/* Nonzero means to allow single precision math even if we're generally + being traditional. */ + int c_flag_allow_single_precision = 0; + +/* Nonzero means give string constants the type `const char *' + to get extra warnings from them. These warnings will be too numerous + to be useful, except in thoroughly ANSIfied programs. */ + int c_warn_write_strings; + +/* Nonzero means warn about pointer casts that can drop a type qualifier + from the pointer target type. */ + int c_warn_cast_qual; + +/* Nonzero means warn when casting a function call to a type that does + not match the return type (e.g. (float)sqrt() or (anything*)malloc() + when there is no previous declaration of sqrt or malloc. */ + int c_warn_bad_function_cast; + + +/* Nonzero means warn about sizeof(function) or addition/subtraction + of function pointers. */ + int c_warn_pointer_arith; + +/* Nonzero means warn for non-prototype function decls + or non-prototyped defs without previous prototype. */ + int c_warn_strict_prototypes; + +/* Nonzero means warn for any global function def + without separate previous prototype decl. */ + int c_warn_missing_prototypes; + +/* Nonzero means warn for any global function def + without separate previous decl. */ + int c_warn_missing_declarations; + +/* Nonzero means warn about multiple (redundant) decls for the same single + variable or function. */ + int c_warn_redundant_decls = 0; + +/* Nonzero means warn about extern declarations of objects not at + file-scope level and about *all* declarations of functions (whether + extern or static) not at file-scope level. Note that we exclude + implicit function declarations. To get warnings about those, use + -Wimplicit. */ + int c_warn_nested_externs = 0; + +/* Warn about *printf or *scanf format/argument anomalies. */ + int c_warn_format; + +/* Warn about a subscript that has type char. */ + int c_warn_char_subscripts = 0; + +/* Warn if a type conversion is done that might have confusing results. */ + int c_warn_conversion; + +/* Warn if adding () is suggested. */ + int c_warn_parentheses; + +/* Warn if initializer is not completely bracketed. */ + int c_warn_missing_braces; + +/* Warn about comparison of signed and unsigned values. + If -1, neither -Wsign-compare nor -Wno-sign-compare has been specified. */ + int c_warn_sign_compare = -1; + +/* Temporarily suppress certain warnings. + This is set while reading code from a system header file. */ + int c_in_system_header = 0; + +/* Name of current original source file (what was input to cpp). + This comes from each #-command in the actual input. */ + char *c_input_filename; + +/* Name of top-level original source file (what was input to cpp). + This comes from the #-command at the beginning of the actual input. + If there isn't any there, then this is the cc1 input file name. */ + char *c_main_input_filename; + +/* Stack of currently pending input files. */ + c_file_stack *c_input_file_stack; + +/* Incremented on each change to input_file_stack. */ + int c_input_file_stack_tick; + +/* Nonzero for -ffloat-store: don't allocate floats and doubles + in extended-precision registers. */ + int c_flag_float_store = 0; + + +/* Nonzero means all references through pointers are volatile. */ + int c_flag_volatile; + +/* Don't print warning messages. -w. */ + int c_inhibit_warnings = 0; + +/* Print various extra warnings. -W. */ + int c_extra_warnings = 0; + +/* Treat warnings as errors. -Werror. */ + int c_warnings_are_errors = 0; + +/* Nonzero means we should be saving declaration info into a .X file. */ + int c_flag_gen_aux_info = 0; + +/* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math + operations in the interest of optimization. For example it allows + GCC to assume arguments to sqrt are nonnegative numbers, allowing + faster code for sqrt to be generated. */ + int c_flag_fast_math = 0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +static void c_init_flags() +{ +/* Nonzero for -pedantic switch: warn about anything that standard C forbids. */ + c_pedantic = 0; + +/* Nonzero means try to imitate old fashioned non-ANSI preprocessor. */ + c_flag_traditional = 0; + +/* Nonzero means `$' can be in an identifier. */ + c_dollars_in_ident = 0; + +/* Nonzero enables objc features. */ + c_doing_objc_thang = 0; + +/* Nonzero means don't recognize the keyword `asm'. */ + c_flag_no_asm = 0; + +/* Nonzero means warn about any identifiers that match in the first N + characters. The value N is in `id_clash_len'. */ + c_warn_id_clash = 0; + c_id_clash_len = 0; + +/* Nonzero for -fwritable-strings: + store string constants in data segment and don't uniquize them. */ + c_flag_writable_strings = 0; + +/* Nonzero means `char' should be signed. */ + c_flag_signed_char = 0; + +/* Nonzero means give an enum type only as many bytes as it needs. */ + c_flag_short_enums = 0; + +/* Nonzero means warn about function definitions that default the return type + or that use a null return and have a return-type other than void. */ + c_warn_return_type = 0; + +/* Nonzero to warn about variables used before they are initialized. */ + c_warn_uninitialized = 0; + +/* Nonzero to warn about unused local variables. */ + c_warn_unused = 0; + +/* Warn if a switch on an enum fails to have a case for every enum value. */ + c_warn_switch = 0; + +/* Nonzero means warn about all declarations which shadow others. */ + c_warn_shadow = 0; + +/* Nonzero means don't place uninitialized global data in common storage + by default. */ + c_flag_no_common = 0; + +/* Nonzero means warn about any objects definitions whose size is larger + than N bytes. Also want about function definitions whose returned + values are larger than N bytes. The value N is in `larger_than_size'. */ + + c_warn_larger_than = 0; + c_larger_than_size = 0; + +/* Nonzero means change certain warnings into errors. + Usually these are warnings about failure to conform to some standard. */ + c_flag_pedantic_errors = 0; + +/* Tag all structures with __attribute__(packed) */ + c_flag_pack_struct = 0; + +/* Warn about traditional constructs whose meanings changed in ANSI C. */ + c_warn_traditional = 0; + +/* Nonzero means that we have builtin functions, and main is an*/ + c_flag_hosted = 1; + +/* Nonzero means don't recognize any builtin functions. */ + c_flag_no_builtin = 0; + +/* Nonzero means to allow single precision math even if we're generally + being traditional. */ + flag_allow_single_precision = 0; + +/* Warn if main is suspicious. */ + c_warn_main = 0; + +/* Nonzero means to treat bitfields as signed unless they say `unsigned'. */ + c_flag_signed_bitfields = 1; + c_explicit_flag_signed_bitfields = 0; + +/* Nonzero means allow type mismatches in conditional expressions = 0; + just make their values `void'. */ + c_flag_cond_mismatch = 0; + +/* Nonzero means give `double' the same size as `float'. */ + c_flag_short_double = 0; + +/* Nonzero means handle `#ident' directives. 0 means ignore them. */ + c_flag_no_ident = 0; + +/* Nonzero means don't recognize the non-ANSI builtin functions. + -ansi sets this. */ + c_flag_no_nonansi_builtin = 0; + +/* Nonzero means message about use of implicit function declarations = 0; + 1 means warning; 2 means error. */ + c_mesg_implicit_function_declaration = 0; + +/* Nonzero means warn about use of implicit int. */ + c_warn_implicit_int = 0; + +/* Nonzero means to allow single precision math even if we're generally + being traditional. */ + c_flag_allow_single_precision = 0; + +/* Nonzero means give string constants the type `const char *' + to get extra warnings from them. These warnings will be too numerous + to be useful, except in thoroughly ANSIfied programs. */ + c_warn_write_strings = 0; + +/* Nonzero means warn about pointer casts that can drop a type qualifier + from the pointer target type. */ + c_warn_cast_qual = 0; + +/* Nonzero means warn when casting a function call to a type that does + not match the return type (e.g. (float)sqrt() or (anything*)malloc() + when there is no previous declaration of sqrt or malloc. */ + c_warn_bad_function_cast = 0; + + +/* Nonzero means warn about sizeof(function) or addition/subtraction + of function pointers. */ + c_warn_pointer_arith = 0; + +/* Nonzero means warn for non-prototype function decls + or non-prototyped defs without previous prototype. */ + c_warn_strict_prototypes = 0; + +/* Nonzero means warn for any global function def + without separate previous prototype decl. */ + c_warn_missing_prototypes = 0; + +/* Nonzero means warn for any global function def + without separate previous decl. */ + c_warn_missing_declarations = 0; + +/* Nonzero means warn about multiple (redundant) decls for the same single + variable or function. */ + c_warn_redundant_decls = 0; + +/* Nonzero means warn about extern declarations of objects not at + file-scope level and about *all* declarations of functions (whether + extern or static) not at file-scope level. Note that we exclude + implicit function declarations. To get warnings about those, use + -Wimplicit. */ + c_warn_nested_externs = 0; + +/* Warn about *printf or *scanf format/argument anomalies. */ + c_warn_format = 0; + +/* Warn about a subscript that has type char. */ + c_warn_char_subscripts = 0; + +/* Warn if a type conversion is done that might have confusing results. */ + c_warn_conversion = 0; + +/* Warn if adding () is suggested. */ + c_warn_parentheses = 0; + +/* Warn if initializer is not completely bracketed. */ + c_warn_missing_braces = 0; + +/* Warn about comparison of signed and unsigned values. + If -1, neither -Wsign-compare nor -Wno-sign-compare has been specified. */ + c_warn_sign_compare = -1; + +/* Temporarily suppress certain warnings. + This is set while reading code from a system header file. */ + c_in_system_header = 0; + +/* Name of current original source file (what was input to cpp). + This comes from each #-command in the actual input. */ + c_input_filename = 0; + +/* Name of top-level original source file (what was input to cpp). + This comes from the #-command at the beginning of the actual input. + If there isn't any there, then this is the cc1 input file name. */ + c_main_input_filename = 0; + +/* Stack of currently pending input files. */ + c_input_file_stack = 0; + +/* Incremented on each change to input_file_stack. */ + c_input_file_stack_tick = 0; + +/* Nonzero for -ffloat-store: don't allocate floats and doubles + in extended-precision registers. */ + c_flag_float_store = 0; + + +/* Nonzero means all references through pointers are volatile. */ + c_flag_volatile = 0; + +/* Don't print warning messages. -w. */ + c_inhibit_warnings = 0; + +/* Print various extra warnings. -W. */ + c_extra_warnings = 0; + +/* Treat warnings as errors. -Werror. */ + c_warnings_are_errors = 0; + +/* Nonzero means we should be saving declaration info into a .X file. */ + c_flag_gen_aux_info = 0; + +/* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math + operations in the interest of optimization. For example it allows + GCC to assume arguments to sqrt are nonnegative numbers, allowing + faster code for sqrt to be generated. */ + c_flag_fast_math = 0; +} + +static int c_parse_one_flags( p ) + + char *p; +{ + c_init_flags(); + + if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional")) + { + c_flag_traditional = 1; + c_flag_writable_strings = 1; + } + else if (!strcmp (p, "-fallow-single-precision")) + c_flag_allow_single_precision = 1; + else if (!strcmp (p, "-fhosted") || !strcmp (p, "-fno-freestanding")) + { + c_flag_hosted = 1; + c_flag_no_builtin = 0; + } + else if (!strcmp (p, "-ffreestanding") || !strcmp (p, "-fno-hosted")) + { + c_flag_hosted = 0; + c_flag_no_builtin = 1; + /* warn_main will be 2 if set by -Wall, 1 if set by -Wmain */ + if (c_warn_main == 2) + c_warn_main = 0; + } + else if (!strcmp (p, "-fnotraditional") || !strcmp (p, "-fno-traditional")) + { + c_flag_traditional = 0; + c_flag_writable_strings = 0; + } + else if (!strcmp (p, "-fdollars-in-identifiers")) + c_dollars_in_ident = 1; + else if (!strcmp (p, "-fno-dollars-in-identifiers")) + c_dollars_in_ident = 0; + else if (!strcmp (p, "-fsigned-char")) + c_flag_signed_char = 1; + else if (!strcmp (p, "-funsigned-char")) + c_flag_signed_char = 0; + else if (!strcmp (p, "-fno-signed-char")) + c_flag_signed_char = 0; + else if (!strcmp (p, "-fno-unsigned-char")) + c_flag_signed_char = 1; + else if (!strcmp (p, "-fsigned-bitfields") + || !strcmp (p, "-fno-unsigned-bitfields")) + { + c_flag_signed_bitfields = 1; + c_explicit_flag_signed_bitfields = 1; + } + else if (!strcmp (p, "-funsigned-bitfields") + || !strcmp (p, "-fno-signed-bitfields")) + { + c_flag_signed_bitfields = 0; + c_explicit_flag_signed_bitfields = 1; + } + else if (!strcmp (p, "-fshort-enums")) + c_flag_short_enums = 1; + else if (!strcmp (p, "-fno-short-enums")) + c_flag_short_enums = 0; + else if (!strcmp (p, "-fcond-mismatch")) + c_flag_cond_mismatch = 1; + else if (!strcmp (p, "-fno-cond-mismatch")) + c_flag_cond_mismatch = 0; + else if (!strcmp (p, "-fshort-double")) + c_flag_short_double = 1; + else if (!strcmp (p, "-fno-short-double")) + c_flag_short_double = 0; + else if (!strcmp (p, "-fasm")) + c_flag_no_asm = 0; + else if (!strcmp (p, "-fno-asm")) + c_flag_no_asm = 1; + else if (!strcmp (p, "-fbuiltin")) + c_flag_no_builtin = 0; + else if (!strcmp (p, "-fno-builtin")) + c_flag_no_builtin = 1; + else if (!strcmp (p, "-fno-ident")) + c_flag_no_ident = 1; + else if (!strcmp (p, "-fident")) + c_flag_no_ident = 0; + else if (!strcmp (p, "-ansi")) + c_flag_no_asm = 1, c_flag_no_nonansi_builtin = 1; + else if (!strcmp (p, "-Werror-implicit-function-declaration")) + c_mesg_implicit_function_declaration = 2; + else if (!strcmp (p, "-Wimplicit-function-declaration")) + c_mesg_implicit_function_declaration = 1; + else if (!strcmp (p, "-Wno-implicit-function-declaration")) + c_mesg_implicit_function_declaration = 0; + else if (!strcmp (p, "-Wimplicit-int")) + c_warn_implicit_int = 1; + else if (!strcmp (p, "-Wno-implicit-int")) + c_warn_implicit_int = 0; + else if (!strcmp (p, "-Wimplicit")) + { + c_warn_implicit_int = 1; + if (c_mesg_implicit_function_declaration != 2) + c_mesg_implicit_function_declaration = 1; + } + else if (!strcmp (p, "-Wno-implicit")) + c_warn_implicit_int = 0, c_mesg_implicit_function_declaration = 0; + else if (!strcmp (p, "-Wwrite-strings")) + c_warn_write_strings = 1; + else if (!strcmp (p, "-Wno-write-strings")) + c_warn_write_strings = 0; + else if (!strcmp (p, "-Wcast-qual")) + c_warn_cast_qual = 1; + else if (!strcmp (p, "-Wno-cast-qual")) + c_warn_cast_qual = 0; + else if (!strcmp (p, "-Wbad-function-cast")) + c_warn_bad_function_cast = 1; + else if (!strcmp (p, "-Wno-bad-function-cast")) + c_warn_bad_function_cast = 0; + else if (!strcmp (p, "-Wpointer-arith")) + c_warn_pointer_arith = 1; + else if (!strcmp (p, "-Wno-pointer-arith")) + c_warn_pointer_arith = 0; + else if (!strcmp (p, "-Wstrict-prototypes")) + c_warn_strict_prototypes = 1; + else if (!strcmp (p, "-Wno-strict-prototypes")) + c_warn_strict_prototypes = 0; + else if (!strcmp (p, "-Wmissing-prototypes")) + c_warn_missing_prototypes = 1; + else if (!strcmp (p, "-Wno-missing-prototypes")) + c_warn_missing_prototypes = 0; + else if (!strcmp (p, "-Wmissing-declarations")) + c_warn_missing_declarations = 1; + else if (!strcmp (p, "-Wno-missing-declarations")) + c_warn_missing_declarations = 0; + else if (!strcmp (p, "-Wredundant-decls")) + c_warn_redundant_decls = 1; + else if (!strcmp (p, "-Wno-redundant-decls")) + c_warn_redundant_decls = 0; + else if (!strcmp (p, "-Wnested-externs")) + c_warn_nested_externs = 1; + else if (!strcmp (p, "-Wno-nested-externs")) + c_warn_nested_externs = 0; + else if (!strcmp (p, "-Wtraditional")) + c_warn_traditional = 1; + else if (!strcmp (p, "-Wno-traditional")) + c_warn_traditional = 0; + else if (!strcmp (p, "-Wformat")) + c_warn_format = 1; + else if (!strcmp (p, "-Wno-format")) + c_warn_format = 0; + else if (!strcmp (p, "-Wchar-subscripts")) + c_warn_char_subscripts = 1; + else if (!strcmp (p, "-Wno-char-subscripts")) + c_warn_char_subscripts = 0; + else if (!strcmp (p, "-Wconversion")) + c_warn_conversion = 1; + else if (!strcmp (p, "-Wno-conversion")) + c_warn_conversion = 0; + else if (!strcmp (p, "-Wparentheses")) + c_warn_parentheses = 1; + else if (!strcmp (p, "-Wno-parentheses")) + c_warn_parentheses = 0; + else if (!strcmp (p, "-Wreturn-type")) + c_warn_return_type = 1; + else if (!strcmp (p, "-Wno-return-type")) + c_warn_return_type = 0; + else if (!strcmp (p, "-Wcomment")) + ; /* cpp handles this one. */ + else if (!strcmp (p, "-Wno-comment")) + ; /* cpp handles this one. */ + else if (!strcmp (p, "-Wcomments")) + ; /* cpp handles this one. */ + else if (!strcmp (p, "-Wno-comments")) + ; /* cpp handles this one. */ + else if (!strcmp (p, "-Wtrigraphs")) + ; /* cpp handles this one. */ + else if (!strcmp (p, "-Wno-trigraphs")) + ; /* cpp handles this one. */ + else if (!strcmp (p, "-Wundef")) + ; /* cpp handles this one. */ + else if (!strcmp (p, "-Wno-undef")) + ; /* cpp handles this one. */ + else if (!strcmp (p, "-Wimport")) + ; /* cpp handles this one. */ + else if (!strcmp (p, "-Wno-import")) + ; /* cpp handles this one. */ + else if (!strcmp (p, "-Wmissing-braces")) + c_warn_missing_braces = 1; + else if (!strcmp (p, "-Wno-missing-braces")) + c_warn_missing_braces = 0; + else if (!strcmp (p, "-Wmain")) + c_warn_main = 1; + else if (!strcmp (p, "-Wno-main")) + c_warn_main = 0; + else if (!strcmp (p, "-Wsign-compare")) + c_warn_sign_compare = 1; + else if (!strcmp (p, "-Wno-sign-compare")) + c_warn_sign_compare = 0; + else if (!strcmp (p, "-Wall")) + { + /* We save the value of warn_uninitialized, since if they put + -Wuninitialized on the command line, we need to generate a + warning about not using it without also specifying -O. */ + if (c_warn_uninitialized != 1) + c_warn_uninitialized = 2; + c_warn_implicit_int = 1; + c_mesg_implicit_function_declaration = 1; + c_warn_return_type = 1; + c_warn_unused = 1; + c_warn_switch = 1; + c_warn_format = 1; + c_warn_char_subscripts = 1; + c_warn_parentheses = 1; + c_warn_missing_braces = 1; + /* We set this to 2 here, but 1 in -Wmain, so -ffreestanding can turn + it off only if it's not explicit. */ + c_warn_main = 2; + } + else + return 0; + + return 1; +} + +int c_parse_flags( Argc, Argv ) + + int Argc; + char **Argv; +{ + int Index; + int Error; + + Error = 0; + + for ( Index = 0; Index < Argc; Index++ ) + { + if ( ! c_parse_one_flags( Argv[ Index ] ) ) Error = 1; + } + + return( Error ); +} diff --git a/alliance/src/gcp/src/c_flags.h b/alliance/src/gcp/src/c_flags.h new file mode 100644 index 00000000..80745e5e --- /dev/null +++ b/alliance/src/gcp/src/c_flags.h @@ -0,0 +1,303 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : C | +| | +| File : c_flags.h | +| | +| Date : 09.07.99 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef C_FLAGS_H +# define C_FLAGS_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct c_file_stack + { + struct c_file_stack *NEXT; + char *NAME; + int LINE; + int INDENT_LEVEL; + + } c_file_stack; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +/* Nonzero for -pedantic switch: warn about anything that standard C forbids. */ + int c_pedantic; + +/* Nonzero means try to imitate old fashioned non-ANSI preprocessor. */ + int c_flag_traditional; + +/* Nonzero means `$' can be in an identifier. */ + extern int c_dollars_in_ident; + +/* Nonzero enables objc features. */ + extern int c_doing_objc_thang; + +/* Nonzero means don't recognize the keyword `asm'. */ + extern int c_flag_no_asm; + +/* Temporarily suppress certain warnings. + extern This is set while reading code from a system header file. */ + extern int c_in_system_header; + +/* Nonzero means warn about any identifiers that match in the first N + extern characters. The value N is in `id_clash_len'. */ + extern int c_warn_id_clash; + extern unsigned c_id_clash_len; + +/* Nonzero for -fwritable-strings: + extern store string constants in data segment and don't uniquize them. */ + extern int c_flag_writable_strings; + +/* Nonzero means `char' should be signed. */ + extern int c_flag_signed_char; + +/* Nonzero means give an enum type only as many bytes as it needs. */ + extern int c_flag_short_enums; + +/* Nonzero means warn about function definitions that default the return type + extern or that use a null return and have a return-type other than void. */ + extern int c_warn_return_type; + +/* Nonzero to warn about variables used before they are initialized. */ + extern int c_warn_uninitialized; + +/* Nonzero to warn about unused local variables. */ + extern int c_warn_unused; + +/* Warn if a switch on an enum fails to have a case for every enum value. */ + extern int c_warn_switch; + +/* Nonzero means warn about all declarations which shadow others. */ + extern int c_warn_shadow; + +/* Nonzero means don't place uninitialized global data in common storage + extern by default. */ + extern int c_flag_no_common; + +/* Nonzero means warn about any objects definitions whose size is larger + extern than N bytes. Also want about function definitions whose returned + extern values are larger than N bytes. The value N is in `larger_than_size'. */ + + extern int c_warn_larger_than; + extern unsigned c_larger_than_size; + +/* Nonzero means change certain warnings into errors. + extern Usually these are warnings about failure to conform to some standard. */ + extern int c_flag_pedantic_errors; + +/* Tag all structures with __attribute__(packed) */ + extern int c_flag_pack_struct; + +/* Warn about traditional constructs whose meanings changed in ANSI C. */ + extern int c_warn_traditional; + +/* Nonzero means that we have builtin functions, and main is an int */ + extern int c_flag_hosted; + +/* Nonzero means don't recognize any builtin functions. */ + extern int c_flag_no_builtin; + +/* Nonzero means to allow single precision math even if we're generally + extern being traditional. */ + extern int flag_allow_single_precision; + +/* Warn if main is suspicious. */ + extern int c_warn_main; + +/* Nonzero means to treat bitfields as signed unless they say `unsigned'. */ + extern int c_flag_signed_bitfields; + extern int c_explicit_flag_signed_bitfields; + +/* Nonzero means allow type mismatches in conditional expressions; + extern just make their values `void'. */ + extern int c_flag_cond_mismatch; + +/* Nonzero means give `double' the same size as `float'. */ + extern int c_flag_short_double; + +/* Nonzero means handle `#ident' directives. 0 means ignore them. */ + extern int c_flag_no_ident; + +/* Nonzero means don't recognize the non-ANSI builtin functions. + extern -ansi sets this. */ + extern int c_flag_no_nonansi_builtin; + +/* Nonzero means message about use of implicit function declarations; + 1 means warning; 2 means error. */ + extern int c_mesg_implicit_function_declaration; + +/* Nonzero means warn about use of implicit int. */ + extern int c_warn_implicit_int; + +/* Nonzero means to allow single precision math even if we're generally + extern being traditional. */ + extern int c_flag_allow_single_precision; + +/* Nonzero means give string constants the type `const char *' + extern to get extra warnings from them. These warnings will be too numerous + extern to be useful, except in thoroughly ANSIfied programs. */ + extern int c_warn_write_strings; + +/* Nonzero means warn about pointer casts that can drop a type qualifier + extern from the pointer target type. */ + extern int c_warn_cast_qual; + +/* Nonzero means warn when casting a function call to a type that does + extern not match the return type (e.g. (float)sqrt() or (anything*)malloc() + extern when there is no previous declaration of sqrt or malloc. */ + extern int c_warn_bad_function_cast; + + +/* Nonzero means warn about sizeof(function) or addition/subtraction + extern of function pointers. */ + extern int c_warn_pointer_arith; + +/* Nonzero means warn for non-prototype function decls + extern or non-prototyped defs without previous prototype. */ + extern int c_warn_strict_prototypes; + +/* Nonzero means warn for any global function def + extern without separate previous prototype decl. */ + extern int c_warn_missing_prototypes; + +/* Nonzero means warn for any global function def + extern without separate previous decl. */ + extern int c_warn_missing_declarations; + +/* Nonzero means warn about multiple (redundant) decls for the same single + extern variable or function. */ + extern int c_warn_redundant_decls; + +/* Nonzero means warn about extern declarations of objects not at + extern file-scope level and about *all* declarations of functions (whether + extern extern or static) not at file-scope level. Note that we exclude + extern implicit function declarations. To get warnings about those, use + extern -Wimplicit. */ + extern int c_warn_nested_externs; + +/* Warn about *printf or *scanf format/argument anomalies. */ + extern int c_warn_format; + +/* Warn about a subscript that has type char. */ + extern int c_warn_char_subscripts; + +/* Warn if a type conversion is done that might have confusing results. */ + extern int c_warn_conversion; + +/* Warn if adding () is suggested. */ + extern int c_warn_parentheses; + +/* Warn if initializer is not completely bracketed. */ + extern int c_warn_missing_braces; + +/* Warn about comparison of signed and unsigned values. + extern If -1, neither -Wsign-compare nor -Wno-sign-compare has been specified. */ + extern int c_warn_sign_compare; + +/* Temporarily suppress certain warnings. + This is set while reading code from a system header file. */ + extern int c_in_system_header; + +/* Name of current original source file (what was input to cpp). + This comes from each #-command in the actual input. */ + extern char *c_input_filename; + +/* Name of top-level original source file (what was input to cpp). + This comes from the #-command at the beginning of the actual input. + If there isn't any there, then this is the cc1 input file name. */ + extern char *c_main_input_filename; + +/* Current line number in real source file. */ + extern int c_lineno; + +/* Stack of currently pending input files. */ + extern c_file_stack *c_input_file_stack; + +/* Incremented on each change to input_file_stack. */ + extern int c_input_file_stack_tick; + +/* Nonzero for -ffloat-store: don't allocate floats and doubles + in extended-precision registers. */ + extern int c_flag_float_store; + +/* Nonzero means all references through pointers are volatile. */ + extern int c_flag_volatile; + +/* Don't print warning messages. -w. */ + extern int c_inhibit_warnings; + +/* Print various extra warnings. -W. */ + extern int c_extra_warnings; + +/* Treat warnings as errors. -Werror. */ + extern int c_warnings_are_errors; + +/* Nonzero means we should be saving declaration info into a .X file. */ + extern int c_flag_gen_aux_info; + +/* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math + operations in the interest of optimization. For example it allows + GCC to assume arguments to sqrt are nonnegative numbers, allowing + faster code for sqrt to be generated. */ + extern int c_flag_fast_math; + + extern int c_parse_flags __P((int Argc, char **Argv)); + +# endif diff --git a/alliance/src/gcp/src/c_foldconst.c b/alliance/src/gcp/src/c_foldconst.c new file mode 100644 index 00000000..fa1be7db --- /dev/null +++ b/alliance/src/gcp/src/c_foldconst.c @@ -0,0 +1,4320 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : C | +| | +| File : c_foldconst.c | +| | +| Date : 09.07.99 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "aut.h" +# include "gcp.h" + +# include "c_flags.h" +# include "c_tree.h" +# include "c_treecompat.h" +# include "c_cdecl.h" +# include "c_convert.h" +# include "c_ctypeck.h" +# include "c_foldconst.h" +# include "c_debug.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +#define c_overflow_sum_sign(a, b, sum) ((~((a) ^ (b)) & ((a) ^ (sum))) < 0) + +#define LOWPART(x) \ + ((x) & (((unsigned C_HOST_WIDE_INT) 1 << (C_HOST_BITS_PER_WIDE_INT/2)) - 1)) +#define HIGHPART(x) \ + ((unsigned C_HOST_WIDE_INT) (x) >> C_HOST_BITS_PER_WIDE_INT/2) +#define BASE ((unsigned C_HOST_WIDE_INT) 1 << C_HOST_BITS_PER_WIDE_INT/2) + + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +/* Nonzero means lvalues are limited to those valid in pedantic ANSI C. + Zero means allow extended lvalues. */ + + int c_pedantic_lvalues; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + + extern void c_rshift_double(); + extern void c_lshift_double(); + extern void c_lrotate_double(); + extern void c_rrotate_double(); + + +/* When pedantic, return an expr equal to X but certainly not valid as a + pedantic lvalue. Otherwise, return X. */ + +c_tree_node *c_get_pedantic_non_lvalue(x) + c_tree_node *x; +{ + if (c_pedantic_lvalues) + return c_get_non_lvalue(x); + else + return x; +} + +/* Given a c_tree_node *comparison code, return the code that is the logical inverse + of the given code. It is not safe to do this for floating-point + comparisons, except for NE_EXPR and EQ_EXPR. */ + +static int c_invert_tree_comparison(code) + int code; +{ + switch (code) + { + case C_EQ_EXPR: + return C_NE_EXPR; + case C_NE_EXPR: + return C_EQ_EXPR; + case C_GT_EXPR: + return C_LE_EXPR; + case C_GE_EXPR: + return C_LT_EXPR; + case C_LT_EXPR: + return C_GE_EXPR; + case C_LE_EXPR: + return C_GT_EXPR; + default: + abort (); + } +} + +/* Return a simplified c_tree_node *node for the truth-negation of ARG. This + never alters ARG itself. We assume that ARG is an operation that + returns a truth value (0 or 1). */ + +c_tree_node *c_invert_truthvalue(arg) + c_tree_node *arg; +{ + c_tree_node *type = CTreeType(arg); + int code = CTreeNodeFirstCode(arg); + + if (code == C_ERROR_NODE) + return arg; + + code = CTreeExprCode(arg); + + /* If this is a comparison, we can simply invert it, except for + floating-point non-equality comparisons, in which case we just + enclose a TRUTH_NOT_EXPR around what we have. */ + + if ( code == C_LT_EXPR || + code == C_LE_EXPR || + code == C_GT_EXPR || + code == C_GE_EXPR || + code == C_EQ_EXPR || + code == C_NE_EXPR || + code == C_SET_LE_EXPR ) + { + if (FLOAT_TYPE_P (CTreeType(CTreeExprOperand(arg, 0))) + && code != C_NE_EXPR && code != C_EQ_EXPR) + return c_tree_build_unary_typed_expr(C_TRUTH_NOT_EXPR, type, arg); + else + return c_tree_build_binary_typed_expr(c_invert_tree_comparison(code), type, + CTreeExprOperand(arg, 0), CTreeExprOperand(arg, 1)); + } + + switch (code) + { + case C_INT_CST_NODE: + return c_convert_expr(type, c_tree_build_int_2(CTreeIntCstLow(arg) == 0 + && CTreeIntCstHigh(arg) == 0, 0)); + + case C_TRUTH_AND_EXPR: + return c_tree_build_binary_typed_expr(C_TRUTH_OR_EXPR, type, + c_invert_truthvalue (CTreeExprOperand(arg, 0)), + c_invert_truthvalue (CTreeExprOperand(arg, 1))); + + case C_TRUTH_OR_EXPR: + return c_tree_build_binary_typed_expr(C_TRUTH_AND_EXPR, type, + c_invert_truthvalue (CTreeExprOperand(arg, 0)), + c_invert_truthvalue (CTreeExprOperand(arg, 1))); + + case C_TRUTH_XOR_EXPR: + /* Here we can invert either operand. We invert the first operand + unless the second operand is a TRUTH_NOT_EXPR in which case our + result is the XOR of the first operand with the inside of the + negation of the second operand. */ + + if ( CTreeExprCode(CTreeExprOperand(arg, 1)) == C_TRUTH_NOT_EXPR) + return c_tree_build_binary_typed_expr(C_TRUTH_XOR_EXPR, type, CTreeExprOperand(arg, 0), + CTreeExprOperand(CTreeExprOperand(arg, 1), 0)); + else + return c_tree_build_binary_typed_expr (C_TRUTH_XOR_EXPR, type, + c_invert_truthvalue (CTreeExprOperand(arg, 0)), + CTreeExprOperand(arg, 1)); + + case C_TRUTH_ANDIF_EXPR: + return c_tree_build_binary_typed_expr (C_TRUTH_ORIF_EXPR, type, + c_invert_truthvalue (CTreeExprOperand(arg, 0)), + c_invert_truthvalue (CTreeExprOperand(arg, 1))); + + case C_TRUTH_ORIF_EXPR: + return c_tree_build_binary_typed_expr (C_TRUTH_ANDIF_EXPR, type, + c_invert_truthvalue (CTreeExprOperand(arg, 0)), + c_invert_truthvalue (CTreeExprOperand(arg, 1))); + + case C_TRUTH_NOT_EXPR: + return CTreeExprOperand(arg, 0); + + case C_COND_EXPR: + return c_tree_build_ternary_typed_expr (C_COND_EXPR, type, CTreeExprOperand(arg, 0), + c_invert_truthvalue (CTreeExprOperand(arg, 1)), + c_invert_truthvalue (CTreeExprOperand(arg, 2))); + + case C_COMPOUND_EXPR: + return c_tree_build_binary_typed_expr (C_COMPOUND_EXPR, type, CTreeExprOperand(arg, 0), + c_invert_truthvalue (CTreeExprOperand(arg, 1))); + + case C_NON_LVALUE_EXPR: + return c_invert_truthvalue (CTreeExprOperand(arg, 0)); + + case C_NOP_EXPR: + case C_CONVERT_EXPR: + case C_FLOAT_EXPR: + return c_tree_build_unary_typed_expr ( CTreeExprCode(arg), type, + c_invert_truthvalue (CTreeExprOperand(arg, 0))); + + case C_BIT_AND_EXPR: + if (! c_tree_is_integer_onep(CTreeExprOperand(arg, 1))) + break; + return c_tree_build_binary_typed_expr( + C_EQ_EXPR, type, arg, c_convert_expr(type, c_integer_zero_node)); + + case C_SAVE_EXPR: + return c_tree_build_unary_typed_expr(C_TRUTH_NOT_EXPR, type, arg); + + case C_CLEANUP_POINT_EXPR: + return c_tree_build_unary_typed_expr(C_CLEANUP_POINT_EXPR, type, + c_invert_truthvalue(CTreeExprOperand(arg, 0))); + + default: + break; + } + if ( CTreeTypeCode(CTreeType(arg)) != C_BOOLEAN_TYPE) + abort (); + return c_tree_build_unary_typed_expr(C_TRUTH_NOT_EXPR, type, arg); +} + + +/* Return an expr equal to X but certainly not valid as an lvalue. + Also make sure it is not valid as an null pointer constant. */ + +c_tree_node *c_non_lvalue(x) + c_tree_node *x; +{ + c_tree_node *result; + int code = CTreeNodeFirstCode(x); + + /* These things are certainly not lvalues. */ + if ( ( code == C_EXPR_NODE && + (CTreeExprCode(x) == C_NON_LVALUE_EXPR || CTreeExprCode(x) == C_ADDR_EXPR)) + || code == C_INT_CST_NODE + || code == C_REAL_CST_NODE + || code == C_STRING_NODE ) + { + if ( code == C_INT_CST_NODE && c_tree_is_integer_zerop(x)) + { + /* Use NOP_EXPR instead of NON_LVALUE_EXPR + so convert_for_assignment won't strip it. + This is so this 0 won't be treated as a null pointer constant. */ + result = c_tree_build_unary_typed_expr( C_NOP_EXPR, CTreeType(x), x); + if ( CIsTreeNodeConstant(x) ) CSetTreeNodeConstant( result ); + return result; + } + return x; + } + + result = c_tree_build_unary_typed_expr( C_NON_LVALUE_EXPR, CTreeType(x), x); + if ( CIsTreeNodeConstant(x) ) CSetTreeNodeConstant( result ); + + return result; +} + + +/* Similar, but return the comparison that results if the operands are + swapped. This is safe for floating-point. */ + +static int c_swap_tree_comparison(code) + int code; +{ + switch (code) + { + case C_EQ_EXPR: + case C_NE_EXPR: + return code; + case C_GT_EXPR: + return C_LT_EXPR; + case C_GE_EXPR: + return C_LE_EXPR; + case C_LT_EXPR: + return C_GT_EXPR; + case C_LE_EXPR: + return C_GE_EXPR; + default: + abort (); + } +} + +/* Return nonzero if CODE is a c_tree_node *code that represents a truth value. */ + +static int +c_truth_value_p (code) + int code; +{ + return ( code == C_LT_EXPR || + code == C_LE_EXPR || + code == C_GT_EXPR || + code == C_GE_EXPR || + code == C_EQ_EXPR || + code == C_NE_EXPR || + code == C_SET_LE_EXPR || + code == C_TRUTH_AND_EXPR || + code == C_TRUTH_ANDIF_EXPR || + code == C_TRUTH_OR_EXPR || + code == C_TRUTH_ORIF_EXPR || + code == C_TRUTH_XOR_EXPR || + code == C_TRUTH_NOT_EXPR); + +} + + +/* Given T, a c_tree_node *representing type conversion of ARG1, a constant, + return a constant c_tree_node *representing the result of conversion. */ + +static c_tree_node *c_fold_convert_expr(t, arg1) + c_tree_node *t; + c_tree_node *arg1; +{ + c_tree_node *type = CTreeType(t); +# ifdef LUDO_NO_SKIP + int overflow = 0; +# endif + + if (POINTER_TYPE_P (type) || INTEGRAL_TYPE_P (type)) + { + if ( CTreeNodeCode(arg1) == C_INT_CST_NODE) + { + /* If we would build a constant wider than GCC supports, + leave the conversion unfolded. */ + if (CTreeTypePrecision(type) > 2 * C_HOST_BITS_PER_WIDE_INT) + return t; + + /* Given an integer constant, make new constant with new type, + appropriately sign-extended or truncated. */ + t = c_tree_build_int_2(CTreeIntCstLow(arg1), CTreeIntCstHigh(arg1)); + CTreeType(t) = type; + /* Indicate an overflow if (1) ARG1 already overflowed, + or (2) force_fit_type indicates an overflow. + Tell force_fit_type that an overflow has already occurred + if ARG1 is a too-large unsigned value and T is signed. + But don't indicate an overflow if converting a pointer. */ + if ((c_force_fit_type(t, (CTreeIntCstHigh(arg1) < 0 + & (CIsTreeNodeUnsigned(type) + < CIsTreeNodeUnsigned(CTreeType(arg1))))) + && ! POINTER_TYPE_P (CTreeType(arg1))) + || CIsTreeNodeOverflow(arg1)) + CSetTreeNodeOverflow(t); + + + if ( CIsTreeNodeOverflow(t) || CIsTreeNodeCstOverflow(arg1)) + CSetTreeNodeCstOverflow(t); + } +# ifdef LUDO_NO_SKIP +#if !defined (REAL_IS_NOT_DOUBLE) || defined (REAL_ARITHMETIC) + else if (CTreeNodeCode(arg1) == REAL_CST) + { + /* Don't initialize these, use assignments. + Initialized local aggregates don't work on old compilers. */ + C_REAL_VALUE_TYPE x; + C_REAL_VALUE_TYPE l; + C_REAL_VALUE_TYPE u; + c_tree_node *type1 = CTreeType(arg1); + + x = TREE_REAL_CST (arg1); + l = c_real_value_from_int_cst(type1, TYPE_MIN_VALUE (type)); + u = c_real_value_from_int_cst(type1, TYPE_MAX_VALUE (type)); + /* See if X will be in range after truncation towards 0. + To compensate for truncation, move the bounds away from 0, + but reject if X exactly equals the adjusted bounds. */ +#ifdef REAL_ARITHMETIC + REAL_ARITHMETIC (l, MINUS_EXPR, l, dconst1); + REAL_ARITHMETIC (u, PLUS_EXPR, u, dconst1); +#else + l--; + u++; +#endif + /* If X is a NaN, use zero instead and show we have an overflow. + Otherwise, range check. */ + if (REAL_VALUE_ISNAN (x)) + overflow = 1, x = dconst0; + else if (! (REAL_VALUES_LESS (l, x) && REAL_VALUES_LESS (x, u))) + overflow = 1; + +#ifndef REAL_ARITHMETIC + { + C_HOST_WIDE_INT low, high; + C_HOST_WIDE_INT half_word + = (HOST_WIDE_INT) 1 << (HOST_BITS_PER_WIDE_INT / 2); + + if (x < 0) + x = -x; + + high = (HOST_WIDE_INT) (x / half_word / half_word); + x -= (REAL_VALUE_TYPE) high * half_word * half_word; + if (x >= (REAL_VALUE_TYPE) half_word * half_word / 2) + { + low = x - (REAL_VALUE_TYPE) half_word * half_word / 2; + low |= (HOST_WIDE_INT) -1 << (HOST_BITS_PER_WIDE_INT - 1); + } + else + low = (HOST_WIDE_INT) x; + if (TREE_REAL_CST (arg1) < 0) + neg_double (low, high, &low, &high); + t = build_int_2 (low, high); + } +#else + { + C_HOST_WIDE_INT low, high; + REAL_VALUE_TO_INT (&low, &high, x); + t = build_int_2 (low, high); + } +#endif + CTreeType(t) = type; + TREE_OVERFLOW (t) + = TREE_OVERFLOW (arg1) | force_fit_type (t, overflow); + TREE_CONSTANT_OVERFLOW (t) + = TREE_OVERFLOW (t) | TREE_CONSTANT_OVERFLOW (arg1); + } +#endif /* not REAL_IS_NOT_DOUBLE, or REAL_ARITHMETIC */ +# endif + CTreeType(t) = type; + } + else if ( CTreeNodeCode(type) == C_REAL_TYPE) + { +# ifdef LUDO_NO_SKIP +#if !defined (REAL_IS_NOT_DOUBLE) || defined (REAL_ARITHMETIC) + if (CTreeNodeCode(arg1) == C_INT_CST_NODE) + return c_build_real_from_int_cst(type, arg1); +#endif /* not REAL_IS_NOT_DOUBLE, or REAL_ARITHMETIC */ +# endif + if (CTreeNodeCode(arg1) == C_REAL_CST_NODE) + { +# ifdef LUDO_NO_SKIP + if (REAL_VALUE_ISNAN (TREE_REAL_CST (arg1))) + { + t = arg1; + CTreeType(arg1) = type; + return t; + } + else if (setjmp (float_error)) + { + overflow = 1; + t = copy_node (arg1); + goto got_it; + } + set_float_handler (float_error); + + t = c_tree_build_real(type, c_real_value_truncate(CTreeTypeMode(type), + CTreeRealCstValue(arg1))); + set_float_handler (NULL_PTR); + + got_it: + TREE_OVERFLOW (t) + = TREE_OVERFLOW (arg1) | force_fit_type (t, overflow); + TREE_CONSTANT_OVERFLOW (t) + = TREE_OVERFLOW (t) | TREE_CONSTANT_OVERFLOW (arg1); + return t; +# endif + } + } + + CSetTreeNodeConstant(t); + return t; +} + + +/* If T contains a COMPOUND_EXPR which was inserted merely to evaluate + S, a SAVE_EXPR, return the expression actually being evaluated. Note + that we may sometimes modify the tree. */ + +static c_tree_node *c_strip_compound_expr(t, s) + c_tree_node *t; + c_tree_node *s; +{ +# ifdef LUDO_NO_SKIP + c_tree_node *type = CTreeType(t); +# endif + int code = CTreeNodeCode(t); + + /* See if this is the COMPOUND_EXPR we want to eliminate. */ + if (code == C_COMPOUND_EXPR && CTreeNodeCode(CTreeExprOperand(t, 0)) == C_CONVERT_EXPR + && CTreeExprOperand(CTreeExprOperand(t, 0), 0) == s) + return CTreeExprOperand(t, 1); + + /* See if this is a COND_EXPR or a simple arithmetic operator. We + don't bother handling any other types. */ + else if (code == C_COND_EXPR) + { + CTreeExprOperand(t, 0) = c_strip_compound_expr(CTreeExprOperand(t, 0), s); + CTreeExprOperand(t, 1) = c_strip_compound_expr(CTreeExprOperand(t, 1), s); + CTreeExprOperand(t, 2) = c_strip_compound_expr(CTreeExprOperand(t, 2), s); + } + else if ( c_tree_get_code_class(code) == '1') + CTreeExprOperand(t, 0) = c_strip_compound_expr(CTreeExprOperand(t, 0), s); + else if (c_tree_get_code_class(code) == '<' + || c_tree_get_code_class(code) == '2') + { + CTreeExprOperand(t, 0) = c_strip_compound_expr(CTreeExprOperand(t, 0), s); + CTreeExprOperand(t, 1) = c_strip_compound_expr(CTreeExprOperand(t, 1), s); + } + + return t; +} + + +/* Split a c_tree_node *IN into a constant and a variable part + that could be combined with CODE to make IN. + CODE must be a commutative arithmetic operation. + Store the constant part into *CONP and the variable in &VARP. + Return 1 if this was done; zero means the c_tree_node *IN did not decompose + this way. + + If CODE is PLUS_EXPR we also split trees that use MINUS_EXPR. + Therefore, we must tell the caller whether the variable part + was subtracted. We do this by storing 1 or -1 into *VARSIGNP. + The value stored is the coefficient for the variable term. + The constant term we return should always be added; + we negate it if necessary. */ + +static int c_split_tree (in, code, varp, conp, varsignp) + c_tree_node *in; + int code; + c_tree_node **varp; + c_tree_node **conp; + int *varsignp; +{ + c_tree_node *outtype = CTreeType(in); + *varp = 0; + *conp = 0; + + /* Strip any conversions that don't change the machine mode. */ + while ((CTreeNodeCode(in) == C_NOP_EXPR + || CTreeNodeCode(in) == C_CONVERT_EXPR) + && (CTreeTypeMode(CTreeType(in)) + == CTreeTypeMode(CTreeType(CTreeExprOperand(in, 0))))) + in = CTreeExprOperand(in, 0); + + if (CTreeNodeCode(in) == code + || (! FLOAT_TYPE_P (CTreeType(in)) + /* We can associate addition and subtraction together + (even though the C standard doesn't say so) + for integers because the value is not affected. + For reals, the value might be affected, so we can't. */ + && ((code == C_PLUS_EXPR && CTreeNodeCode(in) == C_MINUS_EXPR) + || (code == C_MINUS_EXPR && CTreeNodeCode(in) == C_PLUS_EXPR)))) + { + int code = CTreeNodeCode(CTreeExprOperand(in, 0)); + if (code == C_INT_CST_NODE) + { + *conp = CTreeExprOperand(in, 0); + *varp = CTreeExprOperand(in, 1); + if (CTreeTypeMode(CTreeType(*varp)) != CTreeTypeMode(outtype) + && CTreeType(*varp) != outtype) + *varp = c_convert_expr(outtype, *varp); + *varsignp = (CTreeNodeCode(in) == C_MINUS_EXPR) ? -1 : 1; + return 1; + } + if ( CIsTreeNodeConstant(CTreeExprOperand(in, 1))) + { + *conp = CTreeExprOperand(in, 1); + *varp = CTreeExprOperand(in, 0); + *varsignp = 1; + if (CTreeTypeMode(CTreeType(*varp)) != CTreeTypeMode(outtype) + && CTreeType(*varp) != outtype) + *varp = c_convert_expr(outtype, *varp); + if (CTreeNodeCode(in) == C_MINUS_EXPR) + { + /* If operation is subtraction and constant is second, + must negate it to get an additive constant. + And this cannot be done unless it is a manifest constant. + It could also be the address of a static variable. + We cannot negate that, so give up. */ + if (CTreeNodeCode(*conp) == C_INT_CST_NODE) + /* Subtracting from integer_zero_node loses for long long. */ + *conp = c_fold ( + c_tree_build_unary_typed_expr(C_NEGATE_EXPR, CTreeType(*conp), *conp)); + else + return 0; + } + return 1; + } + if ( CIsTreeNodeConstant(CTreeExprOperand(in, 0))) + { + *conp = CTreeExprOperand(in, 0); + *varp = CTreeExprOperand(in, 1); + if (CTreeTypeMode(CTreeType(*varp)) != CTreeTypeMode(outtype) + && CTreeType(*varp) != outtype) + *varp = c_convert_expr(outtype, *varp); + *varsignp = (CTreeNodeCode(in) == C_MINUS_EXPR) ? -1 : 1; + return 1; + } + } + return 0; +} + +/* Unpack a two-word integer into 4 words. + LOW and HI are the integer, as two `HOST_WIDE_INT' pieces. + WORDS points to the array of HOST_WIDE_INTs. */ + +static void c_encode(words, low, hi) + C_HOST_WIDE_INT *words; + C_HOST_WIDE_INT low, hi; +{ + words[0] = LOWPART (low); + words[1] = HIGHPART (low); + words[2] = LOWPART (hi); + words[3] = HIGHPART (hi); +} + +/* Pack an array of 4 words into a two-word integer. + WORDS points to the array of words. + The integer is stored into *LOW and *HI as two `HOST_WIDE_INT' pieces. */ + +static void +c_decode (words, low, hi) + C_HOST_WIDE_INT *words; + C_HOST_WIDE_INT *low, *hi; +{ + *low = words[0] | words[1] * BASE; + *hi = words[2] | words[3] * BASE; +} + + + + +/* Negate a doubleword integer with doubleword result. + Return nonzero if the operation overflows, assuming it's signed. + The argument is given as two `HOST_WIDE_INT' pieces in L1 and H1. + The value is stored as two `HOST_WIDE_INT' pieces in *LV and *HV. */ + +int c_neg_double (l1, h1, lv, hv) + C_HOST_WIDE_INT l1, h1; + C_HOST_WIDE_INT *lv, *hv; +{ + if (l1 == 0) + { + *lv = 0; + *hv = - h1; + return (*hv & h1) < 0; + } + else + { + *lv = - l1; + *hv = ~ h1; + return 0; + } +} + + +/* Divide doubleword integer LNUM, HNUM by doubleword integer LDEN, HDEN + for a quotient (stored in *LQUO, *HQUO) and remainder (in *LREM, *HREM). + CODE is a c_tree_node *code for a kind of division, one of + TRUNC_DIV_EXPR, FLOOR_DIV_EXPR, CEIL_DIV_EXPR, ROUND_DIV_EXPR + or EXACT_DIV_EXPR + It controls how the quotient is rounded to a integer. + Return nonzero if the operation overflows. + UNS nonzero says do unsigned division. */ + +extern int c_mul_double(); +extern int c_neg_double(); +extern int c_add_double(); + +int +c_div_and_round_double (code, uns, + lnum_orig, hnum_orig, lden_orig, hden_orig, + lquo, hquo, lrem, hrem) + int code; + int uns; + C_HOST_WIDE_INT lnum_orig, hnum_orig; /* num == numerator == dividend */ + C_HOST_WIDE_INT lden_orig, hden_orig; /* den == denominator == divisor */ + C_HOST_WIDE_INT *lquo, *hquo, *lrem, *hrem; +{ + int quo_neg = 0; + C_HOST_WIDE_INT num[4 + 1]; /* extra element for scaling. */ + C_HOST_WIDE_INT den[4], quo[4]; + int i, j; + unsigned C_HOST_WIDE_INT work; + unsigned C_HOST_WIDE_INT carry = 0; + C_HOST_WIDE_INT lnum = lnum_orig; + C_HOST_WIDE_INT hnum = hnum_orig; + C_HOST_WIDE_INT lden = lden_orig; + C_HOST_WIDE_INT hden = hden_orig; + int overflow = 0; + + if ((hden == 0) && (lden == 0)) + overflow = 1, lden = 1; + + /* calculate quotient sign and convert operands to unsigned. */ + if (!uns) + { + if (hnum < 0) + { + quo_neg = ~ quo_neg; + /* (minimum integer) / (-1) is the only overflow case. */ + if (c_neg_double(lnum, hnum, &lnum, &hnum) && (lden & hden) == -1) + overflow = 1; + } + if (hden < 0) + { + quo_neg = ~ quo_neg; + c_neg_double (lden, hden, &lden, &hden); + } + } + + if (hnum == 0 && hden == 0) + { /* single precision */ + *hquo = *hrem = 0; + /* This unsigned division rounds toward zero. */ + *lquo = lnum / (unsigned C_HOST_WIDE_INT) lden; + goto finish_up; + } + + if (hnum == 0) + { /* trivial case: dividend < divisor */ + /* hden != 0 already checked. */ + *hquo = *lquo = 0; + *hrem = hnum; + *lrem = lnum; + goto finish_up; + } + + bzero ((char *) quo, sizeof quo); + + bzero ((char *) num, sizeof num); /* to zero 9th element */ + bzero ((char *) den, sizeof den); + + c_encode (num, lnum, hnum); + c_encode (den, lden, hden); + + /* Special code for when the divisor < BASE. */ + if (hden == 0 && lden < BASE) + { + /* hnum != 0 already checked. */ + for (i = 4 - 1; i >= 0; i--) + { + work = num[i] + carry * BASE; + quo[i] = work / (unsigned C_HOST_WIDE_INT) lden; + carry = work % (unsigned C_HOST_WIDE_INT) lden; + } + } + else + { + /* Full double precision division, + with thanks to Don Knuth's "Seminumerical Algorithms". */ + int num_hi_sig, den_hi_sig; + unsigned C_HOST_WIDE_INT quo_est, scale; + + /* Find the highest non-zero divisor digit. */ + for (i = 4 - 1; ; i--) + if (den[i] != 0) { + den_hi_sig = i; + break; + } + + /* Insure that the first digit of the divisor is at least BASE/2. + This is required by the quotient digit estimation algorithm. */ + + scale = BASE / (den[den_hi_sig] + 1); + if (scale > 1) { /* scale divisor and dividend */ + carry = 0; + for (i = 0; i <= 4 - 1; i++) { + work = (num[i] * scale) + carry; + num[i] = LOWPART (work); + carry = HIGHPART (work); + } num[4] = carry; + carry = 0; + for (i = 0; i <= 4 - 1; i++) { + work = (den[i] * scale) + carry; + den[i] = LOWPART (work); + carry = HIGHPART (work); + if (den[i] != 0) den_hi_sig = i; + } + } + + num_hi_sig = 4; + + /* Main loop */ + for (i = num_hi_sig - den_hi_sig - 1; i >= 0; i--) { + /* guess the next quotient digit, quo_est, by dividing the first + two remaining dividend digits by the high order quotient digit. + quo_est is never low and is at most 2 high. */ + unsigned C_HOST_WIDE_INT tmp; + + num_hi_sig = i + den_hi_sig + 1; + work = num[num_hi_sig] * BASE + num[num_hi_sig - 1]; + if (num[num_hi_sig] != den[den_hi_sig]) + quo_est = work / den[den_hi_sig]; + else + quo_est = BASE - 1; + + /* refine quo_est so it's usually correct, and at most one high. */ + tmp = work - quo_est * den[den_hi_sig]; + if (tmp < BASE + && den[den_hi_sig - 1] * quo_est > (tmp * BASE + num[num_hi_sig - 2])) + quo_est--; + + /* Try QUO_EST as the quotient digit, by multiplying the + divisor by QUO_EST and subtracting from the remaining dividend. + Keep in mind that QUO_EST is the I - 1st digit. */ + + carry = 0; + for (j = 0; j <= den_hi_sig; j++) + { + work = quo_est * den[j] + carry; + carry = HIGHPART (work); + work = num[i + j] - LOWPART (work); + num[i + j] = LOWPART (work); + carry += HIGHPART (work) != 0; + } + + /* if quo_est was high by one, then num[i] went negative and + we need to correct things. */ + + if (num[num_hi_sig] < carry) + { + quo_est--; + carry = 0; /* add divisor back in */ + for (j = 0; j <= den_hi_sig; j++) + { + work = num[i + j] + den[j] + carry; + carry = HIGHPART (work); + num[i + j] = LOWPART (work); + } + num [num_hi_sig] += carry; + } + + /* store the quotient digit. */ + quo[i] = quo_est; + } + } + + c_decode (quo, lquo, hquo); + + finish_up: + /* if result is negative, make it so. */ + if (quo_neg) + c_neg_double (*lquo, *hquo, lquo, hquo); + + /* compute trial remainder: rem = num - (quo * den) */ + c_mul_double (*lquo, *hquo, lden_orig, hden_orig, lrem, hrem); + c_neg_double (*lrem, *hrem, lrem, hrem); + c_add_double (lnum_orig, hnum_orig, *lrem, *hrem, lrem, hrem); + + switch (code) + { + case C_TRUNC_DIV_EXPR: + case C_TRUNC_MOD_EXPR: /* round toward zero */ + case C_EXACT_DIV_EXPR: /* for this one, it shouldn't matter */ + return overflow; + + case C_FLOOR_DIV_EXPR: + case C_FLOOR_MOD_EXPR: /* round toward negative infinity */ + if (quo_neg && (*lrem != 0 || *hrem != 0)) /* ratio < 0 && rem != 0 */ + { + /* quo = quo - 1; */ + c_add_double(*lquo, *hquo, (C_HOST_WIDE_INT) -1, (C_HOST_WIDE_INT) -1, + lquo, hquo); + } + else return overflow; + break; + + case C_CEIL_DIV_EXPR: + case C_CEIL_MOD_EXPR: /* round toward positive infinity */ + if (!quo_neg && (*lrem != 0 || *hrem != 0)) /* ratio > 0 && rem != 0 */ + { + c_add_double (*lquo, *hquo, (C_HOST_WIDE_INT) 1, (C_HOST_WIDE_INT) 0, + lquo, hquo); + } + else return overflow; + break; + + case C_ROUND_DIV_EXPR: + case C_ROUND_MOD_EXPR: /* round to closest integer */ + { + C_HOST_WIDE_INT labs_rem = *lrem, habs_rem = *hrem; + C_HOST_WIDE_INT labs_den = lden, habs_den = hden, ltwice, htwice; + + /* get absolute values */ + if (*hrem < 0) c_neg_double (*lrem, *hrem, &labs_rem, &habs_rem); + if (hden < 0) c_neg_double (lden, hden, &labs_den, &habs_den); + + /* if (2 * abs (lrem) >= abs (lden)) */ + c_mul_double ((C_HOST_WIDE_INT) 2, (C_HOST_WIDE_INT) 0, + labs_rem, habs_rem, <wice, &htwice); + if (((unsigned C_HOST_WIDE_INT) habs_den + < (unsigned C_HOST_WIDE_INT) htwice) + || (((unsigned C_HOST_WIDE_INT) habs_den + == (unsigned C_HOST_WIDE_INT) htwice) + && ((C_HOST_WIDE_INT unsigned) labs_den + < (unsigned C_HOST_WIDE_INT) ltwice))) + { + if (*hquo < 0) + /* quo = quo - 1; */ + c_add_double (*lquo, *hquo, + (C_HOST_WIDE_INT) -1, (C_HOST_WIDE_INT) -1, lquo, hquo); + else + /* quo = quo + 1; */ + c_add_double (*lquo, *hquo, (C_HOST_WIDE_INT) 1, (C_HOST_WIDE_INT) 0, + lquo, hquo); + } + else return overflow; + } + break; + + default: + abort (); + } + + /* compute true remainder: rem = num - (quo * den) */ + c_mul_double (*lquo, *hquo, lden_orig, hden_orig, lrem, hrem); + c_neg_double (*lrem, *hrem, lrem, hrem); + c_add_double (lnum_orig, hnum_orig, *lrem, *hrem, lrem, hrem); + return overflow; +} + + +/* Return nonzero if two operands are necessarily equal. + If ONLY_CONST is non-zero, only return non-zero for constants. + This function tests whether the operands are indistinguishable; + it does not test whether they are equal using C's == operation. + The distinction is important for IEEE floating point, because + (1) -0.0 and 0.0 are distinguishable, but -0.0==0.0, and + (2) two NaNs may be indistinguishable, but NaN!=NaN. */ + +int c_is_operand_equal_p(arg0, arg1, only_const) + c_tree_node *arg0; + c_tree_node *arg1; + int only_const; +{ + /* If both types don't have the same signedness, then we can't consider + them equal. We must check this before the STRIP_NOPS calls + because they may change the signedness of the arguments. */ + if (CIsTreeNodeUnsigned(CTreeType(arg0)) != CIsTreeNodeUnsigned(CTreeType(arg1))) + return 0; + + CStripNops(arg0); + CStripNops(arg1); + + if ( CTreeNodeCode(arg0) != CTreeNodeCode(arg1) + /* This is needed for conversions and for COMPONENT_REF. + Might as well play it safe and always test this. */ + || CTreeTypeMode(CTreeType(arg0)) != CTreeTypeMode(CTreeType(arg1))) + return 0; + + /* If ARG0 and ARG1 are the same SAVE_EXPR, they are necessarily equal. + We don't care about side effects in that case because the SAVE_EXPR + takes care of that for us. In all other cases, two expressions are + equal if they have no side effects. If we have two identical + expressions with side effects that should be treated the same due + to the only side effects being identical SAVE_EXPR's, that will + be detected in the recursive calls below. */ + if (arg0 == arg1 && ! only_const + && (CTreeNodeCode(arg0) == C_SAVE_EXPR + || (! CIsTreeNodeSideEffect(arg0) && ! CIsTreeNodeSideEffect(arg1)))) + return 1; + + /* Next handle constant cases, those for which we can return 1 even + if ONLY_CONST is set. */ + if ( CIsTreeNodeConstant(arg0) && CIsTreeNodeConstant(arg1)) + switch (CTreeNodeCode(arg0)) + { + case C_INT_CST_NODE: + return (! CIsTreeNodeCstOverflow(arg0) + && ! CIsTreeNodeCstOverflow(arg1) + && CTreeIntCstLow(arg0) == CTreeIntCstLow(arg1) + && CTreeIntCstHigh(arg0) == CTreeIntCstHigh(arg1)); + + case C_REAL_CST_NODE: + return (! CIsTreeNodeCstOverflow(arg0) + && ! CIsTreeNodeCstOverflow(arg1) + && REAL_VALUES_IDENTICAL ( CTreeRealCstValue(arg0), + CTreeRealCstValue(arg1))); + + case C_COMPLEX_NODE: + return (c_is_operand_equal_p( CTreeComplexReal(arg0), CTreeComplexReal(arg1), + only_const) + && c_is_operand_equal_p( CTreeComplexImag(arg0), CTreeComplexImag(arg1), + only_const)); + + case C_STRING_NODE: + return ( CTreeStringLength(arg0) == CTreeStringLength(arg1) + && ! strncmp ( CTreeStringPointer(arg0), CTreeStringPointer(arg1), + CTreeStringLength(arg0))); + + case C_ADDR_EXPR: + return c_is_operand_equal_p(CTreeExprOperand(arg0, 0), CTreeExprOperand(arg1, 0), + 0); + default: + break; + } + + if (only_const) + return 0; + + switch ( c_tree_get_code_class(CTreeNodeCode(arg0))) + { + case '1': + /* Two conversions are equal only if signedness and modes match. */ + if ((CTreeNodeCode(arg0) == C_NOP_EXPR || CTreeNodeCode(arg0) == C_CONVERT_EXPR) + && (CIsTreeNodeUnsigned(CTreeType(arg0)) + != CIsTreeNodeUnsigned(CTreeType(arg1)))) + return 0; + + return c_is_operand_equal_p(CTreeExprOperand(arg0, 0), + CTreeExprOperand(arg1, 0), 0); + + case '<': + case '2': + if (c_is_operand_equal_p(CTreeExprOperand(arg0, 0), CTreeExprOperand(arg1, 0), 0) + && c_is_operand_equal_p(CTreeExprOperand(arg0, 1), CTreeExprOperand(arg1, 1), + 0)) + return 1; + + /* For commutative ops, allow the other order. */ + return ((CTreeNodeCode(arg0) == C_PLUS_EXPR || CTreeNodeCode(arg0) == C_MULT_EXPR + || CTreeNodeCode(arg0) == C_MIN_EXPR || CTreeNodeCode(arg0) == C_MAX_EXPR + || CTreeNodeCode(arg0) == C_BIT_IOR_EXPR + || CTreeNodeCode(arg0) == C_BIT_XOR_EXPR + || CTreeNodeCode(arg0) == C_BIT_AND_EXPR + || CTreeNodeCode(arg0) == C_NE_EXPR || CTreeNodeCode(arg0) == C_EQ_EXPR) + && c_is_operand_equal_p(CTreeExprOperand(arg0, 0), + CTreeExprOperand(arg1, 1), 0) + && c_is_operand_equal_p(CTreeExprOperand(arg0, 1), + CTreeExprOperand(arg1, 0), 0)); + + case 'r': + switch (CTreeNodeCode(arg0)) + { + case C_INDIRECT_REF: + return c_is_operand_equal_p(CTreeExprOperand(arg0, 0), + CTreeExprOperand(arg1, 0), 0); + + case C_COMPONENT_REF: + case C_ARRAY_REF: + return (c_is_operand_equal_p(CTreeExprOperand(arg0, 0), + CTreeExprOperand(arg1, 0), 0) + && c_is_operand_equal_p(CTreeExprOperand(arg0, 1), + CTreeExprOperand(arg1, 1), 0)); + + case C_BIT_FIELD_REF: + return (c_is_operand_equal_p(CTreeExprOperand(arg0, 0), + CTreeExprOperand(arg1, 0), 0) + && c_is_operand_equal_p(CTreeExprOperand(arg0, 1), + CTreeExprOperand(arg1, 1), 0) + && c_is_operand_equal_p(CTreeExprOperand(arg0, 2), + CTreeExprOperand(arg1, 2), 0)); + default: + return 0; + } + + default: + return 0; + } +} + + +/* Similar to operand_equal_p, but see if ARG0 might have been made by + shorten_compare from ARG1 when ARG1 was being compared with OTHER. + + When in doubt, return 0. */ + +static int +c_is_operand_equal_for_comparison_p(arg0, arg1, other) + c_tree_node *arg0; + c_tree_node *arg1; + c_tree_node *other; +{ + int unsignedp1, unsignedpo; + c_tree_node *primarg1; + c_tree_node *primother; + unsigned correct_width; + + if (c_is_operand_equal_p(arg0, arg1, 0)) + return 1; + + if (! INTEGRAL_TYPE_P (CTreeType(arg0)) + || ! INTEGRAL_TYPE_P (CTreeType(arg1))) + return 0; + + /* Duplicate what shorten_compare does to ARG1 and see if that gives the + actual comparison operand, ARG0. + + First throw away any conversions to wider types + already present in the operands. */ + + primarg1 = c_get_narrower(arg1, &unsignedp1); + primother = c_get_narrower(other, &unsignedpo); + + correct_width = CTreeTypePrecision(CTreeType(arg1)); + if (unsignedp1 == unsignedpo + && CTreeTypePrecision(CTreeType(primarg1)) < correct_width + && CTreeTypePrecision(CTreeType(primother)) < correct_width) + { + c_tree_node *type = CTreeType(arg0); + + /* Make sure shorter operand is extended the right way + to match the longer operand. */ + primarg1 = c_convert_expr( + c_get_signed_or_unsigned_type(unsignedp1, CTreeType(primarg1)), primarg1); + + if (c_is_operand_equal_p(arg0, c_convert_expr(type, primarg1), 0)) + return 1; + } + + return 0; +} + + +/* See if ARG is an expression that is either a comparison or is performing + arithmetic on comparisons. The comparisons must only be comparing + two different values, which will be stored in *CVAL1 and *CVAL2; if + they are non-zero it means that some operands have already been found. + No variables may be used anywhere else in the expression except in the + comparisons. If SAVE_P is true it means we removed a SAVE_EXPR around + the expression and save_expr needs to be called with CVAL1 and CVAL2. + + If this is true, return 1. Otherwise, return zero. */ + +static int c_twoval_comparison_p (arg, cval1, cval2, save_p) + c_tree_node *arg; + c_tree_node **cval1; + c_tree_node **cval2; + int *save_p; +{ + int code = CTreeNodeCode(arg); + char class = c_tree_get_code_class(code); + + /* We can handle some of the 'e' cases here. */ + if (class == 'e' && code == C_TRUTH_NOT_EXPR) + class = '1'; + else if (class == 'e' + && (code == C_TRUTH_ANDIF_EXPR || code == C_TRUTH_ORIF_EXPR + || code == C_COMPOUND_EXPR)) + class = '2'; + + switch (class) + { + case '1': + return c_twoval_comparison_p(CTreeExprOperand(arg, 0), cval1, cval2, save_p); + + case '2': + return (c_twoval_comparison_p(CTreeExprOperand(arg, 0), cval1, cval2, save_p) + && c_twoval_comparison_p(CTreeExprOperand(arg, 1), + cval1, cval2, save_p)); + + case 'c': + return 1; + + case 'e': + if (code == C_COND_EXPR) + return (c_twoval_comparison_p(CTreeExprOperand(arg, 0), + cval1, cval2, save_p) + && c_twoval_comparison_p(CTreeExprOperand(arg, 1), + cval1, cval2, save_p) + && c_twoval_comparison_p(CTreeExprOperand(arg, 2), + cval1, cval2, save_p)); + return 0; + + case '<': + /* First see if we can handle the first operand, then the second. For + the second operand, we know *CVAL1 can't be zero. It must be that + one side of the comparison is each of the values; test for the + case where this isn't true by failing if the two operands + are the same. */ + + if (c_is_operand_equal_p(CTreeExprOperand(arg, 0), + CTreeExprOperand(arg, 1), 0)) + return 0; + + if (*cval1 == 0) + *cval1 = CTreeExprOperand(arg, 0); + else if (c_is_operand_equal_p(*cval1, CTreeExprOperand(arg, 0), 0)) + ; + else if (*cval2 == 0) + *cval2 = CTreeExprOperand(arg, 0); + else if (c_is_operand_equal_p(*cval2, CTreeExprOperand(arg, 0), 0)) + ; + else + return 0; + + if ( c_is_operand_equal_p(*cval1, CTreeExprOperand(arg, 1), 0)) + ; + else if (*cval2 == 0) + *cval2 = CTreeExprOperand(arg, 1); + else if (c_is_operand_equal_p(*cval2, CTreeExprOperand(arg, 1), 0)) + ; + else + return 0; + + return 1; + + default: + return 0; + } +} + +/* Combine two integer constants ARG1 and ARG2 under operation CODE + to produce a new constant. + + If NOTRUNC is nonzero, do not truncate the result to fit the data type. + If FORSIZE is nonzero, compute overflow for unsigned types. */ + +static c_tree_node *c_int_const_binop(code, arg1, arg2, notrunc, forsize) + int code; + c_tree_node *arg1; + c_tree_node *arg2; + int notrunc, forsize; +{ + C_HOST_WIDE_INT int1l, int1h, int2l, int2h; + C_HOST_WIDE_INT low, hi; + C_HOST_WIDE_INT garbagel, garbageh; + c_tree_node *t; + int uns = CIsTreeNodeUnsigned(CTreeType(arg1)); + int overflow = 0; + int no_overflow = 0; + + int1l = CTreeIntCstLow(arg1); + int1h = CTreeIntCstHigh(arg1); + int2l = CTreeIntCstLow(arg2); + int2h = CTreeIntCstHigh(arg2); + + switch (code) + { + case C_BIT_IOR_EXPR: + low = int1l | int2l, hi = int1h | int2h; + break; + + case C_BIT_XOR_EXPR: + low = int1l ^ int2l, hi = int1h ^ int2h; + break; + + case C_BIT_AND_EXPR: + low = int1l & int2l, hi = int1h & int2h; + break; + + case C_BIT_ANDTC_EXPR: + low = int1l & ~int2l, hi = int1h & ~int2h; + break; + + case C_RSHIFT_EXPR: + int2l = - int2l; + case C_LSHIFT_EXPR: + /* It's unclear from the C standard whether shifts can overflow. + The following code ignores overflow; perhaps a C standard + interpretation ruling is needed. */ + c_lshift_double(int1l, int1h, int2l, + CTreeTypePrecision(CTreeType(arg1)), &low, &hi, !uns); + no_overflow = 1; + break; + + case C_RROTATE_EXPR: + int2l = - int2l; + case C_LROTATE_EXPR: + c_lrotate_double(int1l, int1h, int2l, + CTreeTypePrecision(CTreeType(arg1)), &low, &hi); + break; + + case C_PLUS_EXPR: + overflow = c_add_double(int1l, int1h, int2l, int2h, &low, &hi); + break; + + case C_MINUS_EXPR: + c_neg_double (int2l, int2h, &low, &hi); + c_add_double (int1l, int1h, low, hi, &low, &hi); + overflow = c_overflow_sum_sign (hi, int2h, int1h); + break; + + case C_MULT_EXPR: + overflow = c_mul_double(int1l, int1h, int2l, int2h, &low, &hi); + break; + + case C_TRUNC_DIV_EXPR: + case C_FLOOR_DIV_EXPR: + case C_CEIL_DIV_EXPR: + case C_EXACT_DIV_EXPR: + /* This is a shortcut for a common special case. */ + if (int2h == 0 && int2l > 0 + && ! CIsTreeNodeCstOverflow(arg1) + && ! CIsTreeNodeCstOverflow(arg2) + && int1h == 0 && int1l >= 0) + { + if (code == C_CEIL_DIV_EXPR) + int1l += int2l - 1; + low = int1l / int2l, hi = 0; + break; + } + + /* ... fall through ... */ + + case C_ROUND_DIV_EXPR: + if (int2h == 0 && int2l == 1) + { + low = int1l, hi = int1h; + break; + } + if (int1l == int2l && int1h == int2h + && ! (int1l == 0 && int1h == 0)) + { + low = 1, hi = 0; + break; + } + overflow = c_div_and_round_double(code, uns, + int1l, int1h, int2l, int2h, + &low, &hi, &garbagel, &garbageh); + break; + + case C_TRUNC_MOD_EXPR: + case C_FLOOR_MOD_EXPR: + case C_CEIL_MOD_EXPR: + /* This is a shortcut for a common special case. */ + if (int2h == 0 && int2l > 0 + && ! CIsTreeNodeCstOverflow(arg1) + && ! CIsTreeNodeCstOverflow(arg2) + && int1h == 0 && int1l >= 0) + { + if (code == C_CEIL_MOD_EXPR) + int1l += int2l - 1; + low = int1l % int2l, hi = 0; + break; + } + + /* ... fall through ... */ + + case C_ROUND_MOD_EXPR: + overflow = c_div_and_round_double (code, uns, + int1l, int1h, int2l, int2h, + &garbagel, &garbageh, &low, &hi); + break; + + case C_MIN_EXPR: + case C_MAX_EXPR: + if (uns) + { + low = (((unsigned C_HOST_WIDE_INT) int1h + < (unsigned C_HOST_WIDE_INT) int2h) + || (((unsigned C_HOST_WIDE_INT) int1h + == (unsigned C_HOST_WIDE_INT) int2h) + && ((unsigned C_HOST_WIDE_INT) int1l + < (unsigned C_HOST_WIDE_INT) int2l))); + } + else + { + low = ((int1h < int2h) + || ((int1h == int2h) + && ((unsigned C_HOST_WIDE_INT) int1l + < (unsigned C_HOST_WIDE_INT) int2l))); + } + if (low == (code == C_MIN_EXPR)) + low = int1l, hi = int1h; + else + low = int2l, hi = int2h; + break; + + default: + abort (); + } + + if (CTreeType(arg1) == c_size_type && hi == 0 + && low >= 0 && low <= CTreeIntCstLow( CTreeTypeMaxValue(c_size_type)) + && ! overflow + && ! CIsTreeNodeOverflow(arg1) && ! CIsTreeNodeOverflow(arg2)) + t = c_tree_get_size_int(low); + else + { + t = c_tree_build_int_2(low, hi); + CTreeType(t) = CTreeType(arg1); + } + +# ifdef LUDO_NO_SKIP + TREE_OVERFLOW (t) + = ((notrunc ? (!uns || forsize) && overflow + : force_fit_type (t, (!uns || forsize) && overflow) && ! no_overflow) + | TREE_OVERFLOW (arg1) + | TREE_OVERFLOW (arg2)); + /* If we're doing a size calculation, unsigned arithmetic does overflow. + So check if force_fit_type truncated the value. */ + if (forsize + && ! CIsTreeNodeOverflow(t) + && (CTreeIntCstHigh(t) != hi + || CTreeIntCstLow(t) != low)) + TREE_OVERFLOW (t) = 1; + TREE_CONSTANT_OVERFLOW (t) = (TREE_OVERFLOW (t) + | TREE_CONSTANT_OVERFLOW (arg1) + | TREE_CONSTANT_OVERFLOW (arg2)); +# endif + return t; +} + +/* Combine operands OP1 and OP2 with arithmetic operation CODE. + CODE is a c_tree_node *code. Data type is taken from `c_size_type', + If the operands are constant, so is the result. */ + +c_tree_node *c_build_size_binop(code, arg0, arg1) + int code; + c_tree_node *arg0; + c_tree_node *arg1; +{ + c_tree_node *tmp_node; + /* Handle the special case of two integer constants faster. */ + if ( CTreeNodeFirstCode(arg0) == C_INT_CST_NODE && + CTreeNodeFirstCode(arg1) == C_INT_CST_NODE) + { + /* And some specific cases even faster than that. */ + if (code == C_PLUS_EXPR && c_tree_is_integer_zerop(arg0)) + return arg1; + else if ((code == C_MINUS_EXPR || code == C_PLUS_EXPR) + && c_tree_is_integer_zerop(arg1)) + return arg0; + else if (code == C_MULT_EXPR && c_tree_is_integer_onep(arg0)) + return arg1; + + /* Handle general case of two integer constants. */ + return c_int_const_binop (code, arg0, arg1, 0, 1); + } + + if (arg0 == c_error_mark_node || arg1 == c_error_mark_node) + return c_error_mark_node; + + tmp_node = c_tree_build_binary_expr( code, arg0, arg1 ); + CTreeType( tmp_node ) = c_size_type; + + tmp_node = c_fold( tmp_node ); + + + return( tmp_node ); +} + + + +/* Add two doubleword integers with doubleword result. + Each argument is given as two `HOST_WIDE_INT' pieces. + One argument is L1 and H1; the other, L2 and H2. + The value is stored as two `HOST_WIDE_INT' pieces in *LV and *HV. */ + +int +c_add_double (l1, h1, l2, h2, lv, hv) + C_HOST_WIDE_INT l1, h1, l2, h2; + C_HOST_WIDE_INT *lv, *hv; +{ + C_HOST_WIDE_INT l, h; + + l = l1 + l2; + h = h1 + h2 + ((unsigned C_HOST_WIDE_INT) l < l1); + + *lv = l; + *hv = h; + return c_overflow_sum_sign(h1, h2, h); +} + + +/* Multiply two doubleword integers with doubleword result. + Return nonzero if the operation overflows, assuming it's signed. + Each argument is given as two `HOST_WIDE_INT' pieces. + One argument is L1 and H1; the other, L2 and H2. + The value is stored as two `HOST_WIDE_INT' pieces in *LV and *HV. */ + +int +c_mul_double (l1, h1, l2, h2, lv, hv) + C_HOST_WIDE_INT l1, h1, l2, h2; + C_HOST_WIDE_INT *lv, *hv; +{ + C_HOST_WIDE_INT arg1[4]; + C_HOST_WIDE_INT arg2[4]; + C_HOST_WIDE_INT prod[4 * 2]; + unsigned C_HOST_WIDE_INT carry; + int i, j, k; + C_HOST_WIDE_INT toplow, tophigh, neglow, neghigh; + + c_encode(arg1, l1, h1); + c_encode(arg2, l2, h2); + + bzero ((char *) prod, sizeof prod); + + for (i = 0; i < 4; i++) + { + carry = 0; + for (j = 0; j < 4; j++) + { + k = i + j; + /* This product is <= 0xFFFE0001, the sum <= 0xFFFF0000. */ + carry += arg1[i] * arg2[j]; + /* Since prod[p] < 0xFFFF, this sum <= 0xFFFFFFFF. */ + carry += prod[k]; + prod[k] = LOWPART (carry); + carry = HIGHPART (carry); + } + prod[i + 4] = carry; + } + + c_decode(prod, lv, hv); /* This ignores prod[4] through prod[4*2-1] */ + + /* Check for overflow by calculating the top half of the answer in full; + it should agree with the low half's sign bit. */ + c_decode(prod+4, &toplow, &tophigh); + if (h1 < 0) + { + c_neg_double(l2, h2, &neglow, &neghigh); + c_add_double(neglow, neghigh, toplow, tophigh, &toplow, &tophigh); + } + if (h2 < 0) + { + c_neg_double(l1, h1, &neglow, &neghigh); + c_add_double(neglow, neghigh, toplow, tophigh, &toplow, &tophigh); + } + return (*hv < 0 ? ~(toplow & tophigh) : toplow | tophigh) != 0; +} + +/* Shift the doubleword integer in L1, H1 left by COUNT places + keeping only PREC bits of result. + Shift right if COUNT is negative. + ARITH nonzero specifies arithmetic shifting; otherwise use logical shift. + Store the value as two `HOST_WIDE_INT' pieces in *LV and *HV. */ + + +void +c_lshift_double (l1, h1, count, prec, lv, hv, arith) + C_HOST_WIDE_INT l1, h1, count; + int prec; + C_HOST_WIDE_INT *lv, *hv; + int arith; +{ + if (count < 0) + { + c_rshift_double (l1, h1, - count, prec, lv, hv, arith); + return; + } + +#ifdef SHIFT_COUNT_TRUNCATED + if (SHIFT_COUNT_TRUNCATED) + count %= prec; +#endif + + if (count >= C_HOST_BITS_PER_WIDE_INT) + { + *hv = (unsigned C_HOST_WIDE_INT) l1 << (count - C_HOST_BITS_PER_WIDE_INT); + *lv = 0; + } + else + { + *hv = (((unsigned C_HOST_WIDE_INT) h1 << count) + | ((unsigned C_HOST_WIDE_INT) l1 >> ((C_HOST_BITS_PER_WIDE_INT - count - 1) >> 1))); + *lv = (unsigned C_HOST_WIDE_INT) l1 << count; + } +} + +/* Shift the doubleword integer in L1, H1 right by COUNT places + keeping only PREC bits of result. COUNT must be positive. + ARITH nonzero specifies arithmetic shifting; otherwise use logical shift. + Store the value as two `HOST_WIDE_INT' pieces in *LV and *HV. */ + +void +c_rshift_double (l1, h1, count, prec, lv, hv, arith) + C_HOST_WIDE_INT l1, h1, count; + int prec; + C_HOST_WIDE_INT *lv, *hv; + int arith; +{ + unsigned C_HOST_WIDE_INT signmask; + signmask = (arith + ? -((unsigned C_HOST_WIDE_INT) h1 >> (C_HOST_BITS_PER_WIDE_INT - 1)) + : 0); + +#ifdef SHIFT_COUNT_TRUNCATED + if (SHIFT_COUNT_TRUNCATED) + count %= prec; +#endif + + if (count >= C_HOST_BITS_PER_WIDE_INT) + { + *hv = signmask; + *lv = ((signmask << ((2 * C_HOST_BITS_PER_WIDE_INT - count - 1) << 1)) + | ((unsigned C_HOST_WIDE_INT) h1 >> (count - C_HOST_BITS_PER_WIDE_INT))); + } + else + { + *lv = (((unsigned C_HOST_WIDE_INT) l1 >> count) + | ((unsigned C_HOST_WIDE_INT) h1 << ((C_HOST_BITS_PER_WIDE_INT - count - 1) << 1))); + *hv = ((signmask << (C_HOST_BITS_PER_WIDE_INT - count)) + | ((unsigned C_HOST_WIDE_INT) h1 >> count)); + } +} + +/* Rotate the doubleword integer in L1, H1 left by COUNT places + keeping only PREC bits of result. + Rotate right if COUNT is negative. + Store the value as two `HOST_WIDE_INT' pieces in *LV and *HV. */ + +void +c_lrotate_double (l1, h1, count, prec, lv, hv) + C_HOST_WIDE_INT l1, h1, count; + int prec; + C_HOST_WIDE_INT *lv, *hv; +{ + C_HOST_WIDE_INT s1l, s1h, s2l, s2h; + + count %= prec; + if (count < 0) + count += prec; + + c_lshift_double (l1, h1, count, prec, &s1l, &s1h, 0); + c_rshift_double (l1, h1, prec - count, prec, &s2l, &s2h, 0); + *lv = s1l | s2l; + *hv = s1h | s2h; +} + +/* Rotate the doubleword integer in L1, H1 left by COUNT places + keeping only PREC bits of result. COUNT must be positive. + Store the value as two `HOST_WIDE_INT' pieces in *LV and *HV. */ + +void +c_rrotate_double (l1, h1, count, prec, lv, hv) + C_HOST_WIDE_INT l1, h1, count; + int prec; + C_HOST_WIDE_INT *lv, *hv; +{ + C_HOST_WIDE_INT s1l, s1h, s2l, s2h; + + count %= prec; + if (count < 0) + count += prec; + + c_rshift_double (l1, h1, count, prec, &s1l, &s1h, 0); + c_lshift_double (l1, h1, prec - count, prec, &s2l, &s2h, 0); + *lv = s1l | s2l; + *hv = s1h | s2h; +} + + + +/* Combine two constants ARG1 and ARG2 under operation CODE + to produce a new constant. + We assume ARG1 and ARG2 have the same data type, + or at least are the same kind of constant and the same machine mode. + + If NOTRUNC is nonzero, do not truncate the result to fit the data type. */ + +static c_tree_node *c_const_binop(code, arg1, arg2, notrunc) + int code; + c_tree_node *arg1; + c_tree_node *arg2; + int notrunc; +{ + CStripNops(arg1); CStripNops(arg2); + + if ( CTreeNodeCode(arg1) == C_INT_CST_NODE) + return c_int_const_binop(code, arg1, arg2, notrunc, 0); + +# ifdef LUDO_NO_SKIP +#if ! defined (REAL_IS_NOT_DOUBLE) || defined (REAL_ARITHMETIC) + if (CTreeNodeCode(arg1) == REAL_CST) + { + REAL_VALUE_TYPE d1; + REAL_VALUE_TYPE d2; + int overflow = 0; + REAL_VALUE_TYPE value; + c_tree_node *t; + + d1 = TREE_REAL_CST (arg1); + d2 = TREE_REAL_CST (arg2); + + /* If either operand is a NaN, just return it. Otherwise, set up + for floating-point trap; we return an overflow. */ + if (REAL_VALUE_ISNAN (d1)) + return arg1; + else if (REAL_VALUE_ISNAN (d2)) + return arg2; + else if (setjmp (float_error)) + { + t = copy_node (arg1); + overflow = 1; + goto got_float; + } + + set_float_handler (float_error); + +#ifdef REAL_ARITHMETIC + REAL_ARITHMETIC (value, code, d1, d2); +#else + switch (code) + { + case PLUS_EXPR: + value = d1 + d2; + break; + + case MINUS_EXPR: + value = d1 - d2; + break; + + case MULT_EXPR: + value = d1 * d2; + break; + + case RDIV_EXPR: +#ifndef REAL_INFINITY + if (d2 == 0) + abort (); +#endif + + value = d1 / d2; + break; + + case MIN_EXPR: + value = MIN (d1, d2); + break; + + case MAX_EXPR: + value = MAX (d1, d2); + break; + + default: + abort (); + } +#endif /* no REAL_ARITHMETIC */ + t = build_real (CTreeType(arg1), + real_value_truncate (CTreeTypeMode(CTreeType(arg1)), value)); + got_float: + set_float_handler (NULL_PTR); + + TREE_OVERFLOW (t) + = (force_fit_type (t, overflow) + | TREE_OVERFLOW (arg1) | TREE_OVERFLOW (arg2)); + TREE_CONSTANT_OVERFLOW (t) + = TREE_OVERFLOW (t) + | TREE_CONSTANT_OVERFLOW (arg1) + | TREE_CONSTANT_OVERFLOW (arg2); + return t; + } +#endif /* not REAL_IS_NOT_DOUBLE, or REAL_ARITHMETIC */ +# endif + if (CTreeNodeCode(arg1) == C_COMPLEX_NODE) + { + c_tree_node *type = CTreeType(arg1); + c_tree_node *r1 = CTreeComplexReal(arg1); + c_tree_node *i1 = CTreeComplexImag(arg1); + c_tree_node *r2 = CTreeComplexReal(arg2); + c_tree_node *i2 = CTreeComplexImag(arg2); + c_tree_node *t; + + switch (code) + { + case C_PLUS_EXPR: + t = c_tree_build_complex (type, + c_const_binop(C_PLUS_EXPR, r1, r2, notrunc), + c_const_binop(C_PLUS_EXPR, i1, i2, notrunc)); + break; + + case C_MINUS_EXPR: + t = c_tree_build_complex (type, + c_const_binop(C_MINUS_EXPR, r1, r2, notrunc), + c_const_binop(C_MINUS_EXPR, i1, i2, notrunc)); + break; + + case C_MULT_EXPR: + t = c_tree_build_complex(type, + c_const_binop(C_MINUS_EXPR, + c_const_binop(C_MULT_EXPR, + r1, r2, notrunc), + c_const_binop(C_MULT_EXPR, + i1, i2, notrunc), + notrunc), + c_const_binop(C_PLUS_EXPR, + c_const_binop(C_MULT_EXPR, + r1, i2, notrunc), + c_const_binop(C_MULT_EXPR, + i1, r2, notrunc), + notrunc)); + break; + + case C_RDIV_EXPR: + { + c_tree_node *magsquared + = c_const_binop(C_PLUS_EXPR, + c_const_binop(C_MULT_EXPR, r2, r2, notrunc), + c_const_binop(C_MULT_EXPR, i2, i2, notrunc), + notrunc); + + t = c_tree_build_complex(type, + c_const_binop + (INTEGRAL_TYPE_P (CTreeType(r1)) + ? C_TRUNC_DIV_EXPR : C_RDIV_EXPR, + c_const_binop(C_PLUS_EXPR, + c_const_binop(C_MULT_EXPR, r1, r2, + notrunc), + c_const_binop(C_MULT_EXPR, i1, i2, + notrunc), + notrunc), + magsquared, notrunc), + c_const_binop + (INTEGRAL_TYPE_P (CTreeType(r1)) + ? C_TRUNC_DIV_EXPR : C_RDIV_EXPR, + c_const_binop(C_MINUS_EXPR, + c_const_binop(C_MULT_EXPR, i1, r2, + notrunc), + c_const_binop(C_MULT_EXPR, r1, i2, + notrunc), + notrunc), + magsquared, notrunc)); + } + break; + + default: + abort (); + } + return t; + } + return 0; +} + + +/* Return a c_tree_node *for the case when the result of an expression is RESULT + converted to TYPE and OMITTED was previously an operand of the expression + but is now not needed (e.g., we folded OMITTED * 0). + + If OMITTED has side effects, we must evaluate it. Otherwise, just do + the conversion of RESULT to TYPE. */ + +static c_tree_node *c_omit_one_operand(type, result, omitted) + c_tree_node *type; + c_tree_node *result; + c_tree_node *omitted; +{ + c_tree_node *t = c_convert_expr(type, result); + + if ( CIsTreeNodeSideEffect(omitted)) + return c_tree_build_binary_typed_expr(C_COMPOUND_EXPR, type, omitted, t); + + return c_get_non_lvalue(t); +} + + +/* Similar, but call pedantic_non_lvalue instead of non_lvalue. */ + +static c_tree_node *c_pedantic_omit_one_operand(type, result, omitted) + c_tree_node *type; + c_tree_node *result; + c_tree_node *omitted; +{ + c_tree_node *t = c_convert_expr(type, result); + + if ( CIsTreeNodeSideEffect(omitted)) + return c_tree_build_binary_typed_expr(C_COMPOUND_EXPR, type, omitted, t); + + return c_get_pedantic_non_lvalue(t); +} + + +/* Given a bit-wise operation CODE applied to ARG0 and ARG1, see if both + operands are another bit-wise operation with a common input. If so, + distribute the bit operations to save an operation and possibly two if + constants are involved. For example, convert + (A | B) & (A | C) into A | (B & C) + Further simplification will occur if B and C are constants. + + If this optimization cannot be done, 0 will be returned. */ + +static c_tree_node *c_distribute_bit_expr(code, type, arg0, arg1) + int code; + c_tree_node *type; + c_tree_node *arg0; + c_tree_node *arg1; +{ + c_tree_node *common; + c_tree_node *left; + c_tree_node *right; + + if (CTreeNodeCode(arg0) != CTreeNodeCode(arg1) + || CTreeNodeCode(arg0) == code + || (CTreeNodeCode(arg0) != C_BIT_AND_EXPR + && CTreeNodeCode(arg0) != C_BIT_IOR_EXPR)) + return 0; + + if (c_is_operand_equal_p(CTreeExprOperand(arg0, 0), CTreeExprOperand(arg1, 0), 0)) + { + common = CTreeExprOperand(arg0, 0); + left = CTreeExprOperand(arg0, 1); + right = CTreeExprOperand(arg1, 1); + } + else if (c_is_operand_equal_p(CTreeExprOperand(arg0, 0), CTreeExprOperand(arg1, 1), 0)) + { + common = CTreeExprOperand(arg0, 0); + left = CTreeExprOperand(arg0, 1); + right = CTreeExprOperand(arg1, 0); + } + else if (c_is_operand_equal_p(CTreeExprOperand(arg0, 1), CTreeExprOperand(arg1, 0), 0)) + { + common = CTreeExprOperand(arg0, 1); + left = CTreeExprOperand(arg0, 0); + right = CTreeExprOperand(arg1, 1); + } + else if (c_is_operand_equal_p(CTreeExprOperand(arg0, 1), CTreeExprOperand(arg1, 1), 0)) + { + common = CTreeExprOperand(arg0, 1); + left = CTreeExprOperand(arg0, 0); + right = CTreeExprOperand(arg1, 0); + } + else + return 0; + + return c_fold( c_tree_build_binary_typed_expr( + CTreeNodeCode(arg0), type, common, + c_fold(c_tree_build_binary_typed_expr(code, type, left, right)))); +} + + +/* ARG is a c_tree_node *that is known to contain just arithmetic operations and + comparisons. Evaluate the operations in the c_tree_node *substituting NEW0 for + any occurrence of OLD0 as an operand of a comparison and likewise for + NEW1 and OLD1. */ + +static c_tree_node *c_eval_subst(arg, old0, new0, old1, new1) + c_tree_node *arg; + c_tree_node *old0; + c_tree_node *new0; + c_tree_node *old1; + c_tree_node *new1; +{ + c_tree_node *type = CTreeType(arg); + int code = CTreeNodeCode(arg); + char class = c_tree_get_code_class(code); + + /* We can handle some of the 'e' cases here. */ + if (class == 'e' && code == C_TRUTH_NOT_EXPR) + class = '1'; + else if (class == 'e' + && (code == C_TRUTH_ANDIF_EXPR || code == C_TRUTH_ORIF_EXPR)) + class = '2'; + + switch (class) + { + case '1': + return c_fold( c_tree_build_unary_typed_expr(code, type, + c_eval_subst(CTreeExprOperand(arg, 0), + old0, new0, old1, new1))); + + case '2': + return c_fold( c_tree_build_binary_typed_expr(code, type, + c_eval_subst(CTreeExprOperand(arg, 0), + old0, new0, old1, new1), + c_eval_subst(CTreeExprOperand(arg, 1), + old0, new0, old1, new1))); + + case 'e': + switch (code) + { + case C_SAVE_EXPR: + return c_eval_subst(CTreeExprOperand(arg, 0), old0, new0, old1, new1); + + case C_COMPOUND_EXPR: + return c_eval_subst(CTreeExprOperand(arg, 1), old0, new0, old1, new1); + + case C_COND_EXPR: + return c_fold(c_tree_build_ternary_typed_expr(code, type, + c_eval_subst(CTreeExprOperand(arg, 0), + old0, new0, old1, new1), + c_eval_subst(CTreeExprOperand(arg, 1), + old0, new0, old1, new1), + c_eval_subst(CTreeExprOperand(arg, 2), + old0, new0, old1, new1))); + default: + break; + } + /* fall through (???) */ + + case '<': + { + c_tree_node *arg0 = CTreeExprOperand(arg, 0); + c_tree_node *arg1 = CTreeExprOperand(arg, 1); + + /* We need to check both for exact equality and c_tree_node *equality. The + former will be true if the operand has a side-effect. In that + case, we know the operand occurred exactly once. */ + + if (arg0 == old0 || c_is_operand_equal_p(arg0, old0, 0)) + arg0 = new0; + else if (arg0 == old1 || c_is_operand_equal_p(arg0, old1, 0)) + arg0 = new1; + + if (arg1 == old0 || c_is_operand_equal_p(arg1, old0, 0)) + arg1 = new0; + else if (arg1 == old1 || c_is_operand_equal_p(arg1, old1, 0)) + arg1 = new1; + + return c_fold( c_tree_build_binary_typed_expr(code, type, arg0, arg1)); + } + + default: + return arg; + } +} + + +c_tree_node *c_fold( expr ) + + c_tree_node *expr; +{ + c_tree_node *t = expr; + c_tree_node *t1 = NULL; + c_tree_node *tem; + c_tree_node *type = CTreeType(expr); + c_tree_node *arg0; + c_tree_node *arg1; + int code = CTreeNodeCode(t); + int kind; + int invert; + + /* WINS will be nonzero when the switch is done + if all operands are constant. */ + + int wins = 1; + + /* Don't try to process an RTL_EXPR since its operands aren't trees. + Likewise for a SAVE_EXPR that's already been evaluated. */ + if (code == C_RTL_EXPR +# ifdef LUDO_NO_SKIP + || (code == C_SAVE_EXPR && SAVE_EXPR_RTL (t)) != 0 +# endif + ) + return t; + + /* Return right away if already constant. */ + if (CIsTreeNodeConstant(t)) + { + if (code == C_CONST_DECL) + return CTreeDeclInitial(t); + return t; + } + + kind = c_tree_get_code_class(code); + if (code == C_NOP_EXPR || code == C_FLOAT_EXPR || code == C_CONVERT_EXPR) + { + c_tree_node *subop; + + /* Special case for conversion ops that can have fixed point args. */ + arg0 = CTreeExprOperand(t, 0); + + /* Don't use STRIP_NOPS, because signedness of argument type matters. */ + if (arg0 != 0) + { + CStripTypeNops(arg0); + } + + if (arg0 != 0 && CTreeNodeFirstCode(arg0) == C_COMPLEX_NODE) + subop = CTreeComplexReal(arg0); + else + subop = arg0; + + if (subop != 0 && CTreeNodeFirstCode(subop) != C_INT_CST_NODE +#if ! defined (REAL_IS_NOT_DOUBLE) || defined (REAL_ARITHMETIC) + && CTreeNodeFirstCode(subop) != C_REAL_CST_NODE +#endif /* not REAL_IS_NOT_DOUBLE, or REAL_ARITHMETIC */ + ) + /* Note that CIsTreeNodeConstantisn't enough: + static var addresses are constant but we can't + do arithmetic on them. */ + wins = 0; + } + else if (kind == 'e' || kind == '<' + || kind == '1' || kind == '2' || kind == 'r') + { + int len = CTreeExprNumOper(t); + int i; + for (i = 0; i < len; i++) + { + c_tree_node *op = CTreeExprOperand(t, i); + c_tree_node *subop; + + if (op == 0) + continue; /* Valid for CALL_EXPR, at least. */ + + if (kind == '<' || code == C_RSHIFT_EXPR) + { + /* Signedness matters here. Perhaps we can refine this + later. */ + CStripTypeNops(op); + } + else + { + /* Strip any conversions that don't change the mode. */ + CStripNops(op); + } + + if ( CTreeNodeFirstCode(op) == C_COMPLEX_NODE) + subop = CTreeComplexReal(op); + else + subop = op; + + if ( CTreeNodeFirstCode(subop) != C_INT_CST_NODE +#if ! defined (REAL_IS_NOT_DOUBLE) || defined (REAL_ARITHMETIC) + && CTreeNodeFirstCode(subop) != C_REAL_CST_NODE +#endif /* not REAL_IS_NOT_DOUBLE, or REAL_ARITHMETIC */ + ) + /* Note that CIsTreeNodeConstantisn't enough: + static var addresses are constant but we can't + do arithmetic on them. */ + wins = 0; + + if (i == 0) + arg0 = op; + else if (i == 1) + arg1 = op; + } + } + + /* If this is a commutative operation, and ARG0 is a constant, move it + to ARG1 to reduce the number of tests below. */ + if ((code == C_PLUS_EXPR || code == C_MULT_EXPR || code == C_MIN_EXPR + || code == C_MAX_EXPR || code == C_BIT_IOR_EXPR || code == C_BIT_XOR_EXPR + || code == C_BIT_AND_EXPR) + && ( CTreeNodeFirstCode(arg0) == C_INT_CST_NODE || + CTreeNodeFirstCode(arg0) == C_REAL_CST_NODE)) + { + tem = arg0; arg0 = arg1; arg1 = tem; + + tem = CTreeExprOperand(t, 0); CTreeExprOperand(t, 0) = CTreeExprOperand(t, 1); + CTreeExprOperand(t, 1) = tem; + } + + /* Now WINS is set as described above, + ARG0 is the first operand of EXPR, + and ARG1 is the second operand (if it has more than one operand). + + First check for cases where an arithmetic operation is applied to a + compound, conditional, or comparison operation. Push the arithmetic + operation inside the compound or conditional to see if any folding + can then be done. Convert comparison to conditional for this purpose. + The also optimizes non-constant cases that used to be done in + expand_expr. + + Before we do that, see if this is a BIT_AND_EXPR or a BIT_OR_EXPR, + one of the operands is a comparison and the other is a comparison, a + BIT_AND_EXPR with the constant 1, or a truth value. In that case, the + code below would make the expression more complex. Change it to a + TRUTH_{AND,OR}_EXPR. Likewise, c_convert_expra similar NE_EXPR to + TRUTH_XOR_EXPR and an EQ_EXPR to the inversion of a TRUTH_XOR_EXPR. */ + + if ((code == C_BIT_AND_EXPR || code == C_BIT_IOR_EXPR + || code == C_EQ_EXPR || code == C_NE_EXPR) + && ((c_truth_value_p(CTreeNodeCode(arg0)) + && (c_truth_value_p(CTreeNodeCode(arg1)) + || (CTreeNodeCode(arg1) == C_BIT_AND_EXPR + && c_tree_is_integer_onep (CTreeExprOperand(arg1, 1))))) + || (c_truth_value_p(CTreeNodeCode(arg1)) + && (c_truth_value_p(CTreeNodeCode(arg0)) + || (CTreeNodeCode(arg0) == C_BIT_AND_EXPR + && c_tree_is_integer_onep (CTreeExprOperand(arg0, 1))))))) + { + t = c_fold( c_tree_build_binary_typed_expr( + code == C_BIT_AND_EXPR ? C_TRUTH_AND_EXPR + : code == C_BIT_IOR_EXPR ? C_TRUTH_OR_EXPR + : C_TRUTH_XOR_EXPR, type, arg0, arg1)); + + if (code == C_EQ_EXPR) + t = c_invert_truthvalue(t); + + return t; + } + + if (c_tree_get_code_class(code) == '1') + { + if (CTreeNodeCode(arg0) == C_COMPOUND_EXPR) + return c_tree_build_binary_typed_expr( + C_COMPOUND_EXPR, type, CTreeExprOperand(arg0, 0), + c_fold( c_tree_build_unary_typed_expr(code, type, CTreeExprOperand(arg0, 1)))); + else if (CTreeNodeCode(arg0) == C_COND_EXPR) + { + t = c_fold( + c_tree_build_ternary_typed_expr(C_COND_EXPR, type, CTreeExprOperand(arg0, 0), + c_fold(c_tree_build_unary_typed_expr(code, type, CTreeExprOperand(arg0, 1))), + c_fold(c_tree_build_unary_typed_expr(code, type, CTreeExprOperand(arg0, 2))))); + + /* If this was a conversion, and all we did was to move into + inside the COND_EXPR, bring it back out. But leave it if + it is a conversion from integer to integer and the + result precision is no wider than a word since such a + conversion is cheap and may be optimized away by combine, + while it couldn't if it were outside the COND_EXPR. Then return + so we don't get into an infinite recursion loop taking the + conversion out and then back in. */ + + if ((code == C_NOP_EXPR || code == C_CONVERT_EXPR + || code == C_NON_LVALUE_EXPR) + && CTreeNodeCode(t) == C_COND_EXPR + && CTreeNodeCode(CTreeExprOperand(t, 1)) == code + && CTreeNodeCode(CTreeExprOperand(t, 2)) == code + && (CTreeType(CTreeExprOperand(CTreeExprOperand(t, 1), 0)) + == CTreeType(CTreeExprOperand(CTreeExprOperand(t, 2), 0))) + && ! ( INTEGRAL_TYPE_P(CTreeType(t)) + && INTEGRAL_TYPE_P(CTreeType(CTreeExprOperand(CTreeExprOperand(t, 1), 0))) + && CTreeTypePrecision(CTreeType(t)) <= C_BITS_PER_WORD)) + t = c_tree_build_unary_typed_expr(code, type, + c_tree_build_ternary_typed_expr(C_COND_EXPR, + CTreeType(CTreeExprOperand(CTreeExprOperand(t, 1), 0)), + CTreeExprOperand(t, 0), + CTreeExprOperand(CTreeExprOperand(t, 1), 0), + CTreeExprOperand(CTreeExprOperand(t, 2), 0))); + return t; + } + else if ( c_tree_get_code_class(CTreeNodeCode(arg0)) == '<') + return c_fold(c_tree_build_ternary_typed_expr(C_COND_EXPR, type, arg0, + c_fold(c_tree_build_unary_typed_expr(code, type, c_integer_one_node)), + c_fold(c_tree_build_unary_typed_expr(code, type, c_integer_zero_node)))); + } + else if (c_tree_get_code_class(code) == '2' + || c_tree_get_code_class(code) == '<') + { + if ( CTreeNodeCode(arg1) == C_COMPOUND_EXPR) + return c_tree_build_binary_typed_expr(C_COMPOUND_EXPR, type, + CTreeExprOperand(arg1, 0), + c_fold(c_tree_build_binary_typed_expr(code, type, + arg0, CTreeExprOperand(arg1, 1)))); + else if ((CTreeNodeCode(arg1) == C_COND_EXPR + || (c_tree_get_code_class(CTreeNodeCode(arg1)) == '<' + && c_tree_get_code_class(code) != '<')) + && (! CIsTreeNodeSideEffect(arg0) || c_current_function_decl != 0)) + { + c_tree_node *test; + c_tree_node *true_value; + c_tree_node *false_value; + + if (CTreeNodeCode(arg1) == C_COND_EXPR) + { + test = CTreeExprOperand(arg1, 0); + true_value = CTreeExprOperand(arg1, 1); + false_value = CTreeExprOperand(arg1, 2); + } + else + { + c_tree_node *testtype = CTreeType(arg1); + test = arg1; + true_value = c_convert_expr(testtype, c_integer_one_node); + false_value = c_convert_expr(testtype, c_integer_zero_node); + } + + /* If ARG0 is complex we want to make sure we only evaluate + it once. Though this is only required if it is volatile, it + might be more efficient even if it is not. However, if we + succeed in folding one part to a constant, we do not need + to make this SAVE_EXPR. Since we do this optimization + primarily to see if we do end up with constant and this + SAVE_EXPR interferes with later optimizations, suppressing + it when we can is important. */ + + if (CTreeNodeCode(arg0) != C_SAVE_EXPR + && ((CTreeNodeCode(arg0) != C_VAR_DECL + && CTreeNodeCode(arg0) != C_PARAM_DECL) + || CIsTreeNodeSideEffect(arg0))) + { + c_tree_node *lhs = + c_fold(c_tree_build_binary_typed_expr(code, type, arg0, true_value)); + c_tree_node *rhs = + c_fold(c_tree_build_binary_typed_expr(code, type, arg0, false_value)); + + if (CIsTreeNodeConstant(lhs) || CIsTreeNodeConstant(rhs)) + return c_fold( + c_tree_build_ternary_typed_expr(C_COND_EXPR, type, test, lhs, rhs)); + + if (c_current_function_decl != 0) + { +# ifdef LUDO_NO_SKIP + arg0 = save_expr (arg0); +# endif + } + } + + test = c_fold(c_tree_build_ternary_typed_expr(C_COND_EXPR, type, test, + c_fold(c_tree_build_binary_typed_expr(code, type, arg0, true_value)), + c_fold(c_tree_build_binary_typed_expr(code, type, arg0, false_value)))); + if (CTreeNodeCode(arg0) == C_SAVE_EXPR) + return c_tree_build_binary_typed_expr(C_COMPOUND_EXPR, type, + c_convert_expr(c_void_type_node, arg0), + c_strip_compound_expr(test, arg0)); + else + return c_convert_expr(type, test); + } + + else if (CTreeNodeCode(arg0) == C_COMPOUND_EXPR) + return c_tree_build_binary_typed_expr(C_COMPOUND_EXPR, type, + CTreeExprOperand(arg0, 0), + c_fold(c_tree_build_binary_typed_expr(code, type, + CTreeExprOperand(arg0, 1), arg1))); + else if ((CTreeNodeCode(arg0) == C_COND_EXPR + || (c_tree_get_code_class(CTreeNodeCode(arg0)) == '<' + && c_tree_get_code_class(code) != '<')) + && (! CIsTreeNodeSideEffect(arg1) || c_current_function_decl != 0)) + { + c_tree_node *test; + c_tree_node *true_value; + c_tree_node *false_value; + + if (CTreeNodeCode(arg0) == C_COND_EXPR) + { + test = CTreeExprOperand(arg0, 0); + true_value = CTreeExprOperand(arg0, 1); + false_value = CTreeExprOperand(arg0, 2); + } + else + { + c_tree_node *testtype = CTreeType(arg0); + test = arg0; + true_value = c_convert_expr(testtype, c_integer_one_node); + false_value = c_convert_expr(testtype, c_integer_zero_node); + } + + if (CTreeNodeCode(arg1) != C_SAVE_EXPR + && ((CTreeNodeCode(arg1) != C_VAR_DECL + && CTreeNodeCode(arg1) != C_PARAM_DECL) + || CIsTreeNodeSideEffect(arg1))) + { + c_tree_node *lhs = c_fold( + c_tree_build_binary_typed_expr(code, type, true_value, arg1)); + c_tree_node *rhs = c_fold( + c_tree_build_binary_typed_expr(code, type, false_value, arg1)); + + if (CIsTreeNodeConstant(lhs) || CIsTreeNodeConstant(rhs) + || CIsTreeNodeConstant(arg1)) + return c_fold( + c_tree_build_ternary_typed_expr(C_COND_EXPR, type, test, lhs, rhs)); + +# ifdef LUDO_NO_SKIP + if (c_current_function_decl != 0) + arg1 = save_expr (arg1); +# endif + } + + test = c_fold( + c_tree_build_ternary_typed_expr(C_COND_EXPR, type, test, + c_fold(c_tree_build_binary_typed_expr(code, type, true_value, arg1)), + c_fold(c_tree_build_binary_typed_expr(code, type, false_value, arg1)))); + if (CTreeNodeCode(arg1) == C_SAVE_EXPR) + return c_tree_build_binary_typed_expr(C_COMPOUND_EXPR, type, + c_convert_expr(c_void_type_node, arg1), + c_strip_compound_expr(test, arg1)); + else + return c_convert_expr(type, test); + } + } + else if (c_tree_get_code_class(code) == '<' + && CTreeNodeCode(arg0) == C_COMPOUND_EXPR) + return + c_tree_build_binary_typed_expr(C_COMPOUND_EXPR, type, CTreeExprOperand(arg0, 0), + c_fold( c_tree_build_binary_typed_expr(code, type, CTreeExprOperand(arg0, 1), arg1))); + + else if (c_tree_get_code_class(code) == '<' + && CTreeNodeCode(arg1) == C_COMPOUND_EXPR) + return c_tree_build_binary_typed_expr(C_COMPOUND_EXPR, type, CTreeExprOperand(arg1, 0), + c_fold(c_tree_build_binary_typed_expr(code, type, arg0, CTreeExprOperand(arg1, 1)))); + + switch (code) + { + case C_INT_CST_NODE: + case C_REAL_CST_NODE: + case C_STRING_NODE: + case C_COMPLEX_NODE: + case C_CONSTRUCTOR_EXPR: + return t; + + case C_CONST_DECL: + return c_fold(CTreeDeclInitial(t)); + + case C_NOP_EXPR: + case C_FLOAT_EXPR: + case C_CONVERT_EXPR: + case C_FIX_TRUNC_EXPR: + /* Other kinds of FIX are not handled properly by fold_convert. */ + + if (CTreeType(CTreeExprOperand(t, 0)) == CTreeType(t)) + return CTreeExprOperand(t, 0); + + /* Handle cases of two conversions in a row. */ + if (CTreeNodeCode(CTreeExprOperand(t, 0)) == C_NOP_EXPR + || CTreeNodeCode(CTreeExprOperand(t, 0)) == C_CONVERT_EXPR) + { + c_tree_node *inside_type = CTreeType(CTreeExprOperand(CTreeExprOperand(t, 0), 0)); + c_tree_node *inter_type = CTreeType(CTreeExprOperand(t, 0)); + c_tree_node *final_type = CTreeType(t); + int inside_int = INTEGRAL_TYPE_P (inside_type); + int inside_ptr = POINTER_TYPE_P (inside_type); + int inside_float = FLOAT_TYPE_P (inside_type); + int inside_prec = CTreeTypePrecision(inside_type); + int inside_unsignedp = CIsTreeNodeUnsigned(inside_type); + int inter_int = INTEGRAL_TYPE_P (inter_type); + int inter_ptr = POINTER_TYPE_P (inter_type); + int inter_float = FLOAT_TYPE_P (inter_type); + int inter_prec = CTreeTypePrecision(inter_type); + int inter_unsignedp = CIsTreeNodeUnsigned(inter_type); + int final_int = INTEGRAL_TYPE_P (final_type); + int final_ptr = POINTER_TYPE_P (final_type); + int final_float = FLOAT_TYPE_P (final_type); + int final_prec = CTreeTypePrecision(final_type); + int final_unsignedp = CIsTreeNodeUnsigned(final_type); + + /* In addition to the cases of two conversions in a row + handled below, if we are converting something to its own + type via an object of identical or wider precision, neither + conversion is needed. */ + if (inside_type == final_type + && ((inter_int && final_int) || (inter_float && final_float)) + && inter_prec >= final_prec) + return CTreeExprOperand(CTreeExprOperand(t, 0), 0); + + /* Likewise, if the intermediate and final types are either both + float or both integer, we don't need the middle conversion if + it is wider than the final type and doesn't change the signedness + (for integers). Avoid this if the final type is a pointer + since then we sometimes need the inner conversion. Likewise if + the outer has a precision not equal to the size of its mode. */ + if ((((inter_int || inter_ptr) && (inside_int || inside_ptr)) + || (inter_float && inside_float)) + && inter_prec >= inside_prec + && (inter_float || inter_unsignedp == inside_unsignedp) +# ifdef LUDO_NO_SKIP + && ! (final_prec != GET_MODE_BITSIZE (CTreeTypeMode(final_type)) + && CTreeTypeMode(final_type) == CTreeTypeMode(inter_type)) +# endif + && ! final_ptr) + return c_convert_expr(final_type, CTreeExprOperand(CTreeExprOperand(t, 0), 0)); + + /* Two conversions in a row are not needed unless: + - some conversion is floating-point (overstrict for now), or + - the intermediate type is narrower than both initial and + final, or + - the intermediate type and innermost type differ in signedness, + and the outermost type is wider than the intermediate, or + - the initial type is a pointer type and the precisions of the + intermediate and final types differ, or + - the final type is a pointer type and the precisions of the + initial and intermediate types differ. */ + if (! inside_float && ! inter_float && ! final_float + && (inter_prec > inside_prec || inter_prec > final_prec) + && ! (inside_int && inter_int + && inter_unsignedp != inside_unsignedp + && inter_prec < final_prec) + && ((inter_unsignedp && inter_prec > inside_prec) + == (final_unsignedp && final_prec > inter_prec)) + && ! (inside_ptr && inter_prec != final_prec) + && ! (final_ptr && inside_prec != inter_prec) +# ifdef LUDO_NO_SKIP + && ! (final_prec != GET_MODE_BITSIZE (CTreeTypeMode(final_type)) + && CTreeTypeMode(final_type) == CTreeTypeMode(inter_type)) +# endif + && ! final_ptr) + return c_convert_expr(final_type, CTreeExprOperand(CTreeExprOperand(t, 0), 0)); + } + + if (CTreeNodeCode(CTreeExprOperand(t, 0)) == C_MODIFY_EXPR + && CIsTreeNodeConstant(CTreeExprOperand(CTreeExprOperand(t, 0), 1)) + /* Detect assigning a bitfield. */ + && !(CTreeNodeCode(CTreeExprOperand(CTreeExprOperand(t, 0), 0)) == C_COMPONENT_REF + && CIsTreeDeclBitField( + CTreeExprOperand(CTreeExprOperand(CTreeExprOperand(t, 0), 0), 1)))) + { + /* Don't leave an assignment inside a conversion + unless assigning a bitfield. */ + c_tree_node *prev = CTreeExprOperand(t, 0); + CTreeExprOperand(t, 0) = CTreeExprOperand(prev, 1); + /* First do the assignment, then return converted constant. */ + t = c_tree_build_binary_typed_expr(C_COMPOUND_EXPR, CTreeType(t), prev, c_fold(t)); + CSetTreeNodeUsed(t); + return t; + } + if (!wins) + { + if ( CIsTreeNodeConstant(arg0) ) + CSetTreeNodeConstant(t); + return t; + } + return c_fold_convert_expr(t, arg0); + + case C_COMPONENT_REF: + if (CTreeNodeCode(arg0) == C_CONSTRUCTOR_EXPR) + { + c_tree_node *m = c_tree_get_purpose_member(arg1, CTreeExprOperand(arg0,1)); + if (m) + t = CTreeListValue(m); + } + return t; + + case C_RANGE_EXPR: + if ( wins ) CSetTreeNodeConstant(t); + else CClearTreeNodeConstant(t); + + return t; + + case C_NEGATE_EXPR: + if (wins) + { + if (CTreeNodeCode(arg0) == C_INT_CST_NODE) + { + C_HOST_WIDE_INT low, high; + int overflow = c_neg_double (CTreeIntCstLow(arg0), + CTreeIntCstHigh(arg0), + &low, &high); + t = c_tree_build_int_2(low, high); + CTreeType(t) = type; + if ( (CIsTreeNodeOverflow(arg0) + || c_force_fit_type(t, overflow && !CIsTreeNodeUnsigned(type)))) + CSetTreeNodeOverflow(t); + + if ( CIsTreeNodeOverflow(t) || CIsTreeNodeCstOverflow(arg0)) + CSetTreeNodeCstOverflow(t); + } + else if (CTreeNodeCode(arg0) == C_REAL_CST_NODE) + t = c_tree_build_real(type, REAL_VALUE_NEGATE( CTreeRealCstValue(arg0))); + } + else if (CTreeNodeCode(arg0) == C_NEGATE_EXPR) + return CTreeExprOperand(arg0, 0); + + /* Convert - (a - b) to (b - a) for non-floating-point. */ + else if (CTreeNodeCode(arg0) == C_MINUS_EXPR && ! FLOAT_TYPE_P (type)) + return c_tree_build_binary_typed_expr(C_MINUS_EXPR, type, CTreeExprOperand(arg0, 1), + CTreeExprOperand(arg0, 0)); + + return t; + + case C_ABS_EXPR: + if (wins) + { + if (CTreeNodeCode(arg0) == C_INT_CST_NODE) + { + if (! CIsTreeNodeUnsigned(type) + && CTreeIntCstHigh(arg0) < 0) + { + C_HOST_WIDE_INT low, high; + int overflow = c_neg_double (CTreeIntCstLow(arg0), + CTreeIntCstHigh(arg0), + &low, &high); + t = c_tree_build_int_2(low, high); + CTreeType(t) = type; + if ( CIsTreeNodeOverflow(arg0) + | c_force_fit_type(t, overflow)) + CSetTreeNodeOverflow(t); + if (CIsTreeNodeOverflow(t) || CIsTreeNodeCstOverflow(arg0)) + CSetTreeNodeCstOverflow(t); + } + } + else if (CTreeNodeCode(arg0) == C_REAL_CST_NODE) + { + if (REAL_VALUE_NEGATIVE ( CTreeRealCstValue(arg0))) + t = c_tree_build_real (type, + REAL_VALUE_NEGATE( CTreeRealCstValue(arg0))); + } + } + else if (CTreeNodeCode(arg0) == C_ABS_EXPR || CTreeNodeCode(arg0) == C_NEGATE_EXPR) + return c_tree_build_unary_typed_expr(C_ABS_EXPR, type, CTreeExprOperand(arg0, 0)); + return t; + + case C_CONJ_EXPR: + if (CTreeNodeCode(CTreeType(arg0)) != C_COMPLEX_TYPE) + return arg0; + else if (CTreeNodeCode(arg0) == C_COMPLEX_EXPR) + return c_tree_build_binary_typed_expr(C_COMPLEX_EXPR, CTreeType(arg0), + CTreeExprOperand(arg0, 0), + c_fold(c_tree_build_unary_typed_expr(C_NEGATE_EXPR, + CTreeType(CTreeType(arg0)), + CTreeExprOperand(arg0, 1)))); + else if (CTreeNodeCode(arg0) == C_COMPLEX_NODE) + return c_tree_build_complex(type, CTreeExprOperand(arg0, 0), + c_fold(c_tree_build_unary_typed_expr(C_NEGATE_EXPR, + CTreeType(CTreeType(arg0)), + CTreeExprOperand(arg0, 1)))); + else if (CTreeNodeCode(arg0) == C_PLUS_EXPR || CTreeNodeCode(arg0) == C_MINUS_EXPR) + return c_fold(c_tree_build_binary_typed_expr(CTreeNodeCode(arg0), type, + c_fold(c_tree_build_unary_typed_expr(C_CONJ_EXPR, type, + CTreeExprOperand(arg0, 0))), + c_fold(c_tree_build_unary_typed_expr(C_CONJ_EXPR, + type, CTreeExprOperand(arg0, 1))))); + else if (CTreeNodeCode(arg0) == C_CONJ_EXPR) + return CTreeExprOperand(arg0, 0); + return t; + + case C_BIT_NOT_EXPR: + if (wins) + { + t = c_tree_build_int_2(~ CTreeIntCstLow(arg0), ~ CTreeIntCstHigh(arg0)); + CTreeType(t) = type; + c_force_fit_type(t, 0); + if ( CIsTreeNodeOverflow(arg0)) CSetTreeNodeOverflow(t); + if ( CIsTreeNodeCstOverflow(arg0)) CSetTreeNodeCstOverflow(arg0); + } + else if (CTreeNodeCode(arg0) == C_BIT_NOT_EXPR) + return CTreeExprOperand(arg0, 0); + return t; + + case C_PLUS_EXPR: + /* A + (-B) -> A - B */ + if (CTreeNodeCode(arg1) == C_NEGATE_EXPR) + return c_fold( + c_tree_build_binary_typed_expr( + C_MINUS_EXPR, type, arg0, CTreeExprOperand(arg1, 0))); + else if (! FLOAT_TYPE_P (type)) + { + if (c_tree_is_integer_zerop(arg1)) + return c_get_non_lvalue(c_convert_expr(type, arg0)); + + /* If we are adding two BIT_AND_EXPR's, both of which are and'ing + with a constant, and the two constants have no bits in common, + we should treat this as a BIT_IOR_EXPR since this may produce more + simplifications. */ + if (CTreeNodeCode(arg0) == C_BIT_AND_EXPR + && CTreeNodeCode(arg1) == C_BIT_AND_EXPR + && CTreeNodeCode(CTreeExprOperand(arg0, 1)) == C_INT_CST_NODE + && CTreeNodeCode(CTreeExprOperand(arg1, 1)) == C_INT_CST_NODE + && c_tree_is_integer_zerop( + c_const_binop(C_BIT_AND_EXPR, + CTreeExprOperand(arg0, 1), CTreeExprOperand(arg1, 1), 0))) + { + code = C_BIT_IOR_EXPR; + goto bit_ior; + } + + /* (A * C) + (B * C) -> (A+B) * C. Since we are most concerned + about the case where C is a constant, just try one of the + four possibilities. */ + + if (CTreeNodeCode(arg0) == C_MULT_EXPR && + CTreeNodeCode(arg1) == C_MULT_EXPR + && c_is_operand_equal_p(CTreeExprOperand(arg0, 1), + CTreeExprOperand(arg1, 1), 0)) + return c_fold(c_tree_build_binary_typed_expr(C_MULT_EXPR, type, + c_fold(c_tree_build_binary_typed_expr(C_PLUS_EXPR, type, + CTreeExprOperand(arg0, 0), + CTreeExprOperand(arg1, 0))), + CTreeExprOperand(arg0, 1))); + } + /* In IEEE floating point, x+0 may not equal x. */ + else if (( +# ifdef LUDO_NO_SKIP + TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT +# else + 1 +# endif + || c_flag_fast_math) + && c_tree_is_real_zerop(arg1)) + return c_get_non_lvalue(c_convert_expr(type, arg0)); + associate: + /* In most languages, can't associate operations on floats + through parentheses. Rather than remember where the parentheses + were, we don't associate floats at all. It shouldn't matter much. + However, associating multiplications is only very slightly + inaccurate, so do that if -ffast-math is specified. */ + if (FLOAT_TYPE_P (type) + && ! (c_flag_fast_math && code == C_MULT_EXPR)) + goto binary; + + /* The varsign == -1 cases happen only for addition and subtraction. + It says that the arg that was split was really CON minus VAR. + The rest of the code applies to all associative operations. */ + if (!wins) + { + c_tree_node *var; + c_tree_node *con; + int varsign; + + if (c_split_tree(arg0, code, &var, &con, &varsign)) + { + if (varsign == -1) + { + /* EXPR is (CON-VAR) +- ARG1. */ + /* If it is + and VAR==ARG1, return just CONST. */ + if (code == C_PLUS_EXPR && c_is_operand_equal_p(var, arg1, 0)) + return c_convert_expr(CTreeType(t), con); + + /* If ARG0 is a constant, don't change things around; + instead keep all the constant computations together. */ + + if (CIsTreeNodeConstant(arg0)) + return t; + + /* Otherwise return (CON +- ARG1) - VAR. */ + t = c_tree_build_binary_typed_expr(C_MINUS_EXPR, type, + c_fold(c_tree_build_binary_typed_expr(code, type, con, arg1)), var); + } + else + { + /* EXPR is (VAR+CON) +- ARG1. */ + /* If it is - and VAR==ARG1, return just CONST. */ + if (code == C_MINUS_EXPR && c_is_operand_equal_p(var, arg1, 0)) + return c_convert_expr(CTreeType(t), con); + + /* If ARG0 is a constant, don't change things around; + instead keep all the constant computations together. */ + + if (CIsTreeNodeConstant(arg0)) + return t; + + /* Otherwise return VAR +- (ARG1 +- CON). */ + tem = c_fold(c_tree_build_binary_typed_expr(code, type, arg1, con)); + t = c_tree_build_binary_typed_expr(code, type, var, tem); + + if (c_tree_is_integer_zerop(tem) + && (code == C_PLUS_EXPR || code == C_MINUS_EXPR)) + return c_convert_expr(type, var); + /* If we have x +/- (c - d) [c an explicit integer] + change it to x -/+ (d - c) since if d is relocatable + then the latter can be a single immediate insn + and the former cannot. */ + if (CTreeNodeCode(tem) == C_MINUS_EXPR + && CTreeNodeCode(CTreeExprOperand(tem, 0)) == C_INT_CST_NODE) + { + c_tree_node *tem1 = CTreeExprOperand(tem, 1); + CTreeExprOperand(tem, 1) = CTreeExprOperand(tem, 0); + CTreeExprOperand(tem, 0) = tem1; + CTreeNodeCode(t) = (code == C_PLUS_EXPR ? C_MINUS_EXPR : C_PLUS_EXPR); + } + } + return t; + } + + if (c_split_tree(arg1, code, &var, &con, &varsign)) + { + if (CIsTreeNodeConstant(arg1)) + return t; + + if (varsign == -1) + CTreeNodeCode(t) = (code == C_PLUS_EXPR ? C_MINUS_EXPR : C_PLUS_EXPR); + + /* EXPR is ARG0 +- (CON +- VAR). */ + if (CTreeNodeCode(t) == C_MINUS_EXPR + && c_is_operand_equal_p(var, arg0, 0)) + { + /* If VAR and ARG0 cancel, return just CON or -CON. */ + if (code == C_PLUS_EXPR) + return c_convert_expr(CTreeType(t), con); + return c_fold(c_tree_build_unary_typed_expr(C_NEGATE_EXPR, CTreeType(t), + c_convert_expr(CTreeType(t), con))); + } + + t = c_tree_build_binary_typed_expr(CTreeNodeCode(t), type, + c_fold(c_tree_build_binary_typed_expr(code, CTreeType(t), arg0, con)), var); + + if (c_tree_is_integer_zerop(CTreeExprOperand(t, 0)) + && CTreeNodeCode(t) == C_PLUS_EXPR) + return c_convert_expr(CTreeType(t), var); + return t; + } + } + binary: +# ifdef LUDO_NO_SKIP +#if defined (REAL_IS_NOT_DOUBLE) && ! defined (REAL_ARITHMETIC) + if (CTreeNodeCode(arg1) == C_REAL_CST_NODE) + return t; +#endif /* REAL_IS_NOT_DOUBLE, and no REAL_ARITHMETIC */ +# endif + if (wins) + t1 = c_const_binop(code, arg0, arg1, 0); + if (t1 != NULL) + { + /* The return value should always have + the same type as the original expression. */ + if (CTreeType(t1) != CTreeType(t)) + t1 = c_convert_expr(CTreeType(t), t1); + + return t1; + } + return t; + + case C_MINUS_EXPR: + if (! FLOAT_TYPE_P (type)) + { + if (! wins && c_tree_is_integer_zerop(arg0)) + return c_tree_build_unary_typed_expr(C_NEGATE_EXPR, type, arg1); + if (c_tree_is_integer_zerop(arg1)) + return c_get_non_lvalue(c_convert_expr(type, arg0)); + + /* (A * C) - (B * C) -> (A-B) * C. Since we are most concerned + about the case where C is a constant, just try one of the + four possibilities. */ + + if (CTreeNodeCode(arg0) == C_MULT_EXPR && CTreeNodeCode(arg1) == C_MULT_EXPR + && c_is_operand_equal_p(CTreeExprOperand(arg0, 1), + CTreeExprOperand(arg1, 1), 0)) + return c_fold(c_tree_build_binary_typed_expr(C_MULT_EXPR, type, + c_fold(c_tree_build_binary_typed_expr(C_MINUS_EXPR, type, + CTreeExprOperand(arg0, 0), + CTreeExprOperand(arg1, 0))), + CTreeExprOperand(arg0, 1))); + } + /* Convert A - (-B) to A + B. */ + else if (CTreeNodeCode(arg1) == C_NEGATE_EXPR) + return c_fold( + c_tree_build_binary_typed_expr( + C_PLUS_EXPR, type, arg0, CTreeExprOperand(arg1, 0))); + + else if ( +# ifdef LUDO_NO_SKIP + TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT +# else + 1 +# endif + || c_flag_fast_math) + { + /* Except with IEEE floating point, 0-x equals -x. */ + if (! wins && c_tree_is_real_zerop(arg0)) + return c_tree_build_unary_typed_expr(C_NEGATE_EXPR, type, arg1); + /* Except with IEEE floating point, x-0 equals x. */ + if (c_tree_is_real_zerop(arg1)) + return c_get_non_lvalue(c_convert_expr(type, arg0)); + } + + /* Fold &x - &x. This can happen from &x.foo - &x. + This is unsafe for certain floats even in non-IEEE formats. + In IEEE, it is unsafe because it does wrong for NaNs. + Also note that c_is_operand_equal_pis always false if an operand + is volatile. */ + + if ((! FLOAT_TYPE_P (type) || c_flag_fast_math) + && c_is_operand_equal_p(arg0, arg1, 0)) + return c_convert_expr(type, c_integer_zero_node); + + goto associate; + + case C_MULT_EXPR: + if (! FLOAT_TYPE_P (type)) + { + if (c_tree_is_integer_zerop(arg1)) + return c_omit_one_operand(type, arg1, arg0); + if (c_tree_is_integer_onep(arg1)) + return c_get_non_lvalue(c_convert_expr(type, arg0)); + + /* ((A / C) * C) is A if the division is an + EXACT_DIV_EXPR. Since C is normally a constant, + just check for one of the four possibilities. */ + + if (CTreeNodeCode(arg0) == C_EXACT_DIV_EXPR + && c_is_operand_equal_p(CTreeExprOperand(arg0, 1), arg1, 0)) + return CTreeExprOperand(arg0, 0); + + /* (a * (1 << b)) is (a << b) */ + if (CTreeNodeCode(arg1) == C_LSHIFT_EXPR + && c_tree_is_integer_onep(CTreeExprOperand(arg1, 0))) + return c_fold(c_tree_build_binary_typed_expr(C_LSHIFT_EXPR, type, arg0, + CTreeExprOperand(arg1, 1))); + if (CTreeNodeCode(arg0) == C_LSHIFT_EXPR + && c_tree_is_integer_onep(CTreeExprOperand(arg0, 0))) + return c_fold(c_tree_build_binary_typed_expr(C_LSHIFT_EXPR, type, arg1, + CTreeExprOperand(arg0, 1))); + } + else + { + /* x*0 is 0, except for IEEE floating point. */ + if (( +# ifdef LUDO_NO_SKIP + TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT +# else + 1 +# endif + || c_flag_fast_math) + && c_tree_is_real_zerop(arg1)) + return c_omit_one_operand(type, arg1, arg0); + /* In IEEE floating point, x*1 is not equivalent to x for snans. + However, ANSI says we can drop signals, + so we can do this anyway. */ + if (c_tree_is_real_onep(arg1)) + return c_get_non_lvalue(c_convert_expr(type, arg0)); + /* x*2 is x+x */ + if (! wins && c_tree_is_real_twop(arg1) && c_current_function_decl != 0) + { +# ifdef LUDO_NO_SKIP + c_tree_node *arg = save_expr (arg0); +# else + c_tree_node *arg = arg0; +# endif + return c_tree_build_binary_typed_expr(C_PLUS_EXPR, type, arg, arg); + } + } + goto associate; + + case C_BIT_IOR_EXPR: + bit_ior: + { + int code0, code1; + + if (c_tree_is_integer_all_onesp(arg1)) + return c_omit_one_operand(type, arg1, arg0); + if (c_tree_is_integer_zerop(arg1)) + return c_get_non_lvalue(c_convert_expr(type, arg0)); + t1 = c_distribute_bit_expr(code, type, arg0, arg1); + if (t1 != NULL) + return t1; + + /* (A << C1) | (A >> C2) if A is unsigned and C1+C2 is the size of A + is a rotate of A by C1 bits. */ + /* (A << B) | (A >> (Z - B)) if A is unsigned and Z is the size of A + is a rotate of A by B bits. */ + + code0 = CTreeNodeCode(arg0); + code1 = CTreeNodeCode(arg1); + if (((code0 == C_RSHIFT_EXPR && code1 == C_LSHIFT_EXPR) + || (code1 == C_RSHIFT_EXPR && code0 == C_LSHIFT_EXPR)) + && c_is_operand_equal_p(CTreeExprOperand(arg0, 0), CTreeExprOperand(arg1,0), 0) + && CIsTreeNodeUnsigned(CTreeType(CTreeExprOperand(arg0, 0)))) + { + c_tree_node *tree01; + c_tree_node *tree11; + int code01, code11; + + tree01 = CTreeExprOperand(arg0, 1); + tree11 = CTreeExprOperand(arg1, 1); + code01 = CTreeNodeCode(tree01); + code11 = CTreeNodeCode(tree11); + if (code01 == C_INT_CST_NODE + && code11 == C_INT_CST_NODE + && CTreeIntCstHigh(tree01) == 0 + && CTreeIntCstHigh(tree11) == 0 + && ((CTreeIntCstLow(tree01) + CTreeIntCstLow(tree11)) + == CTreeTypePrecision(CTreeType(CTreeExprOperand(arg0, 0))))) + return + c_tree_build_binary_typed_expr(C_LROTATE_EXPR, type, CTreeExprOperand(arg0, 0), + code0 == C_LSHIFT_EXPR ? tree01 : tree11); + else if (code11 == C_MINUS_EXPR + && CTreeNodeCode(CTreeExprOperand(tree11, 0)) == C_INT_CST_NODE + && CTreeIntCstHigh(CTreeExprOperand(tree11, 0)) == 0 + && CTreeIntCstLow(CTreeExprOperand(tree11, 0)) + == CTreeTypePrecision(CTreeType(CTreeExprOperand(arg0, 0))) + && c_is_operand_equal_p(tree01, CTreeExprOperand(tree11, 1), 0)) + return + c_tree_build_binary_typed_expr( + code0 == C_LSHIFT_EXPR ? C_LROTATE_EXPR : C_RROTATE_EXPR, + type, CTreeExprOperand(arg0, 0), tree01); + else if (code01 == C_MINUS_EXPR + && CTreeNodeCode(CTreeExprOperand(tree01, 0)) == C_INT_CST_NODE + && CTreeIntCstHigh(CTreeExprOperand(tree01, 0)) == 0 + && CTreeIntCstLow(CTreeExprOperand(tree01, 0)) + == CTreeTypePrecision(CTreeType(CTreeExprOperand(arg0, 0))) + && c_is_operand_equal_p(tree11, CTreeExprOperand(tree01, 1), 0)) + return + c_tree_build_binary_typed_expr( + code0 != C_LSHIFT_EXPR ? C_LROTATE_EXPR : C_RROTATE_EXPR, + type, CTreeExprOperand(arg0, 0), tree11); + } + + goto associate; + } + + case C_BIT_XOR_EXPR: + if (c_tree_is_integer_zerop(arg1)) + return c_get_non_lvalue(c_convert_expr(type, arg0)); + if (c_tree_is_integer_all_onesp(arg1)) + return c_fold(c_tree_build_unary_typed_expr(C_BIT_NOT_EXPR, type, arg0)); + goto associate; + + case C_BIT_AND_EXPR: + bit_and: + if (c_tree_is_integer_all_onesp(arg1)) + return c_get_non_lvalue(c_convert_expr(type, arg0)); + if (c_tree_is_integer_zerop(arg1)) + return c_omit_one_operand(type, arg1, arg0); + t1 = c_distribute_bit_expr(code, type, arg0, arg1); + if (t1 != NULL) + return t1; + /* Simplify ((int)c & 0x377) into (int)c, if c is unsigned char. */ + if (CTreeNodeCode(arg0) == C_INT_CST_NODE && CTreeNodeCode(arg1) == C_NOP_EXPR + && CIsTreeNodeUnsigned(CTreeType(CTreeExprOperand(arg1, 0)))) + { + int prec = CTreeTypePrecision(CTreeType(CTreeExprOperand(arg1, 0))); + if (prec < C_BITS_PER_WORD && prec < C_HOST_BITS_PER_WIDE_INT + && (~CTreeIntCstLow(arg0) + & (((C_HOST_WIDE_INT) 1 << prec) - 1)) == 0) + return c_tree_build_unary_typed_expr(C_NOP_EXPR, type, CTreeExprOperand(arg1, 0)); + } + if (CTreeNodeCode(arg1) == C_INT_CST_NODE && CTreeNodeCode(arg0) == C_NOP_EXPR + && CIsTreeNodeUnsigned(CTreeType(CTreeExprOperand(arg0, 0)))) + { + int prec = CTreeTypePrecision(CTreeType(CTreeExprOperand(arg0, 0))); + if (prec < C_BITS_PER_WORD && prec < C_HOST_BITS_PER_WIDE_INT + && (~CTreeIntCstLow(arg1) + & (((C_HOST_WIDE_INT) 1 << prec) - 1)) == 0) + return c_tree_build_unary_typed_expr(C_NOP_EXPR, type, CTreeExprOperand(arg0, 0)); + } + goto associate; + + case C_BIT_ANDTC_EXPR: + if (c_tree_is_integer_all_onesp(arg0)) + return c_get_non_lvalue(c_convert_expr(type, arg1)); + if (c_tree_is_integer_zerop(arg0)) + return c_omit_one_operand(type, arg0, arg1); + if (CTreeNodeCode(arg1) == C_INT_CST_NODE) + { + arg1 = c_fold(c_tree_build_unary_typed_expr(C_BIT_NOT_EXPR, type, arg1)); + code = C_BIT_AND_EXPR; + goto bit_and; + } + goto binary; + + case C_RDIV_EXPR: + /* In most cases, do nothing with a divide by zero. */ +#if !defined (REAL_IS_NOT_DOUBLE) || defined (REAL_ARITHMETIC) +#ifndef REAL_INFINITY + if (CTreeNodeCode(arg1) == C_REAL_CST_NODE && c_tree_is_real_zerop(arg1)) + return t; +#endif +#endif /* not REAL_IS_NOT_DOUBLE, or REAL_ARITHMETIC */ + + /* In IEEE floating point, x/1 is not equivalent to x for snans. + However, ANSI says we can drop signals, so we can do this anyway. */ + if (c_tree_is_real_onep(arg1)) + return c_get_non_lvalue(c_convert_expr(type, arg0)); + + /* If ARG1 is a constant, we can c_convert_exprthis to a multiply by the + reciprocal. This does not have the same rounding properties, + so only do this if -ffast-math. We can actually always safely + do it if ARG1 is a power of two, but it's hard to tell if it is + or not in a portable manner. */ + if (CTreeNodeCode(arg1) == C_REAL_CST_NODE) + { + if (c_flag_fast_math + && 0 != (tem = c_const_binop(code, + c_tree_build_real(type, 1.0), arg1, 0))) + return c_fold(c_tree_build_binary_typed_expr(C_MULT_EXPR, type, arg0, tem)); + /* Find the reciprocal if optimizing and the result is exact. */ +# ifdef LUDO_NO_SKIP + else if (optimize) + { + REAL_VALUE_TYPE r; + r = CTreeRealCstValue(arg1); + if (c_exact_real_inverse(TYPE_MODE(TREE_TYPE(arg0)), &r)) + { + tem = c_tree_build_real(type, r); + return + c_fold(c_tree_build_binary_typed_expr(C_MULT_EXPR, type, arg0, tem)); + } + } +# endif + } + goto binary; + + case C_TRUNC_DIV_EXPR: + case C_ROUND_DIV_EXPR: + case C_FLOOR_DIV_EXPR: + case C_CEIL_DIV_EXPR: + case C_EXACT_DIV_EXPR: + if (c_tree_is_integer_onep(arg1)) + return c_get_non_lvalue(c_convert_expr(type, arg0)); + if (c_tree_is_integer_zerop(arg1)) + return t; + + /* If we have ((a / C1) / C2) where both division are the same type, try + to simplify. First see if C1 * C2 overflows or not. */ + if (CTreeNodeCode(arg0) == code && CTreeNodeCode(arg1) == C_INT_CST_NODE + && CTreeNodeCode(CTreeExprOperand(arg0, 1)) == C_INT_CST_NODE) + { + c_tree_node *new_divisor; + + new_divisor = c_const_binop(C_MULT_EXPR, CTreeExprOperand(arg0, 1), arg1, 0); + tem = c_const_binop(C_FLOOR_DIV_EXPR, new_divisor, arg1, 0); + + if (CTreeIntCstLow(CTreeExprOperand(arg0, 1)) == CTreeIntCstLow(tem) + && CTreeIntCstHigh(CTreeExprOperand(arg0, 1)) == CTreeIntCstHigh(tem)) + { + /* If no overflow, divide by C1*C2. */ + return + c_fold( + c_tree_build_binary_typed_expr( + code, type, CTreeExprOperand(arg0, 0), new_divisor)); + } + } + + /* Look for ((a * C1) / C3) or (((a * C1) + C2) / C3), + where C1 % C3 == 0 or C3 % C1 == 0. We can simplify these + expressions, which often appear in the offsets or sizes of + objects with a varying size. Only deal with positive divisors + and multiplicands. If C2 is negative, we must have C2 % C3 == 0. + + Look for NOPs and SAVE_EXPRs inside. */ + + if (CTreeNodeCode(arg1) == C_INT_CST_NODE + && c_tree_is_int_cst_sgn(arg1) >= 0) + { + int have_save_expr = 0; + c_tree_node *c2 = c_integer_zero_node; + c_tree_node *xarg0 = arg0; + + if (CTreeNodeCode(xarg0) == C_SAVE_EXPR +# ifdef LUDO_NO_SKIP + && SAVE_EXPR_RTL (xarg0) == 0 +# endif + ) + have_save_expr = 1, xarg0 = CTreeExprOperand(xarg0, 0); + + CStripNops(xarg0); + + if (CTreeNodeCode(xarg0) == C_PLUS_EXPR + && CTreeNodeCode(CTreeExprOperand(xarg0, 1)) == C_INT_CST_NODE) + c2 = CTreeExprOperand(xarg0, 1), xarg0 = CTreeExprOperand(xarg0, 0); + else if (CTreeNodeCode(xarg0) == C_MINUS_EXPR + && CTreeNodeCode(CTreeExprOperand(xarg0, 1)) == C_INT_CST_NODE + /* If we are doing this computation unsigned, the negate + is incorrect. */ + && ! CIsTreeNodeUnsigned(type)) + { + c2 = + c_fold( c_tree_build_unary_typed_expr( + C_NEGATE_EXPR, type, CTreeExprOperand(xarg0, 1))); + xarg0 = CTreeExprOperand(xarg0, 0); + } + + if (CTreeNodeCode(xarg0) == C_SAVE_EXPR +# ifdef LUDO_NO_SKIP + && SAVE_EXPR_RTL (xarg0) == 0 +# endif + ) + have_save_expr = 1, xarg0 = CTreeExprOperand(xarg0, 0); + + CStripNops(xarg0); + + if (CTreeNodeCode(xarg0) == C_MULT_EXPR + && CTreeNodeCode(CTreeExprOperand(xarg0, 1)) == C_INT_CST_NODE + && c_tree_is_int_cst_sgn(CTreeExprOperand(xarg0, 1)) >= 0 + && (c_tree_is_integer_zerop(c_const_binop(C_TRUNC_MOD_EXPR, + CTreeExprOperand(xarg0, 1), arg1, 1)) + || c_tree_is_integer_zerop(c_const_binop(C_TRUNC_MOD_EXPR, arg1, + CTreeExprOperand(xarg0, 1), 1))) + && (c_tree_is_int_cst_sgn(c2) >= 0 + || c_tree_is_integer_zerop(c_const_binop(C_TRUNC_MOD_EXPR, c2, + arg1, 1)))) + { + c_tree_node *outer_div = c_integer_one_node; + c_tree_node *c1 = CTreeExprOperand(xarg0, 1); + c_tree_node *c3 = arg1; + + /* If C3 > C1, set them equal and do a divide by + C3/C1 at the end of the operation. */ + if (c_tree_is_int_cst_lt(c1, c3)) + outer_div = c_const_binop(code, c3, c1, 0), c3 = c1; + + /* The result is A * (C1/C3) + (C2/C3). */ + t = c_fold(c_tree_build_binary_typed_expr(C_PLUS_EXPR, type, + c_fold(c_tree_build_binary_typed_expr(C_MULT_EXPR, type, + CTreeExprOperand(xarg0, 0), + c_const_binop(code, c1, c3, 1))), + c_const_binop(code, c2, c3, 1))); + + if (! c_tree_is_integer_onep(outer_div)) + t = c_fold( c_tree_build_binary_typed_expr( + code, type, t, c_convert_expr(type, outer_div))); + +# ifdef LUDO_NO_SKIP + if (have_save_expr) + t = save_expr (t); +# endif + return t; + } + } + + goto binary; + + case C_CEIL_MOD_EXPR: + case C_FLOOR_MOD_EXPR: + case C_ROUND_MOD_EXPR: + case C_TRUNC_MOD_EXPR: + if (c_tree_is_integer_onep(arg1)) + return c_omit_one_operand(type, c_integer_zero_node, arg0); + if (c_tree_is_integer_zerop(arg1)) + return t; + + /* Look for ((a * C1) % C3) or (((a * C1) + C2) % C3), + where C1 % C3 == 0. Handle similarly to the division case, + but don't bother with SAVE_EXPRs. */ + + if (CTreeNodeCode(arg1) == C_INT_CST_NODE + && ! c_tree_is_integer_zerop(arg1)) + { + c_tree_node *c2 = c_integer_zero_node; + c_tree_node *xarg0 = arg0; + + if (CTreeNodeCode(xarg0) == C_PLUS_EXPR + && CTreeNodeCode(CTreeExprOperand(xarg0, 1)) == C_INT_CST_NODE) + c2 = CTreeExprOperand(xarg0, 1), xarg0 = CTreeExprOperand(xarg0, 0); + else if (CTreeNodeCode(xarg0) == C_MINUS_EXPR + && CTreeNodeCode(CTreeExprOperand(xarg0, 1)) == C_INT_CST_NODE + && ! CIsTreeNodeUnsigned(type)) + { + c2 = c_fold(c_tree_build_unary_typed_expr( + C_NEGATE_EXPR, type, CTreeExprOperand(xarg0, 1))); + xarg0 = CTreeExprOperand(xarg0, 0); + } + + CStripNops(xarg0); + + if (CTreeNodeCode(xarg0) == C_MULT_EXPR + && CTreeNodeCode(CTreeExprOperand(xarg0, 1)) == C_INT_CST_NODE + && c_tree_is_integer_zerop(c_const_binop(C_TRUNC_MOD_EXPR, + CTreeExprOperand(xarg0, 1), + arg1, 1)) + && c_tree_is_int_cst_sgn(c2) >= 0) + /* The result is (C2%C3). */ + return c_omit_one_operand(type, c_const_binop(code, c2, arg1, 1), + CTreeExprOperand(xarg0, 0)); + } + + goto binary; + + case C_LSHIFT_EXPR: + case C_RSHIFT_EXPR: + case C_LROTATE_EXPR: + case C_RROTATE_EXPR: + if (c_tree_is_integer_zerop(arg1)) + return c_get_non_lvalue(c_convert_expr(type, arg0)); + /* Since negative shift count is not well-defined, + don't try to compute it in the compiler. */ + if (CTreeNodeCode(arg1) == C_INT_CST_NODE && c_tree_is_int_cst_sgn(arg1) < 0) + return t; + /* Rewrite an LROTATE_EXPR by a constant into an + RROTATE_EXPR by a new constant. */ +# ifdef LUDO_NO_SKIP + if (code == C_LROTATE_EXPR && CTreeNodeCode(arg1) == C_INT_CST_NODE) + { + CTreeNodeCode(t) = C_RROTATE_EXPR; + code = C_RROTATE_EXPR; + CTreeExprOperand(t, 1) = arg1 + = c_const_binop(C_MINUS_EXPR, + c_convert_expr(CTreeType(arg1), + c_tree_build_int_2(GET_MODE_BITSIZE(CTreeTypeMode(type)), 0)), + arg1, 0); + if (c_tree_is_int_cst_sgn(arg1) < 0) + return t; + } +# endif + + /* If we have a rotate of a bit operation with the rotate count and + the second operand of the bit operation both constant, + permute the two operations. */ + if (code == C_RROTATE_EXPR && CTreeNodeCode(arg1) == C_INT_CST_NODE + && (CTreeNodeCode(arg0) == C_BIT_AND_EXPR + || CTreeNodeCode(arg0) == C_BIT_ANDTC_EXPR + || CTreeNodeCode(arg0) == C_BIT_IOR_EXPR + || CTreeNodeCode(arg0) == C_BIT_XOR_EXPR) + && CTreeNodeCode(CTreeExprOperand(arg0, 1)) == C_INT_CST_NODE) + return c_fold(c_tree_build_binary_typed_expr(CTreeNodeCode(arg0), type, + c_fold(c_tree_build_binary_typed_expr(code, type, + CTreeExprOperand(arg0, 0), arg1)), + c_fold(c_tree_build_binary_typed_expr(code, type, + CTreeExprOperand(arg0, 1), arg1)))); + +# ifdef LUDO_NO_SKIP + /* Two consecutive rotates adding up to the width of the mode can + be ignored. */ + if (code == C_RROTATE_EXPR && CTreeNodeCode(arg1) == C_INT_CST_NODE + && CTreeNodeCode(arg0) == C_RROTATE_EXPR + && CTreeNodeCode(CTreeExprOperand(arg0, 1)) == C_INT_CST_NODE + && CTreeIntCstHigh(arg1) == 0 + && CTreeIntCstHigh(CTreeExprOperand(arg0, 1)) == 0 + && ((CTreeIntCstLow(arg1) + + CTreeIntCstLow(CTreeExprOperand(arg0, 1))) + == GET_MODE_BITSIZE(CTreeTypeMode(type)))) + return CTreeExprOperand(arg0, 0); +# endif + + goto binary; + + case C_MIN_EXPR: + if (c_is_operand_equal_p(arg0, arg1, 0)) + return arg0; + if (INTEGRAL_TYPE_P (type) + && c_is_operand_equal_p(arg1, CTreeTypeMinValue(type), 1)) + return c_omit_one_operand(type, arg1, arg0); + goto associate; + + case C_MAX_EXPR: + if (c_is_operand_equal_p(arg0, arg1, 0)) + return arg0; + if (INTEGRAL_TYPE_P (type) + && c_is_operand_equal_p(arg1, CTreeTypeMaxValue(type), 1)) + return c_omit_one_operand(type, arg1, arg0); + goto associate; + + case C_TRUTH_NOT_EXPR: + /* Note that the operand of this must be an int + and its values must be 0 or 1. + ("true" is a fixed value perhaps depending on the language, + but we don't handle values other than 1 correctly yet.) */ + tem = c_invert_truthvalue(arg0); + /* Avoid infinite recursion. */ + if (CTreeNodeCode(tem) == C_TRUTH_NOT_EXPR) + return t; + return c_convert_expr(type, tem); + + case C_TRUTH_ANDIF_EXPR: + /* Note that the operands of this must be ints + and their values must be 0 or 1. + ("true" is a fixed value perhaps depending on the language.) */ + /* If first arg is constant zero, return it. */ + if (c_tree_is_integer_zerop(arg0)) + return arg0; + case C_TRUTH_AND_EXPR: + /* If either arg is constant true, drop it. */ + if (CTreeNodeCode(arg0) == C_INT_CST_NODE && ! c_tree_is_integer_zerop(arg0)) + return c_get_non_lvalue(arg1); + if (CTreeNodeCode(arg1) == C_INT_CST_NODE && ! c_tree_is_integer_zerop(arg1)) + return c_get_non_lvalue(arg0); + /* If second arg is constant zero, result is zero, but first arg + must be evaluated. */ + if (c_tree_is_integer_zerop(arg1)) + return c_omit_one_operand(type, arg1, arg0); + /* Likewise for first arg, but note that only the TRUTH_AND_EXPR + case will be handled here. */ + if (c_tree_is_integer_zerop(arg0)) + return c_omit_one_operand(type, arg0, arg1); + + truth_andor: + /* We only do these simplifications if we are optimizing. */ +# ifdef LUDO_NO_SKIP + if (!optimize) + return t; + + /* Check for things like (A || B) && (A || C). We can c_convert_exprthis + to A || (B && C). Note that either operator can be any of the four + truth and/or operations and the transformation will still be + valid. Also note that we only care about order for the + ANDIF and ORIF operators. If B contains side effects, this + might change the truth-value of A. */ + if (CTreeNodeCode(arg0) == CTreeNodeCode(arg1) + && (CTreeNodeCode(arg0) == TRUTH_ANDIF_EXPR + || CTreeNodeCode(arg0) == TRUTH_ORIF_EXPR + || CTreeNodeCode(arg0) == TRUTH_AND_EXPR + || CTreeNodeCode(arg0) == TRUTH_OR_EXPR) + && ! TREE_SIDE_EFFECTS (CTreeExprOperand(arg0, 1))) + { + c_tree_node *a00 = CTreeExprOperand(arg0, 0); + c_tree_node *a01 = CTreeExprOperand(arg0, 1); + c_tree_node *a10 = CTreeExprOperand(arg1, 0); + c_tree_node *a11 = CTreeExprOperand(arg1, 1); + int commutative = ((CTreeNodeCode(arg0) == TRUTH_OR_EXPR + || CTreeNodeCode(arg0) == TRUTH_AND_EXPR) + && (code == TRUTH_AND_EXPR + || code == TRUTH_OR_EXPR)); + + if (c_is_operand_equal_p(a00, a10, 0)) + return c_fold(c_tree_build_binary_typed_expr(CTreeNodeCode(arg0), type, a00, + c_fold(c_tree_build_binary_typed_expr(code, type, a01, a11)))); + else if (commutative && c_is_operand_equal_p(a00, a11, 0)) + return c_fold(c_tree_build_binary_typed_expr(CTreeNodeCode(arg0), type, a00, + c_fold(c_tree_build_binary_typed_expr(code, type, a01, a10)))); + else if (commutative && c_is_operand_equal_p(a01, a10, 0)) + return c_fold(c_tree_build_binary_typed_expr(CTreeNodeCode(arg0), type, a01, + c_fold(c_tree_build_binary_typed_expr(code, type, a00, a11)))); + + /* This case if tricky because we must either have commutative + operators or else A10 must not have side-effects. */ + + else if ((commutative || ! TREE_SIDE_EFFECTS (a10)) + && c_is_operand_equal_p(a01, a11, 0)) + return c_fold(c_tree_build_binary_typed_expr(CTreeNodeCode(arg0), type, + c_fold(c_tree_build_binary_typed_expr(code, type, a00, a10)), + a01)); + } + + /* See if we can c_tree_build_binary_typed_expra range comparison. */ + if (0 != (tem = fold_range_test (t))) + return tem; + + /* Check for the possibility of merging component references. If our + lhs is another similar operation, try to merge its rhs with our + rhs. Then try to merge our lhs and rhs. */ + if (CTreeNodeCode(arg0) == code + && 0 != (tem = fold_truthop (code, type, + CTreeExprOperand(arg0, 1), arg1))) + return + c_fold(c_tree_build_binary_typed_expr(code, type, CTreeExprOperand(arg0, 0), tem)); + + if ((tem = fold_truthop (code, type, arg0, arg1)) != 0) + return tem; +# endif + + return t; + + case C_TRUTH_ORIF_EXPR: + /* Note that the operands of this must be ints + and their values must be 0 or true. + ("true" is a fixed value perhaps depending on the language.) */ + /* If first arg is constant true, return it. */ + if (CTreeNodeCode(arg0) == C_INT_CST_NODE && ! c_tree_is_integer_zerop(arg0)) + return arg0; + case C_TRUTH_OR_EXPR: + /* If either arg is constant zero, drop it. */ + if (CTreeNodeCode(arg0) == C_INT_CST_NODE && c_tree_is_integer_zerop(arg0)) + return c_get_non_lvalue(arg1); + if (CTreeNodeCode(arg1) == C_INT_CST_NODE && c_tree_is_integer_zerop(arg1)) + return c_get_non_lvalue(arg0); + /* If second arg is constant true, result is true, but we must + evaluate first arg. */ + if (CTreeNodeCode(arg1) == C_INT_CST_NODE && ! c_tree_is_integer_zerop(arg1)) + return c_omit_one_operand(type, arg1, arg0); + /* Likewise for first arg, but note this only occurs here for + TRUTH_OR_EXPR. */ + if (CTreeNodeCode(arg0) == C_INT_CST_NODE && ! c_tree_is_integer_zerop(arg0)) + return c_omit_one_operand(type, arg0, arg1); + goto truth_andor; + + case C_TRUTH_XOR_EXPR: + /* If either arg is constant zero, drop it. */ + if (c_tree_is_integer_zerop(arg0)) + return c_get_non_lvalue(arg1); + if (c_tree_is_integer_zerop(arg1)) + return c_get_non_lvalue(arg0); + /* If either arg is constant true, this is a logical inversion. */ + if (c_tree_is_integer_onep(arg0)) + return c_get_non_lvalue(c_invert_truthvalue(arg1)); + if (c_tree_is_integer_onep(arg1)) + return c_get_non_lvalue(c_invert_truthvalue(arg0)); + return t; + + case C_EQ_EXPR: + case C_NE_EXPR: + case C_LT_EXPR: + case C_GT_EXPR: + case C_LE_EXPR: + case C_GE_EXPR: + /* If one arg is a constant integer, put it last. */ + if (CTreeNodeCode(arg0) == C_INT_CST_NODE + && CTreeNodeCode(arg1) != C_INT_CST_NODE) + { + CTreeExprOperand(t, 0) = arg1; + CTreeExprOperand(t, 1) = arg0; + arg0 = CTreeExprOperand(t, 0); + arg1 = CTreeExprOperand(t, 1); + code = c_swap_tree_comparison(code); + CTreeNodeCode(t) = code; + } + + /* Convert foo++ == CONST into ++foo == CONST + INCR. + First, see if one arg is constant; find the constant arg + and the other one. */ + { + c_tree_node *constop = 0; + c_tree_node *varop; + int constopnum = -1; + + if (CIsTreeNodeConstant(arg1)) + constopnum = 1, constop = arg1, varop = arg0; + if (CIsTreeNodeConstant(arg0)) + constopnum = 0, constop = arg0, varop = arg1; + + if (constop && CTreeNodeCode(varop) == C_POSTINCREMENT_EXPR) + { + /* This optimization is invalid for ordered comparisons + if CONST+INCR overflows or if foo+incr might overflow. + This optimization is invalid for floating point due to rounding. + For pointer types we assume overflow doesn't happen. */ + if (POINTER_TYPE_P (CTreeType(varop)) + || (! FLOAT_TYPE_P (CTreeType(varop)) + && (code == C_EQ_EXPR || code == C_NE_EXPR))) + { + c_tree_node *newconst + = c_fold(c_tree_build_binary_typed_expr(C_PLUS_EXPR, CTreeType(varop), + constop, CTreeExprOperand(varop, 1))); + CTreeNodeCode(varop) = C_PREINCREMENT_EXPR; + + /* If VAROP is a reference to a bitfield, we must mask + the constant by the width of the field. */ + if (CTreeNodeCode(CTreeExprOperand(varop, 0)) == C_COMPONENT_REF + && CIsTreeDeclBitField(CTreeExprOperand(CTreeExprOperand(varop, 0), 1))) + { + int size + = CTreeIntCstLow(CTreeDeclSize( + CTreeExprOperand(CTreeExprOperand(varop, 0), 1))); + + newconst = c_fold(c_tree_build_binary_typed_expr(C_BIT_AND_EXPR, + CTreeType(varop), newconst, + c_convert_expr(CTreeType(varop), + c_tree_build_int_2(size, 0)))); + } + + + t = c_tree_build_binary_typed_expr(code, type, CTreeExprOperand(t, 0), + CTreeExprOperand(t, 1)); + CTreeExprOperand(t, constopnum) = newconst; + return t; + } + } + else if (constop && CTreeNodeCode(varop) == C_POSTDECREMENT_EXPR) + { + if (POINTER_TYPE_P (CTreeType(varop)) + || (! FLOAT_TYPE_P (CTreeType(varop)) + && (code == C_EQ_EXPR || code == C_NE_EXPR))) + { + c_tree_node *newconst + = c_fold(c_tree_build_binary_typed_expr(C_MINUS_EXPR, CTreeType(varop), + constop, CTreeExprOperand(varop, 1))); + CTreeNodeCode(varop) = C_PREDECREMENT_EXPR; + + if (CTreeNodeCode(CTreeExprOperand(varop, 0)) == C_COMPONENT_REF + && CIsTreeDeclBitField(CTreeExprOperand(CTreeExprOperand(varop, 0), 1))) + { + int size + = CTreeIntCstLow(CTreeDeclSize(CTreeExprOperand( + CTreeExprOperand(varop, 0), 1))); + + newconst = c_fold(c_tree_build_binary_typed_expr(C_BIT_AND_EXPR, + CTreeType(varop), newconst, + c_convert_expr(CTreeType(varop), + c_tree_build_int_2(size, 0)))); + } + + + t = c_tree_build_binary_typed_expr(code, type, CTreeExprOperand(t, 0), + CTreeExprOperand(t, 1)); + CTreeExprOperand(t, constopnum) = newconst; + return t; + } + } + } + + /* Change X >= CST to X > (CST - 1) if CST is positive. */ + if (CTreeNodeCode(arg1) == C_INT_CST_NODE + && CTreeNodeCode(arg0) != C_INT_CST_NODE + && c_tree_is_int_cst_sgn(arg1) > 0) + { + switch (CTreeNodeCode(t)) + { + case C_GE_EXPR: + code = C_GT_EXPR; + arg1 = c_const_binop(C_MINUS_EXPR, arg1, c_integer_one_node, 0); + t = c_tree_build_binary_typed_expr(code, type, CTreeExprOperand(t, 0), arg1); + break; + + case C_LT_EXPR: + code = C_LE_EXPR; + arg1 = c_const_binop(C_MINUS_EXPR, arg1, c_integer_one_node, 0); + t = c_tree_build_binary_typed_expr(code, type, CTreeExprOperand(t, 0), arg1); + break; + + default: + break; + } + } + + /* If this is an EQ or NE comparison with zero and ARG0 is + (1 << foo) & bar, c_convert_exprit to (bar >> foo) & 1. Both require + two operations, but the latter can be done in one less insn + on machines that have only two-operand insns or on which a + constant cannot be the first operand. */ + if (c_tree_is_integer_zerop(arg1) && (code == C_EQ_EXPR || code == C_NE_EXPR) + && CTreeNodeCode(arg0) == C_BIT_AND_EXPR) + { + if (CTreeNodeCode(CTreeExprOperand(arg0, 0)) == C_LSHIFT_EXPR + && c_tree_is_integer_onep(CTreeExprOperand(CTreeExprOperand(arg0, 0), 0))) + return + c_fold(c_tree_build_binary_typed_expr(code, type, + c_tree_build_binary_typed_expr(C_BIT_AND_EXPR, CTreeType(arg0), + c_tree_build_binary_typed_expr(C_RSHIFT_EXPR, + CTreeType(CTreeExprOperand(arg0, 0)), + CTreeExprOperand(arg0, 1), + CTreeExprOperand(CTreeExprOperand(arg0, 0), 1)), + c_convert_expr(CTreeType(arg0), + c_integer_one_node)), + arg1)); + else if (CTreeNodeCode(CTreeExprOperand(arg0, 1)) == C_LSHIFT_EXPR + && c_tree_is_integer_onep(CTreeExprOperand(CTreeExprOperand(arg0, 1), 0))) + return + c_fold(c_tree_build_binary_typed_expr(code, type, + c_tree_build_binary_typed_expr(C_BIT_AND_EXPR, CTreeType(arg0), + c_tree_build_binary_typed_expr(C_RSHIFT_EXPR, + CTreeType(CTreeExprOperand(arg0, 1)), + CTreeExprOperand(arg0, 0), + CTreeExprOperand(CTreeExprOperand(arg0, 1), 1)), + c_convert_expr(CTreeType(arg0), + c_integer_one_node)), + arg1)); + } + + /* If this is an NE or EQ comparison of zero against the result of a + signed MOD operation whose second operand is a power of 2, make + the MOD operation unsigned since it is simpler and equivalent. */ + if ((code == C_NE_EXPR || code == C_EQ_EXPR) + && c_tree_is_integer_zerop(arg1) + && ! CIsTreeNodeUnsigned(CTreeType(arg0)) + && (CTreeNodeCode(arg0) == C_TRUNC_MOD_EXPR + || CTreeNodeCode(arg0) == C_CEIL_MOD_EXPR + || CTreeNodeCode(arg0) == C_FLOOR_MOD_EXPR + || CTreeNodeCode(arg0) == C_ROUND_MOD_EXPR) + && c_tree_is_integer_pow2p(CTreeExprOperand(arg0, 1))) + { + c_tree_node *newtype = c_get_unsigned_type(CTreeType(arg0)); + c_tree_node *newmod = c_tree_build_binary_typed_expr(CTreeNodeCode(arg0), newtype, + c_convert_expr(newtype, CTreeExprOperand(arg0, 0)), + c_convert_expr(newtype, CTreeExprOperand(arg0, 1))); + + return c_tree_build_binary_typed_expr( + code, type, newmod, c_convert_expr(newtype, arg1)); + } + + /* If this is an NE comparison of zero with an AND of one, remove the + comparison since the AND will give the correct value. */ + if (code == C_NE_EXPR && c_tree_is_integer_zerop(arg1) + && CTreeNodeCode(arg0) == C_BIT_AND_EXPR + && c_tree_is_integer_onep(CTreeExprOperand(arg0, 1))) + return c_convert_expr(type, arg0); + + /* If we have (A & C) == C where C is a power of 2, c_convert_exprthis into + (A & C) != 0. Similarly for NE_EXPR. */ + if ((code == C_EQ_EXPR || code == C_NE_EXPR) + && CTreeNodeCode(arg0) == C_BIT_AND_EXPR + && c_tree_is_integer_pow2p(CTreeExprOperand(arg0, 1)) + && c_is_operand_equal_p(CTreeExprOperand(arg0, 1), arg1, 0)) + return + c_tree_build_binary_typed_expr(code == C_EQ_EXPR ? C_NE_EXPR : C_EQ_EXPR, type, + arg0, c_integer_zero_node); + + /* If X is unsigned, c_convert_exprX < (1 << Y) into X >> Y == 0 + and similarly for >= into !=. */ + if ((code == C_LT_EXPR || code == C_GE_EXPR) + && CIsTreeNodeUnsigned(CTreeType(arg0)) + && CTreeNodeCode(arg1) == C_LSHIFT_EXPR + && c_tree_is_integer_onep(CTreeExprOperand(arg1, 0))) + return c_tree_build_binary_typed_expr(code == C_LT_EXPR ? C_EQ_EXPR : C_NE_EXPR, type, + c_tree_build_binary_typed_expr(C_RSHIFT_EXPR, CTreeType(arg0), arg0, + CTreeExprOperand(arg1, 1)), + c_convert_expr(CTreeType(arg0), c_integer_zero_node)); + + else if ((code == C_LT_EXPR || code == C_GE_EXPR) + && CIsTreeNodeUnsigned(CTreeType(arg0)) + && (CTreeNodeCode(arg1) == C_NOP_EXPR + || CTreeNodeCode(arg1) == C_CONVERT_EXPR) + && CTreeNodeCode(CTreeExprOperand(arg1, 0)) == C_LSHIFT_EXPR + && c_tree_is_integer_onep(CTreeExprOperand(CTreeExprOperand(arg1, 0), 0))) + return + c_tree_build_binary_typed_expr(code == C_LT_EXPR ? C_EQ_EXPR : C_NE_EXPR, type, + c_convert_expr(CTreeType(arg0), + c_tree_build_binary_typed_expr(C_RSHIFT_EXPR, CTreeType(arg0), arg0, + CTreeExprOperand(CTreeExprOperand(arg1, 0), 1))), + c_convert_expr(CTreeType(arg0), c_integer_zero_node)); + + /* Simplify comparison of something with itself. (For IEEE + floating-point, we can only do some of these simplifications.) */ + if (c_is_operand_equal_p(arg0, arg1, 0)) + { + switch (code) + { + case C_EQ_EXPR: + case C_GE_EXPR: + case C_LE_EXPR: + if (INTEGRAL_TYPE_P (CTreeType(arg0))) + { + if (type == c_integer_type_node) + return c_integer_one_node; + + t = c_tree_build_int_2(1, 0); + CTreeType(t) = type; + return t; + } + code = C_EQ_EXPR; + CTreeNodeCode(t) = code; + break; + + case C_NE_EXPR: + /* For NE, we can only do this simplification if integer. */ + if (! INTEGRAL_TYPE_P (CTreeType(arg0))) + break; + /* ... fall through ... */ + case C_GT_EXPR: + case C_LT_EXPR: + if (type == c_integer_type_node) + return c_integer_zero_node; + + t = c_tree_build_int_2(0, 0); + CTreeType(t) = type; + return t; + default: + abort (); + } + } + + /* An unsigned comparison against 0 can be simplified. */ + if (c_tree_is_integer_zerop(arg1) + && (INTEGRAL_TYPE_P (CTreeType(arg1)) + || POINTER_TYPE_P (CTreeType(arg1))) + && CIsTreeNodeUnsigned(CTreeType(arg1))) + { + switch (CTreeNodeCode(t)) + { + case C_GT_EXPR: + code = C_NE_EXPR; + CTreeNodeCode(t) = C_NE_EXPR; + break; + case C_LE_EXPR: + code = C_EQ_EXPR; + CTreeNodeCode(t) = C_EQ_EXPR; + break; + case C_GE_EXPR: + return c_omit_one_operand(type, + c_convert_expr(type, c_integer_one_node), + arg0); + case C_LT_EXPR: + return c_omit_one_operand(type, + c_convert_expr(type, c_integer_zero_node), + arg0); + default: + break; + } + } + + /* An unsigned <= 0x7fffffff can be simplified. */ + { + int width = CTreeTypePrecision(CTreeType(arg1)); + if (CTreeNodeCode(arg1) == C_INT_CST_NODE + && ! CIsTreeNodeCstOverflow(arg1) + && width <= C_HOST_BITS_PER_WIDE_INT + && CTreeIntCstLow(arg1) == ((C_HOST_WIDE_INT) 1 << (width - 1)) - 1 + && CTreeIntCstHigh(arg1) == 0 + && (INTEGRAL_TYPE_P (CTreeType(arg1)) + || POINTER_TYPE_P (CTreeType(arg1))) + && CIsTreeNodeUnsigned(CTreeType(arg1))) + { + switch (CTreeNodeCode(t)) + { + case C_LE_EXPR: + return c_fold(c_tree_build_binary_typed_expr(C_GE_EXPR, type, + c_convert_expr(c_get_signed_type(CTreeType(arg0)), + arg0), + c_convert_expr(c_get_signed_type(CTreeType(arg1)), + c_integer_zero_node))); + case C_GT_EXPR: + return c_fold(c_tree_build_binary_typed_expr(C_LT_EXPR, type, + c_convert_expr( c_get_signed_type(CTreeType(arg0)), + arg0), + c_convert_expr( c_get_signed_type(CTreeType(arg1)), + c_integer_zero_node))); + } + } + } + + /* If we are comparing an expression that just has comparisons + of two integer values, arithmetic expressions of those comparisons, + and constants, we can simplify it. There are only three cases + to check: the two values can either be equal, the first can be + greater, or the second can be greater. Fold the expression for + those three values. Since each value must be 0 or 1, we have + eight possibilities, each of which corresponds to the constant 0 + or 1 or one of the six possible comparisons. + + This handles common cases like (a > b) == 0 but also handles + expressions like ((x > y) - (y > x)) > 0, which supposedly + occur in macroized code. */ + + if (CTreeNodeCode(arg1) == C_INT_CST_NODE && + CTreeNodeCode(arg0) != C_INT_CST_NODE) + { + c_tree_node *cval1 = 0; + c_tree_node *cval2 = 0; + int save_p = 0; + + if (c_twoval_comparison_p(arg0, &cval1, &cval2, &save_p) + /* Don't handle degenerate cases here; they should already + have been handled anyway. */ + && cval1 != 0 && cval2 != 0 + && ! (CIsTreeNodeConstant(cval1) && CIsTreeNodeConstant(cval2)) + && CTreeType(cval1) == CTreeType(cval2) + && INTEGRAL_TYPE_P (CTreeType(cval1)) + && ! c_is_operand_equal_p(CTreeTypeMinValue(CTreeType(cval1)), + CTreeTypeMaxValue(CTreeType(cval2)), 0)) + { + c_tree_node *maxval = CTreeTypeMaxValue(CTreeType(cval1)); + c_tree_node *minval = CTreeTypeMinValue(CTreeType(cval1)); + + /* We can't just pass T to c_eval_substin case cval1 or cval2 + was the same as ARG1. */ + + c_tree_node *high_result + = c_fold(c_tree_build_binary_typed_expr(code, type, + c_eval_subst(arg0, cval1, maxval, cval2, minval), + arg1)); + c_tree_node *equal_result + = c_fold(c_tree_build_binary_typed_expr(code, type, + c_eval_subst(arg0, cval1, maxval, cval2, maxval), + arg1)); + c_tree_node *low_result + = c_fold(c_tree_build_binary_typed_expr(code, type, + c_eval_subst(arg0, cval1, minval, cval2, maxval), + arg1)); + + /* All three of these results should be 0 or 1. Confirm they + are. Then use those values to select the proper code + to use. */ + + if ((c_tree_is_integer_zerop(high_result) + || c_tree_is_integer_onep(high_result)) + && (c_tree_is_integer_zerop(equal_result) + || c_tree_is_integer_onep(equal_result)) + && (c_tree_is_integer_zerop(low_result) + || c_tree_is_integer_onep(low_result))) + { + /* Make a 3-bit mask with the high-order bit being the + value for `>', the next for '=', and the low for '<'. */ + switch ((c_tree_is_integer_onep(high_result) * 4) + + (c_tree_is_integer_onep(equal_result) * 2) + + c_tree_is_integer_onep(low_result)) + { + case 0: + /* Always false. */ + return c_omit_one_operand(type, c_integer_zero_node, arg0); + case 1: + code = C_LT_EXPR; + break; + case 2: + code = C_EQ_EXPR; + break; + case 3: + code = C_LE_EXPR; + break; + case 4: + code = C_GT_EXPR; + break; + case 5: + code = C_NE_EXPR; + break; + case 6: + code = C_GE_EXPR; + break; + case 7: + /* Always true. */ + return c_omit_one_operand(type, c_integer_one_node, arg0); + } + + t = c_tree_build_binary_typed_expr(code, type, cval1, cval2); + if (save_p) +# ifdef LUDO_NO_SKIP + return save_expr (t); +# else + return t; +# endif + else + return c_fold(t); + } + } + } + + /* If this is a comparison of a field, we may be able to simplify it. */ +# ifdef LUDO_NO_SKIP + if ((CTreeNodeCode(arg0) == C_COMPONENT_REF + || CTreeNodeCode(arg0) == C_BIT_FIELD_REF) + && (code == C_EQ_EXPR || code == C_NE_EXPR) + /* Handle the constant case even without -O + to make sure the warnings are given. */ + && (optimize || CTreeNodeCode(arg1) == C_INT_CST_NODE)) + { + t1 = c_optimize_bit_field_compare(code, type, arg0, arg1); + return t1 ? t1 : t; + } +# endif + + /* If this is a comparison of complex values and either or both + sizes are a COMPLEX_EXPR, it is best to split up the comparisons + and join them with a TRUTH_ANDIF_EXPR or TRUTH_ORIF_EXPR. This + may prevent needless evaluations. */ + if ((code == C_EQ_EXPR || code == C_NE_EXPR) + && CTreeNodeCode(CTreeType(arg0)) == C_COMPLEX_TYPE + && (CTreeNodeCode(arg0) == C_COMPLEX_EXPR + || CTreeNodeCode(arg1) == C_COMPLEX_EXPR)) + { + c_tree_node *subtype = CTreeType(CTreeType(arg0)); + c_tree_node *real0 = + c_fold(c_tree_build_unary_typed_expr(C_REALPART_EXPR, subtype, arg0)); + c_tree_node *imag0 = + c_fold(c_tree_build_unary_typed_expr(C_IMAGPART_EXPR, subtype, arg0)); + c_tree_node *real1 = + c_fold(c_tree_build_unary_typed_expr(C_REALPART_EXPR, subtype, arg1)); + c_tree_node *imag1 = + c_fold(c_tree_build_unary_typed_expr(C_IMAGPART_EXPR, subtype, arg1)); + + return c_fold(c_tree_build_binary_typed_expr( + (code == C_EQ_EXPR ? C_TRUTH_ANDIF_EXPR : C_TRUTH_ORIF_EXPR), type, + c_fold(c_tree_build_binary_typed_expr(code, type, real0, real1)), + c_fold(c_tree_build_binary_typed_expr(code, type, imag0, imag1)))); + } + + /* From here on, the only cases we handle are when the result is + known to be a constant. + + To compute GT, swap the arguments and do LT. + To compute GE, do LT and invert the result. + To compute LE, swap the arguments, do LT and invert the result. + To compute NE, do EQ and invert the result. + + Therefore, the code below must handle only EQ and LT. */ + + if (code == C_LE_EXPR || code == C_GT_EXPR) + { + tem = arg0, arg0 = arg1, arg1 = tem; + code = c_swap_tree_comparison(code); + } + + /* Note that it is safe to invert for real values here because we + will check below in the one case that it matters. */ + + invert = 0; + if (code == C_NE_EXPR || code == C_GE_EXPR) + { + invert = 1; + code = c_invert_tree_comparison(code); + } + + /* Compute a result for LT or EQ if args permit; + otherwise return T. */ + if (CTreeNodeCode(arg0) == C_INT_CST_NODE && CTreeNodeCode(arg1) == C_INT_CST_NODE) + { + if (code == C_EQ_EXPR) + t1 = c_tree_build_int_2((CTreeIntCstLow(arg0) + == CTreeIntCstLow(arg1)) + && (CTreeIntCstHigh(arg0) + == CTreeIntCstHigh(arg1)), + 0); + else + t1 = c_tree_build_int_2((CIsTreeNodeUnsigned(CTreeType(arg0)) + ? INT_CST_LT_UNSIGNED (arg0, arg1) + : INT_CST_LT (arg0, arg1)), + 0); + } + /* Two real constants can be compared explicitly. */ + else if (CTreeNodeCode(arg0) == C_REAL_CST_NODE && + CTreeNodeCode(arg1) == C_REAL_CST_NODE) + { + /* If either operand is a NaN, the result is false with two + exceptions: First, an NE_EXPR is true on NaNs, but that case + is already handled correctly since we will be inverting the + result for NE_EXPR. Second, if we had inverted a LE_EXPR + or a GE_EXPR into a LT_EXPR, we must return true so that it + will be inverted into false. */ + +# ifdef LUDO_NO_SKIP + if (REAL_VALUE_ISNAN (TREE_REAL_CST (arg0)) + || REAL_VALUE_ISNAN (TREE_REAL_CST (arg1))) + t1 = c_tree_build_int_2(invert && code == LT_EXPR, 0); + else +# endif + if (code == C_EQ_EXPR) + t1 = c_tree_build_int_2(REAL_VALUES_EQUAL ( + CTreeRealCstValue(arg0), CTreeRealCstValue(arg1)), + 0); + else + t1 = c_tree_build_int_2(REAL_VALUES_LESS (CTreeRealCstValue(arg0), + CTreeRealCstValue(arg1)), + 0); + } + + if (t1 == NULL) + return t; + + if (invert) + CTreeIntCstLow(t1) ^= 1; + + CTreeType(t1) = type; + return t1; + + case C_COND_EXPR: + /* Pedantic ANSI C says that a conditional expression is never an lvalue, + so all simple results must be passed through pedantic_non_lvalue. */ + if (CTreeNodeCode(arg0) == C_INT_CST_NODE) + return c_get_pedantic_non_lvalue( + CTreeExprOperand(t, (c_tree_is_integer_zerop(arg0) ? 2 : 1))); + else if (c_is_operand_equal_p(arg1, CTreeExprOperand(expr, 2), 0)) + return c_pedantic_omit_one_operand(type, arg1, arg0); + + /* If the second operand is zero, invert the comparison and swap + the second and third operands. Likewise if the second operand + is constant and the third is not or if the third operand is + equivalent to the first operand of the comparison. */ + + if (c_tree_is_integer_zerop(arg1) + || (CIsTreeNodeConstant(arg1) && ! CIsTreeNodeConstant(CTreeExprOperand(t, 2))) + || (c_tree_get_code_class(CTreeNodeCode(arg0)) == '<' + && c_is_operand_equal_for_comparison_p( + CTreeExprOperand(arg0, 0), CTreeExprOperand(t, 2), + CTreeExprOperand(arg0, 1)))) + { + /* See if this can be inverted. If it can't, possibly because + it was a floating-point inequality comparison, don't do + anything. */ + tem = c_invert_truthvalue(arg0); + + if (CTreeNodeCode(tem) != C_TRUTH_NOT_EXPR) + { + t = c_tree_build_ternary_typed_expr(code, type, tem, + CTreeExprOperand(t, 2), CTreeExprOperand(t, 1)); + arg0 = tem; + arg1 = CTreeExprOperand(t, 2); + CStripNops(arg1); + } + } + + /* If we have A op B ? A : C, we may be able to c_convert_exprthis to a + simpler expression, depending on the operation and the values + of B and C. IEEE floating point prevents this though, + because A or B might be -0.0 or a NaN. */ + + if (c_tree_get_code_class(CTreeNodeCode(arg0)) == '<' + && ( +# ifdef LUDO_NO_SKIP + TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT || +# endif + ! FLOAT_TYPE_P (CTreeType(CTreeExprOperand(arg0, 0))) + || c_flag_fast_math) + && c_is_operand_equal_for_comparison_p(CTreeExprOperand(arg0, 0), + arg1, CTreeExprOperand(arg0, 1))) + { + c_tree_node *arg2 = CTreeExprOperand(t, 2); + int comp_code = CTreeNodeCode(arg0); + + CStripNops(arg2); + + /* If we have A op 0 ? A : -A, this is A, -A, abs (A), or abs (-A), + depending on the comparison operation. */ + if ((FLOAT_TYPE_P (CTreeType(CTreeExprOperand(arg0, 1))) + ? c_tree_is_real_zerop(CTreeExprOperand(arg0, 1)) + : c_tree_is_integer_zerop(CTreeExprOperand(arg0, 1))) + && CTreeNodeCode(arg2) == C_NEGATE_EXPR + && c_is_operand_equal_p(CTreeExprOperand(arg2, 0), arg1, 0)) + switch (comp_code) + { + case C_EQ_EXPR: + return c_get_pedantic_non_lvalue( + c_fold(c_tree_build_unary_typed_expr(C_NEGATE_EXPR, type, arg1))); + case C_NE_EXPR: + return c_get_pedantic_non_lvalue(c_convert_expr(type, arg1)); + case C_GE_EXPR: + case C_GT_EXPR: + return c_get_pedantic_non_lvalue( + c_convert_expr(type, c_fold(c_tree_build_unary_typed_expr(C_ABS_EXPR, + CTreeType(arg1), arg1)))); + case C_LE_EXPR: + case C_LT_EXPR: + return c_get_pedantic_non_lvalue( + c_fold(c_tree_build_unary_typed_expr(C_NEGATE_EXPR, type, + c_convert_expr(type, + c_fold(c_tree_build_unary_typed_expr(C_ABS_EXPR, + CTreeType(arg1), + arg1)))))); + default: + abort (); + } + + /* If this is A != 0 ? A : 0, this is simply A. For ==, it is + always zero. */ + + if (c_tree_is_integer_zerop(CTreeExprOperand(arg0, 1)) && + c_tree_is_integer_zerop(arg2)) + { + if (comp_code == C_NE_EXPR) + return c_get_pedantic_non_lvalue(c_convert_expr(type, arg1)); + else if (comp_code == C_EQ_EXPR) + return c_get_pedantic_non_lvalue(c_convert_expr(type, c_integer_zero_node)); + } + + /* If this is A op B ? A : B, this is either A, B, min (A, B), + or max (A, B), depending on the operation. */ + + if (c_is_operand_equal_for_comparison_p(CTreeExprOperand(arg0, 1), + arg2, CTreeExprOperand(arg0, 0))) + { + c_tree_node *comp_op0 = CTreeExprOperand(arg0, 0); + c_tree_node *comp_op1 = CTreeExprOperand(arg0, 1); + c_tree_node *comp_type = CTreeType(comp_op0); + + switch (comp_code) + { + case C_EQ_EXPR: + return c_get_pedantic_non_lvalue(c_convert_expr(type, arg2)); + case C_NE_EXPR: + return c_get_pedantic_non_lvalue(c_convert_expr(type, arg1)); + case C_LE_EXPR: + case C_LT_EXPR: + /* In C++ a ?: expression can be an lvalue, so put the + operand which will be used if they are equal first + so that we can c_convert_exprthis back to the + corresponding COND_EXPR. */ + return c_get_pedantic_non_lvalue( + c_convert_expr( + type, (c_fold(c_tree_build_binary_typed_expr(C_MIN_EXPR, comp_type, + (comp_code == C_LE_EXPR + ? comp_op0 : comp_op1), + (comp_code == C_LE_EXPR + ? comp_op1 : comp_op0)))))); + break; + case C_GE_EXPR: + case C_GT_EXPR: + return c_get_pedantic_non_lvalue( + c_convert_expr(type, + c_fold(c_tree_build_binary_typed_expr(C_MAX_EXPR, comp_type, + (comp_code == C_GE_EXPR + ? comp_op0 : comp_op1), + (comp_code == C_GE_EXPR + ? comp_op1 : comp_op0))))); + break; + default: + abort (); + } + } + + /* If this is A op C1 ? A : C2 with C1 and C2 constant integers, + we might still be able to simplify this. For example, + if C1 is one less or one more than C2, this might have started + out as a MIN or MAX and been transformed by this function. + Only good for INTEGER_TYPEs, because we need TYPE_MAX_VALUE. */ + + if (INTEGRAL_TYPE_P (type) + && CTreeNodeCode(CTreeExprOperand(arg0, 1)) == C_INT_CST_NODE + && CTreeNodeCode(arg2) == C_INT_CST_NODE) + switch (comp_code) + { + case C_EQ_EXPR: + /* We can replace A with C1 in this case. */ + arg1 = c_convert_expr(type, CTreeExprOperand(arg0, 1)); + t = c_tree_build_ternary_typed_expr(code, type, CTreeExprOperand(t, 0), arg1, + CTreeExprOperand(t, 2)); + break; + + case C_LT_EXPR: + /* If C1 is C2 + 1, this is min(A, C2). */ + if (! c_is_operand_equal_p(arg2, CTreeTypeMaxValue(type), 1) + && c_is_operand_equal_p(CTreeExprOperand(arg0, 1), + c_const_binop(C_PLUS_EXPR, arg2, + c_integer_one_node, 0), 1)) + return c_get_pedantic_non_lvalue( + c_fold(c_tree_build_binary_typed_expr(C_MIN_EXPR, type, arg1, arg2))); + break; + + case C_LE_EXPR: + /* If C1 is C2 - 1, this is min(A, C2). */ + if (! c_is_operand_equal_p(arg2, CTreeTypeMinValue(type), 1) + && c_is_operand_equal_p(CTreeExprOperand(arg0, 1), + c_const_binop(C_MINUS_EXPR, arg2, + c_integer_one_node, 0), 1)) + return c_get_pedantic_non_lvalue( + c_fold(c_tree_build_binary_typed_expr(C_MIN_EXPR, type, arg1, arg2))); + break; + + case C_GT_EXPR: + /* If C1 is C2 - 1, this is max(A, C2). */ + if (! c_is_operand_equal_p(arg2, CTreeTypeMinValue(type), 1) + && c_is_operand_equal_p(CTreeExprOperand(arg0, 1), + c_const_binop(C_MINUS_EXPR, arg2, + c_integer_one_node, 0), 1)) + return c_get_pedantic_non_lvalue( + c_fold(c_tree_build_binary_typed_expr(C_MAX_EXPR, type, arg1, arg2))); + break; + + case C_GE_EXPR: + /* If C1 is C2 + 1, this is max(A, C2). */ + if (! c_is_operand_equal_p(arg2, CTreeTypeMaxValue(type), 1) + && c_is_operand_equal_p(CTreeExprOperand(arg0, 1), + c_const_binop(C_PLUS_EXPR, arg2, + c_integer_one_node, 0), 1)) + return c_get_pedantic_non_lvalue( + c_fold(c_tree_build_binary_typed_expr(C_MAX_EXPR, type, arg1, arg2))); + break; + case C_NE_EXPR: + break; + default: + abort (); + } + } + + /* If the second operand is simpler than the third, swap them + since that produces better jump optimization results. */ + if ((CIsTreeNodeConstant(arg1) || c_tree_get_code_class(CTreeNodeCode(arg1)) == 'd' + || CTreeNodeCode(arg1) == C_SAVE_EXPR) + && ! (CIsTreeNodeConstant(CTreeExprOperand(t, 2)) + || c_tree_get_code_class(CTreeNodeCode(CTreeExprOperand(t, 2))) == 'd' + || CTreeNodeCode(CTreeExprOperand(t, 2)) == C_SAVE_EXPR)) + { + /* See if this can be inverted. If it can't, possibly because + it was a floating-point inequality comparison, don't do + anything. */ + tem = c_invert_truthvalue(arg0); + + if (CTreeNodeCode(tem) != C_TRUTH_NOT_EXPR) + { + t = c_tree_build_ternary_typed_expr(code, type, tem, + CTreeExprOperand(t, 2), CTreeExprOperand(t, 1)); + arg0 = tem; + arg1 = CTreeExprOperand(t, 2); + CStripNops(arg1); + } + } + + /* Convert A ? 1 : 0 to simply A. */ + if (c_tree_is_integer_onep(CTreeExprOperand(t, 1)) + && c_tree_is_integer_zerop(CTreeExprOperand(t, 2)) + /* If we try to c_convert_exprCTreeExprOperand(t, 0) to our type, the + call to c_foldwill try to move the conversion inside + a COND, which will recurse. In that case, the COND_EXPR + is probably the best choice, so leave it alone. */ + && type == CTreeType(arg0)) + return c_get_pedantic_non_lvalue(arg0); + + /* Look for expressions of the form A & 2 ? 2 : 0. The result of this + operation is simply A & 2. */ + + if (c_tree_is_integer_zerop(CTreeExprOperand(t, 2)) + && CTreeNodeCode(arg0) == C_NE_EXPR + && c_tree_is_integer_zerop(CTreeExprOperand(arg0, 1)) + && c_tree_is_integer_pow2p(arg1) + && CTreeNodeCode(CTreeExprOperand(arg0, 0)) == C_BIT_AND_EXPR + && c_is_operand_equal_p(CTreeExprOperand(CTreeExprOperand(arg0, 0), 1), + arg1, 1)) + return c_get_pedantic_non_lvalue(c_convert_expr(type, CTreeExprOperand(arg0, 0))); + + return t; + + case C_COMPOUND_EXPR: + /* When pedantic, a compound expression can be neither an lvalue + nor an integer constant expression. */ + if ( CIsTreeNodeSideEffect(arg0) || c_pedantic) + return t; + /* Don't let (0, 0) be null pointer constant. */ + if (c_tree_is_integer_zerop(arg1)) + return c_get_non_lvalue(arg1); + return arg1; + + case C_COMPLEX_EXPR: + if (wins) + return c_tree_build_complex(type, arg0, arg1); + return t; + + case C_REALPART_EXPR: + if (CTreeNodeCode(CTreeType(arg0)) != C_COMPLEX_TYPE) + return t; + else if (CTreeNodeCode(arg0) == C_COMPLEX_EXPR) + return c_omit_one_operand(type, CTreeExprOperand(arg0, 0), + CTreeExprOperand(arg0, 1)); + else if (CTreeNodeCode(arg0) == C_COMPLEX_NODE) + return CTreeComplexReal(arg0); + else if (CTreeNodeCode(arg0) == C_PLUS_EXPR || CTreeNodeCode(arg0) == C_MINUS_EXPR) + return c_fold(c_tree_build_binary_typed_expr(CTreeNodeCode(arg0), type, + c_fold(c_tree_build_unary_typed_expr(C_REALPART_EXPR, type, + CTreeExprOperand(arg0, 0))), + c_fold(c_tree_build_unary_typed_expr(C_REALPART_EXPR, + type, CTreeExprOperand(arg0, 1))))); + return t; + + case C_IMAGPART_EXPR: + if (CTreeNodeCode(CTreeType(arg0)) != C_COMPLEX_TYPE) + return c_convert_expr(type, c_integer_zero_node); + else if (CTreeNodeCode(arg0) == C_COMPLEX_EXPR) + return c_omit_one_operand(type, CTreeExprOperand(arg0, 1), + CTreeExprOperand(arg0, 0)); + else if (CTreeNodeCode(arg0) == C_COMPLEX_NODE) + return CTreeComplexImag(arg0); + else if (CTreeNodeCode(arg0) == C_PLUS_EXPR || CTreeNodeCode(arg0) == C_MINUS_EXPR) + return c_fold(c_tree_build_binary_typed_expr(CTreeNodeCode(arg0), type, + c_fold(c_tree_build_unary_typed_expr(C_IMAGPART_EXPR, type, + CTreeExprOperand(arg0, 0))), + c_fold(c_tree_build_unary_typed_expr(C_IMAGPART_EXPR, type, + CTreeExprOperand(arg0, 1))))); + return t; + + /* Pull arithmetic ops out of the CLEANUP_POINT_EXPR where + appropriate. */ + case C_CLEANUP_POINT_EXPR: + if (! CIsTreeNodeSideEffect(arg0)) + return CTreeExprOperand(t, 0); + + { + int code0 = CTreeNodeCode(arg0); + int kind0 = c_tree_get_code_class(code0); + c_tree_node *arg00 = CTreeExprOperand(arg0, 0); + c_tree_node *arg01; + + if (kind0 == '1' || code0 == C_TRUTH_NOT_EXPR) + return c_fold(c_tree_build_unary_typed_expr(code0, type, + c_fold(c_tree_build_unary_typed_expr(C_CLEANUP_POINT_EXPR, + CTreeType(arg00), arg00)))); + + if (kind0 == '<' || kind0 == '2' + || code0 == C_TRUTH_ANDIF_EXPR || code0 == C_TRUTH_ORIF_EXPR + || code0 == C_TRUTH_AND_EXPR || code0 == C_TRUTH_OR_EXPR + || code0 == C_TRUTH_XOR_EXPR) + { + arg01 = CTreeExprOperand(arg0, 1); + + if (! CIsTreeNodeSideEffect(arg00)) + return c_fold(c_tree_build_binary_typed_expr(code0, type, arg00, + c_fold(c_tree_build_unary_typed_expr(C_CLEANUP_POINT_EXPR, + CTreeType(arg01), arg01)))); + + if (! CIsTreeNodeSideEffect(arg01)) + return c_fold(c_tree_build_binary_typed_expr(code0, type, + c_fold(c_tree_build_unary_typed_expr(C_CLEANUP_POINT_EXPR, + CTreeType(arg00), arg00)), + arg01)); + } + + return t; + } + + default: + return t; + } /* switch (code) */ + return expr; +} diff --git a/alliance/src/gcp/src/c_foldconst.h b/alliance/src/gcp/src/c_foldconst.h new file mode 100644 index 00000000..9d691fad --- /dev/null +++ b/alliance/src/gcp/src/c_foldconst.h @@ -0,0 +1,87 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : C | +| | +| File : c_foldconst.h | +| | +| Date : 09.07.99 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef C_FOLD_CONST_H +# define C_FOLD_CONST_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +/* Nonzero means lvalues are limited to those valid in pedantic ANSI C. + Zero means allow extended lvalues. */ + extern int c_pedantic_lvalues; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern c_tree_node *c_invert_truthvalue __P((c_tree_node *arg)); + extern c_tree_node *c_non_lvalue __P(( c_tree_node *x)); + extern c_tree_node *c_build_size_binop __P(( int code, c_tree_node *arg0, c_tree_node *arg1)); + extern c_tree_node *c_fold __P((c_tree_node *expr)); + extern int c_is_operand_equal_p __P((c_tree_node *arg0, c_tree_node *arg1, int only_const)); + extern c_tree_node *c_get_pedantic_non_lvalue __P((c_tree_node *x)); + +# endif diff --git a/alliance/src/gcp/src/c_gperf.h b/alliance/src/gcp/src/c_gperf.h new file mode 100644 index 00000000..cbd7b8af --- /dev/null +++ b/alliance/src/gcp/src/c_gperf.h @@ -0,0 +1,219 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/* C code produced by gperf version 2.5 (GNU C++ version) */ +/* Command-line: gperf -p -j1 -i 1 -g -o -t -G -N is_reserved_word -k1,3,$ ./c-parse.gperf */ +/* Command-line: gperf -p -j1 -i 1 -g -o -t -N is_reserved_word -k1,3,$ c-parse.gperf */ +struct resword { char *name; short token; enum rid rid; }; + +#define TOTAL_KEYWORDS 79 +#define MIN_WORD_LENGTH 2 +#define MAX_WORD_LENGTH 20 +#define MIN_HASH_VALUE 10 +#define MAX_HASH_VALUE 144 +/* maximum key range = 135, duplicates = 0 */ + +#ifdef __GNUC__ +inline +#endif +static unsigned int +hash (str, len) + register char *str; + register int unsigned len; +{ + static unsigned char asso_values[] = + { + 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 145, 25, 145, 145, 145, 145, 145, + 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 145, 145, 1, 145, 46, 8, 15, + 61, 6, 36, 48, 3, 5, 145, 18, 63, 25, + 29, 76, 1, 145, 13, 2, 1, 51, 37, 9, + 9, 1, 3, 145, 145, 145, 145, 145, + }; + register int hval = len; + + switch (hval) + { + default: + case 3: + hval += asso_values[(unsigned int)str[2]]; + case 2: + case 1: + hval += asso_values[(unsigned int)str[0]]; + break; + } + return hval + asso_values[(unsigned int)str[len - 1]]; +} + +static struct resword wordlist[] = +{ + {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, + {"",}, + {"int", tok_TYPESPEC, RID_INT}, + {"",}, {"",}, + {"__typeof__", tok_TYPEOF, NORID}, + {"__signed__", tok_TYPESPEC, RID_SIGNED}, + {"__imag__", tok_IMAGPART, NORID}, + {"switch", tok_SWITCH, NORID}, + {"__inline__", tok_SCSPEC, RID_INLINE}, + {"else", tok_ELSE, NORID}, + {"__iterator__", tok_SCSPEC, RID_ITERATOR}, + {"__inline", tok_SCSPEC, RID_INLINE}, + {"__extension__", tok_EXTENSION, NORID}, + {"struct", tok_STRUCT, NORID}, + {"__real__", tok_REALPART, NORID}, + {"__const", tok_TYPE_QUAL, RID_CONST}, + {"while", tok_WHILE, NORID}, + {"__const__", tok_TYPE_QUAL, RID_CONST}, + {"case", tok_CASE, NORID}, + {"__complex__", tok_TYPESPEC, RID_COMPLEX}, + {"__iterator", tok_SCSPEC, RID_ITERATOR}, + {"bycopy", tok_TYPE_QUAL, RID_BYCOPY}, + {"",}, {"",}, {"",}, + {"__complex", tok_TYPESPEC, RID_COMPLEX}, + {"",}, + {"in", tok_TYPE_QUAL, RID_IN}, + {"break", tok_BREAK, NORID}, + {"@defs", tok_DEFS, NORID}, + {"",}, {"",}, {"",}, + {"extern", tok_SCSPEC, RID_EXTERN}, + {"if", tok_IF, NORID}, + {"typeof", tok_TYPEOF, NORID}, + {"typedef", tok_SCSPEC, RID_TYPEDEF}, + {"__typeof", tok_TYPEOF, NORID}, + {"sizeof", tok_SIZEOF, NORID}, + {"",}, + {"return", tok_RETURN, NORID}, + {"const", tok_TYPE_QUAL, RID_CONST}, + {"__volatile__", tok_TYPE_QUAL, RID_VOLATILE}, + {"@private", tok_PRIVATE, NORID}, + {"@selector", tok_SELECTOR, NORID}, + {"__volatile", tok_TYPE_QUAL, RID_VOLATILE}, + {"__asm__", tok_ASM_KEYWORD, NORID}, + {"",}, {"",}, + {"continue", tok_CONTINUE, NORID}, + {"__alignof__", tok_ALIGNOF, NORID}, + {"__imag", tok_IMAGPART, NORID}, + {"__attribute__", tok_ATTRIBUTE, NORID}, + {"",}, {"",}, + {"__attribute", tok_ATTRIBUTE, NORID}, + {"for", tok_FOR, NORID}, + {"",}, + {"@encode", tok_ENCODE, NORID}, + {"id", tok_OBJECTNAME, RID_ID}, + {"static", tok_SCSPEC, RID_STATIC}, + {"@interface", tok_INTERFACE, NORID}, + {"",}, + {"__signed", tok_TYPESPEC, RID_SIGNED}, + {"",}, + {"__label__", tok_LABEL, NORID}, + {"",}, {"",}, + {"__asm", tok_ASM_KEYWORD, NORID}, + {"char", tok_TYPESPEC, RID_CHAR}, + {"",}, + {"inline", tok_SCSPEC, RID_INLINE}, + {"out", tok_TYPE_QUAL, RID_OUT}, + {"register", tok_SCSPEC, RID_REGISTER}, + {"__real", tok_REALPART, NORID}, + {"short", tok_TYPESPEC, RID_SHORT}, + {"",}, + {"enum", tok_ENUM, NORID}, + {"inout", tok_TYPE_QUAL, RID_INOUT}, + {"",}, + {"oneway", tok_TYPE_QUAL, RID_ONEWAY}, + {"union", tok_UNION, NORID}, + {"",}, + {"__alignof", tok_ALIGNOF, NORID}, + {"",}, + {"@implementation", tok_IMPLEMENTATION, NORID}, + {"",}, + {"@class", tok_CLASS, NORID}, + {"",}, + {"@public", tok_PUBLIC, NORID}, + {"asm", tok_ASM_KEYWORD, NORID}, + {"",}, {"",}, {"",}, {"",}, {"",}, + {"default", tok_DEFAULT, NORID}, + {"",}, + {"void", tok_TYPESPEC, RID_VOID}, + {"",}, + {"@protected", tok_PROTECTED, NORID}, + {"@protocol", tok_PROTOCOL, NORID}, + {"",}, {"",}, {"",}, + {"volatile", tok_TYPE_QUAL, RID_VOLATILE}, + {"",}, {"",}, + {"signed", tok_TYPESPEC, RID_SIGNED}, + {"float", tok_TYPESPEC, RID_FLOAT}, + {"@end", tok_END, NORID}, + {"",}, {"",}, + {"unsigned", tok_TYPESPEC, RID_UNSIGNED}, + {"@compatibility_alias", tok_ALIAS, NORID}, + {"double", tok_TYPESPEC, RID_DOUBLE}, + {"",}, {"",}, + {"auto", tok_SCSPEC, RID_AUTO}, + {"",}, + {"goto", tok_GOTO, NORID}, + {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, + {"do", tok_DO, NORID}, + {"",}, {"",}, {"",}, {"",}, + {"long", tok_TYPESPEC, RID_LONG}, +}; + +#ifdef __GNUC__ +inline +#endif +struct resword * +c_is_reserved_word (str, len) + register char *str; + register unsigned int len; +{ + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + { + register char *s = wordlist[key].name; + + if (*s == *str && !strcmp (str + 1, s + 1)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/alliance/src/gcp/src/c_parse.c b/alliance/src/gcp/src/c_parse.c new file mode 100644 index 00000000..389d2f0f --- /dev/null +++ b/alliance/src/gcp/src/c_parse.c @@ -0,0 +1,172 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : VBL | +| | +| File : c_parse.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 01.01.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "gcp.h" + +# include +# include +# include +# include +# include +# include + +# include "c_tree.h" +# include "c_cdecl.h" +# include "c_clex.h" +# include "c_debug.h" +# include "c_flags.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern FILE *c_y_in; + extern int c_y_parse(); + + static char BuffTmpFile[ 64 ]; + static int UnlinkTmpFile = 0; + +void gcpexit( Code ) + + int Code; +{ + if ( UnlinkTmpFile ) + { + unlink( BuffTmpFile ); + } + + autexit( Code ); +} + +/*------------------------------------------------------------\ +| | +| c_tree_parse_file | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_parse_file( InputFileName, Argc, Argv ) + + char *InputFileName; + int Argc; + char **Argv; +{ + struct stat Stat; + char BuffExec[ 2048 ]; + char *ScanArg; + int Index; + int Error; + + if ( stat( InputFileName, &Stat ) ) + { + fprintf( stdout, "Error unable to open file %s\n", InputFileName ); + gcpexit( 1 ); + } + + sprintf( BuffTmpFile, "/tmp/gcp%d", getpid() ); + + ScanArg = BuffExec; + sprintf( ScanArg, "gcc -E %s ", InputFileName ); + ScanArg += strlen( ScanArg ); + + for ( Index = 0; Index < Argc; Index++ ) + { + strcpy( ScanArg, "'" ); + ScanArg += 1; + strcpy( ScanArg, Argv[ Index ] ); + ScanArg += strlen( ScanArg ); + strcpy( ScanArg, "' " ); + ScanArg += 2; + } + + sprintf( ScanArg, "-o %s", BuffTmpFile ); + + UnlinkTmpFile = 1; + + errno = 0; + Error = system( BuffExec ); + + if ( ( Error ) && + ( Error != -1 ) ) + { + fprintf( stdout, + "An error occured while preprocessing %s, exit code %d (errno %d)\n", + InputFileName, Error, errno ); + gcpexit( 2 ); + } + + c_y_in = fopen( BuffTmpFile, "r" ); + + if ( c_y_in == (FILE *)0 ) + { + fprintf( stdout, "Error unable to open file %s\n", BuffTmpFile ); + gcpexit( 3 ); + } + + c_parse_flags( Argc, Argv ); + + c_init_lex( InputFileName ); + c_init_decl_processing(); + + Error = c_y_parse(); + + fclose( c_y_in ); + + unlink( BuffTmpFile ); + UnlinkTmpFile = 0; + + return( c_tree_program_node ); +} diff --git a/alliance/src/gcp/src/c_parse.h b/alliance/src/gcp/src/c_parse.h new file mode 100644 index 00000000..3cc726f9 --- /dev/null +++ b/alliance/src/gcp/src/c_parse.h @@ -0,0 +1,52 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : C | +| | +| File : c_cparse.h | +| | +| Date : 09.07.99 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef C_CPARSE_H +# define C_CPARSE_H + + extern void gcpexit __P(( int Code )); + +# endif + diff --git a/alliance/src/gcp/src/c_stmt.c b/alliance/src/gcp/src/c_stmt.c new file mode 100644 index 00000000..2133e99a --- /dev/null +++ b/alliance/src/gcp/src/c_stmt.c @@ -0,0 +1,93 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : C | +| | +| File : c_stmt.c | +| | +| Date : 09.07.99 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include + +# include "mut.h" +# include "aut.h" +# include "gcp.h" + +# include "c_flags.h" +# include "c_tree.h" +# include "c_treecompat.h" +# include "c_cdecl.h" +# include "c_convert.h" +# include "c_ctypeck.h" +# include "c_stmt.h" +# include "c_debug.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +/* Filename and line number of last line-number note, + whether we actually emitted it or not. */ + + char *c_emit_filename; + int c_emit_lineno; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +void c_emit_line_note(file, line) + char *file; + int line; +{ + c_emit_filename = file; + c_emit_lineno = line; +} diff --git a/alliance/src/gcp/src/c_stmt.h b/alliance/src/gcp/src/c_stmt.h new file mode 100644 index 00000000..46c25fa8 --- /dev/null +++ b/alliance/src/gcp/src/c_stmt.h @@ -0,0 +1,81 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : C | +| | +| File : c_stmt.h | +| | +| Date : 09.07.99 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef C_STMT_H +# define C_STMT_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char *c_emit_filename; + extern int c_emit_lineno; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void c_emit_line_note __P((char *file, int line)); + +# endif diff --git a/alliance/src/gcp/src/c_tree.c b/alliance/src/gcp/src/c_tree.c new file mode 100644 index 00000000..49034aa3 --- /dev/null +++ b/alliance/src/gcp/src/c_tree.c @@ -0,0 +1,2307 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : C | +| | +| File : c_tree.c | +| | +| Date : 09.07.99 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "aut.h" +# include "gcp.h" + +# include "c_tree.h" +# include "c_treecompat.h" +# include "c_debug.h" +# include "c_cdecl.h" +# include "c_debug.h" +# include "c_convert.h" +# include "c_flags.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static authtable *CTreeHashIdentifier = (authtable *)0; + static char *CTreeNameBuiltIn = (char *)0; + + char *C_NODE_CODE_NAME[ C_MAX_NODE_CODE ] = + { + "INT_CST", + "REAL_CST", + "STRING", + "COMPLEX", + "IDENTIFIER", + "LIST", + "VEC", + "EXPR", + "BLOCK", + "TYPE", + "DECL", + "INST", + "ERROR" + }; + + int C_NODE_SIZE[ C_MAX_NODE_CODE ] = + { + sizeof( c_tree_int_cst ), /* INT_CST_NODE */ + sizeof( c_tree_real_cst ), /* REAL_CST_NODE */ + sizeof( c_tree_string ), /* STRING_NODE */ + sizeof( c_tree_complex ), /* COMPLEX_NODE */ + sizeof( c_tree_ident ), /* IDENTIFIER_NODE */ + sizeof( c_tree_list ), /* LIST_NODE */ + sizeof( c_tree_vec ), /* VEC_NODE */ + sizeof( c_tree_expr ), /* EXPR_NODE */ + sizeof( c_tree_block ), /* BLOCK_NODE */ + sizeof( c_tree_type ), /* TYPE_NODE */ + sizeof( c_tree_decl ), /* DECL_NODE */ + sizeof( c_tree_inst ), /* INST_NODE */ + sizeof( c_tree_common ) /* ERROR_NODE */ + }; + + char *C_EXPR_CODE_NAME[ C_MAX_EXPR_CODE ] = + { + "UNKNOWN", + "CONSTRUCTOR", + "COMPOUND", + "MODIFY", + "INIT", + "TARGET", + "COND", + "BIND", + "CALL", + "METHOD_CALL", + "WITH_CLEANUP", + "CLEANUP_POINT", + "PLACEHOLDER", + "WITH_RECORD", + "PLUS", + "MINUS", + "MULT", + "TRUNC_DIV", + "CEIL_DIV", + "FLOOR_DIV", + "ROUND_DIV", + "TRUNC_MOD", + "CEIL_MOD", + "FLOOR_MOD", + "ROUND_MOD", + "RDIV", + "EXACT_DIV", + "FIX_TRUNC", + "FIX_CEIL", + "FIX_FLOOR", + "FIX_ROUND", + "FLOAT", + "EXPON", + "NEGATE", + "MIN", + "MAX", + "ABS", + "FFS", + "LSHIFT", + "RSHIFT", + "LROTATE", + "RROTATE", + "BIT_IOR", + "BIT_XOR", + "BIT_AND", + "BIT_ANDTC", + "BIT_NOT", + "TRUTH_ANDIF", + "TRUTH_ORIF", + "TRUTH_AND", + "TRUTH_OR", + "TRUTH_XOR", + "TRUTH_NOT", + "LT", + "LE", + "GT", + "GE", + "EQ", + "NE", + "IN", + "SET_LE", + "CARD", + "RANGE", + "CONVERT", + "NOP", + "NON_LVALUE", + "SAVE", + "UNSAVE", + "RTL", + "ADDR", + "REFERENCE", + "ENTRY_VALUE", + "COMPLEX", + "CONJ", + "REALPART", + "IMAGPART", + "PREDECREMENT", + "PREINCREMENT", + "POSTDECREMENT", + "POSTINCREMENT", + "TRY_CATCH", + "POPDHC", + "POPDCC", + "LABEL", + "GOTO", + "RETURN", + "EXIT", + "LOOP", + "COMPONENT_REF", + "BIT_FIELD_REF", + "INDIRECT_REF", + "BUFFER_REF", + "ARRAY_REF" + }; + + char *C_TYPE_CODE_NAME[ C_MAX_TYPE_CODE ] = + { + "UNKNOWN", + "VOID", + "INTEGER", + "REAL", + "COMPLEX", + "ENUMERAL", + "BOOLEAN", + "CHAR", + "POINTER", + "OFFSET", + "REFERENCE", + "METHOD", + "FILE", + "ARRAY", + "SET", + "RECORD", + "UNION", + "QUAL_UNION", + "FUNCTION", + "LANG" + }; + + char *C_DECL_CODE_NAME[ C_MAX_DECL_CODE ] = + { + "UNKNOWN", + "FUNCTION", + "LABEL", + "CONST", + "TYPE", + "VAR", + "PARAM", + "RESULT", + "FIELD" + }; + + char *C_INST_CODE_NAME[ C_MAX_INST_CODE ] = + { + "UNKNOWN", + "FOR", + "WHILE", + "DO", + "IF", + "GOTO", + "RETURN", + "CONTINUE", + "BREAK", + "SWITCH", + "CASE" + }; + + char *C_CASE_CODE_NAME[ C_MAX_CASE_CODE ] = + { + "STANDARD", + "RANGE", + "DEFAULT" + }; + + short C_TREE_FORCE_VIEW_NODE = 0; + short C_TREE_VIEW_TYPE_NODE = 0; + short C_TREE_VIEW_SIZE_NODE = 0; + + c_tree_node *C_HEAD_NODE_LIST[ C_MAX_NODE_CODE ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| C Alloc Function | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| C Alloc Tree Node | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_alloc_node( NodeCode ) + + int NodeCode; +{ + c_tree_node *TreeNode; + int FirstCode; + + FirstCode = CFirstCode( NodeCode ); + TreeNode = (c_tree_node *)autallocheap( C_NODE_SIZE[ FirstCode ] ); + CTreeNodeCode( TreeNode ) = NodeCode; + + TreeNode->COMMON.NEXT = C_HEAD_NODE_LIST[ FirstCode ]; + C_HEAD_NODE_LIST[ FirstCode ] = TreeNode; + + return( TreeNode ); +} + +/*------------------------------------------------------------\ +| | +| C Alloc Tree Node Array | +| | +\------------------------------------------------------------*/ + +c_tree_node **c_tree_alloc_node_array( Length ) + + int Length; +{ + return( (c_tree_node **)autallocheap( sizeof( c_tree_node *) * Length ) ); +} + +/*------------------------------------------------------------\ +| | +| C Make Function | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| C Tree Make Node | +| | +\------------------------------------------------------------*/ + +extern int c_lineno; +extern char *c_input_filename; + +c_tree_node *c_tree_add_node( NodeCode ) + + int NodeCode; +{ + c_tree_node *TreeNode; + int FirstCode; + + TreeNode = c_tree_alloc_node( NodeCode ); + FirstCode = CFirstCode( NodeCode ); + + CTreeLineNum( TreeNode ) = c_lineno; + + if ( c_input_filename ) + { + CTreeFileName( TreeNode ) = c_input_filename; + } + else + { + if ( CTreeNameBuiltIn == (char *)0 ) + { + CTreeNameBuiltIn = autnamealloc( "" ); + } + + CTreeFileName( TreeNode ) = CTreeNameBuiltIn; + } + + + if ( FirstCode == C_TYPE_NODE ) + { + CTreeTypeAlign( TreeNode ) = 1; + CTreeTypeMainVariant( TreeNode ) = TreeNode; + } + else + if ( ( FirstCode == C_INT_CST_NODE ) || + ( FirstCode == C_REAL_CST_NODE ) || + ( FirstCode == C_STRING_NODE ) || + ( FirstCode == C_COMPLEX_NODE ) ) + { + CSetTreeNodeConstant( TreeNode ); + } + + + return( TreeNode ); +} + +/*------------------------------------------------------------\ +| | +| C Copy Function | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| C Tree Copy Node | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_copy_node( TreeNode ) + + c_tree_node *TreeNode; +{ + c_tree_node *DupNode; + int NodeCode; + int FirstCode; + + NodeCode = CTreeNodeCode( TreeNode ); + FirstCode = CFirstCode( NodeCode ); + DupNode = c_tree_alloc_node( NodeCode ); + memcpy( DupNode, TreeNode, C_NODE_SIZE[ FirstCode ] ); + + CTreeChain( DupNode ) = (c_tree_node *)0; + + return( DupNode ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Copy List | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_copy_list( TreeNode ) + + c_tree_node *TreeNode; +{ + c_tree_node *PrevNode; + c_tree_node *NextNode; + c_tree_node *HeadNode; + + if ( TreeNode == (c_tree_node *)0 ) + { + return( (c_tree_node *)0 ); + } + + HeadNode = c_tree_copy_node( TreeNode ); + PrevNode = HeadNode; + + NextNode = TreeNode->COMMON.CHAIN; + + while ( NextNode != (c_tree_node *)0 ) + { + PrevNode->COMMON.CHAIN = c_tree_copy_node( NextNode ); + PrevNode = PrevNode->COMMON.CHAIN; + NextNode = NextNode->COMMON.CHAIN; + } + + return( HeadNode ); +} + +/*------------------------------------------------------------\ +| | +| C Build Function | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| C Tree Build Vector | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_build_vec( Length ) + + int Length; +{ + c_tree_node *TreeNode; + + TreeNode = c_tree_add_node( C_VEC_NODE ); + TreeNode->VEC.LENGTH = Length; + TreeNode->VEC.ARRAY = c_tree_alloc_node_array( Length ); + + return( TreeNode ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Build List | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_build_list( Purpose, Value ) + + c_tree_node *Purpose; + c_tree_node *Value; +{ + c_tree_node *ListTree; + + ListTree = c_tree_add_node( C_LIST_NODE ); + ListTree->LIST.PURPOSE = Purpose; + ListTree->LIST.VALUE = Value; + + return( ListTree ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Build Complex | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_build_complex( Type, Real, Imag ) + + c_tree_node *Type; + c_tree_node *Real; + c_tree_node *Imag; +{ + c_tree_node *ComplexTree; + + ComplexTree = c_tree_add_node( C_COMPLEX_NODE ); + ComplexTree->COMPLEX.REAL = Real; + ComplexTree->COMPLEX.IMAG = Imag; + + if ( Type == (c_tree_node *)0 ) + { + Type = c_tree_build_complex_type( CTreeType( Real ) ); + } + + return( ComplexTree ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Build Declaration | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_build_decl( DeclCode, TreeName, TreeType ) + + int DeclCode; + c_tree_node *TreeName; + c_tree_node *TreeType; +{ + c_tree_node *TreeResult; + + TreeResult = c_tree_add_node( DeclCode ); + TreeResult->DECL.NAME = TreeName; + TreeResult->COMMON.TYPE = TreeType; + + return( TreeResult ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Build Instruction | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_build_inst( InstCode ) + + int InstCode; +{ + c_tree_node *TreeResult; + + TreeResult = c_tree_add_node( InstCode ); + + return( TreeResult ); + +} + +/*------------------------------------------------------------\ +| | +| C Tree Build Type | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_build_type( TypeCode ) + + int TypeCode; +{ + c_tree_node *TreeResult; + + TreeResult = c_tree_add_node( TypeCode ); + + return( TreeResult ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Build Type Copy | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_build_type_copy( TreeType ) + + c_tree_node *TreeType; +{ + c_tree_node *TreeResult; + + TreeResult = c_tree_copy_node( TreeType ); + + CTreeTypeNextVariant( TreeResult ) = CTreeTypeNextVariant( TreeType ); + CTreeTypeNextVariant( CTreeTypeMainVariant( TreeType ) ) = TreeResult; + + return( TreeResult ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Build Type Variant | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_build_type_variant( TreeType, ConstP, VolatileP ) + + c_tree_node *TreeType; + int ConstP; + int VolatileP; +{ + c_tree_node *TreeResult; + + ConstP = !! ConstP; + VolatileP = !! VolatileP; + + for ( TreeResult = CTreeTypeMainVariant( TreeType ); + TreeResult != (c_tree_node *)0; + TreeResult = CTreeTypeNextVariant( TreeResult ) ) + { + if ( ( ( !! CIsTreeNodeReadOnly( TreeResult ) ) == ConstP ) && + ( ( !! CIsTreeNodeVolatile( TreeResult ) ) == VolatileP ) && + ( CTreeTypeName( TreeResult ) == CTreeTypeName( TreeType ) ) ) + { + return( TreeResult ); + } + } + + TreeResult = c_tree_build_type_copy( TreeType ); + + if ( ConstP ) CSetTreeNodeReadOnly( TreeType ); + if ( VolatileP ) CSetTreeNodeVolatile( TreeType ); + + return( TreeResult ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Build Type Attribute Variant | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_build_type_attribute_variant( TreeType, TreeAttr ) + + c_tree_node *TreeType; + c_tree_node *TreeAttr; +{ + /* Rien a voir avec l'original car les attributs ne nous interessent pas */ + + return( c_tree_build_type_variant( TreeType, + CIsTreeNodeReadOnly( TreeType ), + CIsTreeNodeVolatile( TreeType ) ) ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Build Function Type | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_build_function_type( ValueType, ArgTypes ) + + c_tree_node *ValueType; + c_tree_node *ArgTypes; +{ + c_tree_node *TreeResult; + + if ( CTreeTypeCode( ValueType ) == C_FUNCTION_TYPE ) + { + error("function return type cannot be function"); + ValueType = c_integer_type_node; + } + + TreeResult = c_tree_build_type( C_FUNCTION_TYPE ); + CTreeType( TreeResult ) = ValueType; + CTreeTypeValues( TreeResult ) = ArgTypes; + + /* + if ( CTreeTypeSize( TreeResult ) == 0 ) + { + c_layout_type( TreeResult ); + } + */ + + c_layout_type( TreeResult ); + + return( TreeResult ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Build Complex Type | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_build_complex_type( Component ) + + c_tree_node *Component; +{ + c_tree_node *TreeResult; + + TreeResult = c_tree_build_type( C_COMPLEX_TYPE ); + TreeResult->COMMON.TYPE = CTreeTypeMainVariant( Component ); + + if ( CIsTreeNodeVolatile( Component ) ) + { + CSetTreeNodeVolatile( TreeResult ); + } + + if ( CIsTreeNodeReadOnly( Component ) ) + { + CSetTreeNodeReadOnly( TreeResult ); + } + + c_layout_type( TreeResult ); + + return( TreeResult ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Build Signed Type | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_build_signed_type( Precision ) + + int Precision; +{ + c_tree_node *TreeResult; + c_tree_node *TreeMin; + c_tree_node *TreeMax; + + TreeResult = c_tree_build_type( C_INTEGER_TYPE ); + CTreeTypePrecision( TreeResult ) = Precision; + + TreeMin = c_tree_build_int_2((Precision - C_HOST_BITS_PER_WIDE_INT > 0 + ? 0 : (C_HOST_WIDE_INT) (-1) << (Precision - 1)), + (((C_HOST_WIDE_INT) (-1) + << (Precision - C_HOST_BITS_PER_WIDE_INT - 1 > 0 + ? Precision - C_HOST_BITS_PER_WIDE_INT - 1 + : 0)))); + TreeMax = c_tree_build_int_2((Precision - C_HOST_BITS_PER_WIDE_INT > 0 + ? -1 : ((C_HOST_WIDE_INT) 1 << (Precision - 1)) - 1), + (Precision - C_HOST_BITS_PER_WIDE_INT - 1 > 0 + ? (((C_HOST_WIDE_INT) 1 + << (Precision - C_HOST_BITS_PER_WIDE_INT - 1))) - 1 + : 0)); + + CTreeType( TreeMin ) = TreeResult; + CTreeType( TreeMax ) = TreeResult; + + CTreeTypeMinValue( TreeResult ) = TreeMin; + CTreeTypeMaxValue( TreeResult ) = TreeMax; + + if ( c_size_type == (c_tree_node *)0 ) + { + c_size_type = TreeResult; + } + + c_layout_type( TreeResult ); + + return( TreeResult ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Build Unsigned Type | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_build_unsigned_type( Precision ) + + int Precision; +{ + c_tree_node *TreeResult; + c_tree_node *TreeMin; + c_tree_node *TreeMax; + + TreeResult = c_tree_build_type( C_INTEGER_TYPE ); + CTreeTypePrecision( TreeResult ) = Precision; + CSetTreeNodeUnsigned( TreeResult ); + + TreeMin = c_tree_build_int_2( 0, 0 ); + TreeMax = c_tree_build_int_2( Precision - C_HOST_BITS_PER_WIDE_INT >= 0 + ? -1 : ((C_HOST_WIDE_INT) 1 << Precision) - 1, + Precision - C_HOST_BITS_PER_WIDE_INT > 0 + ? ((unsigned C_HOST_WIDE_INT) ~0 + >> (C_HOST_BITS_PER_WIDE_INT + - (Precision - C_HOST_BITS_PER_WIDE_INT))) + : 0); + + CTreeType( TreeMin ) = TreeResult; + CTreeType( TreeMax ) = TreeResult; + + CTreeTypeMinValue( TreeResult ) = TreeMin; + CTreeTypeMaxValue( TreeResult ) = TreeMax; + + c_layout_type( TreeResult ); + + return( TreeResult ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Build Pointer Type | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_build_pointer_type( TreeType ) + + c_tree_node *TreeType; +{ + c_tree_node *TreeResult; + + TreeResult = TreeType->TYPE.POINTER_TO; + + if ( TreeResult == (c_tree_node *)0 ) + { + TreeResult = c_tree_build_type( C_POINTER_TYPE ); + TreeResult->COMMON.TYPE = TreeType; + TreeType->TYPE.POINTER_TO = TreeResult; + + c_layout_type( TreeResult ); + } + + return( TreeResult ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Build Array Type | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_build_array_type( ElemType, IndexType ) + + c_tree_node *ElemType; + c_tree_node *IndexType; +{ + c_tree_node *TreeResult; + + if ( CTreeTypeCode( ElemType ) == C_FUNCTION_TYPE ) + { + error("arrays of functions are not meaningful"); + ElemType = c_integer_type_node; + } + + c_tree_build_pointer_type( ElemType ); + + TreeResult = c_tree_build_type( C_ARRAY_TYPE ); + + CTreeType( TreeResult ) = ElemType; + CTreeTypeValues( TreeResult ) = IndexType; + + if ( IndexType == (c_tree_node *)0 ) + { + return( TreeResult ); + } + + if ( CTreeTypeSize( TreeResult ) == (c_tree_node *)0 ) + { + c_layout_type( TreeResult ); + } + + return( TreeResult ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Build Index Type | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_build_index_type( MaxVal ) + + c_tree_node *MaxVal; +{ + c_tree_node *IndexType; + + IndexType = c_tree_build_type( C_INTEGER_TYPE ); + CTreeTypePrecision( IndexType ) = CTreeTypePrecision( c_size_type ); + + CTreeTypeMinValue( IndexType ) = c_size_zero_node; + CTreeTypeMaxValue( IndexType ) = c_convert_expr( c_size_type, MaxVal ); + + CTreeTypeMode( IndexType ) = CTreeTypeMode( c_size_type ); + CTreeTypeSize( IndexType ) = CTreeTypeSize( c_size_type ); + CTreeTypeAlign( IndexType ) = CTreeTypeAlign( c_size_type ); + + + if ( CTreeNodeFirstCode( MaxVal ) == C_INST_NODE ) + { + /* If the domain should be empty, make sure the maxval remains -1 and is not + * spoiled by truncation. */ + + if ( INT_CST_LT( MaxVal, c_integer_zero_node)) + { + CTreeTypeMaxValue( IndexType ) = c_tree_build_int_2(-1, -1); + CTreeType( CTreeTypeMaxValue( IndexType ) ) = c_size_type; + } + } + + return( IndexType ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Build Unary Expr | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_build_unary_expr( ExprCode, TreeExpr ) + + int ExprCode; + c_tree_node *TreeExpr; +{ + c_tree_node *TreeResult; + + TreeResult = c_tree_add_node( ExprCode ); + TreeResult->EXPR.OPERANDS = c_tree_alloc_node_array( 1 ); + TreeResult->EXPR.NUM_OPER = 1; + + TreeResult->EXPR.OPERANDS[ 0 ] = TreeExpr; + + return( TreeResult ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Build Binary Expr | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_build_binary_expr( ExprCode, TreeExpr1, TreeExpr2 ) + + int ExprCode; + c_tree_node *TreeExpr1; + c_tree_node *TreeExpr2; +{ + c_tree_node *TreeResult; + + TreeResult = c_tree_add_node( ExprCode ); + TreeResult->EXPR.OPERANDS = c_tree_alloc_node_array( 2 ); + TreeResult->EXPR.NUM_OPER = 2; + + TreeResult->EXPR.OPERANDS[ 0 ] = TreeExpr1; + TreeResult->EXPR.OPERANDS[ 1 ] = TreeExpr2; + + return( TreeResult ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Build Ternary Expr | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_build_ternary_expr( ExprCode, TreeExpr1, TreeExpr2, TreeExpr3 ) + + int ExprCode; + c_tree_node *TreeExpr1; + c_tree_node *TreeExpr2; + c_tree_node *TreeExpr3; +{ + c_tree_node *TreeResult; + + TreeResult = c_tree_add_node( ExprCode ); + TreeResult->EXPR.OPERANDS = c_tree_alloc_node_array( 3 ); + TreeResult->EXPR.NUM_OPER = 3; + + TreeResult->EXPR.OPERANDS[ 0 ] = TreeExpr1; + TreeResult->EXPR.OPERANDS[ 1 ] = TreeExpr2; + TreeResult->EXPR.OPERANDS[ 2 ] = TreeExpr3; + + return( TreeResult ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Build Real | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_build_real( TreeType, Value ) + + c_tree_node *TreeType; + double Value; +{ + c_tree_node *RealCstTree; + + RealCstTree = c_tree_add_node( C_REAL_CST_NODE ); + RealCstTree->REAL_CST.VALUE = Value; + RealCstTree->COMMON.TYPE = TreeType; + + return( RealCstTree ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Build Integer | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_build_int_2( Low, High ) + + long Low; + long High; +{ + c_tree_node *IntCstTree; + + IntCstTree = c_tree_add_node( C_INT_CST_NODE ); + IntCstTree->INT_CST.LOW = Low; + IntCstTree->INT_CST.HIGH = High; + IntCstTree->COMMON.TYPE = c_integer_type_node; + + return( IntCstTree ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Build String | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_build_string( Length, Text ) + + int Length; + char *Text; +{ + c_tree_node *TreeString; + + Text = autnamealloc( Text ); + + TreeString = c_tree_add_node( C_STRING_NODE ); + TreeString->STRING.LENGTH = Length; + TreeString->STRING.POINTER = Text; + + return( TreeString ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Build Pointer Declarator | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_build_pointer_declarator( TreeTypeQual, TreeTarget ) + + c_tree_node *TreeTypeQual; + c_tree_node *TreeTarget; +{ + c_tree_node *TreeResult; + + TreeResult = c_tree_build_unary_expr( C_INDIRECT_REF, TreeTarget ); + CTreeType( TreeResult ) = TreeTypeQual; + + return( TreeResult ); +} + +/*------------------------------------------------------------\ +| | +| C Combine Function | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_combine_strings( TreeString ) + + c_tree_node *TreeString; +{ + c_tree_node *TreeResult; + c_tree_node *ScanString; + c_tree_node *TreeType; + char *Name; + char *Buffer; + char *Scan; + int Length; + int TotalLength; + + if ( CTreeChain( TreeString ) != (c_tree_node *)0 ) + { + TotalLength = 1; + + for ( ScanString = TreeString; + ScanString != (c_tree_node *)0; + ScanString = CTreeChain( ScanString ) ) + { + c_fprintf( stdout, "%s %d\n", + CTreeStringPointer( ScanString ), + CTreeStringLength( ScanString ) ); + TotalLength += (CTreeStringLength( ScanString ) - 1); + } + + /* If anything is wide, the non-wides will be converted, + which makes them take more space. */ + + Buffer = autallocblock( TotalLength ); + Buffer[ 0 ] = '"'; + Scan = Buffer + 1; + + for ( ScanString = TreeString; + ScanString != (c_tree_node *)0; + ScanString = CTreeChain( ScanString ) ) + { + Name = CTreeStringPointer( ScanString ) + 1; + Length = CTreeStringLength( ScanString ) - 1; + + strncpy( Scan, Name, Length ); + Scan += (Length - 1); + } + + TreeResult = c_tree_build_string( TotalLength, Buffer ); + autfreeblock( Buffer ); + } + else + { + TreeResult = TreeString; + TotalLength = CTreeStringLength( TreeString ); + } + + /* Create the array type for the string constant. + -Wwrite-strings says make the string constant an array of const char + so that copying it to a non-const pointer will get a warning. */ + + if ( ( c_warn_write_strings ) && + (! c_flag_traditional ) && + (! c_flag_writable_strings ) ) + { + TreeType = c_tree_build_type_variant( c_char_type_node, 1, 0); + + CTreeType( TreeResult ) = + c_tree_build_array_type( TreeType, + c_tree_build_index_type( c_tree_build_int_2( TotalLength - 1, 0))); + } + else + { + CTreeType( TreeResult ) = + c_tree_build_array_type( c_char_type_node, + c_tree_build_index_type( c_tree_build_int_2( TotalLength - 1, 0))); + } + + CSetTreeNodeConstant( TreeResult ); + CSetTreeNodeStatic( TreeResult ); + + return( TreeResult ); +} + +/*------------------------------------------------------------\ +| | +| C Get Function | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| C Tree Get Size Int | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_get_size_int( Number ) + + int Number; +{ + c_tree_node *TreeNode; + + TreeNode = c_tree_build_int_2( Number, 0 ); + CTreeType( TreeNode ) = c_size_type; + + return( TreeNode ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Get List Length | +| | +\------------------------------------------------------------*/ + +int c_tree_get_list_length( ListTree ) + + c_tree_node *ListTree; +{ + int Length; + + Length = 0; + + while ( ListTree != (c_tree_node *)0 ) + { + ListTree = CTreeChain( ListTree ); + Length++; + } + + return( Length ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Get Identifier | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_get_identifier( Text ) + + char *Text; +{ + c_tree_node *TreeNode; + authelem *Element; + + Text = autnamealloc( Text ); + + if ( CTreeHashIdentifier == (authtable *)0 ) + { + CTreeHashIdentifier = createauthtable( 1000 ); + } + + Element = searchauthelem( CTreeHashIdentifier, Text ); + + if ( Element == (authelem *)0 ) + { + TreeNode = c_tree_add_node( C_IDENTIFIER_NODE ); + TreeNode->IDENT.LENGTH = strlen( Text ); + TreeNode->IDENT.POINTER = Text; + + addauthelem( CTreeHashIdentifier, Text, (long)TreeNode ); + } + else + { + TreeNode = (c_tree_node *)Element->VALUE; + } + + return( TreeNode ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Concat List | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_concat_list( ListTree1, ListTree2 ) + + c_tree_node *ListTree1; + c_tree_node *ListTree2; +{ + c_tree_node *ScanTree; + + if ( ListTree1 == (c_tree_node *)0 ) + { + return( ListTree2 ); + } + + for ( ScanTree = ListTree1; + ScanTree != (c_tree_node *)0; + ScanTree = ScanTree->COMMON.CHAIN ) + { + if ( ScanTree->COMMON.CHAIN == (c_tree_node *)0 ) + { + ScanTree->COMMON.CHAIN = ListTree2; break; + } + } + + return( ListTree1 ); +} + +/* Return first list element whose TREE_PURPOSE is ELEM. + Return 0 if ELEM is not in LIST. */ + +c_tree_node *c_tree_get_purpose_member(elem, list) + c_tree_node *elem; + c_tree_node *list; +{ + while (list) + { + if (elem == CTreeListPurpose(list)) + return list; + list = CTreeChain(list); + } + return (c_tree_node *)0; +} + +/*------------------------------------------------------------\ +| | +| C Tree Add Head List | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_add_head_list( Purpose, Value, ListTree ) + + c_tree_node *Purpose; + c_tree_node *Value; + c_tree_node *ListTree; +{ + c_tree_node *HeadTree; + + HeadTree = c_tree_add_node( C_LIST_NODE ); + HeadTree->LIST.PURPOSE = Purpose; + HeadTree->LIST.VALUE = Value; + HeadTree->COMMON.CHAIN = ListTree; + + return( HeadTree ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Is Int Cst Signed | +| | +\------------------------------------------------------------*/ + +/* Return an indication of the sign of the integer constant T. + The return value is -1 if T < 0, 0 if T == 0, and 1 if T > 0. + Note that -1 will never be returned it T's type is unsigned. */ + +int c_tree_is_int_cst_sgn (t) + + c_tree_node *t; +{ + if ( ( CTreeIntCstLow(t) == 0 ) && + ( CTreeIntCstHigh(t) == 0 ) ) + { + return 0; + } + else if ( CIsTreeNodeUnsigned( CTreeType(t))) + { + return 1; + } + else if ( CTreeIntCstHigh(t) < 0) + { + return -1; + } + else + { + return 1; + } +} + +/*------------------------------------------------------------\ +| | +| C Tree Is Real Zero | +| | +\------------------------------------------------------------*/ + +/* Return 1 if EXPR is the integer constant zero or a complex constant + of zero. */ + +int c_tree_is_real_zerop(expr) + + c_tree_node *expr; +{ + CStripNops(expr); + + if ( CTreeNodeFirstCode( expr ) == C_REAL_CST_NODE ) + { + return( CTreeRealCstValue( expr ) == 0.0 ); + } + + if ( CTreeNodeFirstCode( expr ) == C_COMPLEX_NODE ) + { + return( c_tree_is_real_zerop( CTreeComplexReal( expr ) ) && + c_tree_is_real_zerop( CTreeComplexImag( expr ) ) ); + + } + + return( 0 ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Is Real One | +| | +\------------------------------------------------------------*/ + +/* Return 1 if EXPR is the integer constant one or the corresponding + complex constant. */ + +int c_tree_is_real_onep(expr) + + c_tree_node *expr; +{ + CStripNops(expr); + + if ( CTreeNodeFirstCode( expr ) == C_REAL_CST_NODE ) + { + return( CTreeRealCstValue( expr ) == 1.0 ); + } + + if ( CTreeNodeFirstCode( expr ) == C_COMPLEX_NODE ) + { + return( c_tree_is_real_onep( CTreeComplexReal( expr ) ) && + c_tree_is_real_zerop( CTreeComplexImag( expr ) ) ); + + } + + return( 0 ); +} + +/* Return 1 if EXPR is the integer constant two or the corresponding + complex constant. */ + +int c_tree_is_real_twop(expr) + + c_tree_node *expr; +{ + CStripNops(expr); + + if ( CTreeNodeFirstCode( expr ) == C_REAL_CST_NODE ) + { + return( CTreeRealCstValue( expr ) == 2.0 ); + } + + if ( CTreeNodeFirstCode( expr ) == C_COMPLEX_NODE ) + { + return( c_tree_is_real_twop( CTreeComplexReal( expr ) ) && + c_tree_is_real_twop( CTreeComplexImag( expr ) ) ); + + } + + return( 0 ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Is Int Zero | +| | +\------------------------------------------------------------*/ + +/* Return 1 if EXPR is the integer constant zero or a complex constant + of zero. */ + +int c_tree_is_integer_zerop(expr) + + c_tree_node *expr; +{ + CStripNops(expr); + + if ( CTreeNodeFirstCode( expr ) == C_INT_CST_NODE ) + { + return( ( CTreeIntCstLow( expr ) == 0 ) && + ( CTreeIntCstHigh( expr ) == 0 ) ); + } + + if ( CTreeNodeFirstCode( expr ) == C_COMPLEX_NODE ) + { + return( c_tree_is_integer_zerop( CTreeComplexReal( expr ) ) && + c_tree_is_integer_zerop( CTreeComplexImag( expr ) ) ); + + } + + return( 0 ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Is Int One | +| | +\------------------------------------------------------------*/ + +/* Return 1 if EXPR is the integer constant one or the corresponding + complex constant. */ + +int c_tree_is_integer_onep(expr) + + c_tree_node *expr; +{ + CStripNops(expr); + + if ( CTreeNodeFirstCode( expr ) == C_INT_CST_NODE ) + { + return( ( CTreeIntCstLow( expr ) == 1 ) && + ( CTreeIntCstHigh( expr ) == 0 ) ); + } + + if ( CTreeNodeFirstCode( expr ) == C_COMPLEX_NODE ) + { + return( c_tree_is_integer_onep( CTreeComplexReal( expr ) ) && + c_tree_is_integer_zerop( CTreeComplexImag( expr ) ) ); + + } + + return( 0 ); +} + +/*------------------------------------------------------------\ +| | +| C Tree Is Int Less Than | +| | +\------------------------------------------------------------*/ + +int c_tree_is_int_cst_lt(t1, t2) + + c_tree_node *t1; + c_tree_node *t2; +{ + if (t1 == t2) + { + return 0; + } + + if (! CIsTreeNodeUnsigned( CTreeType(t1))) + { + return INT_CST_LT(t1, t2); + } + return INT_CST_LT_UNSIGNED(t1, t2); +} + +/*------------------------------------------------------------\ +| | +| C Tree Is Int Cst Equal | +| | +\------------------------------------------------------------*/ + +/* Nonzero if integer constants T1 and T2 + represent the same constant value. */ + +int c_tree_is_int_cst_equal(t1, t2) + c_tree_node *t1; + c_tree_node *t2; +{ + if (t1 == t2) + return 1; + if (t1 == 0 || t2 == 0) + return 0; + if ( CTreeNodeFirstCode(t1) == C_INT_CST_NODE + && CTreeNodeFirstCode(t2) == C_INT_CST_NODE + && CTreeIntCstLow(t1) == CTreeIntCstLow(t2) + && CTreeIntCstHigh(t1) == CTreeIntCstHigh(t2)) + return 1; + return 0; +} + + +/* Return 1 if EXPR is an integer constant that is a power of 2 (i.e., has only + one bit on). */ + +int c_tree_is_integer_pow2p(expr) + c_tree_node *expr; +{ + int prec; + C_HOST_WIDE_INT high, low; + + CStripNops(expr); + + if (CTreeNodeCode(expr) == C_COMPLEX_NODE + && c_tree_is_integer_pow2p( CTreeComplexReal(expr)) + && c_tree_is_integer_zerop( CTreeComplexImag(expr))) + return 1; + + if (CTreeNodeCode(expr) != C_INT_CST_NODE || CIsTreeNodeCstOverflow(expr)) + return 0; + + prec = (POINTER_TYPE_P (CTreeType(expr)) + ? C_POINTER_SIZE : CTreeTypePrecision(CTreeType(expr))); + high = CTreeIntCstHigh(expr); + low = CTreeIntCstLow(expr); + + /* First clear all bits that are beyond the type's precision in case + we've been sign extended. */ + + if (prec == 2 * C_HOST_BITS_PER_WIDE_INT) + ; + else if (prec > C_HOST_BITS_PER_WIDE_INT) + high &= ~((C_HOST_WIDE_INT) (-1) << (prec - C_HOST_BITS_PER_WIDE_INT)); + else + { + high = 0; + if (prec < C_HOST_BITS_PER_WIDE_INT) + low &= ~((C_HOST_WIDE_INT) (-1) << prec); + } + + if (high == 0 && low == 0) + return 0; + + return ((high == 0 && (low & (low - 1)) == 0) + || (low == 0 && (high & (high - 1)) == 0)); +} + +/*------------------------------------------------------------\ +| | +| C Tree Reverse List | +| | +\------------------------------------------------------------*/ + +c_tree_node *c_tree_reverse_list( t ) + + c_tree_node *t; +{ + c_tree_node *prev = 0; + c_tree_node *decl; + c_tree_node *next; + + for (decl = t; decl; decl = next) + { + next = CTreeChain(decl); + CTreeChain(decl) = prev; + prev = decl; + } + + return prev; +} + +/*------------------------------------------------------------\ +| | +| C Tree Get Last List | +| | +\------------------------------------------------------------*/ + +/* Return the last node in a chain of nodes (chained through TREE_CHAIN). */ + +c_tree_node *c_tree_get_last_list(chain) + + c_tree_node *chain; +{ + c_tree_node *next; + if (chain) + { + while ((next = CTreeChain(chain)) != NULL ) + { + chain = next; + } + } + return chain; +} + +/* Same as above, but only builds for unary operators. + Saves lions share of calls to `build'; cuts down use + of varargs, which is expensive for RISC machines. */ + +c_tree_node *c_tree_build_unary_typed_expr(code, type, node) + int code; + c_tree_node *type; + c_tree_node *node; +{ + c_tree_node *t; + + t = c_tree_build_unary_expr( code, node ); + + CTreeType(t) = type; + if (node) + { + if ( CIsTreeNodeSideEffect(node)) CSetTreeNodeSideEffect(t); + if ( CIsTreeNodeRaises(node)) CSetTreeNodeRaises(t); + } + + return t; +} + + +c_tree_node *c_tree_build_binary_typed_expr(code, type, arg0, arg1 ) + int code; + c_tree_node *type; + c_tree_node *arg0; + c_tree_node *arg1; +{ + c_tree_node *t; + + t = c_tree_build_binary_expr( code, arg0, arg1 ); + + CTreeType(t) = type; + if (arg0) + { + if ( CIsTreeNodeSideEffect(arg0)) CSetTreeNodeSideEffect(t); + if ( CIsTreeNodeRaises(arg0)) CSetTreeNodeRaises(t); + } + + if (arg1) + { + if ( CIsTreeNodeSideEffect(arg1)) CSetTreeNodeSideEffect(t); + if ( CIsTreeNodeRaises(arg1)) CSetTreeNodeRaises(t); + } + + return t; +} + +c_tree_node *c_tree_build_ternary_typed_expr(code, type, arg0, arg1, arg2 ) + int code; + c_tree_node *type; + c_tree_node *arg0; + c_tree_node *arg1; + c_tree_node *arg2; +{ + c_tree_node *t; + + t = c_tree_build_ternary_expr( code, arg0, arg1, arg2 ); + + CTreeType(t) = type; + if (arg0) + { + if ( CIsTreeNodeSideEffect(arg0)) CSetTreeNodeSideEffect(t); + if ( CIsTreeNodeRaises(arg0)) CSetTreeNodeRaises(t); + } + + if (arg1) + { + if ( CIsTreeNodeSideEffect(arg1)) CSetTreeNodeSideEffect(t); + if ( CIsTreeNodeRaises(arg1)) CSetTreeNodeRaises(t); + } + + if (arg2) + { + if ( CIsTreeNodeSideEffect(arg2)) CSetTreeNodeSideEffect(t); + if ( CIsTreeNodeRaises(arg2)) CSetTreeNodeRaises(t); + } + + return t; +} + +/*------------------------------------------------------------\ +| | +| C Tree View Node | +| | +\------------------------------------------------------------*/ + + +static long CViewIdent = 0; + +void c_indent() +{ + long Index; + + for ( Index = 1; Index < CViewIdent; Index++ ) + { + fprintf( stdout, "| " ); + } +} + +# define c_printf c_indent(); fprintf + +void c_tree_view_node( TreeNode ) + + c_tree_node *TreeNode; +{ + c_tree_node *TreeScan; + c_tree_node *TreeHead; + c_tree_node *TreeName; + char *Name; + int FirstCode; + int ExprCode; + int TypeCode; + int DeclCode; + int InstCode; + int CaseCode; + int Index; + int ViewList; + + if ( TreeNode == (c_tree_node *)0 ) + { + fprintf( stdout, " \n" ); + return; + } + + if ( TreeNode == c_error_mark_node ) + { + fprintf( stdout, " #ERROR#\n" ); + return; + } + + if ( CIsTreeNodeMark( TreeNode ) ) + { + FirstCode = CTreeNodeFirstCode( TreeNode ); + fprintf( stdout, " %s", C_NODE_CODE_NAME[ FirstCode ] ); + + switch ( FirstCode ) + { + case C_INT_CST_NODE : + fprintf( stdout, ",%ld,%ld", + CTreeIntCstLow(TreeNode), CTreeIntCstHigh(TreeNode)); + break; + + case C_REAL_CST_NODE : + fprintf( stdout, ",%g", CTreeRealCstValue( TreeNode ) ); + break; + + case C_STRING_NODE : + fprintf( stdout, ",/*%s*/", CTreeStringPointer( TreeNode ) ); + break; + + case C_COMPLEX_NODE : + break; + + case C_IDENTIFIER_NODE : + fprintf( stdout, ",/*%s*/", CTreeIdentPointer( TreeNode ) ); + break; + + case C_LIST_NODE : + break; + + case C_VEC_NODE : + break; + + case C_EXPR_NODE : + ExprCode = CExtraCode( CTreeExprCode( TreeNode ) ); + fprintf( stdout, ",%s", C_EXPR_CODE_NAME[ ExprCode ] ); + break; + + case C_BLOCK_NODE : + break; + + case C_TYPE_NODE : + TypeCode = CExtraCode( CTreeTypeCode( TreeNode ) ); + TreeName = CTreeTypeName( TreeNode ); + fprintf( stdout, ",%s", C_TYPE_CODE_NAME[ TypeCode ] ); + + if ( ( TreeName != (c_tree_node *)0 ) && + ( CTreeNodeFirstCode( TreeName ) == C_DECL_NODE ) ) + { + TreeName = CTreeDeclName( TreeName ); + if ( TreeName != (c_tree_node *)0 ) + { + fprintf( stdout, ",%s", CTreeIdentPointer( TreeName ) ); + } + } + + break; + case C_DECL_NODE : + DeclCode = CExtraCode( CTreeDeclCode( TreeNode ) ); + TreeName = CTreeDeclName( TreeNode ); + fprintf( stdout, ",%s", C_DECL_CODE_NAME[ DeclCode ] ); + + if ( ( TreeName != (c_tree_node *)0 ) && + ( CTreeNodeFirstCode( TreeName ) == C_IDENTIFIER_NODE ) ) + { + fprintf( stdout, ",/*%s*/", CTreeIdentPointer( TreeName ) ); + } + + break; + case C_INST_NODE : + InstCode = CExtraCode( CTreeInstCode( TreeNode ) ); + fprintf( stdout, ",%s", C_INST_CODE_NAME[ InstCode ] ); + break; + } + + fprintf( stdout, ",[0x%08lx]\n", (long)TreeNode ); + + return; + } + + CViewIdent++; + fprintf( stdout, "\n" ); + + TreeHead = TreeNode; + ViewList = 0; + + while ( TreeNode != (c_tree_node *)0 ) + { + CSetTreeNodeMark( TreeNode ); + + c_printf( stdout, "{-- COMMON ------# [0x%08lx]\n", (long)TreeNode ); + + FirstCode = CTreeNodeFirstCode( TreeNode ); + c_printf( stdout, "NODE_CODE : %s\n" , C_NODE_CODE_NAME[ FirstCode ] ); + + if ( CTreeChain( TreeNode ) != (c_tree_node *)0 ) + { + c_printf( stdout, "CHAIN : [0x%08lx]\n", (long)CTreeChain( TreeNode ) ); + } + else + { + c_printf( stdout, "CHAIN : \n" ); + } + + c_printf( stdout, "TYPE :" ); + + if ( ! C_TREE_VIEW_TYPE_NODE ) + { + if ( CTreeType( TreeNode ) != (c_tree_node *)0 ) + { + CSetTreeNodeMark( CTreeType( TreeNode ) ); + } + } + + c_tree_view_node( CTreeType( TreeNode ) ); + + c_printf( stdout, "FLAGS : 0x%08lx\n", CTreeFlags( TreeNode ) ); + c_printf( stdout, "USER : 0x%08lx\n", (long)CTreeUser( TreeNode ) ); + Name = CTreeFileName( TreeNode ); + c_printf( stdout, "FILE_NAME : %s\n", ( Name != (char *)0 ) ? Name : "null" ); + c_printf( stdout, "LINE_NUM : %d\n", CTreeLineNum( TreeNode ) ); + + c_printf( stdout, "#-- %-10s --#\n", C_NODE_CODE_NAME[ FirstCode ] ); + + switch ( FirstCode ) + { + case C_INT_CST_NODE : + c_printf( stdout, "LOW : %ld\n", CTreeIntCstLow( TreeNode ) ); + c_printf( stdout, "HIGH : %ld\n", CTreeIntCstHigh( TreeNode ) ); + break; + case C_REAL_CST_NODE : + c_printf( stdout, "VALUE : %g\n", CTreeRealCstValue( TreeNode ) ); + break; + case C_STRING_NODE : + c_printf( stdout, "LENGTH : %d\n", CTreeStringLength( TreeNode ) ); + c_printf( stdout, "POINTER : /*%s*/\n", CTreeStringPointer( TreeNode ) ); + break; + case C_COMPLEX_NODE : + c_printf( stdout, "REAL : %ld\n", (long)CTreeComplexReal( TreeNode ) ); + c_printf( stdout, "IMAG : %ld\n", (long)CTreeComplexImag( TreeNode ) ); + break; + case C_IDENTIFIER_NODE : + c_printf( stdout, "LENGTH : %d\n", CTreeIdentLength( TreeNode ) ); + c_printf( stdout, "POINTER : /*%s*/\n", CTreeIdentPointer( TreeNode ) ); + c_printf( stdout, "GLOBAL :" ); + c_tree_view_node( CTreeIdentGlobalValue( TreeNode ) ); + c_printf( stdout, "LOCAL :" ); + c_tree_view_node( CTreeIdentLocalValue( TreeNode ) ); + c_printf( stdout, "LABEL :" ); + c_tree_view_node( CTreeIdentLabelValue( TreeNode ) ); + c_printf( stdout, "IMPLICIT :" ); + c_tree_view_node( CTreeIdentImplicitDecl( TreeNode ) ); + c_printf( stdout, "ERROR :" ); + c_tree_view_node( CTreeIdentErrorLocus( TreeNode ) ); + c_printf( stdout, "LIMBO :" ); + c_tree_view_node( CTreeIdentLimboValue( TreeNode ) ); + break; + case C_LIST_NODE : + c_printf( stdout, "PURPOSE :" ); + c_tree_view_node( CTreeListPurpose( TreeNode ) ); + c_printf( stdout, "VALUE :" ); + c_tree_view_node( CTreeListValue( TreeNode ) ); + + ViewList = 1; + break; + case C_VEC_NODE : + c_printf( stdout, "LENGTH : %d\n", CTreeVecLength( TreeNode ) ); + + for ( Index = 0; Index < CTreeVecLength( TreeNode ); Index++ ) + { + TreeScan = CTreeVecElem( TreeNode, Index ); + c_printf( stdout, "ARRAY : %d", Index ); + c_tree_view_node( TreeScan ); + } + break; + case C_EXPR_NODE : + ExprCode = CExtraCode( CTreeExprCode( TreeNode ) ); + c_printf( stdout, "EXPR_CODE : %s\n", C_EXPR_CODE_NAME[ ExprCode ] ); + c_printf( stdout, "COMPLEXITY: %d\n", CTreeExprComplexity( TreeNode ) ); + c_printf( stdout, "NUM_OPER : %d\n", CTreeExprNumOper( TreeNode ) ); + + for ( Index = 0; Index < CTreeExprNumOper( TreeNode ); Index++ ) + { + TreeScan = CTreeExprOperand( TreeNode, Index ); + c_printf( stdout, "OPERANDS : %d", Index ); + c_tree_view_node( TreeScan ); + } + break; + case C_BLOCK_NODE : + c_printf( stdout, "VARS :" ); + c_tree_view_node_list( CTreeBlockVars( TreeNode ) ); + c_printf( stdout, "TYPE TAGS :" ); + c_tree_view_node( CTreeBlockTypeTags( TreeNode ) ); + c_printf( stdout, "BODY :" ); + c_tree_view_node( CTreeBlockBody( TreeNode ) ); + c_printf( stdout, "SUB BLOCK :" ); + c_tree_view_node( CTreeBlockSubBlocks( TreeNode ) ); + c_printf( stdout, "SUP CONT :" ); + c_tree_view_node( CTreeBlockSuperContext( TreeNode ) ); + c_printf( stdout, "AB ORIGIN :" ); + c_tree_view_node( CTreeBlockAbstractOrigin( TreeNode ) ); + break; + case C_TYPE_NODE : + TypeCode = CExtraCode( CTreeTypeCode( TreeNode ) ); + c_printf( stdout, "TYPE_CODE : %s\n", C_TYPE_CODE_NAME[ TypeCode ] ); + c_printf( stdout, "VALUES :" ); + c_tree_view_node( CTreeTypeValues( TreeNode ) ); + + if ( C_TREE_VIEW_SIZE_NODE ) + { + c_printf( stdout, "SIZE :" ); + c_tree_view_node( CTreeTypeSize( TreeNode ) ); + } + + c_printf( stdout, "ATTRIBUTES:" ); + c_tree_view_node( CTreeTypeAttributes( TreeNode ) ); + c_printf( stdout, "TYPE_ID : %d\n", CTreeTypeId( TreeNode ) ); + c_printf( stdout, "MODE : %d\n", CTreeTypeMode( TreeNode ) ); + c_printf( stdout, "PRECISION : %d\n", CTreeTypePrecision( TreeNode ) ); + c_printf( stdout, "ALIGN : %d\n", CTreeTypeAlign( TreeNode ) ); + c_printf( stdout, "POINTER_TO:" ); + c_tree_view_node( CTreeTypePointerTo( TreeNode ) ); + c_printf( stdout, "REF_TO :" ); + c_tree_view_node( CTreeTypeReferenceTo( TreeNode ) ); + c_printf( stdout, "NAME :" ); + c_tree_view_node( CTreeTypeName( TreeNode ) ); + c_printf( stdout, "MIN_VALUE :" ); + c_tree_view_node( CTreeTypeMinValue( TreeNode ) ); + c_printf( stdout, "MAX_VALUE :" ); + c_tree_view_node( CTreeTypeMaxValue( TreeNode ) ); + c_printf( stdout, "NEXT_VARIA:" ); + c_tree_view_node( CTreeTypeNextVariant( TreeNode ) ); + c_printf( stdout, "MAIN_VARIA:" ); + c_tree_view_node( CTreeTypeMainVariant( TreeNode ) ); + c_printf( stdout, "BINFO :" ); + c_tree_view_node( CTreeTypeBInfo( TreeNode ) ); + c_printf( stdout, "NONCOPIED :" ); + c_tree_view_node( CTreeTypeNonCopiedParts( TreeNode ) ); + c_printf( stdout, "CONTEXT :" ); + c_tree_view_node( CTreeTypeContext( TreeNode ) ); + break; + case C_DECL_NODE : + DeclCode = CExtraCode( CTreeDeclCode( TreeNode ) ); + c_printf( stdout, "DECL_CODE : %s\n", C_DECL_CODE_NAME[ DeclCode ] ); + Name = CTreeDeclFileName( TreeNode ); + c_printf( stdout, "DECL_ID : %d\n", CTreeDeclId( TreeNode ) ); + + if ( C_TREE_VIEW_SIZE_NODE ) + { + c_printf( stdout, "SIZE :" ); + c_tree_view_node( CTreeDeclSize( TreeNode ) ); + } + + c_printf( stdout, "MODE : %d\n", CTreeDeclMode( TreeNode ) ); + c_printf( stdout, "FIELD SIZE: %d\n", CTreeDeclFieldSize( TreeNode ) ); + c_printf( stdout, "NAME :" ); + c_tree_view_node( CTreeDeclName( TreeNode ) ); + c_printf( stdout, "CONTEXT :" ); + c_tree_view_node( CTreeDeclContext( TreeNode ) ); + c_printf( stdout, "AB ORIGIN :" ); + c_tree_view_node( CTreeDeclAbstractOrigin( TreeNode ) ); + c_printf( stdout, "ARGUMENTS :" ); + c_tree_view_node_list( CTreeDeclArguments( TreeNode ) ); + c_printf( stdout, "RESULT :" ); + c_tree_view_node( CTreeDeclResult( TreeNode ) ); + c_printf( stdout, "INITIAL :" ); + c_tree_view_node( CTreeDeclInitial( TreeNode ) ); + c_printf( stdout, "FLAGS : 0x%08lx\n", CTreeDeclFlags( TreeNode ) ); + + ViewList = CTreeDeclCode( TreeNode ) == C_FIELD_DECL; + break; + case C_INST_NODE : + InstCode = CExtraCode( CTreeInstCode( TreeNode ) ); + c_printf( stdout, "INST_CODE : %s\n", C_INST_CODE_NAME[ InstCode ] ); + + InstCode = CTreeNodeCode( TreeNode ); + + switch ( InstCode ) + { + case C_FOR_INST : + c_printf( stdout, "START :" ); + c_tree_view_node( CTreeInstForStart( TreeNode ) ); + c_printf( stdout, "COND :" ); + c_tree_view_node( CTreeInstForCond( TreeNode ) ); + c_printf( stdout, "INC :" ); + c_tree_view_node( CTreeInstForInc( TreeNode ) ); + c_printf( stdout, "BODY :" ); + c_tree_view_node( CTreeInstForBody( TreeNode ) ); + break; + case C_WHILE_INST : + c_printf( stdout, "COND :" ); + c_tree_view_node( CTreeInstWhileCond( TreeNode ) ); + c_printf( stdout, "BODY :" ); + c_tree_view_node( CTreeInstWhileBody( TreeNode ) ); + break; + case C_DO_INST : + c_printf( stdout, "BODY :" ); + c_tree_view_node( CTreeInstDoBody( TreeNode ) ); + c_printf( stdout, "COND :" ); + c_tree_view_node( CTreeInstDoCond( TreeNode ) ); + break; + case C_IF_INST : + c_printf( stdout, "COND :" ); + c_tree_view_node( CTreeInstIfCond( TreeNode ) ); + c_printf( stdout, "THEN :" ); + c_tree_view_node( CTreeInstIfThen( TreeNode ) ); + c_printf( stdout, "ELSE :" ); + c_tree_view_node( CTreeInstIfElse( TreeNode ) ); + break; + case C_GOTO_INST : + c_printf( stdout, "LABEL :" ); + c_tree_view_node( CTreeInstGotoLabel( TreeNode ) ); + break; + case C_RETURN_INST : + c_printf( stdout, "VALUE :" ); + c_tree_view_node( CTreeInstReturnValue( TreeNode ) ); + break; + case C_CONTINUE_INST : + break; + case C_BREAK_INST : + break; + case C_SWITCH_INST : + c_printf( stdout, "ON :" ); + c_tree_view_node( CTreeInstSwitchOn( TreeNode ) ); + c_printf( stdout, "BODY :" ); + c_tree_view_node( CTreeInstSwitchBody( TreeNode ) ); + break; + case C_CASE_INST : + CaseCode = CTreeInstCaseCode( TreeNode ); + c_printf( stdout, "CASE_CODE : %s\n", C_CASE_CODE_NAME[ CaseCode ] ); + c_printf( stdout, "FROM :" ); + c_tree_view_node( CTreeInstCaseFrom( TreeNode ) ); + c_printf( stdout, "TO :" ); + c_tree_view_node( CTreeInstCaseTo( TreeNode ) ); + break; + } + break; + } + + TreeNode = CTreeChain( TreeNode ); + c_printf( stdout, "}\n" ); + + if ( ! ViewList ) break; + } + + if ( C_TREE_FORCE_VIEW_NODE ) + { + for ( TreeNode = TreeHead; + TreeNode != (c_tree_node *)0; + TreeNode = CTreeChain( TreeNode ) ) + { + CClearTreeNodeMark( TreeNode ); + } + } + + CViewIdent--; +} + +void c_tree_view_node_list( TreeNode ) + + c_tree_node *TreeNode; +{ + if ( TreeNode == (c_tree_node *)0 ) + { + c_tree_view_node( TreeNode ); + } + + while ( TreeNode != (c_tree_node *)0 ) + { + c_tree_view_node( TreeNode ); + TreeNode = CTreeChain( TreeNode ); + } +} + +char c_tree_get_code_class( NodeCode ) + + int NodeCode; +{ +static int LastCode = -1; +static char LastClass = 'x'; + + int FirstCode; + + if ( NodeCode == LastCode ) return LastClass; + + LastCode = NodeCode; + FirstCode = CFirstCode( NodeCode ); + + if ( FirstCode == C_TYPE_NODE ) + { + LastClass = 't'; + } + else + if ( FirstCode == C_BLOCK_NODE ) + { + LastClass = 'b'; + } + else + if ( FirstCode == C_INT_CST_NODE || + FirstCode == C_REAL_CST_NODE || + FirstCode == C_STRING_NODE || + FirstCode == C_COMPLEX_NODE ) + { + LastClass = 'c'; + } + else + if ( FirstCode == C_DECL_NODE ) + { + LastClass = 'd'; + } + else + if ( NodeCode == C_COMPONENT_REF || + NodeCode == C_BIT_FIELD_REF || + NodeCode == C_INDIRECT_REF || + NodeCode == C_BUFFER_REF || + NodeCode == C_ARRAY_REF) + { + LastClass = 'r'; + } + else + if ( FirstCode == C_EXPR_NODE ) + { + if ( NodeCode == C_LT_EXPR || + NodeCode == C_LE_EXPR || + NodeCode == C_GT_EXPR || + NodeCode == C_GE_EXPR || + NodeCode == C_EQ_EXPR || + NodeCode == C_NE_EXPR || + NodeCode == C_SET_LE_EXPR ) LastClass = '<'; + else + if ( NodeCode == C_POPDHC_EXPR || + NodeCode == C_POPDCC_EXPR || + NodeCode == C_LABEL_EXPR || + NodeCode == C_GOTO_EXPR || + NodeCode == C_RETURN_EXPR || + NodeCode == C_EXIT_EXPR || + NodeCode == C_LOOP_EXPR ) LastClass = 's'; + else + if ( NodeCode == C_FIX_TRUNC_EXPR || + NodeCode == C_FIX_CEIL_EXPR || + NodeCode == C_FIX_FLOOR_EXPR || + NodeCode == C_FIX_ROUND_EXPR || + NodeCode == C_FLOAT_EXPR || + NodeCode == C_NEGATE_EXPR || + NodeCode == C_ABS_EXPR || + NodeCode == C_FFS_EXPR || + NodeCode == C_BIT_NOT_EXPR || + NodeCode == C_CARD_EXPR || + NodeCode == C_CONVERT_EXPR || + NodeCode == C_NOP_EXPR || + NodeCode == C_NON_LVALUE_EXPR || + NodeCode == C_CONJ_EXPR || + NodeCode == C_REALPART_EXPR || + NodeCode == C_IMAGPART_EXPR ) LastClass = '1'; + else + if ( NodeCode == C_PLUS_EXPR || + NodeCode == C_MINUS_EXPR || + NodeCode == C_MULT_EXPR || + NodeCode == C_TRUNC_DIV_EXPR || + NodeCode == C_CEIL_DIV_EXPR || + NodeCode == C_FLOOR_DIV_EXPR || + NodeCode == C_ROUND_DIV_EXPR || + NodeCode == C_TRUNC_MOD_EXPR || + NodeCode == C_CEIL_MOD_EXPR || + NodeCode == C_FLOOR_MOD_EXPR || + NodeCode == C_ROUND_MOD_EXPR || + NodeCode == C_RDIV_EXPR || + NodeCode == C_EXACT_DIV_EXPR || + NodeCode == C_EXPON_EXPR || + NodeCode == C_MIN_EXPR || + NodeCode == C_MAX_EXPR || + NodeCode == C_LSHIFT_EXPR || + NodeCode == C_RSHIFT_EXPR || + NodeCode == C_LROTATE_EXPR || + NodeCode == C_RROTATE_EXPR || + NodeCode == C_BIT_IOR_EXPR || + NodeCode == C_BIT_XOR_EXPR || + NodeCode == C_BIT_AND_EXPR || + NodeCode == C_BIT_ANDTC_EXPR || + NodeCode == C_IN_EXPR || + NodeCode == C_RANGE_EXPR || + NodeCode == C_COMPLEX_EXPR ) LastClass = '2'; + else + LastClass = 'e'; + } + else + { + LastClass = 'x'; + } + + return LastClass; +} + + +/* Return 1 if EXPR is an integer containing all 1's in as much precision as + it contains. Likewise for the corresponding complex constant. */ + +int c_tree_is_integer_all_onesp(expr) + c_tree_node *expr; +{ + int prec; + int uns; + + CStripNops(expr); + + if ( CTreeNodeCode(expr) == C_COMPLEX_NODE + && c_tree_is_integer_all_onesp( CTreeComplexReal(expr)) + && c_tree_is_integer_zerop( CTreeComplexImag(expr))) + return 1; + + else if (CTreeNodeCode(expr) != C_INT_CST_NODE + || CIsTreeNodeCstOverflow(expr)) + return 0; + + uns = CIsTreeNodeUnsigned(CTreeType(expr)); + if (!uns) + return CTreeIntCstLow(expr) == -1 && CTreeIntCstHigh(expr) == -1; + + /* Note that using CTreeTypePrecisionhere is wrong. We care about the + actual bits, not the (arbitrary) range of the type. */ +# ifdef LUDO_NO_SKIP + prec = GET_MODE_BITSIZE (CTreeTypeMode(CTreeType(expr))); + if (prec >= HOST_BITS_PER_WIDE_INT) + { + int high_value, shift_amount; + + shift_amount = prec - HOST_BITS_PER_WIDE_INT; + + if (shift_amount > HOST_BITS_PER_WIDE_INT) + /* Can not handle precisions greater than twice the host int size. */ + abort (); + else if (shift_amount == HOST_BITS_PER_WIDE_INT) + /* Shifting by the host word size is undefined according to the ANSI + standard, so we must handle this as a special case. */ + high_value = -1; + else + high_value = ((C_C_HOST_WIDE_INT) 1 << shift_amount) - 1; + + return CTreeIntCstLow(expr) == -1 + && CTreeIntCstHigh(expr) == high_value; + } + else +# endif + return CTreeIntCstLow(expr) == ((C_HOST_WIDE_INT) 1 << prec) - 1; +} + +void c_tree_free_all_node() +{ + c_tree_node *FreeNode; + int Index; + int FirstCode; + + for ( Index = 0; Index < C_MAX_NODE_CODE; Index++ ) + { + if ( Index == C_IDENTIFIER_NODE ) continue; + + while ( C_HEAD_NODE_LIST[ Index ] != (c_tree_node *)0 ) + { + FreeNode = C_HEAD_NODE_LIST[ Index ]; + C_HEAD_NODE_LIST[ Index ] = FreeNode->COMMON.NEXT; + + FirstCode = CTreeNodeFirstCode( FreeNode ); + autfreeheap( FreeNode, C_NODE_SIZE[ FirstCode ] ); + } + } +} diff --git a/alliance/src/gcp/src/c_tree.h b/alliance/src/gcp/src/c_tree.h new file mode 100644 index 00000000..e737cbf7 --- /dev/null +++ b/alliance/src/gcp/src/c_tree.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : C | +| | +| File : c_tree.h | +| | +| Date : 09.07.99 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef C_TREE_H +# define C_TREE_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/gcp/src/c_treecompat.h b/alliance/src/gcp/src/c_treecompat.h new file mode 100644 index 00000000..6a0dd02a --- /dev/null +++ b/alliance/src/gcp/src/c_treecompat.h @@ -0,0 +1,109 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : C | +| | +| File : c_treecompat.h | +| | +| Date : 09.07.99 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef C_TREE_COMPAT_H +# define C_TREE_COMPAT_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define C_NULL_TREE (c_tree_node *)0 + +# define TREE_TYPE(N) CTreeType(N) +# define TREE_CHAIN(N) CTreeChain(N) + +# define TREE_INT_CST_LOW(N) CTreeIntCstLow(N) +# define TREE_INT_CST_HIGH(N) CTreeIntCstHigh(N) + +# define TYPE_MIN_VALUE(N) CTreeTypeMinValue( N ) +# define TYPE_MAX_VALUE(N) CTreeTypeMaxValue( N ) + +typedef union c_tree_node *tree; + +# define NULL_TREE (tree)0 + +#define INT_CST_LT(A, B) \ +(CTreeIntCstHigh(A) < CTreeIntCstHigh(B) \ + || ( CTreeIntCstHigh(A) == CTreeIntCstHigh(B) \ + && ((unsigned int) CTreeIntCstLow(A) \ + < (unsigned int) CTreeIntCstLow(B)))) + + +#define INT_CST_LT_UNSIGNED(A, B) \ +(((unsigned int) CTreeIntCstHigh(A) \ + < (unsigned int) CTreeIntCstHigh(B)) \ + || (((unsigned int) CTreeIntCstHigh(A) \ + == (unsigned int ) CTreeIntCstHigh(B)) \ + && (((unsigned int) CTreeIntCstLow(A) \ + < (unsigned int) CTreeIntCstLow(B))))) + +# define INTEGRAL_TYPE_P(TYPE) \ + ( CTreeTypeCode(TYPE) == C_INTEGER_TYPE || \ + CTreeTypeCode(TYPE) == C_ENUMERAL_TYPE || \ + CTreeTypeCode(TYPE) == C_BOOLEAN_TYPE || \ + CTreeTypeCode(TYPE) == C_CHAR_TYPE) + +#define POINTER_TYPE_P(TYPE) \ + (CTreeTypeCode(TYPE) == C_POINTER_TYPE || \ + CTreeTypeCode(TYPE) == C_REFERENCE_TYPE) + + +# define REAL_VALUE_TYPE double + +#define REAL_VALUE_NEGATE(N) (double)(-N) +#define REAL_VALUE_NEGATIVE(N) ((N) < 0.0) +#define REAL_VALUES_EQUAL(A,B) ((A) == (B)) +#define REAL_VALUES_LESS(A,B) ((A) < (B)) + +#define FLOAT_TYPE_P(TYPE) \ + ( CTreeTypeCode(TYPE) == C_REAL_TYPE \ + || ( CTreeTypeCode(TYPE) == C_COMPLEX_TYPE \ + && CTreeTypeCode( CTreeType(TYPE)) == C_REAL_TYPE)) +# define REAL_VALUES_IDENTICAL(A, B) (A == B) + +# endif diff --git a/alliance/src/gcp/src/gcp.h b/alliance/src/gcp/src/gcp.h new file mode 100644 index 00000000..d8c97393 --- /dev/null +++ b/alliance/src/gcp/src/gcp.h @@ -0,0 +1,1021 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------\ +| | +| Title : Structures and fonctions for GCP | +| | +| Date : 09.01.99 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------*/ + +# ifndef GCP_101_H +# define GCP_101_H + +/*------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------*/ + +# ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +# endif + +/*------------------------------------------------------------\ +| | +| Tree Mode Class | +| | +\------------------------------------------------------------*/ + +# define C_MODE_CLASS_RANDOM 0 +# define C_MODE_CLASS_INT 1 +# define C_MODE_CLASS_FLOAT 2 +# define C_MODE_CLASS_PARTIAL_INT 3 +# define C_MODE_CLASS_CC 4 +# define C_MODE_CLASS_COMPLEX_INT 5 +# define C_MODE_CLASS_COMPLEX_FLOAT 6 + +# define C_MAX_MODE_CLASS 7 + +/*------------------------------------------------------------\ +| | +| Tree Node | +| | +\------------------------------------------------------------*/ + +# define C_INT_CST_NODE 0 +# define C_REAL_CST_NODE 1 +# define C_STRING_NODE 2 +# define C_COMPLEX_NODE 3 +# define C_IDENTIFIER_NODE 4 +# define C_LIST_NODE 5 +# define C_VEC_NODE 6 +# define C_EXPR_NODE 7 +# define C_BLOCK_NODE 8 +# define C_TYPE_NODE 9 +# define C_DECL_NODE 10 +# define C_INST_NODE 11 +# define C_ERROR_NODE 12 + +# define C_MAX_NODE_CODE 13 + +/*------------------------------------------------------------\ +| | +| Tree Type | +| | +\------------------------------------------------------------*/ + +# define C_TREE_NODE_FIRST_CODE_MASK 0x00FF +# define C_TREE_NODE_EXTRA_CODE_MASK 0xFF00 +# define C_TREE_NODE_EXTRA_CODE_SHIFT 8 + +# define CConcatCode(E,C) (((E) << C_TREE_NODE_EXTRA_CODE_SHIFT) | C) +# define CFirstCode(C) ((C) & C_TREE_NODE_FIRST_CODE_MASK) +# define CExtraCode(C) ((C) >> C_TREE_NODE_EXTRA_CODE_SHIFT) + +# define C_UNKNOWN_TYPE CConcatCode(0,C_TYPE_NODE) +# define C_VOID_TYPE CConcatCode(1,C_TYPE_NODE) +# define C_INTEGER_TYPE CConcatCode(2,C_TYPE_NODE) +# define C_REAL_TYPE CConcatCode(3,C_TYPE_NODE) +# define C_COMPLEX_TYPE CConcatCode(4,C_TYPE_NODE) +# define C_ENUMERAL_TYPE CConcatCode(5,C_TYPE_NODE) +# define C_BOOLEAN_TYPE CConcatCode(6,C_TYPE_NODE) +# define C_CHAR_TYPE CConcatCode(7,C_TYPE_NODE) +# define C_POINTER_TYPE CConcatCode(8,C_TYPE_NODE) +# define C_OFFSET_TYPE CConcatCode(9,C_TYPE_NODE) +# define C_REFERENCE_TYPE CConcatCode(10,C_TYPE_NODE) +# define C_METHOD_TYPE CConcatCode(11,C_TYPE_NODE) +# define C_FILE_TYPE CConcatCode(12,C_TYPE_NODE) +# define C_ARRAY_TYPE CConcatCode(13,C_TYPE_NODE) +# define C_SET_TYPE CConcatCode(14,C_TYPE_NODE) +# define C_RECORD_TYPE CConcatCode(15,C_TYPE_NODE) +# define C_UNION_TYPE CConcatCode(16,C_TYPE_NODE) +# define C_QUAL_UNION_TYPE CConcatCode(17,C_TYPE_NODE) +# define C_FUNCTION_TYPE CConcatCode(18,C_TYPE_NODE) +# define C_LANG_TYPE CConcatCode(19,C_TYPE_NODE) + +# define C_MAX_TYPE_CODE 20 + +/*------------------------------------------------------------\ +| | +| Tree Declaration | +| | +\------------------------------------------------------------*/ + +# define C_UNKNOWN_DECL CConcatCode(0,C_DECL_NODE) +# define C_FUNCTION_DECL CConcatCode(1,C_DECL_NODE) +# define C_LABEL_DECL CConcatCode(2,C_DECL_NODE) +# define C_CONST_DECL CConcatCode(3,C_DECL_NODE) +# define C_TYPE_DECL CConcatCode(4,C_DECL_NODE) +# define C_VAR_DECL CConcatCode(5,C_DECL_NODE) +# define C_PARAM_DECL CConcatCode(6,C_DECL_NODE) +# define C_RESULT_DECL CConcatCode(7,C_DECL_NODE) +# define C_FIELD_DECL CConcatCode(8,C_DECL_NODE) + +# define C_MAX_DECL_CODE 9 + +/*------------------------------------------------------------\ +| | +| Tree Expression | +| | +\------------------------------------------------------------*/ + +# define C_UNKNOWN_EXPR CConcatCode(0,C_EXPR_NODE) +# define C_CONSTRUCTOR_EXPR CConcatCode(1,C_EXPR_NODE) +# define C_COMPOUND_EXPR CConcatCode(2,C_EXPR_NODE) +# define C_MODIFY_EXPR CConcatCode(3,C_EXPR_NODE) +# define C_INIT_EXPR CConcatCode(4,C_EXPR_NODE) +# define C_TARGET_EXPR CConcatCode(5,C_EXPR_NODE) +# define C_COND_EXPR CConcatCode(6,C_EXPR_NODE) +# define C_BIND_EXPR CConcatCode(7,C_EXPR_NODE) +# define C_CALL_EXPR CConcatCode(8,C_EXPR_NODE) +# define C_METHOD_CALL_EXPR CConcatCode(9,C_EXPR_NODE) +# define C_WITH_CLEANUP_EXPR CConcatCode(10,C_EXPR_NODE) +# define C_CLEANUP_POINT_EXPR CConcatCode(11,C_EXPR_NODE) +# define C_PLACEHOLDER_EXPR CConcatCode(12,C_EXPR_NODE) +# define C_WITH_RECORD_EXPR CConcatCode(13,C_EXPR_NODE) +# define C_PLUS_EXPR CConcatCode(14,C_EXPR_NODE) +# define C_MINUS_EXPR CConcatCode(15,C_EXPR_NODE) +# define C_MULT_EXPR CConcatCode(16,C_EXPR_NODE) +# define C_TRUNC_DIV_EXPR CConcatCode(17,C_EXPR_NODE) +# define C_CEIL_DIV_EXPR CConcatCode(18,C_EXPR_NODE) +# define C_FLOOR_DIV_EXPR CConcatCode(19,C_EXPR_NODE) +# define C_ROUND_DIV_EXPR CConcatCode(20,C_EXPR_NODE) +# define C_TRUNC_MOD_EXPR CConcatCode(21,C_EXPR_NODE) +# define C_CEIL_MOD_EXPR CConcatCode(22,C_EXPR_NODE) +# define C_FLOOR_MOD_EXPR CConcatCode(23,C_EXPR_NODE) +# define C_ROUND_MOD_EXPR CConcatCode(24,C_EXPR_NODE) +# define C_RDIV_EXPR CConcatCode(25,C_EXPR_NODE) +# define C_EXACT_DIV_EXPR CConcatCode(26,C_EXPR_NODE) +# define C_FIX_TRUNC_EXPR CConcatCode(27,C_EXPR_NODE) +# define C_FIX_CEIL_EXPR CConcatCode(28,C_EXPR_NODE) +# define C_FIX_FLOOR_EXPR CConcatCode(29,C_EXPR_NODE) +# define C_FIX_ROUND_EXPR CConcatCode(30,C_EXPR_NODE) +# define C_FLOAT_EXPR CConcatCode(31,C_EXPR_NODE) +# define C_EXPON_EXPR CConcatCode(32,C_EXPR_NODE) +# define C_NEGATE_EXPR CConcatCode(33,C_EXPR_NODE) +# define C_MIN_EXPR CConcatCode(34,C_EXPR_NODE) +# define C_MAX_EXPR CConcatCode(35,C_EXPR_NODE) +# define C_ABS_EXPR CConcatCode(36,C_EXPR_NODE) +# define C_FFS_EXPR CConcatCode(37,C_EXPR_NODE) +# define C_LSHIFT_EXPR CConcatCode(38,C_EXPR_NODE) +# define C_RSHIFT_EXPR CConcatCode(39,C_EXPR_NODE) +# define C_LROTATE_EXPR CConcatCode(40,C_EXPR_NODE) +# define C_RROTATE_EXPR CConcatCode(41,C_EXPR_NODE) +# define C_BIT_IOR_EXPR CConcatCode(42,C_EXPR_NODE) +# define C_BIT_XOR_EXPR CConcatCode(43,C_EXPR_NODE) +# define C_BIT_AND_EXPR CConcatCode(44,C_EXPR_NODE) +# define C_BIT_ANDTC_EXPR CConcatCode(45,C_EXPR_NODE) +# define C_BIT_NOT_EXPR CConcatCode(46,C_EXPR_NODE) +# define C_TRUTH_ANDIF_EXPR CConcatCode(47,C_EXPR_NODE) +# define C_TRUTH_ORIF_EXPR CConcatCode(48,C_EXPR_NODE) +# define C_TRUTH_AND_EXPR CConcatCode(49,C_EXPR_NODE) +# define C_TRUTH_OR_EXPR CConcatCode(50,C_EXPR_NODE) +# define C_TRUTH_XOR_EXPR CConcatCode(51,C_EXPR_NODE) +# define C_TRUTH_NOT_EXPR CConcatCode(52,C_EXPR_NODE) +# define C_LT_EXPR CConcatCode(53,C_EXPR_NODE) +# define C_LE_EXPR CConcatCode(54,C_EXPR_NODE) +# define C_GT_EXPR CConcatCode(55,C_EXPR_NODE) +# define C_GE_EXPR CConcatCode(56,C_EXPR_NODE) +# define C_EQ_EXPR CConcatCode(57,C_EXPR_NODE) +# define C_NE_EXPR CConcatCode(58,C_EXPR_NODE) +# define C_IN_EXPR CConcatCode(59,C_EXPR_NODE) +# define C_SET_LE_EXPR CConcatCode(60,C_EXPR_NODE) +# define C_CARD_EXPR CConcatCode(61,C_EXPR_NODE) +# define C_RANGE_EXPR CConcatCode(62,C_EXPR_NODE) +# define C_CONVERT_EXPR CConcatCode(63,C_EXPR_NODE) +# define C_NOP_EXPR CConcatCode(64,C_EXPR_NODE) +# define C_NON_LVALUE_EXPR CConcatCode(65,C_EXPR_NODE) +# define C_SAVE_EXPR CConcatCode(66,C_EXPR_NODE) +# define C_UNSAVE_EXPR CConcatCode(67,C_EXPR_NODE) +# define C_RTL_EXPR CConcatCode(68,C_EXPR_NODE) +# define C_ADDR_EXPR CConcatCode(69,C_EXPR_NODE) +# define C_REFERENCE_EXPR CConcatCode(70,C_EXPR_NODE) +# define C_ENTRY_VALUE_EXPR CConcatCode(71,C_EXPR_NODE) +# define C_COMPLEX_EXPR CConcatCode(72,C_EXPR_NODE) +# define C_CONJ_EXPR CConcatCode(73,C_EXPR_NODE) +# define C_REALPART_EXPR CConcatCode(74,C_EXPR_NODE) +# define C_IMAGPART_EXPR CConcatCode(75,C_EXPR_NODE) +# define C_PREDECREMENT_EXPR CConcatCode(76,C_EXPR_NODE) +# define C_PREINCREMENT_EXPR CConcatCode(77,C_EXPR_NODE) +# define C_POSTDECREMENT_EXPR CConcatCode(78,C_EXPR_NODE) +# define C_POSTINCREMENT_EXPR CConcatCode(79,C_EXPR_NODE) +# define C_TRY_CATCH_EXPR CConcatCode(80,C_EXPR_NODE) +# define C_POPDHC_EXPR CConcatCode(81,C_EXPR_NODE) +# define C_POPDCC_EXPR CConcatCode(82,C_EXPR_NODE) +# define C_LABEL_EXPR CConcatCode(83,C_EXPR_NODE) +# define C_GOTO_EXPR CConcatCode(84,C_EXPR_NODE) +# define C_RETURN_EXPR CConcatCode(85,C_EXPR_NODE) +# define C_EXIT_EXPR CConcatCode(86,C_EXPR_NODE) +# define C_LOOP_EXPR CConcatCode(87,C_EXPR_NODE) + +# define C_COMPONENT_REF CConcatCode(88,C_EXPR_NODE) +# define C_BIT_FIELD_REF CConcatCode(89,C_EXPR_NODE) +# define C_INDIRECT_REF CConcatCode(90,C_EXPR_NODE) +# define C_BUFFER_REF CConcatCode(91,C_EXPR_NODE) +# define C_ARRAY_REF CConcatCode(92,C_EXPR_NODE) + +# define C_MAX_EXPR_CODE 93 + +/*------------------------------------------------------------\ +| | +| Tree Instruction | +| | +\------------------------------------------------------------*/ + +# define C_UNKNOWN_INST CConcatCode(0,C_INST_NODE) +# define C_FOR_INST CConcatCode(1,C_INST_NODE) +# define C_WHILE_INST CConcatCode(2,C_INST_NODE) +# define C_DO_INST CConcatCode(3,C_INST_NODE) +# define C_IF_INST CConcatCode(4,C_INST_NODE) +# define C_GOTO_INST CConcatCode(5,C_INST_NODE) +# define C_RETURN_INST CConcatCode(6,C_INST_NODE) +# define C_CONTINUE_INST CConcatCode(7,C_INST_NODE) +# define C_BREAK_INST CConcatCode(8,C_INST_NODE) +# define C_SWITCH_INST CConcatCode(9,C_INST_NODE) +# define C_CASE_INST CConcatCode(10,C_INST_NODE) + +# define C_MAX_INST_CODE 11 + +/*------------------------------------------------------------\ +| | +| Case Code | +| | +\------------------------------------------------------------*/ + +# define C_STANDARD_CASE 0 +# define C_RANGE_CASE 1 +# define C_DEFAULT_CASE 2 + +# define C_MAX_CASE_CODE 3 + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +# define c_sizeof_numbits( N ) (sizeof( N ) * 8) + +# define CStripNops( E ) \ + \ + while (( CTreeExprCode( E ) == C_NOP_EXPR \ + || CTreeExprCode( E ) == C_CONVERT_EXPR \ + || CTreeExprCode( E ) == C_NON_LVALUE_EXPR) \ + && ( CTreeTypeMode( CTreeType( E )) \ + == CTreeTypeMode( CTreeType( CTreeExprOperand( E, 0))))) \ + ( E ) = CTreeExprOperand( E, 0); + +# define CStripTypeNops( E ) \ + \ + while (( CTreeExprCode( E ) == C_NOP_EXPR \ + || CTreeExprCode( E ) == C_CONVERT_EXPR \ + || CTreeExprCode( E ) == C_NON_LVALUE_EXPR) \ + && ( CTreeType( E ) \ + == CTreeType( CTreeExprOperand( E , 0)))) \ + ( E ) = CTreeExprOperand( E, 0); + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + +# define CTreeNodeFirstCode(N) (CFirstCode((N)->COMMON.NODE_CODE)) +# define CTreeNodeExtraCode(N) (CExtraCode((N)->COMMON.NODE_CODE)) + +# define CTreeNodeCode(N) ((N)->COMMON.NODE_CODE) +# define CTreeChain(N) ((N)->COMMON.CHAIN) +# define CTreeType(N) ((N)->COMMON.TYPE) +# define CTreeFlags(N) ((N)->COMMON.FLAGS) +# define CTreeUser(N) ((N)->COMMON.USER) +# define CTreeFileName(N) ((N)->COMMON.FILE_NAME) +# define CTreeLineNum(N) ((N)->COMMON.LINE_NUM) + +# define C_TREE_NODE_MARK_MASK 0x00001 +# define C_TREE_NODE_EXTERNAL_MASK 0x00002 +# define C_TREE_NODE_STATIC_MASK 0x00004 +# define C_TREE_NODE_PUBLIC_MASK 0x00008 +# define C_TREE_NODE_PRIVATE_MASK 0x00010 +# define C_TREE_NODE_UNSIGNED_MASK 0x00020 +# define C_TREE_NODE_READONLY_MASK 0x00040 +# define C_TREE_NODE_VOLATILE_MASK 0x00080 +# define C_TREE_NODE_CONSTANT_MASK 0x00100 +# define C_TREE_NODE_SIDE_EFFECT_MASK 0x00200 +# define C_TREE_NODE_CDECL_LABEL_MASK 0x00400 +# define C_TREE_NODE_USED_MASK 0x00800 +# define C_TREE_NODE_ASM_WRITTEN_MASK 0x01000 +# define C_TREE_NODE_PERMANENT_MASK 0x02000 +# define C_TREE_NODE_RAISES_MASK 0x04000 +# define C_TREE_NODE_ADDRESSABLE_MASK 0x08000 +# define C_TREE_NODE_OVERFLOW_MASK 0x10000 +# define C_TREE_NODE_CST_OVERFLOW_MASK 0x20000 + +# define CIsTreeNodeMark( N ) ((N)->COMMON.FLAGS & C_TREE_NODE_MARK_MASK ) +# define CSetTreeNodeMark( N ) ((N)->COMMON.FLAGS |= C_TREE_NODE_MARK_MASK) +# define CClearTreeNodeMark( N ) ((N)->COMMON.FLAGS &= ~C_TREE_NODE_MARK_MASK) + +# define CIsTreeNodeExternal( N ) ((N)->COMMON.FLAGS & C_TREE_NODE_EXTERNAL_MASK ) +# define CSetTreeNodeExternal( N ) ((N)->COMMON.FLAGS |= C_TREE_NODE_EXTERNAL_MASK) +# define CClearTreeNodeExternal( N ) ((N)->COMMON.FLAGS &= ~C_TREE_NODE_EXTERNAL_MASK) + +# define CIsTreeNodeStatic( N ) ((N)->COMMON.FLAGS & C_TREE_NODE_STATIC_MASK ) +# define CSetTreeNodeStatic( N ) ((N)->COMMON.FLAGS |= C_TREE_NODE_STATIC_MASK) +# define CClearTreeNodeStatic( N ) ((N)->COMMON.FLAGS &= ~C_TREE_NODE_STATIC_MASK) + +# define CIsTreeNodePublic( N ) ((N)->COMMON.FLAGS & C_TREE_NODE_PUBLIC_MASK ) +# define CSetTreeNodePublic( N ) ((N)->COMMON.FLAGS |= C_TREE_NODE_PUBLIC_MASK) +# define CClearTreeNodePublic( N ) ((N)->COMMON.FLAGS &= ~C_TREE_NODE_PUBLIC_MASK) + +# define CIsTreeNodePrivate( N ) ((N)->COMMON.FLAGS & C_TREE_NODE_PRIVATE_MASK ) +# define CSetTreeNodePrivate( N ) ((N)->COMMON.FLAGS |= C_TREE_NODE_PRIVATE_MASK) +# define CClearTreeNodePrivate( N ) ((N)->COMMON.FLAGS &= ~C_TREE_NODE_PRIVATE_MASK) + +# define CIsTreeNodeUnsigned( N ) ((N)->COMMON.FLAGS & C_TREE_NODE_UNSIGNED_MASK ) +# define CSetTreeNodeUnsigned( N ) ((N)->COMMON.FLAGS |= C_TREE_NODE_UNSIGNED_MASK) +# define CClearTreeNodeUnsigned( N ) ((N)->COMMON.FLAGS &= ~C_TREE_NODE_UNSIGNED_MASK) + +# define CIsTreeNodeReadOnly( N ) ((N)->COMMON.FLAGS & C_TREE_NODE_READONLY_MASK ) +# define CSetTreeNodeReadOnly( N ) ((N)->COMMON.FLAGS |= C_TREE_NODE_READONLY_MASK) +# define CClearTreeNodeReadOnly( N ) ((N)->COMMON.FLAGS &= ~C_TREE_NODE_READONLY_MASK) + +# define CIsTreeNodeVolatile( N ) ((N)->COMMON.FLAGS & C_TREE_NODE_VOLATILE_MASK ) +# define CSetTreeNodeVolatile( N ) ((N)->COMMON.FLAGS |= C_TREE_NODE_VOLATILE_MASK) +# define CClearTreeNodeVolatile( N ) ((N)->COMMON.FLAGS &= ~C_TREE_NODE_VOLATILE_MASK) + +# define CIsTreeNodeConstant( N ) ((N)->COMMON.FLAGS & C_TREE_NODE_CONSTANT_MASK ) +# define CSetTreeNodeConstant( N ) ((N)->COMMON.FLAGS |= C_TREE_NODE_CONSTANT_MASK) +# define CClearTreeNodeConstant( N ) ((N)->COMMON.FLAGS &= ~C_TREE_NODE_CONSTANT_MASK) + +# define CIsTreeNodeSideEffect( N ) ((N)->COMMON.FLAGS & C_TREE_NODE_SIDE_EFFECT_MASK ) +# define CSetTreeNodeSideEffect( N ) ((N)->COMMON.FLAGS |= C_TREE_NODE_SIDE_EFFECT_MASK) +# define CClearTreeNodeSideEffect( N ) ((N)->COMMON.FLAGS &= ~C_TREE_NODE_SIDE_EFFECT_MASK) + +# define CIsTreeNodeCDeclLabel( N ) ((N)->COMMON.FLAGS & C_TREE_NODE_CDECL_LABEL_MASK ) +# define CSetTreeNodeCDeclLabel( N ) ((N)->COMMON.FLAGS |= C_TREE_NODE_CDECL_LABEL_MASK) +# define CClearTreeNodeCDeclLabel( N ) ((N)->COMMON.FLAGS &= ~C_TREE_NODE_CDECL_LABEL_MASK) + +# define CIsTreeNodeUsed( N ) ((N)->COMMON.FLAGS & C_TREE_NODE_USED_MASK ) +# define CSetTreeNodeUsed( N ) ((N)->COMMON.FLAGS |= C_TREE_NODE_USED_MASK) +# define CClearTreeNodeUsed( N ) ((N)->COMMON.FLAGS &= ~C_TREE_NODE_USED_MASK) + +# define CIsTreeNodeAsmWritten( N ) ((N)->COMMON.FLAGS & C_TREE_NODE_ASM_WRITTEN_MASK ) +# define CSetTreeNodeAsmWritten( N ) ((N)->COMMON.FLAGS |= C_TREE_NODE_ASM_WRITTEN_MASK) +# define CClearTreeNodeAsmWritten( N ) ((N)->COMMON.FLAGS &= ~C_TREE_NODE_ASM_WRITTEN_MASK) + +# define CIsTreeNodePermanent( N ) ((N)->COMMON.FLAGS & C_TREE_NODE_PERMANENT_MASK ) +# define CSetTreeNodePermanent( N ) ((N)->COMMON.FLAGS |= C_TREE_NODE_PERMANENT_MASK) +# define CClearTreeNodePermanent( N ) ((N)->COMMON.FLAGS &= ~C_TREE_NODE_PERMANENT_MASK) + +# define CIsTreeNodeRaises( N ) ((N)->COMMON.FLAGS & C_TREE_NODE_RAISES_MASK ) +# define CSetTreeNodeRaises( N ) ((N)->COMMON.FLAGS |= C_TREE_NODE_RAISES_MASK) +# define CClearTreeNodeRaises( N ) ((N)->COMMON.FLAGS &= ~C_TREE_NODE_RAISES_MASK) + +# define CIsTreeNodeAddressable( N ) ((N)->COMMON.FLAGS & C_TREE_NODE_ADDRESSABLE_MASK ) +# define CSetTreeNodeAddressable( N ) ((N)->COMMON.FLAGS |= C_TREE_NODE_ADDRESSABLE_MASK) +# define CClearTreeNodeAddressable( N ) ((N)->COMMON.FLAGS &= ~C_TREE_NODE_ADDRESSABLE_MASK) + +# define CIsTreeNodeOverflow( N ) ((N)->COMMON.FLAGS & C_TREE_NODE_OVERFLOW_MASK ) +# define CSetTreeNodeOverflow( N ) ((N)->COMMON.FLAGS |= C_TREE_NODE_OVERFLOW_MASK) +# define CClearTreeNodeOverflow( N ) ((N)->COMMON.FLAGS &= ~C_TREE_NODE_OVERFLOW_MASK) + +# define CIsTreeNodeCstOverflow( N ) ((N)->COMMON.FLAGS & C_TREE_NODE_CST_OVERFLOW_MASK ) +# define CSetTreeNodeCstOverflow( N ) ((N)->COMMON.FLAGS |= C_TREE_NODE_CST_OVERFLOW_MASK) +# define CClearTreeNodeCstOverflow( N ) ((N)->COMMON.FLAGS &= ~C_TREE_NODE_CST_OVERFLOW_MASK) + + typedef struct c_tree_common + { + union c_tree_node *CHAIN; + union c_tree_node *TYPE; + union c_tree_node *NEXT; + char *FILE_NAME; + int LINE_NUM; + short NODE_CODE; + long FLAGS; + void *USER; + + } c_tree_common; + +# define CTreeIntCstLow(N) ((N)->INT_CST.LOW) +# define CTreeIntCstHigh(N) ((N)->INT_CST.HIGH) + + typedef struct c_tree_int_cst + { + struct c_tree_common COMMON; + long LOW; + long HIGH; + + } c_tree_int_cst; + +# define CTreeRealCstValue(N) ((N)->REAL_CST.VALUE) + + typedef struct c_tree_real_cst + { + struct c_tree_common COMMON; + double VALUE; + + } c_tree_real_cst; + +# define CTreeStringLength(N) ((int )(N)->STRING.LENGTH) +# define CTreeStringPointer(N) ((char *)(N)->STRING.POINTER) + + typedef struct c_tree_string + { + struct c_tree_common COMMON; + int LENGTH; + char *POINTER; + + } c_tree_string; + +# define CTreeComplexReal(N) ((N)->COMPLEX.REAL) +# define CTreeComplexImag(N) ((N)->COMPLEX.IMAG) + + typedef struct c_tree_complex + { + struct c_tree_common COMMON; + union c_tree_node *REAL; + union c_tree_node *IMAG; + + } c_tree_complex; + +# define CTreeIdentLength(N) ((N)->IDENT.LENGTH ) +# define CTreeIdentPointer(N) ((N)->IDENT.POINTER) +# define CTreeIdentGlobalValue(N) ((N)->IDENT.GLOBAL_VALUE) +# define CTreeIdentLocalValue(N) ((N)->IDENT.LOCAL_VALUE) +# define CTreeIdentLabelValue(N) ((N)->IDENT.LABEL_VALUE) +# define CTreeIdentImplicitDecl(N) ((N)->IDENT.IMPLICIT_DECL) +# define CTreeIdentErrorLocus(N) ((N)->IDENT.ERROR_LOCUS) +# define CTreeIdentLimboValue(N) ((N)->IDENT.LIMBO_VALUE) + + typedef struct c_tree_ident + { + struct c_tree_common COMMON; + int LENGTH; + char *POINTER; + union c_tree_node *GLOBAL_VALUE; + union c_tree_node *LOCAL_VALUE; + union c_tree_node *LABEL_VALUE; + union c_tree_node *IMPLICIT_DECL; + union c_tree_node *ERROR_LOCUS; + union c_tree_node *LIMBO_VALUE; + + } c_tree_ident; + +# define CTreeListPurpose( N ) ((N)->LIST.PURPOSE) +# define CTreeListValue( N ) ((N)->LIST.VALUE) + + typedef struct c_tree_list + { + struct c_tree_common COMMON; + union c_tree_node *PURPOSE; + union c_tree_node *VALUE; + + } c_tree_list; + +# define CTreeVecLength( N ) ((N)->VEC.LENGTH) +# define CTreeVecElem( N, I ) ((N)->VEC.ARRAY[(I)]) + + typedef struct c_tree_vec + { + struct c_tree_common COMMON; + int LENGTH; + union c_tree_node **ARRAY; + + } c_tree_vec; + +# define CTreeExprCode( N ) CTreeNodeCode(N) +# define CTreeExprComplexity( N ) ((N)->EXPR.COMPLEXITY) +# define CTreeExprNumOper( N ) ((N)->EXPR.NUM_OPER) +# define CTreeExprOperand( N, I ) ((N)->EXPR.OPERANDS[(I)]) + + typedef struct c_tree_expr + { + struct c_tree_common COMMON; + int COMPLEXITY; + int NUM_OPER; + union c_tree_node **OPERANDS; + + } c_tree_expr; + +# define CTreeBlockVars( N ) ((N)->BLOCK.VARS) +# define CTreeBlockTypeTags( N ) ((N)->BLOCK.TYPE_TAGS) +# define CTreeBlockSubBlocks( N ) ((N)->BLOCK.SUB_BLOCKS) +# define CTreeBlockSuperContext( N ) ((N)->BLOCK.SUPER_CONTEXT) +# define CTreeBlockAbstractOrigin( N ) ((N)->BLOCK.ABSTRACT_ORIGIN) +# define CTreeBlockBody( N ) ((N)->BLOCK.BODY) + + typedef struct c_tree_block + { + struct c_tree_common COMMON; + union c_tree_node *VARS; + union c_tree_node *TYPE_TAGS; + union c_tree_node *SUB_BLOCKS; + union c_tree_node *SUPER_CONTEXT; + union c_tree_node *ABSTRACT_ORIGIN; + union c_tree_node *BODY; + + } c_tree_block; + +# define CTreeTypeCode( N ) CTreeNodeCode(N) +# define CTreeTypeValues( N ) ((N)->TYPE.VALUES) +# define CTreeTypeSize( N ) ((N)->TYPE.SIZE) +# define CTreeTypeAttributes( N ) ((N)->TYPE.ATTRIBUTES) +# define CTreeTypeId( N ) ((N)->TYPE.TYPE_ID) +# define CTreeTypeMode( N ) ((N)->TYPE.MODE) +# define CTreeTypePrecision( N ) ((N)->TYPE.PRECISION) +# define CTreeTypeAlign( N ) ((N)->TYPE.ALIGN) +# define CTreeTypePointerTo( N ) ((N)->TYPE.POINTER_TO) +# define CTreeTypeReferenceTo( N ) ((N)->TYPE.REFERENCE_TO) +# define CTreeTypeName( N ) ((N)->TYPE.NAME) +# define CTreeTypeMinValue( N ) ((N)->TYPE.MIN_VALUE) +# define CTreeTypeMaxValue( N ) ((N)->TYPE.MAX_VALUE) +# define CTreeTypeNextVariant( N ) ((N)->TYPE.NEXT_VARIANT) +# define CTreeTypeMainVariant( N ) ((N)->TYPE.MAIN_VARIANT) +# define CTreeTypeBInfo( N ) ((N)->TYPE.BINFO) +# define CTreeTypeNonCopiedParts( N ) ((N)->TYPE.NONCOPIED_PARTS) +# define CTreeTypeContext( N ) ((N)->TYPE.CONTEXT) + +# define C_TREE_TYPE_VAR_SIZE_MASK 0x01 +# define C_TREE_TYPE_TRANS_UNION_MASK 0x02 +# define C_TREE_TYPE_FIELDS_RD_ONLY_MASK 0x04 +# define C_TREE_TYPE_FIELDS_VOLAT_MASK 0x08 + +# define CIsTreeTypeVarSize( N ) ((N)->TYPE.FLAGS & C_TREE_TYPE_VAR_SIZE_MASK ) +# define CSetTreeTypeVarSize( N ) ((N)->TYPE.FLAGS |= C_TREE_TYPE_VAR_SIZE_MASK) +# define CClearTreeTypeVarSize( N ) ((N)->TYPE.FLAGS &= ~C_TREE_TYPE_VAR_SIZE_MASK) + +# define CIsTreeTypeTransUnion( N ) ((N)->TYPE.FLAGS & C_TREE_TYPE_TRANS_UNION_MASK ) +# define CSetTreeTypeTransUnion( N ) ((N)->TYPE.FLAGS |= C_TREE_TYPE_TRANS_UNION_MASK) +# define CClearTreeTypeTransUnion( N ) ((N)->TYPE.FLAGS &= ~C_TREE_TYPE_TRANS_UNION_MASK) + +# define CIsTreeTypeFieldsReadOnly(N) ((N)->TYPE.FLAGS & C_TREE_TYPE_FIELDS_RD_ONLY_MASK ) +# define CSetTreeTypeFieldsReadOnly(N) ((N)->TYPE.FLAGS |= C_TREE_TYPE_FIELDS_RD_ONLY_MASK) +# define CClearTreeTypeFieldsReadOnly(N) ((N)->TYPE.FLAGS &= ~C_TREE_TYPE_FIELDS_RD_ONLY_MASK) + +# define CIsTreeTypeFieldsVolatile( N ) ((N)->TYPE.FLAGS & C_TREE_TYPE_FIELDS_VOLAT_MASK ) +# define CSetTreeTypeFieldsVolatile( N ) ((N)->TYPE.FLAGS |= C_TREE_TYPE_FIELDS_VOLAT_MASK) +# define CClearTreeTypeFieldsVolatile( N ) ((N)->TYPE.FLAGS &= ~C_TREE_TYPE_FIELDS_VOLAT_MASK) + + + + typedef struct c_tree_type + { + struct c_tree_common COMMON; + union c_tree_node *VALUES; + union c_tree_node *SIZE; + union c_tree_node *ATTRIBUTES; + int TYPE_ID; + int MODE; + unsigned char PRECISION; + unsigned char UNSIGNED; + int ALIGN; + union c_tree_node *POINTER_TO; + union c_tree_node *REFERENCE_TO; + union c_tree_node *NAME; + union c_tree_node *MIN_VALUE; + union c_tree_node *MAX_VALUE; + union c_tree_node *NEXT_VARIANT; + union c_tree_node *MAIN_VARIANT; + union c_tree_node *BINFO; + union c_tree_node *NONCOPIED_PARTS; + union c_tree_node *CONTEXT; + long FLAGS; + + } c_tree_type; + +# define CTreeDeclCode(N) CTreeNodeCode(N) +# define CTreeDeclFileName(N) CTreeFileName(N) +# define CTreeDeclLineNum(N) CTreeLineNum(N) +# define CTreeDeclId(N) ((N)->DECL.DECL_ID) +# define CTreeDeclSize(N) ((N)->DECL.SIZE) +# define CTreeDeclMode(N) ((N)->DECL.MODE) +# define CTreeDeclFieldSize(N) ((N)->DECL.FIELD_SIZE) +# define CTreeDeclName(N) ((N)->DECL.NAME) +# define CTreeDeclContext(N) ((N)->DECL.CONTEXT) +# define CTreeDeclAbstractOrigin(N) ((N)->DECL.ABSTRACT_ORIGIN) +# define CTreeDeclArguments(N) ((N)->DECL.ARGUMENTS) +# define CTreeDeclResult(N) ((N)->DECL.RESULT) +# define CTreeDeclInitial(N) ((N)->DECL.INITIAL) +# define CTreeDeclFlags(N) ((N)->DECL.FLAGS) + +# define C_TREE_DECL_EXTERNAL_MASK 0x0001 +# define C_TREE_DECL_NON_LOCAL_MASK 0x0002 +# define C_TREE_DECL_COMMON_MASK 0x0004 +# define C_TREE_DECL_VAR_SIZE_MASK 0x0008 +# define C_TREE_DECL_C_BIT_FIELD_MASK 0x0010 +# define C_TREE_DECL_ITERATOR_MASK 0x0020 +# define C_TREE_DECL_REGISTER_MASK 0x0040 +# define C_TREE_DECL_BUILT_IN_MASK 0x0080 +# define C_TREE_DECL_BIT_FIELD_MASK 0x0100 +# define C_TREE_DECL_SYSTEM_HEADER_MASK 0x0100 +# define C_TREE_DECL_IGNORED_MASK 0x0200 +# define C_TREE_DECL_ANTICIPATED_MASK 0x0400 +# define C_TREE_DECL_DECLARED_LABEL_MASK 0x0800 +# define C_TREE_DECL_WEAK_MASK 0x1000 +# define C_TREE_DECL_INLINE_MASK 0x2000 + +# define CIsTreeDeclExternal( N ) ((N)->DECL.FLAGS & C_TREE_DECL_EXTERNAL_MASK ) +# define CSetTreeDeclExternal( N ) ((N)->DECL.FLAGS |= C_TREE_DECL_EXTERNAL_MASK) +# define CClearTreeDeclExternal( N ) ((N)->DECL.FLAGS &= ~C_TREE_DECL_EXTERNAL_MASK) + +# define CIsTreeDeclNonLocal( N ) ((N)->DECL.FLAGS & C_TREE_DECL_NON_LOCAL_MASK ) +# define CSetTreeDeclNonLocal( N ) ((N)->DECL.FLAGS |= C_TREE_DECL_NON_LOCAL_MASK) +# define CClearTreeDeclNonLocal( N ) ((N)->DECL.FLAGS &= ~C_TREE_DECL_NON_LOCAL_MASK) + +# define CIsTreeDeclCommon( N ) ((N)->DECL.FLAGS & C_TREE_DECL_COMMON_MASK ) +# define CSetTreeDeclCommon( N ) ((N)->DECL.FLAGS |= C_TREE_DECL_COMMON_MASK) +# define CClearTreeDeclCommon( N ) ((N)->DECL.FLAGS &= ~C_TREE_DECL_COMMON_MASK) + +# define CIsTreeDeclVarSize( N ) ((N)->DECL.FLAGS & C_TREE_DECL_VAR_SIZE_MASK ) +# define CSetTreeDeclVarSize( N ) ((N)->DECL.FLAGS |= C_TREE_DECL_VAR_SIZE_MASK) +# define CClearTreeDeclVarSize( N ) ((N)->DECL.FLAGS &= ~C_TREE_DECL_VAR_SIZE_MASK) + +# define CIsTreeDeclCBitField( N ) ((N)->DECL.FLAGS & C_TREE_DECL_C_BIT_FIELD_MASK ) +# define CSetTreeDeclCBitField( N ) ((N)->DECL.FLAGS |= C_TREE_DECL_C_BIT_FIELD_MASK) +# define CClearTreeDeclCBitField( N ) ((N)->DECL.FLAGS &= ~C_TREE_DECL_C_BIT_FIELD_MASK) + +# define CIsTreeDeclIterator( N ) ((N)->DECL.FLAGS & C_TREE_DECL_ITERATOR_MASK) +# define CSetTreeDeclIterator( N ) ((N)->DECL.FLAGS |= C_TREE_DECL_ITERATOR_MASK) +# define CClearTreeDeclIterator( N ) ((N)->DECL.FLAGS &= ~C_TREE_DECL_ITERATOR_MASK) + +# define CIsTreeDeclRegister( N ) ((N)->DECL.FLAGS & C_TREE_DECL_REGISTER_MASK) +# define CSetTreeDeclRegister( N ) ((N)->DECL.FLAGS |= C_TREE_DECL_REGISTER_MASK) +# define CClearTreeDeclRegister( N ) ((N)->DECL.FLAGS &= ~C_TREE_DECL_REGISTER_MASK) + +# define CIsTreeDeclBuiltIn( N ) ((N)->DECL.FLAGS & C_TREE_DECL_BUILT_IN_MASK) +# define CSetTreeDeclBuiltIn( N ) ((N)->DECL.FLAGS |= C_TREE_DECL_BUILT_IN_MASK) +# define CClearTreeDeclBuiltIn( N ) ((N)->DECL.FLAGS &= ~C_TREE_DECL_BUILT_IN_MASK) + +# define CIsTreeDeclBitField( N ) ((N)->DECL.FLAGS & C_TREE_DECL_BIT_FIELD_MASK ) +# define CSetTreeDeclBitField( N ) ((N)->DECL.FLAGS |= C_TREE_DECL_BIT_FIELD_MASK) +# define CClearTreeDeclBitField( N ) ((N)->DECL.FLAGS &= ~C_TREE_DECL_BIT_FIELD_MASK) + +# define CIsTreeDeclSystemHeader( N ) ((N)->DECL.FLAGS & C_TREE_DECL_SYSTEM_HEADER_MASK ) +# define CSetTreeDeclSystemHeader( N ) ((N)->DECL.FLAGS |= C_TREE_DECL_SYSTEM_HEADER_MASK) +# define CClearTreeDeclSystemHeader( N ) ((N)->DECL.FLAGS &= ~C_TREE_DECL_SYSTEM_HEADER_MASK) + +# define CIsTreeDeclIgnored( N ) ((N)->DECL.FLAGS & C_TREE_DECL_IGNORED_MASK ) +# define CSetTreeDeclIgnored( N ) ((N)->DECL.FLAGS |= C_TREE_DECL_IGNORED_MASK) +# define CClearTreeDeclIgnored( N ) ((N)->DECL.FLAGS &= ~C_TREE_DECL_IGNORED_MASK) + +# define CIsTreeDeclAnticipated( N ) ((N)->DECL.FLAGS & C_TREE_DECL_ANTICIPATED_MASK ) +# define CSetTreeDeclAnticipated( N ) ((N)->DECL.FLAGS |= C_TREE_DECL_ANTICIPATED_MASK) +# define CClearTreeDeclAnticipated( N ) ((N)->DECL.FLAGS &= ~C_TREE_DECL_ANTICIPATED_MASK) + +# define CIsTreeDeclDeclaredLabel( N ) ((N)->DECL.FLAGS & C_TREE_DECL_DECLARED_LABEL_MASK ) +# define CSetTreeDeclDeclaredLabel( N ) ((N)->DECL.FLAGS |= C_TREE_DECL_DECLARED_LABEL_MASK) +# define CClearTreeDeclDeclaredLabel( N ) ((N)->DECL.FLAGS &= ~C_TREE_DECL_DECLARED_LABEL_MASK) + +# define CIsTreeDeclWeak( N ) ((N)->DECL.FLAGS & C_TREE_DECL_WEAK_MASK ) +# define CSetTreeDeclWeak( N ) ((N)->DECL.FLAGS |= C_TREE_DECL_WEAK_MASK) +# define CClearTreeDeclWeak( N ) ((N)->DECL.FLAGS &= ~C_TREE_DECL_WEAK_MASK) + +# define CIsTreeDeclInline( N ) ((N)->DECL.FLAGS & C_TREE_DECL_INLINE_MASK ) +# define CSetTreeDeclInline( N ) ((N)->DECL.FLAGS |= C_TREE_DECL_INLINE_MASK) +# define CClearTreeDeclInline( N ) ((N)->DECL.FLAGS &= ~C_TREE_DECL_INLINE_MASK) + + typedef struct c_tree_decl + { + struct c_tree_common COMMON; + int DECL_ID; + union c_tree_node *SIZE; + int MODE; + int FIELD_SIZE; + union c_tree_node *NAME; + union c_tree_node *CONTEXT; + union c_tree_node *ABSTRACT_ORIGIN; + union c_tree_node *ARGUMENTS; + union c_tree_node *RESULT; + union c_tree_node *INITIAL; + long FLAGS; + + } c_tree_decl; + +# define CTreeInstCaseCode(N) ((N)->INST.CLASS.CASE.CASE_CODE) +# define CTreeInstCaseFrom(N) ((N)->INST.CLASS.CASE.FROM) +# define CTreeInstCaseTo(N) ((N)->INST.CLASS.CASE.TO) + + typedef struct c_tree_inst_case + { + struct c_tree_common COMMON; + short CASE_CODE; + union c_tree_node *FROM; + union c_tree_node *TO; + + } c_tree_inst_case; + +# define CTreeInstSwitchOn(N) ((N)->INST.CLASS.SWITCH.ON) +# define CTreeInstSwitchBody(N) ((N)->INST.CLASS.SWITCH.BODY) + + typedef struct c_tree_inst_switch + { + struct c_tree_common COMMON; + union c_tree_node *ON; + union c_tree_node *BODY; + + } c_tree_inst_switch; + + typedef struct c_tree_inst_break + { + struct c_tree_common COMMON; + + } c_tree_inst_break; + + typedef struct c_tree_inst_continue + { + struct c_tree_common COMMON; + + } c_tree_inst_continue; + +# define CTreeInstReturnValue(N) ((N)->INST.CLASS.RETURN.VALUE) + + typedef struct c_tree_inst_return + { + struct c_tree_common COMMON; + union c_tree_node *VALUE; + + } c_tree_inst_return; + +# define CTreeInstGotoLabel(N) ((N)->INST.CLASS.GOTO.LABEL) + + typedef struct c_tree_inst_goto + { + struct c_tree_common COMMON; + union c_tree_node *LABEL; + + } c_tree_inst_goto; + +# define CTreeInstForStart(N) ((N)->INST.CLASS.FOR.START) +# define CTreeInstForCond(N) ((N)->INST.CLASS.FOR.COND) +# define CTreeInstForInc(N) ((N)->INST.CLASS.FOR.INC) +# define CTreeInstForBody(N) ((N)->INST.CLASS.FOR.BODY) + + typedef struct c_tree_inst_for + { + struct c_tree_common COMMON; + union c_tree_node *START; + union c_tree_node *COND; + union c_tree_node *INC; + union c_tree_node *BODY; + + } c_tree_inst_for; + +# define CTreeInstWhileCond(N) ((N)->INST.CLASS.WHILE.COND) +# define CTreeInstWhileBody(N) ((N)->INST.CLASS.WHILE.BODY) + + typedef struct c_tree_inst_while + { + struct c_tree_common COMMON; + union c_tree_node *COND; + union c_tree_node *BODY; + + } c_tree_inst_while; + +# define CTreeInstDoCond(N) ((N)->INST.CLASS.DO.COND) +# define CTreeInstDoBody(N) ((N)->INST.CLASS.DO.BODY) + + typedef struct c_tree_inst_do + { + struct c_tree_common COMMON; + union c_tree_node *COND; + union c_tree_node *BODY; + + } c_tree_inst_do; + +# define CTreeInstIfCond(N) ((N)->INST.CLASS.IF.COND) +# define CTreeInstIfThen(N) ((N)->INST.CLASS.IF.THEN) +# define CTreeInstIfElse(N) ((N)->INST.CLASS.IF.ELSE) + + typedef struct c_tree_inst_if + { + struct c_tree_common COMMON; + union c_tree_node *COND; + union c_tree_node *THEN; + union c_tree_node *ELSE; + + } c_tree_inst_if; + +# define CTreeInstCode(N) CTreeNodeCode(N) + + typedef struct c_tree_inst + { + struct c_tree_common COMMON; + union + { + c_tree_inst_for FOR; + c_tree_inst_while WHILE; + c_tree_inst_do DO; + c_tree_inst_if IF; + c_tree_inst_goto GOTO; + c_tree_inst_return RETURN; + c_tree_inst_continue CONTINUE; + c_tree_inst_break BREAK; + c_tree_inst_switch SWITCH; + c_tree_inst_case CASE; + + } CLASS; + } c_tree_inst; + + typedef union c_tree_node + { + c_tree_common COMMON; + c_tree_int_cst INT_CST; + c_tree_real_cst REAL_CST; + c_tree_string STRING; + c_tree_complex COMPLEX; + c_tree_ident IDENT; + c_tree_decl DECL; + c_tree_type TYPE; + c_tree_list LIST; + c_tree_vec VEC; + c_tree_expr EXPR; + c_tree_block BLOCK; + c_tree_inst INST; + + } c_tree_node; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char *C_NODE_CODE_NAME[ C_MAX_NODE_CODE ]; + extern int C_NODE_SIZE[ C_MAX_NODE_CODE ]; + extern char *C_EXPR_CODE_NAME[ C_MAX_EXPR_CODE ]; + extern char *C_TYPE_CODE_NAME[ C_MAX_TYPE_CODE ]; + extern char *C_DECL_CODE_NAME[ C_MAX_DECL_CODE ]; + extern char *C_INST_CODE_NAME[ C_MAX_INST_CODE ]; + extern char *C_CASE_CODE_NAME[ C_MAX_CASE_CODE ]; + + extern short C_TREE_FORCE_VIEW_NODE; + extern short C_TREE_VIEW_TYPE_NODE; + extern short C_TREE_VIEW_SIZE_NODE; + extern c_tree_node *C_HEAD_NODE_LIST[ C_MAX_NODE_CODE ]; + + extern c_tree_node *c_error_mark_node; + extern c_tree_node *c_size_type; + extern c_tree_node *c_size_zero_node; + extern c_tree_node *c_size_one_node; + extern c_tree_node *c_short_integer_type_node; + extern c_tree_node *c_integer_type_node; + extern c_tree_node *c_long_integer_type_node; + extern c_tree_node *c_long_long_integer_type_node; + extern c_tree_node *c_short_unsigned_type_node; + extern c_tree_node *c_unsigned_type_node; + extern c_tree_node *c_long_unsigned_type_node; + extern c_tree_node *c_long_long_unsigned_type_node; + extern c_tree_node *c_boolean_type_node; + extern c_tree_node *c_boolean_false_node; + extern c_tree_node *c_boolean_true_node; + extern c_tree_node *c_ptrdiff_type_node; + extern c_tree_node *c_unsigned_char_type_node; + extern c_tree_node *c_signed_char_type_node; + extern c_tree_node *c_char_type_node; + extern c_tree_node *c_wchar_type_node; + extern c_tree_node *c_signed_wchar_type_node; + extern c_tree_node *c_unsigned_wchar_type_node; + extern c_tree_node *c_float_type_node; + extern c_tree_node *c_double_type_node; + extern c_tree_node *c_long_double_type_node; + extern c_tree_node *c_complex_integer_type_node; + extern c_tree_node *c_complex_float_type_node; + extern c_tree_node *c_complex_double_type_node; + extern c_tree_node *c_complex_long_double_type_node; + extern c_tree_node *c_void_type_node; + extern c_tree_node *c_ptr_type_node; + extern c_tree_node *c_const_ptr_type_node; + extern c_tree_node *c_string_type_node; + extern c_tree_node *c_const_string_type_node; + extern c_tree_node *c_char_array_type_node; + extern c_tree_node *c_int_array_type_node; + extern c_tree_node *c_wchar_array_type_node; + extern c_tree_node *c_default_function_type; + extern c_tree_node *c_double_ftype_double; + extern c_tree_node *c_double_ftype_double_double; + extern c_tree_node *c_int_ftype_int; + extern c_tree_node *c_long_ftype_long; + extern c_tree_node *c_float_ftype_float; + extern c_tree_node *c_ldouble_ftype_ldouble; + extern c_tree_node *c_void_ftype_ptr_ptr_int; + extern c_tree_node *c_int_ftype_ptr_ptr_int; + extern c_tree_node *c_void_ftype_ptr_int_int; + extern c_tree_node *c_string_ftype_ptr_ptr; + extern c_tree_node *c_int_ftype_string_string; + extern c_tree_node *c_int_ftype_cptr_cptr_sizet; + extern c_tree_node *c_integer_zero_node; + extern c_tree_node *c_null_pointer_node; + extern c_tree_node *c_integer_one_node; + extern c_tree_node *c_size_type; + extern c_tree_node *c_size_zero_node; + extern c_tree_node *c_size_one_node; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tree Function | +| | +\------------------------------------------------------------*/ + + extern c_tree_node * c_tree_alloc_node __P(()); + extern c_tree_node ** c_tree_alloc_node_array __P((int Length)); + extern c_tree_node * c_tree_add_node __P((int NodeCode)); + extern c_tree_node * c_tree_copy_node __P((c_tree_node *TreeNode)); + extern c_tree_node * c_tree_copy_list __P((c_tree_node *TreeNode)); + extern c_tree_node * c_tree_build_vec __P((int Length)); + extern c_tree_node * c_tree_build_list __P((c_tree_node *Purpose, c_tree_node *Value)); + extern c_tree_node * c_tree_build_complex __P((c_tree_node *Type, c_tree_node *Real, c_tree_node *Imag)); + extern c_tree_node * c_tree_build_decl __P((int DeclType, c_tree_node *TreeName, c_tree_node *TreeType)); + extern c_tree_node * c_tree_build_inst __P(( int InstCode )); + extern c_tree_node * c_tree_build_type __P((int TypeType)); + extern c_tree_node * c_tree_build_type_copy __P((c_tree_node *TreeType)); + extern c_tree_node * c_tree_build_type_variant __P((c_tree_node *TreeType, int ConstP, int VolatileP)); + extern c_tree_node * c_tree_build_function_type __P((c_tree_node *ValueType, c_tree_node *ArgTypes)); + extern c_tree_node * c_tree_build_complex_type __P((c_tree_node *Component)); + extern c_tree_node * c_tree_build_signed_type __P((int Precision)); + extern c_tree_node * c_tree_build_unsigned_type __P((int Precision)); + extern c_tree_node * c_tree_build_pointer_type __P((c_tree_node *TreeType)); + extern c_tree_node * c_tree_build_array_type __P((c_tree_node *ElemType, c_tree_node *IndexType)); + extern c_tree_node * c_tree_build_index_type __P((c_tree_node *MaxVal)); + extern c_tree_node * c_tree_build_unary_expr __P((int ExprCode, c_tree_node *TreeExpr)); + extern c_tree_node * c_tree_build_binary_expr __P((int ExprCode, c_tree_node *TreeExpr1, c_tree_node *TreeExpr2)); + extern c_tree_node * c_tree_build_ternary_expr __P((int ExprCode, c_tree_node *TreeExpr1, c_tree_node *TreeExpr2, c_tree_node *TreeExpr3)); + extern c_tree_node * c_tree_build_real __P((c_tree_node *TreeType, double Value)); + extern c_tree_node * c_tree_build_int_2 __P((long Low, long High)); + extern c_tree_node * c_tree_build_string __P((int Length, char *Text)); + extern c_tree_node * c_tree_build_pointer_declarator __P((c_tree_node *TreeTypeQual, c_tree_node *TreeTarget)); + extern c_tree_node * c_tree_combine_strings __P((c_tree_node *TreeString)); + extern c_tree_node * c_tree_get_size_int __P((int Number)); + extern int c_tree_get_list_length __P((c_tree_node *ListTree)); + extern c_tree_node * c_tree_get_identifier __P((char *Text)); + extern c_tree_node * c_tree_concat_list __P((c_tree_node *ListTree1, c_tree_node *ListTree2)); + extern c_tree_node * c_tree_add_head_list __P((c_tree_node *Purpose, c_tree_node *Value, c_tree_node *ListTree)); + extern int c_tree_is_int_cst_sgn __P((c_tree_node *t)); + extern int c_tree_is_real_zerop __P((c_tree_node *expr)); + extern int c_tree_is_real_onep __P((c_tree_node *expr)); + extern int c_tree_is_real_twop __P((c_tree_node *expr)); + extern int c_tree_is_integer_zerop __P((c_tree_node *expr)); + extern int c_tree_is_integer_onep __P((c_tree_node *expr)); + extern int c_tree_is_integer_all_onesp __P((c_tree_node *expr)); + extern int c_tree_is_int_cst_lt __P((c_tree_node *t1, c_tree_node *t2)); + extern int c_tree_is_int_cst_equal __P((c_tree_node *t1, c_tree_node *t2)); + extern int c_tree_is_integer_pow2p __P((c_tree_node *expr)); + extern c_tree_node * c_tree_reverse_list __P((c_tree_node *t)); + extern c_tree_node * c_tree_get_last_list __P((c_tree_node *chain)); + extern void c_indent __P(()); + extern void c_tree_view_node __P((c_tree_node *TreeNode)); + extern void c_tree_view_node_list __P((c_tree_node *TreeNode)); + + extern c_tree_node * c_tree_build_type_attribute_variant __P((c_tree_node *TreeType, c_tree_node *TreeAttr )); + extern c_tree_node * c_tree_build_unary_typed_expr __P((int code, c_tree_node *type, c_tree_node *node)); + extern c_tree_node * c_tree_build_binary_typed_expr __P((int code, c_tree_node *type, c_tree_node * arg0, c_tree_node * arg1 )); + extern c_tree_node * c_tree_build_ternary_typed_expr __P((int code, c_tree_node *type, c_tree_node *arg0, c_tree_node *arg1, c_tree_node *arg2 )); + extern c_tree_node * c_tree_get_purpose_member __P((c_tree_node *elem, c_tree_node *list)); + + extern char c_tree_get_code_class __P(( int NodeCode )); + + extern void c_tree_free_all_node __P(()); + +/*------------------------------------------------------------\ +| | +| Parse Function | +| | +\------------------------------------------------------------*/ + + extern c_tree_node *c_tree_parse_file __P((char *InputFileName, int Argc, char **Argv)); + +# endif diff --git a/alliance/src/gcp/src/main.c b/alliance/src/gcp/src/main.c new file mode 100644 index 00000000..c84a3bc6 --- /dev/null +++ b/alliance/src/gcp/src/main.c @@ -0,0 +1,188 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +# include +# include + +# include "mut.h" +# include "aut.h" +# include "gcp.h" + +/*------------------------------------------------------------\ +| | +| Usage | +| | +\------------------------------------------------------------*/ + +void CUsage() +{ + fprintf( stderr, "\t\tgcptest --[Options] Input_name_1 ... Input_name_N -[GCC Options]\n\n" ); + fprintf( stdout, "\t\tOptions : --V Sets Verbose mode on\n" ); + fprintf( stdout, "\t\t --D Sets Debug mode on\n" ); + fprintf( stdout, "\t\t --F Sets Force display\n" ); + fprintf( stdout, "\t\t --T Sets display Types\n" ); + fprintf( stdout, "\t\t --S Sets display Sizes\n" ); + fprintf( stdout, "\n" ); + + exit( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern int c_y_debug; + +int main( argc, argv ) + + int argc; + char **argv; +{ + c_tree_node *TreeNode; + char *InputFileName[ 10 ]; + int Last; + int Number; + int Index; + char Option; + char *Extention; + char **Argv; + int Argc; + + int FlagVerbose = 0; + int FlagDebug = 0; + int NoMoreFileName = 0; + + mbkenv(); + autenv(); + + if ( argc < 2 ) CUsage(); + + InputFileName[ 0 ] = (char *)0; + Last = 0; + Argc = 0; + Argv = (char **)0; + + for ( Number = 1; Number < argc; Number++ ) + { + if ( argv[ Number ][ 0 ] == '-' ) + { + if ( argv[ Number ][ 1 ] == '-' ) + { + for ( Index = 2; argv[ Number ][ Index ] != '\0'; Index++ ) + { + Option = argv[ Number ][ Index ]; + + if ( Option == 'I' ) + { + Number++; + + if ( Number < argc ) Extention = argv[ Number ]; + else CUsage(); + + break; + } + + switch ( Option ) + { + case 'V' : FlagVerbose = 1; + break; + case 'D' : FlagDebug |= 1; + break; + case 'F' : FlagDebug |= 2; + break; + case 'T' : FlagDebug |= 4; + break; + case 'S' : FlagDebug |= 8; + break; + default : CUsage(); + } + } + } + else + if ( ! NoMoreFileName ) + { + NoMoreFileName = 1; + Argv = &argv[ Number ]; + Argc = argc - Number; + } + } + else + if ( ! NoMoreFileName ) + { + InputFileName[ Last ] = argv[ Number ]; + Last++; + + if ( Last >= 10 ) NoMoreFileName = 1; + else InputFileName[ Last ] = (char *)0; + } + else + CUsage(); + } + + if ( InputFileName[ 0 ] == (char *)0 ) CUsage(); + + if ( FlagDebug & 1 ) + { + c_y_debug = 1; + } + + if ( FlagDebug & 2 ) + { + C_TREE_FORCE_VIEW_NODE = 1; + } + + if ( FlagDebug & 4 ) + { + C_TREE_VIEW_TYPE_NODE = 1; + } + + if ( FlagDebug & 8 ) + { + C_TREE_VIEW_SIZE_NODE = 1; + } + + for ( Index = 0; Index < Last; Index++ ) + { + if ( FlagVerbose ) + { + fprintf( stdout, "--> Processing file %s\n", InputFileName[ Index ] ); + } + + TreeNode = c_tree_parse_file( InputFileName[ Index ], Argc, Argv ); + + if ( FlagVerbose ) + { + fprintf( stdout, "<-- done\n\n" ); + c_tree_view_node( TreeNode ); + } + } + + c_tree_free_all_node(); + + return( 0 ); +} diff --git a/alliance/src/graal/Makefile.am b/alliance/src/graal/Makefile.am new file mode 100644 index 00000000..5fcaa0d3 --- /dev/null +++ b/alliance/src/graal/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src man1 diff --git a/alliance/src/graal/configure.in b/alliance/src/graal/configure.in new file mode 100644 index 00000000..8134e032 --- /dev/null +++ b/alliance/src/graal/configure.in @@ -0,0 +1,36 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(src/graal.c) + +GRAAL_MAJOR_VERSION=1 +GRAAL_MINOR_VERSION=27 +GRAAL_VERSION=$GRAAL_MAJOR_VERSION.$GRAAL_MINOR_VERSION + +AC_SUBST(GRAAL_MAJOR_VERSION) +AC_SUBST(GRAAL_MINOR_VERSION) +AC_SUBST(GRAAL_VERSION) + +# For automake. +VERSION=$GRAAL_VERSION +PACKAGE=graal + +dnl Initialize automake stuff +AM_INIT_AUTOMAKE($PACKAGE, $VERSION) + +dnl Checks for programs. +AC_PROG_CC +AM_PROG_LEX +AC_PROG_YACC +AC_PROG_RANLIB +AC_PROG_MAKE_SET +AC_FIND_MOTIF + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST + +AM_ALLIANCE + +AC_OUTPUT([ +Makefile +src/Makefile +man1/Makefile +]) diff --git a/alliance/src/graal/etc/cmos_12.graal b/alliance/src/graal/etc/cmos_12.graal new file mode 100644 index 00000000..29cfc32a --- /dev/null +++ b/alliance/src/graal/etc/cmos_12.graal @@ -0,0 +1,348 @@ +# /*------------------------------------------------------------\ +# | | +# | Title : Parameters File for Graal | +# | | +# | Technology : Cmos V7 | +# | | +# | Date : 27/06/95 | +# | | +# \------------------------------------------------------------*/ +# /*------------------------------------------------------------\ +# | | +# | Graal Peek Bound in lambda | +# | | +# \------------------------------------------------------------*/ + +DEFINE GRAAL_PEEK_BOUND 7 + +# /*------------------------------------------------------------\ +# | | +# | Lower Grid Step in pixel by lambda | +# | | +# \------------------------------------------------------------*/ + +DEFINE GRAAL_LOWER_GRID_STEP 10 + +# /*------------------------------------------------------------\ +# | | +# | Lower Figure Text Step in pixel by lambda | +# | | +# \------------------------------------------------------------*/ + +DEFINE GRAAL_LOWER_FIGURE_STEP 1 + +# /*------------------------------------------------------------\ +# | | +# | Lower Instance Text Step in pixel by lambda | +# | | +# \------------------------------------------------------------*/ + +DEFINE GRAAL_LOWER_INSTANCE_STEP 1 + +# /*------------------------------------------------------------\ +# | | +# | Lower Connector Text Step in pixel by lambda | +# | | +# \------------------------------------------------------------*/ + +DEFINE GRAAL_LOWER_CONNECTOR_STEP 5 + +# /*------------------------------------------------------------\ +# | | +# | Lower Segment Text Step in pixel by lambda | +# | | +# \------------------------------------------------------------*/ + +DEFINE GRAAL_LOWER_SEGMENT_STEP 7 + +# /*------------------------------------------------------------\ +# | | +# | Lower Reference Text Step in pixel by lambda | +# | | +# \------------------------------------------------------------*/ + +DEFINE GRAAL_LOWER_REFERENCE_STEP 10 + +# /*------------------------------------------------------------\ +# | | +# | Graal Cursor Color Name | +# | | +# \------------------------------------------------------------*/ + +DEFINE GRAAL_CURSOR_COLOR_NAME Gray + +# /*------------------------------------------------------------\ +# | | +# | Graal Cursor Size in pixel | +# | | +# \------------------------------------------------------------*/ + +DEFINE GRAAL_CURSOR_SIZE 10 + +# /*------------------------------------------------------------\ +# | | +# | Segment Panel Button Label, Foreground , Background Color | +# | | +# \------------------------------------------------------------*/ + +TABLE GRAAL_SEGMENT_NAME + + NWELL Nwell tan Black + PWELL Pwell light_yellow Black + NDIF Ndif lawn_green Black + PDIF Pdif yellow Black + NTIE Ntie spring_green Black + PTIE Ptie light_goldenrod Black + POLY Poly red Black + POLY2 Poly2 orange Black + ALU1 Alu1 royal_blue Black + ALU2 Alu2 Cyan Black + ALU3 Alu3 light_pink Black + ALU4 Alu4 green Black + ALU5 Alu5 yellow Black + ALU6 Alu6 violet Black + TPOLY Tpoly hot_pink Black + TALU1 Talu1 royal_blue Black + TALU2 Talu2 turquoise Black + TALU3 Talu3 light_pink Black + TALU4 Talu4 green Black + TALU5 Talu5 yellow Black + TALU6 Talu6 violet Black + CALU1 CAlu1 royal_blue Black + CALU2 CAlu2 Cyan Black + CALU3 CAlu3 light_pink Black + CALU4 CAlu4 green Black + CALU5 CAlu5 yellow Black + CALU6 CAlu6 violet Black + +END + +# /*------------------------------------------------------------\ +# | | +# | Transistor Panel Button Label, Foreground, Background Color | +# | | +# \------------------------------------------------------------*/ + +TABLE GRAAL_TRANSISTOR_NAME + + NTRANS Ntrans lawn_green Black + PTRANS Ptrans yellow Black + +END + +# /*------------------------------------------------------------\ +# | | +# | Connector Panel Button Label, Foreground , Background Color | +# | | +# \------------------------------------------------------------*/ + +TABLE GRAAL_CONNECTOR_NAME + + POLY Poly red Black + POLY2 Poly2 orange Black + ALU1 Alu1 royal_blue Black + ALU2 Alu2 Cyan Black + ALU3 Alu3 light_pink Black + ALU4 Alu4 green Black + ALU5 Alu5 yellow Black + ALU6 Alu6 violet Black + +END + +# /*------------------------------------------------------------\ +# | | +# | Minimun Length and Width for a symbolic Segment | +# | | +# \------------------------------------------------------------*/ + +TABLE GRAAL_SEGMENT_VALUE + + NWELL 4 4 + PWELL 4 4 + NDIF 2 2 + PDIF 2 2 + NTIE 2 2 + PTIE 2 2 + NTRANS 1 4 + PTRANS 1 4 + POLY 1 1 + POLY2 1 1 + ALU1 1 1 + ALU2 2 1 + ALU3 2 1 + ALU4 2 1 + ALU5 2 1 + ALU6 2 1 + TPOLY 1 1 + TALU1 1 1 + TALU2 2 2 + TALU3 2 2 + TALU4 2 2 + TALU5 2 2 + TALU6 2 2 + CALU1 2 0 + CALU2 2 0 + CALU3 2 0 + CALU4 2 0 + CALU5 2 0 + CALU6 2 0 + +END + +# /*------------------------------------------------------------\ +# | | +# | Reference Panel Button Label, Foreground, Background Color | +# | | +# \------------------------------------------------------------*/ + +TABLE GRAAL_REFERENCE_NAME + + REF_REF Ref_Ref red Black + REF_CON Ref_Con Cyan Black + +END + +# /*------------------------------------------------------------\ +# | | +# | Via Panel Button Label, Foreground , Background Color | +# | | +# \------------------------------------------------------------*/ + +TABLE GRAAL_VIA_NAME + + CONT_DIF_N Cont_NDif lawn_green Black + CONT_DIF_P Cont_PDif yellow Black + CONT_BODY_N Cont_NTie spring_green Black + CONT_BODY_P Cont_PTie light_goldenrod Black + CONT_POLY Cont_Poly red Black + CONT_POLY2 Cont_Poly2 orange Black + CONT_VIA Via_1-2 cyan Black + CONT_VIA2 Via_2-3 light_pink Black + CONT_VIA3 Via_3-4 green Black + CONT_VIA4 Via_4-5 yellow Black + CONT_VIA5 Via_5-6 violet Black + C_X_N Cont_CxN orange Black + C_X_P Cont_CxP orange Black + +END + +# /*------------------------------------------------------------\ +# | | +# | Big Via Panel Button Label, Foreground , Background Color | +# | | +# \------------------------------------------------------------*/ + +TABLE GRAAL_BIGVIA_NAME + + CONT_VIA Big_Via_1-2 cyan Black + CONT_VIA2 Big_Via_2-3 light_pink Black + CONT_VIA3 Big_Via_3-4 green Black + + CONT_TURN1 Turn_Via_1 royal_blue Black + CONT_TURN2 Turn_Via_2 Cyan Black + CONT_TURN3 Turn_Via_3 light_pink Black + CONT_TURN4 Turn_Via_4 green Black + +END + +# /*------------------------------------------------------------\ +# | | +# | Minimun Size for a symbolic Big Via | +# | | +# \------------------------------------------------------------*/ + +TABLE GRAAL_BIGVIA_VALUE + + CONT_VIA 2 + CONT_VIA2 2 + CONT_VIA3 2 + + CONT_TURN1 2 + CONT_TURN2 2 + CONT_TURN3 2 + CONT_TURN4 2 + +END + +# /*------------------------------------------------------------\ +# | | +# | Orient Panel Button Label, Foreground , Background Color | +# | | +# \------------------------------------------------------------*/ + +TABLE GRAAL_ORIENT_NAME + + NORTH North lawn_green Black + SOUTH South yellow Black + EAST East tan Black + WEST West red Black + +END + +# /*------------------------------------------------------------\ +# | | +# | Symmetry Panel Button Label, Foreground , Background Color | +# | | +# \------------------------------------------------------------*/ + +TABLE GRAAL_SYMMETRY_NAME + + NOSYM No_Sym LightBlue Black + SYM_X Sym_X turquoise Black + SYM_Y Sym_Y cyan Black + SYMXY Sym_XY LightCyan Black + ROT_P Rot_P MediumAquamarine Black + ROT_M Rot_M aquamarine Black + SY_RP Sym_RP green Black + SY_RM Sym_RM MediumSpringGreen Black + +END + +# /*------------------------------------------------------------\ +# | | +# | View Layer Panel Button Label, Foreground, Background Color | +# | | +# \------------------------------------------------------------*/ + +TABLE GRAAL_RDS_LAYER_NAME + + RDS_NWELL Nwell tan Black + RDS_PWELL Pwell light_yellow Black + RDS_NIMP Nimp forest_green Black + RDS_PIMP Pimp goldenrod Black + RDS_ACTIV Activ brown Black + RDS_NDIF Ndif lawn_green Black + RDS_PDIF Pdif yellow Black + RDS_NTIE Ntie spring_green Black + RDS_PTIE Ptie light_goldenrod Black + RDS_POLY Poly red Black + RDS_POLY2 Poly2 orange Black + RDS_VPOLY VPoly coral Black + RDS_GATE Gate orange Black + RDS_TPOLY Tpoly hot_pink Black + RDS_CONT Cont dark_violet Black + RDS_TCONT TCont orchid Black + RDS_ALU1 Alu1 royal_blue Black + RDS_VALU1 VAlu1 sky_blue Black + RDS_TALU1 Talu1 royal_blue Black + RDS_VIA1 Via1 deep_sky_blue Black + RDS_TVIA1 TVia1 dodger_blue Black + RDS_ALU2 Alu2 cyan Black + RDS_TALU2 Talu2 turquoise Black + RDS_VIA2 Via2 deep_pink Black + RDS_ALU3 Alu3 light_pink Black + RDS_TALU3 Talu3 light_pink Black + RDS_VIA3 Via3 sea_green Black + RDS_ALU4 Alu4 green Black + RDS_TALU4 Talu4 green Black + RDS_VIA4 Via4 gold Black + RDS_ALU5 Alu5 yellow Black + RDS_TALU5 Talu5 yellow Black + RDS_VIA5 Via5 violet_red Black + RDS_ALU6 Alu6 violet Black + RDS_TALU6 Talu6 violet Black + RDS_CPAS Cpas gray Black + RDS_REF Ref coral Black + RDS_ABOX Abox pink Black + +END diff --git a/alliance/src/graal/man1/Makefile.am b/alliance/src/graal/man1/Makefile.am new file mode 100644 index 00000000..0347f581 --- /dev/null +++ b/alliance/src/graal/man1/Makefile.am @@ -0,0 +1,2 @@ +man_MANS = graal.1 +EXTRA_DIST = $(man_MANS) diff --git a/alliance/src/graal/man1/graal.1 b/alliance/src/graal/man1/graal.1 new file mode 100644 index 00000000..bd29512a --- /dev/null +++ b/alliance/src/graal/man1/graal.1 @@ -0,0 +1,153 @@ +.\" $Id: graal.1,v 1.1 2002/03/29 17:39:57 ludo Exp $ +.\" @(#)graal 1.07 94/10/10 UPMC/ASIM/LIP6/CAO-VLSI " +.TH GRAAL 1 "October 1, 1997" "ASIM/LIP6" "ALLIANCE Reference Manual" +.SH NAME +graal \- symbolic layout editor +.SH SYNOPSIS +.B graal +[\-l file_name] +[\-scale n] +[\-debug] +[\-xor] +[\-install] + [\-force] +.br +.so man1/alc_origin.1 +.SH DESCRIPTION +.B Graal +is a hierarchical symbolic layout editor. All functionnalities can be +accessed through different menus. +Among them exists a design rule checker performing verifications inside a +user defined window. +.B Graal +works under Motif and X11r6. +When entering +.B Graal, +the main window appears and shows 7 different +menus on the top bar.These menus can be entered by simply clicking on the +mouse left button. Here is the description of these menus. + +.TP 10 +.B File +\f4New\fP : clean the entire window and save the current cell. +.br +\f4Open\fP : load an already existing cell. +.br +\f4Save\fP : save the current cell. +.br +\f4Save as\fP : rename and save the current cell. +.br +\f4Quit\fP : quit graal. + +.TP 10 +.B Edit +\f4Undo\fP : undo the previous action. +.br +\f4Copy\fP : copy a selected object. +.br +\f4Move\fP : move a selected object. +.br +\f4Delete\fP : delete a selected object. +.br +\f4Stretch\fP : strech a selected object (transistor or segment length). +.br +\f4Modify\fP : modify the caracteristics of an object (name, width, +etc...). +.br +\f4Identify\fP : identify a selected object. +.br +\f4Search\fP : search an object according to its type. + +.TP 10 +.B Window +This menu allows user to perform the same actions than the previous menu +Edit, not on an object but on a group of objects belonging to a defined +window.The two opposite corner of the window are set by clicking on the mouse +left button. + +.TP 10 +.B Create +\f4Instance\fP : add a new instance in the current cell. +.br +\f4Abutmentbox\fP : define the abutment box of the current cell. +.br +\f4Segment\fP : add segments. +.br +\f4Via\fP : add vias or contacts. +.br +\f4Connector\fP : add connectors. +.br +\f4Transistor\fP : add transistors. +.br +\f4Reference\fP : add references. + +.TP 10 +.B View +\f4Zoom\fP : perform zoom in, zoom out, center, fit, refresh on figure. +.br +\f4Layer\fP : select types of layers displayed. +.br +\f4Map\fP : show cursor position in the entire figure. +.br +\f4Arrows\fP : show arrows for moving at the grid step. +.br +\f4Grid\fP : Set the X,Y step of the grid if displayed. + +.TP 10 +.B Tools +\f4Equi\fP : highlight all objects electrically connected to a given object. +.br +\f4Flat\fP : virtual hierarchy flattening of an instance +(display all visible objects inside a given instance). +.br +\f4UnFlat\fP : undo the virtual flattening of an instance +(done before with the Flat command) +.br +\f4Peek\fP : virtual hierarchy flattening +(display all visible objects inside a given window). +.br +\f4UnPeek\fP : undo the virtual flattening of a window +(done before with the Peek command) +.br +\f4Druc\fP : call the design rule checker in a given window. +.br +\f4RealFlat\fP : real hierarchy flattening of instances included in a window +(this command can not be undone, and should be used very carefully) +.br +\f4Hierarchy\fP : navigate into the current figure hierarchy +.br +\f4Load Error\fP : load a real layout file and superpose it to the current figure. +.br +\f4Message\fP : display the last error messages + + +.TP 10 +.B Setup +Save or load a user defined configuration of default displayed menus. + +.SH ENVIRONMENT VARIABLES +.TP +.B MBK_CATA_LIB +indicates the path to the read only libraries to be used. +.TP +.B MBK_WORK_LIB +indicates the path to the read/write directory for the session. +.TP +.B MBK_IN_PH +indicates the file format to be used for the leaf cells. +.TP +.B MBK_OUT_PH +indicates the file format to be used for the generated figures. +.TP +.B GRAAL_TECHNO_NAME (optionnal) +indicates the path to the techno name file used by Graal. +.TP +.B RDS_TECHNO_NAME (optionnal) +indicates the path to the RDS configuration file used by Graal. + +.SH SEE ALSO +mbk(1), MBK_CATA_LIB(1), MBK_IN_PH(1), MBK_OUT_PH(1), RDS_TECHNO_NAME(1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/graal/motif.m4 b/alliance/src/graal/motif.m4 new file mode 100644 index 00000000..ea6e01aa --- /dev/null +++ b/alliance/src/graal/motif.m4 @@ -0,0 +1,196 @@ +dnl +dnl +dnl AC_FIND_MOTIF : find OSF/Motif or LessTif, and provide variables +dnl to easily use them in a Makefile. +dnl +dnl Adapted from a macro by Andreas Zeller. +dnl +dnl The variables provided are : +dnl LINK_MOTIF (e.g. -L/usr/lesstif/lib -lXm) +dnl INCLUDE_MOTIF (e.g. -I/usr/lesstif/lib) +dnl MOTIF_LIBRARIES (e.g. /usr/lesstif/lib) +dnl MOTIF_INCLUDES (e.g. /usr/lesstif/include) +dnl +dnl The LINK_MOTIF and INCLUDE_MOTIF variables should be fit to put on +dnl your application's link line in your Makefile. +dnl +dnl Oleo CVS $Id: motif.m4,v 1.1 2002/03/29 17:39:54 ludo Exp $ +dnl +AC_DEFUN(AC_FIND_MOTIF, +[ + +AC_REQUIRE([AC_PATH_XTRA]) + +MOTIF_INCLUDES= +MOTIF_LIBRARIES= + +dnl AC_ARG_WITH(motif, +dnl [ --without-motif do not use Motif widgets]) +dnl Treat --without-motif like +dnl --without-motif-includes --without-motif-libraries. +dnl if test "$with_motif" = "no" +dnl then +dnl MOTIF_INCLUDES=none +dnl MOTIF_LIBRARIES=none +dnl fi + +AC_ARG_WITH(motif-includes, +[ --with-motif-includes=DIR Motif include files are in DIR], +MOTIF_INCLUDES="$withval") + +AC_ARG_WITH(motif-libraries, +[ --with-motif-libraries=DIR Motif libraries are in DIR], +MOTIF_LIBRARIES="$withval") + +AC_MSG_CHECKING(for Motif) + +# +# +# Search the include files. +# +if test "$MOTIF_INCLUDES" = ""; then +AC_CACHE_VAL(ac_cv_motif_includes, +[ +ac_motif_save_LIBS="$LIBS" +ac_motif_save_CFLAGS="$CFLAGS" +ac_motif_save_CPPFLAGS="$CPPFLAGS" +ac_motif_save_LDFLAGS="$LDFLAGS" +# +LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS" +CFLAGS="$X_CFLAGS $CFLAGS" +CPPFLAGS="$X_CFLAGS $CPPFLAGS" +LDFLAGS="$X_LIBS $LDFLAGS" +# +ac_cv_motif_includes="none" +AC_TRY_COMPILE([#include ],[int a;], +[ +# Xm/Xm.h is in the standard search path. +ac_cv_motif_includes= +], +[ +# Xm/Xm.h is not in the standard search path. +# Locate it and put its directory in `MOTIF_INCLUDES' +# +# /usr/include/Motif* are used on HP-UX (Motif). +# /usr/include/X11* are used on HP-UX (X and Athena). +# /usr/dt is used on Solaris (Motif). +# /usr/openwin is used on Solaris (X and Athena). +# Other directories are just guesses. +for dir in "$x_includes" "${prefix}/include" /usr/include /usr/local/include \ + /usr/include/Motif2.0 /usr/include/Motif1.2 /usr/include/Motif1.1 \ + /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 \ + /usr/dt/include /usr/openwin/include \ + /usr/dt/*/include /opt/*/include /usr/include/Motif* \ + "${prefix}"/*/include /usr/*/include /usr/local/*/include \ + "${prefix}"/include/* /usr/include/* /usr/local/include/*; do +if test -f "$dir/Xm/Xm.h"; then +ac_cv_motif_includes="$dir" +break +fi +done +]) +# +LIBS="$ac_motif_save_LIBS" +CFLAGS="$ac_motif_save_CFLAGS" +CPPFLAGS="$ac_motif_save_CPPFLAGS" +LDFLAGS="$ac_motif_save_LDFLAGS" +]) +MOTIF_INCLUDES="$ac_cv_motif_includes" +fi +# +# +# Now for the libraries. +# +if test "$MOTIF_LIBRARIES" = ""; then +AC_CACHE_VAL(ac_cv_motif_libraries, +[ +ac_motif_save_LIBS="$LIBS" +ac_motif_save_CFLAGS="$CFLAGS" +ac_motif_save_CPPFLAGS="$CPPFLAGS" +ac_motif_save_LDFLAGS="$LDFLAGS" +# +LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS" +CFLAGS="$X_CFLAGS $CFLAGS" +CPPFLAGS="$X_CFLAGS $CPPFLAGS" +LDFLAGS="$X_LIBS $LDFLAGS" +# +ac_cv_motif_libraries="none" +AC_TRY_LINK([#include ],[XtToolkitInitialize();], +[ +# libXm.a is in the standard search path. +ac_cv_motif_libraries= +], +[ +# libXm.a is not in the standard search path. +# Locate it and put its directory in `MOTIF_LIBRARIES' +# +# /usr/lib/Motif* are used on HP-UX (Motif). +# /usr/lib/X11* are used on HP-UX (X and Athena). +# /usr/dt is used on Solaris (Motif). +# /usr/lesstif is used on Linux (Lesstif). +# /usr/openwin is used on Solaris (X and Athena). +# Other directories are just guesses. +for dir in "$x_libraries" "${prefix}/lib" /usr/lib /usr/local/lib \ + /usr/lib/Motif2.0 /usr/lib/Motif1.2 /usr/lib/Motif1.1 \ + /usr/lib/X11R6 /usr/lib/X11R5 /usr/lib/X11R4 /usr/lib/X11 \ + /usr/dt/lib /usr/openwin/lib \ + /usr/dt/*/lib /opt/*/lib /usr/lib/Motif* \ + /usr/lesstif*/lib /usr/lib/Lesstif* \ + "${prefix}"/*/lib /usr/*/lib /usr/local/*/lib \ + "${prefix}"/lib/* /usr/lib/* /usr/local/lib/*; do +if test -d "$dir" && test "`ls $dir/libXm.* 2> /dev/null`" != ""; then +ac_cv_motif_libraries="$dir" +break +fi +done +]) +# +LIBS="$ac_motif_save_LIBS" +CFLAGS="$ac_motif_save_CFLAGS" +CPPFLAGS="$ac_motif_save_CPPFLAGS" +LDFLAGS="$ac_motif_save_LDFLAGS" +]) +# +MOTIF_LIBRARIES="$ac_cv_motif_libraries" +fi +# +# Provide an easier way to link +# +if test "$MOTIF_INCLUDES" = "none" -o "$MOTIF_LIBRARIES" = "none"; then + with_motif="no" +else + with_motif="yes" +fi + +if test "$with_motif" != "no"; then + if test "$MOTIF_LIBRARIES" = ""; then + LINK_MOTIF="-lXm" + MOTIF_LIBS="-lXm" + else + LINK_MOTIF="-L$MOTIF_LIBRARIES -lXm" + MOTIF_LIBS="-L$MOTIF_LIBRARIES -lXm" + fi + if test "$MOTIF_INCLUDES" != ""; then + INCLUDE_MOTIF="-I$MOTIF_INCLUDES" + MOTIF_CFLAGS="-I$MOTIF_INCLUDES" + fi + AC_DEFINE(HAVE_MOTIF) +else + with_motif="no" +fi +# +AC_SUBST(LINK_MOTIF) +AC_SUBST(INCLUDE_MOTIF) +# +# +# +motif_libraries_result="$MOTIF_LIBRARIES" +motif_includes_result="$MOTIF_INCLUDES" +test "$motif_libraries_result" = "" && motif_libraries_result="in default path" +test "$motif_includes_result" = "" && motif_includes_result="in default path" +test "$motif_libraries_result" = "none" && motif_libraries_result="(none)" +test "$motif_includes_result" = "none" && motif_includes_result="(none)" +AC_MSG_RESULT( + [libraries $motif_libraries_result, headers $motif_includes_result]) +])dnl + diff --git a/alliance/src/graal/src/GMC.h b/alliance/src/graal/src/GMC.h new file mode 100644 index 00000000..d39c8767 --- /dev/null +++ b/alliance/src/graal/src/GMC.h @@ -0,0 +1,102 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Create.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_GMC +# define GRAAL_GMC + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern GraalMenuItem GraalCreateMenu[]; + extern GraalPanelItem GraalCreateSegmentPanel; + extern GraalPanelItem GraalCreateViaPanel; + extern GraalPanelItem GraalCreateBigViaPanel; + extern GraalPanelItem GraalCreateTransistorPanel; + extern GraalPanelItem GraalCreateConnectorPanel; + extern GraalPanelItem GraalCreateReferencePanel; + extern GraalPanelItem GraalCreateInstancePanel; + + extern int GraalCreateSegmentDefaultValues[ 5 ]; + extern int GraalCreateViaDefaultValues[ 5 ]; + extern int GraalCreateBigViaDefaultValues[ 5 ]; + extern int GraalCreateTransistorDefaultValues[ 5 ]; + extern int GraalCreateConnectorDefaultValues[ 5 ]; + extern int GraalCreateReferenceDefaultValues[ 5 ]; + extern int GraalCreateInstanceDefaultValues[ 5 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalBuildPanelCreate(); + extern void GraalBuildCreateDialog(); + extern void GraalCreateSegmentMbk(); + extern void GraalCreateViaMbk(); + extern void GraalCreateBigViaMbk(); + extern void GraalCreateTransistorMbk(); + extern void GraalCreateConnectorMbk(); + extern void GraalCreateReferenceMbk(); + extern void GraalCreateInstanceMbk(); + extern void GraalCreateAbutmentBoxMbk(); + + extern void GraalChangeSegmentLayer(); + extern void GraalChangeViaType(); + extern void GraalChangeBigViaType(); + extern void GraalChangeTransistorType(); + extern void GraalChangeConnectorLayer(); + extern void GraalChangeReferenceType(); + +# endif + diff --git a/alliance/src/graal/src/GMC_create.c b/alliance/src/graal/src/GMC_create.c new file mode 100644 index 00000000..b7ce6a07 --- /dev/null +++ b/alliance/src/graal/src/GMC_create.c @@ -0,0 +1,891 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Create.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GRM.h" +# include "GMX.h" +# include "GTB.h" +# include "GSB.h" +# include "GMC.h" + +# include "GMC_create.h" +# include "GMC_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Segment & Wire | +| | +\------------------------------------------------------------*/ + + char GraalSegmentLayer = ALU1; + long GraalSegmentWidth = -1; + char *GraalSegmentName = (char *)NULL; + char GraalSegmentWire = GRAAL_FALSE; + +/*------------------------------------------------------------\ +| | +| Via | +| | +\------------------------------------------------------------*/ + + char GraalViaType = CONT_POLY; + char *GraalViaName = (char *)NULL; + +/*------------------------------------------------------------\ +| | +| Big Via | +| | +\------------------------------------------------------------*/ + + char GraalBigViaType = CONT_VIA; + char *GraalBigViaName = (char *)NULL; + +/*------------------------------------------------------------\ +| | +| Transistor | +| | +\------------------------------------------------------------*/ + + char GraalTransistorType = NTRANS; + long GraalTransistorWidth = -1; + char *GraalTransistorName = (char *)NULL; + char GraalTransistorWire = GRAAL_FALSE; + +/*------------------------------------------------------------\ +| | +| Connector | +| | +\------------------------------------------------------------*/ + + char GraalConnectorLayer = ALU1; + long GraalConnectorWidth = -1; + char *GraalConnectorName = (char *)NULL; + char GraalConnectorOrient = GRAAL_NORTH; + +/*------------------------------------------------------------\ +| | +| Reference | +| | +\------------------------------------------------------------*/ + + char GraalReferenceType = MBK_REF_REF; + char *GraalReferenceName = (char *)NULL; + +/*------------------------------------------------------------\ +| | +| Instance | +| | +\------------------------------------------------------------*/ + + char GraalInstanceSym = NOSYM; + char *GraalInstanceName = (char *)NULL; + char *GraalInstanceModel = (char *)NULL; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalCreateFigureMbk | +| | +\------------------------------------------------------------*/ + +void GraalCreateFigureMbk() + +{ + if ( GraalFigureMbk == (phfig_list *)NULL ) + { + rdsbegin(); + + GraalFigureMbk = addphfig( GRAAL_DEFAULT_FIGURE_NAME ); + + GraalAddFigure(); + GraalChangeTopLevelTitle( GraalFigureMbk->NAME ); + + rdsend(); + } +} + +/*------------------------------------------------------------\ +| | +| GraalCreateSegmentMbk | +| | +\------------------------------------------------------------*/ + +void GraalCreateSegmentMbk( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ) + + long LambdaX1; + long LambdaY1; + long LambdaX2; + long LambdaY2; +{ + rdsrec_list *Rectangle; + phseg_list *Segment; + char *SaveName; + char *SegmentName; + long Delta; + int Error; + + rdsbegin(); + + if ( LambdaX1 == LambdaX2 ) + { + Delta = LambdaY2 - LambdaY1; + } + else + { + Delta = LambdaX2 - LambdaX1; + } + + if ( Delta < 0 ) Delta = - Delta; + + if ( Delta < GRAAL_SEGMENT_VALUE_TABLE[GraalSegmentLayer][1] ) + { + GraalErrorMessage( GraalMainWindow, "This segment is too small !" ); + + rdsend(); + return; + } + + if ( ( GraalSegmentLayer >= CALU1 ) && + ( GraalSegmentLayer <= CALU9 ) ) + { + SaveName = GraalSegmentName; + + GraalEnterDialog( &GraalChangeSegmentNameDialog ); + + if ( GraalCreateDialogCancel ) + { + rdsend(); + return; + } + + SegmentName = GraalSegmentName; + GraalSegmentName = SaveName; + + if ( SegmentName == (char *)NULL ) + { + GraalErrorMessage( GraalMainWindow, "Connector must have name !" ); + + rdsend(); + return; + } + } + else + { + SegmentName = GraalSegmentName; + } + + GraalCreateFigureMbk(); + + Segment = + + addphseg( GraalFigureMbk, GraalSegmentLayer, + GraalSegmentWidth * SCALE_X, + LambdaX1 * GRAAL_SCALE_X, LambdaY1 * GRAAL_SCALE_X, + LambdaX2 * GRAAL_SCALE_X, LambdaY2 * GRAAL_SCALE_X, + SegmentName ); + + Segment->USER = (void *)(&GraalFigureMbk->PHSEG); + + if ( Segment->NEXT != (phseg_list *)NULL ) + { + Segment->NEXT->USER = (void *)(&Segment->NEXT); + } + + Rectangle = GraalAddSegment( Segment ); + + if ( Rectangle != (rdsrec_list *)NULL ) + { + GraalAddUndo(); + GraalAddUndoRec( Rectangle ); + + if ( ( GraalHeadEqui != (rdsrec_list *)NULL ) || + ( GraalHeadPeek != (graalpeek *)NULL ) ) + { + GraalDelEqui(); + GraalDelPeek(); + GraalZoomRefresh(); + } + else + { + GraalDisplayRectangle( Rectangle ); + } + } + else + { + delphseg( GraalFigureMbk, Segment ); + + GraalErrorMessage( GraalMainWindow, "Can't create any segment of this layer !" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalCreateViaMbk | +| | +\------------------------------------------------------------*/ + +void GraalCreateViaMbk( LambdaX1, LambdaY1 ) + + long LambdaX1; + long LambdaY1; +{ + rdsrec_list *Rectangle; + phvia_list *Via; + + rdsbegin(); + + GraalCreateFigureMbk(); + + Via = addphvia( GraalFigureMbk, GraalViaType, + LambdaX1 * GRAAL_SCALE_X, LambdaY1 * GRAAL_SCALE_X, 0, 0, GraalViaName ); + + Via->USER = (void *)(&GraalFigureMbk->PHVIA); + + if ( Via->NEXT != (phvia_list *)NULL ) + { + Via->NEXT->USER = (void *)(&Via->NEXT); + } + + Rectangle = GraalAddVia( Via ); + + if ( Rectangle != (rdsrec_list *)NULL ) + { + GraalAddUndo(); + GraalAddUndoRec( Rectangle ); + + if ( ( GraalHeadEqui != (rdsrec_list *)NULL ) || + ( GraalHeadPeek != (graalpeek *)NULL ) ) + { + GraalDelEqui(); + GraalDelPeek(); + GraalZoomRefresh(); + } + else + { + GraalDisplayRectangle( Rectangle ); + } + } + else + { + delphvia( GraalFigureMbk, Via ); + + GraalErrorMessage( GraalMainWindow, "Can't create any via of this type !" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalCreateBigViaMbk | +| | +\------------------------------------------------------------*/ + +void GraalCreateBigViaMbk( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ) + + long LambdaX1; + long LambdaY1; +{ + rdsrec_list *Rectangle; + phvia_list *Via; + long Swap; + long ViaDx; + long ViaDy; + + rdsbegin(); + + if ( ( LambdaX1 != LambdaX2 ) && + ( LambdaY1 != LambdaY2 ) ) + { + if ( LambdaX1 > LambdaX2 ) + { + Swap = LambdaX1; LambdaX1 = LambdaX2; LambdaX2 = Swap; + } + + if ( LambdaY1 > LambdaY2 ) + { + Swap = LambdaY1; LambdaY1 = LambdaY2; LambdaY2 = Swap; + } + + ViaDx = LambdaX2 - LambdaX1; + ViaDy = LambdaY2 - LambdaY1; + + if ( ( ViaDx < GRAAL_BIGVIA_VALUE_TABLE[ GraalBigViaType ][0] ) || + ( ViaDy < GRAAL_BIGVIA_VALUE_TABLE[ GraalBigViaType ][0] ) ) + { + GraalErrorMessage( GraalMainWindow, "This big via is too small !" ); + + rdsend(); + return; + } + } + else + { + GraalErrorMessage( GraalMainWindow, "The big via must be rectangular !" ); + + rdsend(); + return; + } + + GraalCreateFigureMbk(); + + Via = addphvia( GraalFigureMbk, GraalBigViaType, + (( LambdaX1 + LambdaX2 ) >> 1) * GRAAL_SCALE_X, + (( LambdaY1 + LambdaY2 ) >> 1) * GRAAL_SCALE_X, + ViaDx * GRAAL_SCALE_X, ViaDy * GRAAL_SCALE_X, GraalBigViaName ); + + Via->USER = (void *)(&GraalFigureMbk->PHVIA); + + if ( Via->NEXT != (phvia_list *)NULL ) + { + Via->NEXT->USER = (void *)(&Via->NEXT); + } + + Rectangle = GraalAddVia( Via ); + + if ( Rectangle != (rdsrec_list *)NULL ) + { + GraalAddUndo(); + GraalAddUndoRec( Rectangle ); + + if ( ( GraalHeadEqui != (rdsrec_list *)NULL ) || + ( GraalHeadPeek != (graalpeek *)NULL ) ) + { + GraalDelEqui(); + GraalDelPeek(); + GraalZoomRefresh(); + } + else + { + GraalDisplayRectangle( Rectangle ); + } + } + else + { + delphvia( GraalFigureMbk, Via ); + + GraalErrorMessage( GraalMainWindow, "Can't create any big via of this type !" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalCreateTransistorMbk | +| | +\------------------------------------------------------------*/ + +void GraalCreateTransistorMbk( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ) + + long LambdaX1; + long LambdaY1; + long LambdaX2; + long LambdaY2; +{ + rdsrec_list *Rectangle; + phseg_list *Transistor; + long Delta; + + rdsbegin(); + + if ( LambdaX1 == LambdaX2 ) + { + Delta = LambdaY2 - LambdaY1; + } + else + { + Delta = LambdaX2 - LambdaX1; + } + + if ( Delta < 0 ) Delta = - Delta; + + if ( Delta < GRAAL_SEGMENT_VALUE_TABLE[GraalTransistorType][1] ) + { + GraalErrorMessage( GraalMainWindow, "This transistor is too small !" ); + + rdsend(); + return; + } + + GraalCreateFigureMbk(); + + Transistor = + + addphseg( GraalFigureMbk, GraalTransistorType, + GraalTransistorWidth * SCALE_X, + LambdaX1 * GRAAL_SCALE_X, LambdaY1 * GRAAL_SCALE_X, + LambdaX2 * GRAAL_SCALE_X, LambdaY2 * GRAAL_SCALE_X, + GraalTransistorName ); + + Transistor->USER = (void *)(&GraalFigureMbk->PHSEG); + + if ( Transistor->NEXT != (phseg_list *)NULL ) + { + Transistor->NEXT->USER = (void *)(&Transistor->NEXT); + } + + Rectangle = GraalAddSegment( Transistor ); + + if ( Rectangle != (rdsrec_list *)NULL ) + { + GraalAddUndo(); + GraalAddUndoRec( Rectangle ); + + if ( ( GraalHeadEqui != (rdsrec_list *)NULL ) || + ( GraalHeadPeek != (graalpeek *)NULL ) ) + { + GraalDelEqui(); + GraalDelPeek(); + GraalZoomRefresh(); + } + else + { + GraalDisplayRectangle( Rectangle ); + } + } + else + { + delphseg( GraalFigureMbk, Transistor ); + + GraalErrorMessage( GraalMainWindow, "Can't create any transistor of this type !" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalCreateConnectorMbk | +| | +\------------------------------------------------------------*/ + +void GraalCreateConnectorMbk( LambdaX1, LambdaY1 ) + + long LambdaX1; + long LambdaY1; +{ + rdsrec_list *Rectangle; + phcon_list *Connector; + char Orient; + char MbkOrient; + + rdsbegin(); + + LambdaX1 = LambdaX1 * GRAAL_SCALE_X; + LambdaY1 = LambdaY1 * GRAAL_SCALE_X; + + switch ( GraalConnectorOrient ) + { + case GRAAL_NORTH : MbkOrient = NORTH; + break; + case GRAAL_SOUTH : MbkOrient = SOUTH; + break; + case GRAAL_EAST : MbkOrient = EAST; + break; + default : MbkOrient = WEST; + } + + GraalEnterDialog( &GraalChangeConnectorNameDialog ); + + if ( GraalCreateDialogCancel ) + { + rdsend(); + return; + } + + if ( GraalConnectorName != (char *)NULL ) + { + GraalCreateFigureMbk(); + + Connector = + + addphcon( GraalFigureMbk, MbkOrient, + GraalConnectorName, + LambdaX1, LambdaY1, + GraalConnectorLayer, + GraalConnectorWidth * SCALE_X ); + + Connector->USER = (void *)(&GraalFigureMbk->PHCON); + + if ( Connector->NEXT != (phcon_list *)NULL ) + { + Connector->NEXT->USER = (void *)(&Connector->NEXT); + } + + Rectangle = GraalAddConnector( Connector ); + + if ( Rectangle != (rdsrec_list *)NULL ) + { + GraalAddUndo(); + GraalAddUndoRec( Rectangle ); + + if ( ( GraalHeadEqui != (rdsrec_list *)NULL ) || + ( GraalHeadPeek != (graalpeek *)NULL ) ) + { + GraalDelEqui(); + GraalDelPeek(); + GraalZoomRefresh(); + } + else + { + GraalDisplayRectangle( Rectangle ); + } + } + else + { + delphcon( GraalFigureMbk, Connector ); + + GraalErrorMessage( GraalMainWindow, "Can't create any connector of this layer !" ); + } + } + else + { + GraalErrorMessage( GraalMainWindow, "Connector must have name !" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalCreateReferenceMbk | +| | +\------------------------------------------------------------*/ + +void GraalCreateReferenceMbk( LambdaX1, LambdaY1 ) + + long LambdaX1; + long LambdaY1; +{ + rdsrec_list *Rectangle; + phref_list *Reference; + + rdsbegin(); + + GraalEnterDialog( &GraalChangeReferenceNameDialog ); + + if ( GraalCreateDialogCancel ) + { + rdsend(); + return; + } + + if ( GraalReferenceName != (char *)NULL ) + { + GraalCreateFigureMbk(); + + Reference = + + addphref( GraalFigureMbk, + (GraalReferenceType == MBK_REF_REF) ? "ref_ref":"ref_con" , + GraalReferenceName, + LambdaX1 * GRAAL_SCALE_X, LambdaY1 * GRAAL_SCALE_X ); + + Reference->USER = (void *)(&GraalFigureMbk->PHREF); + + if ( Reference->NEXT != (phref_list *)NULL ) + { + Reference->NEXT->USER = (void *)(&Reference->NEXT); + } + + Rectangle = GraalAddReference( Reference ); + + if ( Rectangle != (rdsrec_list *)NULL ) + { + GraalAddUndo(); + GraalAddUndoRec( Rectangle ); + + if ( ( GraalHeadEqui != (rdsrec_list *)NULL ) || + ( GraalHeadPeek != (graalpeek *)NULL ) ) + { + GraalDelEqui(); + GraalDelPeek(); + GraalZoomRefresh(); + } + else + { + GraalDisplayRectangle( Rectangle ); + } + } + else + { + delphref( GraalFigureMbk, Reference ); + + GraalErrorMessage( GraalMainWindow, "Can't create any reference of this type !" ); + } + } + else + { + GraalErrorMessage( GraalMainWindow, "Reference must have name !" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalCreateInstanceMbk | +| | +\------------------------------------------------------------*/ + +void GraalCreateInstanceMbk( LambdaX1, LambdaY1 ) + + long LambdaX1; + long LambdaY1; +{ + rdsrec_list *Rectangle; + phins_list *InstanceMbk; + phins_list *SaveInstance; + rdsins_list *InstanceRds; + + rdsbegin(); + + GraalEnterChangeInstanceModelDialog(); + + if ( GraalCreateDialogCancel ) + { + rdsend(); + return; + } + + if ( GraalInstanceModel != (char *)NULL ) + { + GraalEnterDialog( &GraalChangeInstanceNameDialog ); + + if ( GraalCreateDialogCancel ) + { + rdsend(); + return; + } + + if ( GraalInstanceName != (char *)NULL ) + { + GraalCreateFigureMbk(); + + if ( GraalFigureMbk->NAME == GraalInstanceModel ) + { + GraalErrorMessage( GraalMainWindow, + "A figure cannot be part of itself !" ); + rdsend(); + return; + } + + for ( InstanceRds = GraalFigureRds->INSTANCE; + InstanceRds != (rdsins_list *)NULL; + InstanceRds = InstanceRds->NEXT ) + { + if ( InstanceRds->INSNAME == GraalInstanceName ) + { + if ( ! IsGraalDeleted( InstanceRds->LAYERTAB[ RDS_ABOX ] ) ) + { + GraalErrorMessage( GraalMainWindow, + "All instances must have different names !" ); + rdsend(); + return; + } + } + } + + SaveInstance = GraalFigureMbk->PHINS; + GraalFigureMbk->PHINS = (phins_list *)NULL; + + InstanceMbk = + + addphins( GraalFigureMbk, + GraalInstanceModel, + GraalInstanceName, + GraalInstanceSym, + LambdaX1 * GRAAL_SCALE_X, LambdaY1 * GRAAL_SCALE_X ); + + InstanceMbk->NEXT = SaveInstance; + InstanceMbk->USER = (void *)(&GraalFigureMbk->PHINS); + + if ( SaveInstance != (phins_list *)NULL ) + { + SaveInstance->USER = (void *)(&InstanceMbk->NEXT); + } + + InstanceRds = GraalAddInstance( InstanceMbk ); + + GraalDisplayToolsMessage(); + + if ( InstanceRds == (rdsins_list *)NULL ) + { + GraalFigureMbk->PHINS = SaveInstance; + mbkfree( InstanceMbk ); + + GraalErrorMessage( GraalMainWindow, "Unable to load instance model !" ); + } + else + { + GraalDelEqui(); + GraalAddUndo(); + GraalAddUndoRec( InstanceRds->LAYERTAB[ RDS_ABOX ] ); + GraalZoomRefresh(); + } + } + else + { + GraalErrorMessage( GraalMainWindow, "An instance must have a name !" ); + } + } + else + { + GraalErrorMessage( GraalMainWindow, "An instance model name must specified !" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Graal Create Abutmentbox | +| | +\------------------------------------------------------------*/ + +void GraalCreateAbutmentBoxMbk( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ) + + long LambdaX1; + long LambdaY1; + long LambdaX2; + long LambdaY2; +{ + rdsrec_list *Rectangle; + long Swap; + + rdsbegin(); + + if ( ( LambdaX1 != LambdaX2 ) && + ( LambdaY1 != LambdaY2 ) ) + { + if ( LambdaX1 > LambdaX2 ) + { + Swap = LambdaX1; LambdaX1 = LambdaX2; LambdaX2 = Swap; + } + + if ( LambdaY1 > LambdaY2 ) + { + Swap = LambdaY1; LambdaY1 = LambdaY2; LambdaY2 = Swap; + } + } + else + { + GraalErrorMessage( GraalMainWindow, "The abutment box must be rectangular !" ); + + rdsend(); + return; + } + + GraalCreateFigureMbk(); + + GraalFigureMbk->XAB1 = LambdaX1 * GRAAL_SCALE_X; + GraalFigureMbk->YAB1 = LambdaY1 * GRAAL_SCALE_X; + GraalFigureMbk->XAB2 = LambdaX2 * GRAAL_SCALE_X; + GraalFigureMbk->YAB2 = LambdaY2 * GRAAL_SCALE_X; + + Rectangle = GraalAddAbox(); + + if ( Rectangle != (rdsrec_list *)NULL ) + { + GraalAddUndo(); + GraalAddUndoRec( Rectangle ); + + if ( ( GraalHeadEqui != (rdsrec_list *)NULL ) || + ( GraalHeadPeek != (graalpeek *)NULL ) ) + { + GraalDelEqui(); + GraalDelPeek(); + GraalZoomRefresh(); + } + else + { + GraalDisplayRectangle( Rectangle ); + } + + GraalChangeEditMode( GRAAL_EDIT_MEASURE, + GraalPromptEditMeasure ); + } + else + { + GraalFigureMbk->XAB1 = 0; + GraalFigureMbk->YAB1 = 0; + GraalFigureMbk->XAB2 = 0; + GraalFigureMbk->YAB2 = 0; + + GraalErrorMessage( GraalMainWindow, "Can't create this abutment box !" ); + } + + rdsend(); +} diff --git a/alliance/src/graal/src/GMC_create.h b/alliance/src/graal/src/GMC_create.h new file mode 100644 index 00000000..5a9cdb87 --- /dev/null +++ b/alliance/src/graal/src/GMC_create.h @@ -0,0 +1,141 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Create.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_CREATE +# define GRAAL_CREATE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Segment & Wire | +| | +\------------------------------------------------------------*/ + + extern char GraalSegmentLayer; + extern long GraalSegmentWidth; + extern char *GraalSegmentName; + extern char GraalSegmentWire; + +/*------------------------------------------------------------\ +| | +| Via | +| | +\------------------------------------------------------------*/ + + extern char GraalViaType; + extern char *GraalViaName; + +/*------------------------------------------------------------\ +| | +| Big Via | +| | +\------------------------------------------------------------*/ + + extern char GraalBigViaType; + extern char *GraalBigViaName; + +/*------------------------------------------------------------\ +| | +| Transistor | +| | +\------------------------------------------------------------*/ + + extern char GraalTransistorType; + extern char *GraalTransistorName; + extern long GraalTransistorWidth; + extern char GraalTransistorWire; + +/*------------------------------------------------------------\ +| | +| Connector | +| | +\------------------------------------------------------------*/ + + extern char GraalConnectorLayer; + extern long GraalConnectorWidth; + extern char *GraalConnectorName; + extern char GraalConnectorOrient; + +/*------------------------------------------------------------\ +| | +| Reference | +| | +\------------------------------------------------------------*/ + + extern char GraalReferenceType; + extern char *GraalReferenceName; + +/*------------------------------------------------------------\ +| | +| Instance | +| | +\------------------------------------------------------------*/ + + extern char GraalInstanceSym; + extern char *GraalInstanceName; + extern char *GraalInstanceModel; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GMC_dialog.c b/alliance/src/graal/src/GMC_dialog.c new file mode 100644 index 00000000..f99641be --- /dev/null +++ b/alliance/src/graal/src/GMC_dialog.c @@ -0,0 +1,1145 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Dialog.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GRM.h" +# include "GMX.h" +# include "GTB.h" +# include "GSB.h" +# include "GMC.h" +# include "GMF.h" + +# include "GMC_dialog.h" +# include "GMC_create.h" +# include "GMC_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + char GraalCreateDialogCancel = 1; + + char GraalModelFilter[ 10 ] = "*."; + char GraalModelExtention[ 10 ] = "."; + + char GraalModelBuffer[ 128 ]; + char GraalModelDirectoryBuffer[ 512 ]; + +/*------------------------------------------------------------\ +| | +| Create Dialog | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Segment Dialog | +| | +\------------------------------------------------------------*/ + + GraalDialogItem GraalChangeSegmentWidthDialog = + + { + "Segment width", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackChangeSegmentWidthOk, + (XtPointer)NULL, + (void *)CallbackChangeSegmentWidthCancel, + (XtPointer)NULL + }; + + GraalDialogItem GraalChangeSegmentNameDialog = + + { + "Segment name", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackChangeSegmentNameOk, + (XtPointer)NULL, + (void *)CallbackChangeSegmentNameCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Via Dialog | +| | +\------------------------------------------------------------*/ + + GraalDialogItem GraalChangeViaNameDialog = + + { + "Via name", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackChangeViaNameOk, + (XtPointer)NULL, + (void *)CallbackChangeViaNameCancel, + (XtPointer)NULL + }; + + GraalDialogItem GraalChangeBigViaNameDialog = + + { + "BigVia name", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackChangeBigViaNameOk, + (XtPointer)NULL, + (void *)CallbackChangeBigViaNameCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Transistor Dialog | +| | +\------------------------------------------------------------*/ + + GraalDialogItem GraalChangeTransistorWidthDialog = + + { + "Transistor width", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackChangeTransistorWidthOk, + (XtPointer)NULL, + (void *)CallbackChangeTransistorWidthCancel, + (XtPointer)NULL + }; + + GraalDialogItem GraalChangeTransistorNameDialog = + + { + "Transistor name", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackChangeTransistorNameOk, + (XtPointer)NULL, + (void *)CallbackChangeTransistorNameCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Connector Dialog | +| | +\------------------------------------------------------------*/ + + GraalDialogItem GraalChangeConnectorWidthDialog = + + { + "Connector width", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackChangeConnectorWidthOk, + (XtPointer)NULL, + (void *)CallbackChangeConnectorWidthCancel, + (XtPointer)NULL + }; + + GraalDialogItem GraalChangeConnectorNameDialog = + + { + "Connector name", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackChangeConnectorNameOk, + (XtPointer)NULL, + (void *)CallbackChangeConnectorNameCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Reference Dialog | +| | +\------------------------------------------------------------*/ + + GraalDialogItem GraalChangeReferenceNameDialog = + + { + "Reference name", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackChangeReferenceNameOk, + (XtPointer)NULL, + (void *)CallbackChangeReferenceNameCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Instance Dialog | +| | +\------------------------------------------------------------*/ + + GraalDialogItem GraalChangeInstanceNameDialog = + + { + "Instance name", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackChangeInstanceNameOk, + (XtPointer)NULL, + (void *)CallbackChangeInstanceNameCancel, + (XtPointer)NULL + }; + + GraalDialogItem GraalChangeInstanceModelDialog = + + { + "Instance model name", + GRAAL_DIALOG_FILE, + (Widget)NULL, + (void *)CallbackChangeInstanceModelOk, + (XtPointer)NULL, + (void *)CallbackChangeInstanceModelCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalBuildCreateDialog | +| | +\------------------------------------------------------------*/ + +void GraalBuildCreateDialog() + +{ + rdsbegin(); + + GraalBuildDialog( GraalMainWindow, &GraalChangeSegmentWidthDialog ); + GraalBuildDialog( GraalMainWindow, &GraalChangeSegmentNameDialog ); + GraalBuildDialog( GraalMainWindow, &GraalChangeTransistorWidthDialog ); + GraalBuildDialog( GraalMainWindow, &GraalChangeTransistorNameDialog ); + GraalBuildDialog( GraalMainWindow, &GraalChangeViaNameDialog ); + GraalBuildDialog( GraalMainWindow, &GraalChangeBigViaNameDialog ); + GraalBuildDialog( GraalMainWindow, &GraalChangeConnectorWidthDialog ); + GraalBuildDialog( GraalMainWindow, &GraalChangeConnectorNameDialog ); + GraalBuildDialog( GraalMainWindow, &GraalChangeReferenceNameDialog ); + GraalBuildDialog( GraalMainWindow, &GraalChangeInstanceNameDialog ); + GraalBuildDialog( GraalMainWindow, &GraalChangeInstanceModelDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Dialog | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackChangeSegmentWidthOk | +| | +\------------------------------------------------------------*/ + +void CallbackChangeSegmentWidthOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *WidthSet; + long NewWidth; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &WidthSet ); + + XtUnmanageChild( GraalChangeSegmentWidthDialog.WIDGET ); + + GraalExitDialog(); + + GraalCreateDialogCancel = 0; + + if ( WidthSet != (char *)NULL ) + { + NewWidth = atoi( WidthSet ); + + if ( NewWidth >= GRAAL_SEGMENT_VALUE_TABLE[ GraalSegmentLayer ][0] ) + { + GraalSegmentWidth = NewWidth; + } + else + { + GraalErrorMessage( GraalMainWindow, "Incorrect segment width !" ); + } + + if ( GraalSegmentWire == GRAAL_FALSE ) + { + GraalChangeEditMode( GRAAL_CREATE_SEGMENT, + GraalPromptCreateSegment ); + } + else + { + GraalChangeEditMode( GRAAL_CREATE_SEGMENT_WIRE, + GraalPromptCreateSegment ); + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeSegmentWidthCancel | +| | +\------------------------------------------------------------*/ + +void CallbackChangeSegmentWidthCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalChangeSegmentWidthDialog.WIDGET ); + + GraalExitDialog(); + + GraalCreateDialogCancel = 1; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeSegmentNameOk | +| | +\------------------------------------------------------------*/ + +void CallbackChangeSegmentNameOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *NameSet; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &NameSet ); + + XtUnmanageChild( GraalChangeSegmentNameDialog.WIDGET ); + + GraalExitDialog(); + + GraalCreateDialogCancel = 0; + + NameSet = GraalPostTreatString( NameSet ); + + if ( NameSet != (char *)NULL ) + { + NameSet = namealloc( NameSet ); + } + + GraalSegmentName = NameSet; + + if ( GraalSegmentWire == GRAAL_FALSE ) + { + GraalChangeEditMode( GRAAL_CREATE_SEGMENT, + GraalPromptCreateSegment ); + } + else + { + GraalChangeEditMode( GRAAL_CREATE_SEGMENT_WIRE, + GraalPromptCreateSegment ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeSegmentNameCancel | +| | +\------------------------------------------------------------*/ + +void CallbackChangeSegmentNameCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalChangeSegmentNameDialog.WIDGET ); + + GraalExitDialog(); + + GraalCreateDialogCancel = 1; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Transistor | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackChangeTransistorWidthOk | +| | +\------------------------------------------------------------*/ + +void CallbackChangeTransistorWidthOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *WidthSet; + long NewWidth; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &WidthSet ); + + XtUnmanageChild( GraalChangeTransistorWidthDialog.WIDGET ); + + GraalExitDialog(); + + GraalCreateDialogCancel = 0; + + if ( WidthSet != (char *)NULL ) + { + NewWidth = atoi( WidthSet ); + + if ( NewWidth >= GRAAL_SEGMENT_VALUE_TABLE[ GraalTransistorType ][0] ) + { + GraalTransistorWidth = NewWidth; + } + else + { + GraalErrorMessage( GraalMainWindow, "Incorrect transistor width !" ); + } + + if ( GraalTransistorWire == GRAAL_FALSE ) + { + GraalChangeEditMode( GRAAL_CREATE_TRANSISTOR, + GraalPromptCreateTransistor ); + } + else + { + GraalChangeEditMode( GRAAL_CREATE_TRANSISTOR_WIRE, + GraalPromptCreateTransistor ); + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeTransistorWidthCancel | +| | +\------------------------------------------------------------*/ + +void CallbackChangeTransistorWidthCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalChangeTransistorWidthDialog.WIDGET ); + + GraalExitDialog(); + + GraalCreateDialogCancel = 1; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeTransistorNameOk | +| | +\------------------------------------------------------------*/ + +void CallbackChangeTransistorNameOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *NameSet; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &NameSet ); + + XtUnmanageChild( GraalChangeTransistorNameDialog.WIDGET ); + + GraalExitDialog(); + + GraalCreateDialogCancel = 0; + + NameSet = GraalPostTreatString( NameSet ); + + if ( NameSet != (char *)NULL ) + { + NameSet = namealloc( NameSet ); + } + + GraalTransistorName = NameSet; + + if ( GraalTransistorWire == GRAAL_FALSE ) + { + GraalChangeEditMode( GRAAL_CREATE_TRANSISTOR, + GraalPromptCreateTransistor ); + } + else + { + GraalChangeEditMode( GRAAL_CREATE_TRANSISTOR_WIRE, + GraalPromptCreateTransistor ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeTransistorNameCancel | +| | +\------------------------------------------------------------*/ + +void CallbackChangeTransistorNameCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalChangeTransistorNameDialog.WIDGET ); + + GraalExitDialog(); + + GraalCreateDialogCancel = 1; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Connector | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackChangeConnectorWidthOk | +| | +\------------------------------------------------------------*/ + +void CallbackChangeConnectorWidthOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *WidthSet; + long NewWidth; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &WidthSet ); + + XtUnmanageChild( GraalChangeConnectorWidthDialog.WIDGET ); + + GraalExitDialog(); + + GraalCreateDialogCancel = 0; + + if ( WidthSet != (char *)NULL ) + { + NewWidth = atoi( WidthSet ); + + if ( NewWidth >= GRAAL_SEGMENT_VALUE_TABLE[ GraalConnectorLayer ][0] ) + { + GraalConnectorWidth = NewWidth; + } + else + { + GraalErrorMessage( GraalMainWindow, "Incorrect connector width !" ); + } + + GraalChangeEditMode( GRAAL_CREATE_CONNECTOR, + GraalPromptCreateConnector ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeConnectorWidthCancel | +| | +\------------------------------------------------------------*/ + +void CallbackChangeConnectorWidthCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalChangeConnectorWidthDialog.WIDGET ); + + GraalExitDialog(); + + GraalCreateDialogCancel = 1; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeConnectorNameOk | +| | +\------------------------------------------------------------*/ + +void CallbackChangeConnectorNameOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *NameSet; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &NameSet ); + + XtUnmanageChild( GraalChangeConnectorNameDialog.WIDGET ); + + GraalExitDialog(); + + GraalCreateDialogCancel = 0; + + NameSet = GraalPostTreatString( NameSet ); + + if ( NameSet != (char *)NULL ) + { + NameSet = namealloc( NameSet ); + } + + GraalConnectorName = NameSet; + + GraalChangeEditMode( GRAAL_CREATE_CONNECTOR, + GraalPromptCreateConnector ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeConnectorNameCancel | +| | +\------------------------------------------------------------*/ + +void CallbackChangeConnectorNameCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalChangeConnectorNameDialog.WIDGET ); + + GraalExitDialog(); + + GraalCreateDialogCancel = 1; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Reference | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackChangeReferenceNameOk | +| | +\------------------------------------------------------------*/ + +void CallbackChangeReferenceNameOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *NameSet; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &NameSet ); + + XtUnmanageChild( GraalChangeReferenceNameDialog.WIDGET ); + + GraalExitDialog(); + + GraalCreateDialogCancel = 0; + + NameSet = GraalPostTreatString( NameSet ); + + if ( NameSet != (char *)NULL ) + { + NameSet = namealloc( NameSet ); + } + + GraalReferenceName = NameSet; + + GraalChangeEditMode( GRAAL_CREATE_REFERENCE, + GraalPromptCreateReference ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeReferenceNameCancel | +| | +\------------------------------------------------------------*/ + +void CallbackChangeReferenceNameCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalChangeReferenceNameDialog.WIDGET ); + + GraalExitDialog(); + + GraalCreateDialogCancel = 1; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Instance | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackChangeInstanceNameOk | +| | +\------------------------------------------------------------*/ + +void CallbackChangeInstanceNameOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *NameSet; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &NameSet ); + + XtUnmanageChild( GraalChangeInstanceNameDialog.WIDGET ); + + GraalExitDialog(); + + GraalCreateDialogCancel = 0; + + NameSet = GraalPostTreatString( NameSet ); + + if ( NameSet != (char *)NULL ) + { + NameSet = namealloc( NameSet ); + + GraalInstanceName = NameSet; + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeInstanceNameCancel | +| | +\------------------------------------------------------------*/ + +void CallbackChangeInstanceNameCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalChangeInstanceNameDialog.WIDGET ); + + GraalExitDialog(); + + GraalCreateDialogCancel = 1; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeInstanceModelOk | +| | +\------------------------------------------------------------*/ + +void CallbackChangeInstanceModelOk( MyWidget, ClientData, FileStruct ) + + Widget MyWidget; + caddr_t ClientData; + XmFileSelectionBoxCallbackStruct *FileStruct; +{ + char *Directory; + char *FileName; + int Index; + + rdsbegin(); + + FileName = (char *)0; + Directory = (char *)0; + + XtUnmanageChild( GraalChangeInstanceModelDialog.WIDGET ); + + GraalExitDialog(); + + if ( FileStruct->value != NULL ) + { + XmStringGetLtoR( FileStruct->value, + XmSTRING_DEFAULT_CHARSET, + &FileName + ); + + FileName = GraalPostTreatString( FileName ); + } + + if ( FileName != (char *)NULL ) + { + GraalCreateDialogCancel = 0; + + if ( GRAAL_WORK_LIB == (char *)NULL ) + { + GRAAL_WORK_LIB = WORK_LIB; + } + + for ( Index = strlen( FileName ); Index >= 0; Index-- ) + { + if ( FileName[ Index ] == '/' ) break; + } + + if ( Index >= 0 ) + { + strcpy( GraalModelDirectoryBuffer, FileName ); + strcpy( GraalModelBuffer, FileName + Index + 1); + + GraalModelDirectoryBuffer[ Index + 1 ] = '\0'; + Directory = GraalModelDirectoryBuffer; + } + else + { + strcpy( GraalModelBuffer, FileName ); + Directory = GRAAL_WORK_LIB; + } + + Index = strlen( GraalModelBuffer ) - strlen( GraalModelExtention ); + + if ( Index >= 0 ) + { + if ( ! strcmp( GraalModelBuffer + Index, GraalModelExtention ) ) + { + GraalModelBuffer[ Index ] = '\0'; + } + } + + GraalInstanceModel = namealloc( GraalModelBuffer ); + + GraalChangeEditMode( GRAAL_CREATE_INSTANCE, + GraalPromptCreateInstance ); + + if ( Directory != GRAAL_WORK_LIB ) + { + GraalAddDirectoryToCataLibrary( Directory ); + } + } + else + { + GraalCreateDialogCancel = 1; + + GraalErrorMessage( GraalMainWindow, "Unable to load this model !" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeInstanceModelCancel | +| | +\------------------------------------------------------------*/ + +void CallbackChangeInstanceModelCancel( MyWidget, ClientData, FileStruct ) + + Widget MyWidget; + caddr_t ClientData; + XmFileSelectionBoxCallbackStruct *FileStruct; +{ + rdsbegin(); + + XtUnmanageChild( GraalChangeInstanceModelDialog.WIDGET ); + + GraalExitDialog(); + + GraalCreateDialogCancel = 1; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEnterChangeInstanceModelDialog | +| | +\------------------------------------------------------------*/ + +void GraalEnterChangeInstanceModelDialog() +{ + XmString Label; + XmString Filter; + + if ( GraalModelFilter[2] == '\0' ) + { + strcat( GraalModelFilter, IN_PH ); + strcat( GraalModelExtention, IN_PH ); + + Filter = XmStringCreateSimple( GraalModelFilter ); + + XtVaSetValues( GraalChangeInstanceModelDialog.WIDGET, + XmNpattern, Filter, NULL); + + XmStringFree( Filter ); + } + + GraalEnterDialog( &GraalChangeInstanceModelDialog ); +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeViaNameOk | +| | +\------------------------------------------------------------*/ + +void CallbackChangeViaNameOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *NameSet; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &NameSet ); + + XtUnmanageChild( GraalChangeViaNameDialog.WIDGET ); + + GraalExitDialog(); + + GraalCreateDialogCancel = 0; + + NameSet = GraalPostTreatString( NameSet ); + + if ( NameSet != (char *)NULL ) + { + NameSet = namealloc( NameSet ); + } + + GraalViaName = NameSet; + + GraalChangeEditMode( GRAAL_CREATE_VIA, GraalPromptCreateVia ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeViaNameCancel | +| | +\------------------------------------------------------------*/ + +void CallbackChangeViaNameCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalChangeViaNameDialog.WIDGET ); + + GraalExitDialog(); + + GraalCreateDialogCancel = 1; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeBigViaNameOk | +| | +\------------------------------------------------------------*/ + +void CallbackChangeBigViaNameOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *NameSet; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &NameSet ); + + XtUnmanageChild( GraalChangeBigViaNameDialog.WIDGET ); + + GraalExitDialog(); + + GraalCreateDialogCancel = 0; + + NameSet = GraalPostTreatString( NameSet ); + + if ( NameSet != (char *)NULL ) + { + NameSet = namealloc( NameSet ); + } + + GraalBigViaName = NameSet; + + GraalChangeEditMode( GRAAL_CREATE_BIGVIA, GraalPromptCreateBigVia ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeBigViaNameCancel | +| | +\------------------------------------------------------------*/ + +void CallbackChangeBigViaNameCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalChangeBigViaNameDialog.WIDGET ); + + GraalExitDialog(); + + GraalCreateDialogCancel = 1; + + rdsend(); +} + diff --git a/alliance/src/graal/src/GMC_dialog.h b/alliance/src/graal/src/GMC_dialog.h new file mode 100644 index 00000000..6930bef0 --- /dev/null +++ b/alliance/src/graal/src/GMC_dialog.h @@ -0,0 +1,116 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Dialog.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_CREATE_DIALOG +# define GRAAL_CREATE_DIALOG + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char GraalCreateDialogCancel; + + extern GraalDialogItem GraalChangeSegmentWidthDialog; + extern GraalDialogItem GraalChangeSegmentNameDialog; + extern GraalDialogItem GraalChangeViaNameDialog; + extern GraalDialogItem GraalChangeBigViaNameDialog; + extern GraalDialogItem GraalChangeTransistorWidthDialog; + extern GraalDialogItem GraalChangeTransistorNameDialog; + extern GraalDialogItem GraalChangeConnectorWidthDialog; + extern GraalDialogItem GraalChangeConnectorNameDialog; + extern GraalDialogItem GraalChangeReferenceNameDialog; + extern GraalDialogItem GraalChangeInstanceNameDialog; + extern GraalDialogItem GraalChangeInstanceModelDialog; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackChangeSegmentWidthOk(); + extern void CallbackChangeSegmentWidthCancel(); + extern void CallbackChangeSegmentNameOk(); + extern void CallbackChangeSegmentNameCancel(); + + extern void CallbackChangeViaNameOk(); + extern void CallbackChangeViaNameCancel(); + + extern void CallbackChangeBigViaNameOk(); + extern void CallbackChangeBigViaNameCancel(); + + extern void CallbackChangeTransistorWidthOk(); + extern void CallbackChangeTransistorWidthCancel(); + extern void CallbackChangeTransistorNameOk(); + extern void CallbackChangeTransistorNameCancel(); + + extern void CallbackChangeConnectorWidthOk(); + extern void CallbackChangeConnectorWidthCancel(); + extern void CallbackChangeConnectorNameOk(); + extern void CallbackChangeConnectorNameCancel(); + + extern void CallbackChangeReferenceNameOk(); + extern void CallbackChangeReferenceNameCancel(); + + extern void CallbackChangeInstanceNameOk(); + extern void CallbackChangeInstanceNameCancel(); + extern void CallbackChangeInstanceModelOk(); + extern void CallbackChangeInstanceModelCancel(); + + extern void GraalEnterChangeInstanceModelDialog(); + +# endif diff --git a/alliance/src/graal/src/GMC_menu.c b/alliance/src/graal/src/GMC_menu.c new file mode 100644 index 00000000..36193f44 --- /dev/null +++ b/alliance/src/graal/src/GMC_menu.c @@ -0,0 +1,435 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Menu.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "GTB.h" +# include "GSB.h" +# include "GRM.h" +# include "GMX.h" +# include "GMC.h" + +# include "GMC_menu.h" +# include "GMC_create.h" +# include "GMC_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + GraalMenuItem GraalCreateMenu[] = + + { + { + "Instance", + 'I', + "CtrlI", + "Ctrl I", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackCreateInstance, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Abutment Box", + 'A', + "CtrlA", + "Ctrl A", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackCreateAbutmentBox, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Segment", + 'S', + "CtrlE", + "Ctrl E", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackCreateSegment, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Via", + 'V', + "CtrlV", + "Ctrl V", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackCreateVia, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Big Via", + 'B', + "CtrlB", + "Ctrl B", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackCreateBigVia, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Connector ", + 'o', + "CtrlN", + "Ctrl N", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackCreateConnector, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Transistor ", + 'T', + "CtrlT", + "Ctrl T", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackCreateTransistor, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Reference ", + 'R', + "CtrlF", + "Ctrl F", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackCreateReference, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL, + } + , + NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackCreateSegment | +| | +\------------------------------------------------------------*/ + +void CallbackCreateSegment( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( GraalSegmentWidth == -1 ) + { + GraalSegmentWidth = GRAAL_SEGMENT_VALUE_TABLE[ GraalSegmentLayer ][0]; + } + + if ( GraalSegmentWire == GRAAL_FALSE ) + { + GraalChangeEditMode( GRAAL_CREATE_SEGMENT, + GraalPromptCreateSegment ); + } + else + { + GraalChangeEditMode( GRAAL_CREATE_SEGMENT_WIRE, + GraalPromptCreateSegment ); + } + + GraalEnterPanel( &GraalCreateSegmentPanel ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCreateReference | +| | +\------------------------------------------------------------*/ + +void CallbackCreateReference( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalChangeEditMode( GRAAL_CREATE_REFERENCE, + GraalPromptCreateReference ); + + GraalEnterPanel( &GraalCreateReferencePanel ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCreateVia | +| | +\------------------------------------------------------------*/ + +void CallbackCreateVia( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalChangeEditMode( GRAAL_CREATE_VIA, + GraalPromptCreateVia ); + + GraalEnterPanel( &GraalCreateViaPanel ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCreateBigVia | +| | +\------------------------------------------------------------*/ + +void CallbackCreateBigVia( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalChangeEditMode( GRAAL_CREATE_BIGVIA, + GraalPromptCreateBigVia ); + + GraalEnterPanel( &GraalCreateBigViaPanel ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCreateInstance | +| | +\------------------------------------------------------------*/ + +void CallbackCreateInstance( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalChangeEditMode( GRAAL_CREATE_INSTANCE, + GraalPromptCreateInstance ); + + GraalEnterPanel( &GraalCreateInstancePanel ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCreateConnector | +| | +\------------------------------------------------------------*/ + +void CallbackCreateConnector( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( ( GraalFigureMbk == (phfig_list *)NULL ) || + ( ( GraalFigureMbk->XAB1 == 0 ) && + ( GraalFigureMbk->XAB2 == 0 ) && + ( GraalFigureMbk->YAB1 == 0 ) && + ( GraalFigureMbk->YAB2 == 0 ) ) ) + { + GraalErrorMessage( GraalMainWindow, "No abutment box, can't create connector !" ); + } + else + { + if ( GraalConnectorWidth == -1 ) + { + GraalConnectorWidth = GRAAL_SEGMENT_VALUE_TABLE[ GraalConnectorLayer ][0]; + } + + GraalChangeEditMode( GRAAL_CREATE_CONNECTOR, + GraalPromptCreateConnector ); + + GraalEnterPanel( &GraalCreateConnectorPanel ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCreateTransistor | +| | +\------------------------------------------------------------*/ + +void CallbackCreateTransistor( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( GraalTransistorWidth == -1 ) + { + GraalTransistorWidth = GRAAL_SEGMENT_VALUE_TABLE[ GraalTransistorType ][0]; + } + + GraalChangeEditMode( GRAAL_CREATE_TRANSISTOR, + GraalPromptCreateTransistor ); + + GraalEnterPanel ( &GraalCreateTransistorPanel ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCreateAbutmentBox | +| | +\------------------------------------------------------------*/ + +void CallbackCreateAbutmentBox( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( ( GraalFigureMbk != (phfig_list *)NULL ) && + ( ( GraalFigureMbk->XAB1 != 0 ) || + ( GraalFigureMbk->XAB2 != 0 ) || + ( GraalFigureMbk->YAB1 != 0 ) || + ( GraalFigureMbk->YAB2 != 0 ) ) ) + { + GraalErrorMessage( GraalMainWindow, "There is already one abutment box !"); + } + else + { + GraalChangeEditMode( GRAAL_CREATE_ABUTMENTBOX, + GraalPromptCreateAbutmentBox ); + } + + rdsend(); +} diff --git a/alliance/src/graal/src/GMC_menu.h b/alliance/src/graal/src/GMC_menu.h new file mode 100644 index 00000000..41352675 --- /dev/null +++ b/alliance/src/graal/src/GMC_menu.h @@ -0,0 +1,79 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Menu.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_CREATE_MENU +# define GRAAL_CREATE_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackCreateSegment(); + extern void CallbackCreateVia(); + extern void CallbackCreateBigVia(); + extern void CallbackCreateInstance(); + extern void CallbackCreateConnector(); + extern void CallbackCreateTransistor(); + extern void CallbackCreateReference(); + extern void CallbackCreateAbutmentBox(); + +# endif diff --git a/alliance/src/graal/src/GMC_message.c b/alliance/src/graal/src/GMC_message.c new file mode 100644 index 00000000..7eff80f5 --- /dev/null +++ b/alliance/src/graal/src/GMC_message.c @@ -0,0 +1,289 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Message.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GRM.h" +# include "GMX.h" +# include "GTB.h" +# include "GSB.h" +# include "GMC.h" +# include "GMC_message.h" +# include "GMC_create.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static char MessageBuffer[ 512 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalPromptCreateSegment | +| | +\------------------------------------------------------------*/ + +void GraalPromptCreateSegment() + +{ + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Create Segment" ); + + sprintf( MessageBuffer, "Layer: %s Width: %2d Name: %s", + GRAAL_SEGMENT_NAME_TABLE[ GraalSegmentLayer ][0] , + GraalSegmentWidth, + ( GraalSegmentName ) ? GraalSegmentName : "none" ); + + GraalDisplayMessage( GRAAL_MESSAGE_INFO, MessageBuffer ); + + switch ( GraalCountEventEdit ) + { + case 0 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter first point" ); + + break; + + case 1 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter second point" ); + } +} + +/*------------------------------------------------------------\ +| | +| GraalPromptCreateConnector | +| | +\------------------------------------------------------------*/ + +void GraalPromptCreateConnector() + +{ + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Create Connector" ); + + sprintf( MessageBuffer, "Layer: %s Width: %2d Orient: %s", + GRAAL_CONNECTOR_NAME_TABLE[ GraalConnectorLayer ][0], + GraalConnectorWidth, + GRAAL_ORIENT_NAME_TABLE[ GraalConnectorOrient ][0] ); + + GraalDisplayMessage( GRAAL_MESSAGE_INFO, MessageBuffer ); + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter center point" ); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptCreateReference | +| | +\------------------------------------------------------------*/ + +void GraalPromptCreateReference() + +{ + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Create Reference" ); + + sprintf( MessageBuffer, "Type: %s", + GRAAL_REFERENCE_NAME_TABLE[GraalReferenceType][0] ); + + GraalDisplayMessage( GRAAL_MESSAGE_INFO, MessageBuffer ); + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter center point" ); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptCreateVia | +| | +\------------------------------------------------------------*/ + +void GraalPromptCreateVia() + +{ + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Create Via" ); + + sprintf( MessageBuffer, "Type: %s Name: %s", + GRAAL_VIA_NAME_TABLE[ GraalViaType ][0], + ( GraalViaName ) ? GraalViaName : "none" ); + + GraalDisplayMessage( GRAAL_MESSAGE_INFO, MessageBuffer ); + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter center point" ); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptCreateBigVia | +| | +\------------------------------------------------------------*/ + +void GraalPromptCreateBigVia() + +{ + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Create Big Via" ); + + sprintf( MessageBuffer, "Type: %s Name: %s", + GRAAL_BIGVIA_NAME_TABLE[ GraalBigViaType ][0], + ( GraalBigViaName ) ? GraalBigViaName : "none" ); + + GraalDisplayMessage( GRAAL_MESSAGE_INFO, MessageBuffer ); + + switch ( GraalCountEventEdit ) + { + case 0 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter first corner" ); + + break; + + case 1 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter second corner" ); + } +} + +/*------------------------------------------------------------\ +| | +| GraalPromptCreateTransistor | +| | +\------------------------------------------------------------*/ + +void GraalPromptCreateTransistor() + +{ + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Create Transistor" ); + + if ( GraalTransistorName == (char *)NULL ) + { + sprintf( MessageBuffer, "Type: %s Width: %2d Name: none", + GRAAL_TRANSISTOR_NAME_TABLE[ GraalTransistorType ][0], + GraalTransistorWidth ); + } + else + { + sprintf( MessageBuffer, "Type: %s Width: %2d Name: %s", + GRAAL_TRANSISTOR_NAME_TABLE[ GraalTransistorType ][0], + GraalTransistorWidth, GraalTransistorName ); + } + + GraalDisplayMessage( GRAAL_MESSAGE_INFO, MessageBuffer ); + + switch ( GraalCountEventEdit ) + { + case 0 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter first point" ); + + break; + + case 1 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter second point" ); + } +} + +/*------------------------------------------------------------\ +| | +| GraalPromptCreateAbutmentBox | +| | +\------------------------------------------------------------*/ + +void GraalPromptCreateAbutmentBox() + +{ + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Create Abutmentbox" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO, "Select window" ); + + switch ( GraalCountEventEdit ) + { + case 0 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter first corner" ); + + break; + + case 1 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter second corner" ); + } +} + +/*------------------------------------------------------------\ +| | +| GraalPromptCreateInstance | +| | +\------------------------------------------------------------*/ + +void GraalPromptCreateInstance() + +{ + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Create Instance" ); + + sprintf( MessageBuffer, "Symmetry: %s", + GRAAL_SYMMETRY_NAME_TABLE[ GraalInstanceSym ][0] ); + + GraalDisplayMessage( GRAAL_MESSAGE_INFO, MessageBuffer ); + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter base point" ); +} diff --git a/alliance/src/graal/src/GMC_message.h b/alliance/src/graal/src/GMC_message.h new file mode 100644 index 00000000..5a545ff2 --- /dev/null +++ b/alliance/src/graal/src/GMC_message.h @@ -0,0 +1,79 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Message.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_MESSAGE +# define GRAAL_MESSAGE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalPromptCreateSegment(); + extern void GraalPromptCreateConnector(); + extern void GraalPromptCreateReference(); + extern void GraalPromptCreateVia(); + extern void GraalPromptCreateBigVia(); + extern void GraalPromptCreateTransistor(); + extern void GraalPromptCreateAbutmentBox(); + extern void GraalPromptCreateInstance(); + +# endif diff --git a/alliance/src/graal/src/GMC_panel.c b/alliance/src/graal/src/GMC_panel.c new file mode 100644 index 00000000..c752294a --- /dev/null +++ b/alliance/src/graal/src/GMC_panel.c @@ -0,0 +1,3913 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Panel.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "GTB.h" +# include "GSB.h" +# include "GMX.h" +# include "GRM.h" +# include "GMC.h" + +# include "GMC_panel.h" +# include "GMC_dialog.h" +# include "GMC_create.h" +# include "GMC_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Create Panel | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Segment Panel | +| | +\------------------------------------------------------------*/ + + static GraalPanelButtonItem GraalCreateSegmentButton[ MBK_MAX_LAYER + 4 ] = + + { + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeSegmentLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + "Width", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackChangeSegmentWidth, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Name", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackChangeSegmentName, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Simple", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackChangeSegmentWire, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Close", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackChangeSegmentClose, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalCreateSegmentPanel = + + { + "Segment", + 1, + 0, + GRAAL_CREATE_SEGMENT_X, + GRAAL_CREATE_SEGMENT_Y, + 100, + 300, + 2, + ( MBK_MAX_LAYER + 4 ) / 2, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + MBK_MAX_LAYER + 4, + GraalCreateSegmentButton + }; + + int GraalCreateSegmentDefaultValues[ 5 ] = + + { + GRAAL_CREATE_SEGMENT_X, + GRAAL_CREATE_SEGMENT_Y, + 100, 300, 0 + }; + +/*------------------------------------------------------------\ +| | +| Via Panel | +| | +\------------------------------------------------------------*/ + + static GraalPanelButtonItem GraalCreateViaButton[ MBK_MAX_VIA + 2 ] = + + { + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + "Name", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaName, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Close", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeViaClose, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalCreateViaPanel = + + { + "Via", + 1, + 0, + GRAAL_CREATE_VIA_X, + GRAAL_CREATE_VIA_Y, + 100, + 300, + 1, + MBK_MAX_VIA + 2, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + MBK_MAX_VIA + 2, + GraalCreateViaButton + }; + + int GraalCreateViaDefaultValues[ 5 ] = + + { + GRAAL_CREATE_VIA_X, + GRAAL_CREATE_VIA_Y, + 100, 300, 0 + }; + +/*------------------------------------------------------------\ +| | +| Big Via Panel | +| | +\------------------------------------------------------------*/ + + static GraalPanelButtonItem GraalCreateBigViaButton[ MBK_MAX_VIA + 2 ] = + + { + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaType, + (XtPointer)0, + (Widget)NULL + } + , + { + "Name", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaName, + (XtPointer)0, + (Widget)NULL + } + , + { + "Close", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeBigViaClose, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalCreateBigViaPanel = + + { + "BigVia", + 1, + 0, + GRAAL_CREATE_BIGVIA_X, + GRAAL_CREATE_BIGVIA_Y, + 100, + 275, + 1, + MBK_MAX_VIA + 2, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + MBK_MAX_VIA + 2, + GraalCreateBigViaButton + }; + + int GraalCreateBigViaDefaultValues[ 5 ] = + + { + GRAAL_CREATE_BIGVIA_X, + GRAAL_CREATE_BIGVIA_Y, + 100, 275, 0 + }; + +/*------------------------------------------------------------\ +| | +| Transistor Panel | +| | +\------------------------------------------------------------*/ + + static GraalPanelButtonItem GraalCreateTransistorButton[ MBK_MAX_LAYER + 4 ] = + + { + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + "Width", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackChangeTransistorWidth, + (XtPointer) NULL, + (Widget)NULL + } + , + { + "Name", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackChangeTransistorName, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Simple", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackChangeTransistorWire, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Close", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackChangeTransistorClose, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalCreateTransistorPanel = + + { + "Transistor", + 1, + 0, + GRAAL_CREATE_TRANSISTOR_X, + GRAAL_CREATE_TRANSISTOR_Y, + 100, + 300, + 2, + ( MBK_MAX_LAYER + 4 ) / 2, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + MBK_MAX_LAYER + 4, + GraalCreateTransistorButton + }; + + int GraalCreateTransistorDefaultValues[ 5 ] = + + { + GRAAL_CREATE_TRANSISTOR_X, + GRAAL_CREATE_TRANSISTOR_Y, + 100, 300, 0 + }; + +/*------------------------------------------------------------\ +| | +| Connector Panel | +| | +\------------------------------------------------------------*/ + + static GraalPanelButtonItem GraalCreateConnectorButton[MBK_MAX_LAYER+MBK_MAX_ORIENT+2] = + + { + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + "Width", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackChangeConnectorWidth, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackChangeConnectorOrient, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackChangeConnectorOrient, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackChangeConnectorOrient, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackChangeConnectorOrient, + (XtPointer)0, + (Widget)NULL + } + , + { + "Close", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackChangeConnectorClose, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalCreateConnectorPanel = + + { + "Connector", + 1, + 0, + GRAAL_CREATE_CONNECTOR_X, + GRAAL_CREATE_CONNECTOR_Y, + 100, + 325, + 2, + (MBK_MAX_LAYER+MBK_MAX_ORIENT+2)/2, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + MBK_MAX_LAYER+MBK_MAX_ORIENT+2, + GraalCreateConnectorButton + }; + + int GraalCreateConnectorDefaultValues[ 5 ] = + + { + GRAAL_CREATE_CONNECTOR_X, + GRAAL_CREATE_CONNECTOR_Y, + 100, 325, 0 + }; + +/*------------------------------------------------------------\ +| | +| Reference Panel | +| | +\------------------------------------------------------------*/ + + static GraalPanelButtonItem GraalCreateReferenceButton[ MBK_MAX_REFERENCE + 1 ] = + + { + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeReferenceType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeReferenceType, + (XtPointer)0, + (Widget)NULL + } + , + { + "Close", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeReferenceClose, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalCreateReferencePanel = + + { + "Reference", + 1, + 0, + GRAAL_CREATE_REFERENCE_X, + GRAAL_CREATE_REFERENCE_Y, + 100, + 75, + 1, + MBK_MAX_REFERENCE + 1, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + MBK_MAX_REFERENCE + 1, + GraalCreateReferenceButton + }; + + int GraalCreateReferenceDefaultValues[ 5 ] = + + { + GRAAL_CREATE_REFERENCE_X, + GRAAL_CREATE_REFERENCE_Y, + 100, 75, 0 + }; + +/*------------------------------------------------------------\ +| | +| Instance Panel | +| | +\------------------------------------------------------------*/ + + static GraalPanelButtonItem GraalCreateInstanceButton[ MBK_MAX_SYMMETRY + 1 ] = + + { + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeInstanceSym, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeInstanceSym, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeInstanceSym, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeInstanceSym, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeInstanceSym, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeInstanceSym, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeInstanceSym, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeInstanceSym, + (XtPointer)0, + (Widget)NULL + } + , + { + "Close", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackChangeInstanceClose, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalCreateInstancePanel = + + { + "Instance", + 1, + 0, + GRAAL_CREATE_INSTANCE_X, + GRAAL_CREATE_INSTANCE_Y, + 100, + 225, + 1, + MBK_MAX_SYMMETRY + 1, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + MBK_MAX_SYMMETRY + 1, + GraalCreateInstanceButton + }; + + int GraalCreateInstanceDefaultValues[ 5 ] = + + { + GRAAL_CREATE_INSTANCE_X, + GRAAL_CREATE_INSTANCE_Y, + 100, 225, 0 + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalBuildPanelCreate | +| | +\------------------------------------------------------------*/ + +void GraalBuildPanelCreate() + +{ + GraalPanelButtonItem *Button; + long Index; + unsigned char X1; + unsigned char Y1; + + X1 = 0; + Y1 = 0; + + for ( Index = 0; Index < MBK_MAX_LAYER; Index++ ) + { + if ( GRAAL_SEGMENT_NAME_TABLE[ Index ][ 0 ] != (char *)NULL ) + { + Button = &GraalCreateSegmentButton[ Index ]; + + Button->LABEL = GRAAL_SEGMENT_NAME_TABLE[ Index ][ 0 ]; + Button->FOREGROUND = GRAAL_SEGMENT_NAME_TABLE[ Index ][ 1 ]; + Button->BACKGROUND = GRAAL_SEGMENT_NAME_TABLE[ Index ][ 2 ]; + + Button->X = X1; + Button->Y = Y1; + Button->CALLDATA = (XtPointer)Index; + + if ( X1 == 1 ) + { + X1 = 0; Y1 = Y1 + 1; + } + else + { + X1 = X1 + 1; + } + } + } + + if ( X1 == 1 ) Y1 = Y1 + 1; + + for ( Index = 0; Index < 4; Index++ ) + { + GraalCreateSegmentButton[ MBK_MAX_LAYER + Index ].Y = Y1; + Y1 = Y1 + 1; + } + + GraalCreateSegmentPanel.ROW = Y1; + GraalCreateSegmentDefaultValues[ 3 ] = Y1 * 25; + + Y1 = 0; + + for ( Index = 0; Index < MBK_MAX_VIA; Index++ ) + { + if ( GRAAL_VIA_NAME_TABLE[ Index ][ 0 ] != (char *)NULL ) + { + Button = &GraalCreateViaButton[ Index ]; + + Button->LABEL = GRAAL_VIA_NAME_TABLE[ Index ][ 0 ]; + Button->FOREGROUND = GRAAL_VIA_NAME_TABLE[ Index ][ 1 ]; + Button->BACKGROUND = GRAAL_VIA_NAME_TABLE[ Index ][ 2 ]; + + Button->Y = Y1; + Button->CALLDATA = (XtPointer)Index; + + Y1 = Y1 + 1; + } + } + + GraalCreateViaButton[ MBK_MAX_VIA ].Y = Y1; + Y1 = Y1 + 1; + + GraalCreateViaButton[ MBK_MAX_VIA + 1 ].Y = Y1; + Y1 = Y1 + 1; + + GraalCreateViaPanel.ROW = Y1; + GraalCreateViaDefaultValues[ 3 ] = Y1 * 25; + + Y1 = 0; + + for ( Index = 0; Index < MBK_MAX_VIA; Index++ ) + { + if ( GRAAL_BIGVIA_NAME_TABLE[ Index ][ 0 ] != (char *)NULL ) + { + Button = &GraalCreateBigViaButton[ Index ]; + + Button->LABEL = GRAAL_BIGVIA_NAME_TABLE[ Index ][ 0 ]; + Button->FOREGROUND = GRAAL_BIGVIA_NAME_TABLE[ Index ][ 1 ]; + Button->BACKGROUND = GRAAL_BIGVIA_NAME_TABLE[ Index ][ 2 ]; + + Button->Y = Y1; + Button->CALLDATA = (XtPointer)Index; + + Y1 = Y1 + 1; + } + } + + GraalCreateBigViaButton[ MBK_MAX_VIA ].Y = Y1; + Y1 = Y1 + 1; + + GraalCreateBigViaButton[ MBK_MAX_VIA + 1 ].Y = Y1; + Y1 = Y1 + 1; + + GraalCreateBigViaPanel.ROW = Y1; + GraalCreateBigViaDefaultValues[ 3 ] = Y1 * 25; + + X1 = 0; + Y1 = 0; + + for ( Index = 0; Index < MBK_MAX_LAYER; Index++ ) + { + if ( GRAAL_TRANSISTOR_NAME_TABLE[ Index ][ 0 ] != (char *)NULL ) + { + Button = &GraalCreateTransistorButton[ Index ]; + + Button->LABEL = GRAAL_TRANSISTOR_NAME_TABLE[ Index ][ 0 ]; + Button->FOREGROUND = GRAAL_TRANSISTOR_NAME_TABLE[ Index ][ 1 ]; + Button->BACKGROUND = GRAAL_TRANSISTOR_NAME_TABLE[ Index ][ 2 ]; + + + Button->X = X1; + Button->Y = Y1; + Button->CALLDATA = (XtPointer)Index; + + if ( X1 == 1 ) + { + X1 = 0; Y1 = Y1 + 1; + } + else + { + X1 = X1 + 1; + } + } + } + + if ( X1 == 1 ) Y1 = Y1 + 1; + + for ( Index = 0; Index < 4; Index++ ) + { + GraalCreateTransistorButton[ MBK_MAX_LAYER + Index ].Y = Y1; + Y1 = Y1 + 1; + } + + GraalCreateTransistorPanel.ROW = Y1; + GraalCreateTransistorDefaultValues[ 3 ] = Y1 * 25; + + X1 = 0; + Y1 = 0; + + for ( Index = 0; Index < MBK_MAX_LAYER; Index++ ) + { + if ( GRAAL_CONNECTOR_NAME_TABLE[ Index ][ 0 ] != (char *)NULL ) + { + Button = &GraalCreateConnectorButton[ Index ]; + + Button->LABEL = GRAAL_CONNECTOR_NAME_TABLE[ Index ][ 0 ]; + Button->FOREGROUND = GRAAL_CONNECTOR_NAME_TABLE[ Index ][ 1 ]; + Button->BACKGROUND = GRAAL_CONNECTOR_NAME_TABLE[ Index ][ 2 ]; + + Button->X = X1; + Button->Y = Y1; + Button->CALLDATA = (XtPointer)Index; + + if ( X1 == 1 ) + { + X1 = 0; Y1 = Y1 + 1; + } + else + { + X1 = X1 + 1; + } + } + } + + if ( X1 == 1 ) + { + Y1 = Y1 + 1; X1 = 0; + } + + GraalCreateConnectorButton[ MBK_MAX_LAYER ].Y = Y1; + + Y1 = Y1 + 1; + + for ( Index = 0; Index < MBK_MAX_ORIENT; Index++ ) + { + if ( GRAAL_ORIENT_NAME_TABLE[ Index ][ 0 ] != (char *)NULL ) + { + Button = &GraalCreateConnectorButton[ Index + MBK_MAX_LAYER + 1 ]; + + Button->LABEL = GRAAL_ORIENT_NAME_TABLE[ Index ][ 0 ]; + Button->FOREGROUND = GRAAL_ORIENT_NAME_TABLE[ Index ][ 1 ]; + Button->BACKGROUND = GRAAL_ORIENT_NAME_TABLE[ Index ][ 2 ]; + + Button->Y = Y1; + Button->CALLDATA = (XtPointer)Index; + + Y1 = Y1 + 1; + } + } + + GraalCreateConnectorButton[ MBK_MAX_LAYER + MBK_MAX_ORIENT + 1 ].Y = Y1; + Y1 = Y1 + 1; + + GraalCreateConnectorPanel.ROW = Y1; + GraalCreateConnectorDefaultValues[ 3 ] = Y1 * 25; + + Y1 = 0; + + for ( Index = 0; Index < MBK_MAX_REFERENCE; Index++ ) + { + if ( GRAAL_REFERENCE_NAME_TABLE[ Index ][ 0 ] != (char *)NULL ) + { + Button = &GraalCreateReferenceButton[ Index ]; + + Button->LABEL = GRAAL_REFERENCE_NAME_TABLE[ Index ][ 0 ]; + Button->FOREGROUND = GRAAL_REFERENCE_NAME_TABLE[ Index ][ 1 ]; + Button->BACKGROUND = GRAAL_REFERENCE_NAME_TABLE[ Index ][ 2 ]; + + Button->Y = Y1; + Button->CALLDATA = (XtPointer)Index; + + Y1 = Y1 + 1; + } + } + + GraalCreateReferenceButton[ MBK_MAX_REFERENCE ].Y = Y1; + Y1 = Y1 + 1; + + GraalCreateReferencePanel.ROW = Y1; + GraalCreateReferenceDefaultValues[ 3 ] = Y1 * 25; + + Y1 = 0; + + for ( Index = 0; Index < MBK_MAX_SYMMETRY; Index++ ) + { + if ( GRAAL_SYMMETRY_NAME_TABLE[ Index ][ 0 ] != (char *)NULL ) + { + Button = &GraalCreateInstanceButton[ Index ]; + + Button->LABEL = GRAAL_SYMMETRY_NAME_TABLE[ Index ][ 0 ]; + Button->FOREGROUND = GRAAL_SYMMETRY_NAME_TABLE[ Index ][ 1 ]; + Button->BACKGROUND = GRAAL_SYMMETRY_NAME_TABLE[ Index ][ 2 ]; + + Button->Y = Y1; + Button->CALLDATA = (XtPointer)Index; + + Y1 = Y1 + 1; + } + } + + GraalCreateInstanceButton[ MBK_MAX_SYMMETRY ].Y = Y1; + Y1 = Y1 + 1; + + GraalCreateInstancePanel.ROW = Y1; + GraalCreateInstanceDefaultValues[ 3 ] = Y1 * 25; +} + +/*------------------------------------------------------------\ +| | +| Callback For Segment | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackChangeSegmentLayer | +| | +\------------------------------------------------------------*/ + +void CallbackChangeSegmentLayer( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalSegmentLayer = (int)ClientData; + GraalSegmentWidth = GRAAL_SEGMENT_VALUE_TABLE[ GraalSegmentLayer ][0]; + + if ( GraalSegmentWire == GRAAL_FALSE ) + { + GraalChangeEditMode( GRAAL_CREATE_SEGMENT, + GraalPromptCreateSegment ); + } + else + { + GraalChangeEditMode( GRAAL_CREATE_SEGMENT_WIRE, + GraalPromptCreateSegment ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalChangeSegmentLayer | +| | +\------------------------------------------------------------*/ + +void GraalChangeSegmentLayer( LayerUp ) + + int LayerUp; +{ + int MbkLayer; + int Step; + + if ( LayerUp ) Step = 1; + else Step = -1; + + MbkLayer = GraalSegmentLayer; + + do + { + MbkLayer += Step; + + if ( MbkLayer >= MBK_MAX_LAYER ) MbkLayer = 0; + else + if ( MbkLayer < 0 ) MbkLayer = MBK_MAX_LAYER - 1; + } + while ( GRAAL_SEGMENT_NAME_TABLE[ MbkLayer ][ 0 ] == (char *)0 ); + + GraalSegmentLayer = MbkLayer; + GraalSegmentWidth = GRAAL_SEGMENT_VALUE_TABLE[ MbkLayer ][0]; +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeSegmentWire | +| | +\------------------------------------------------------------*/ + +void CallbackChangeSegmentWire( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + XmString Label; + + rdsbegin(); + + GraalSegmentWire = ! GraalSegmentWire; + + if ( GraalSegmentWire == GRAAL_FALSE ) + { + Label = XmStringCreateSimple( "Simple" ); + + GraalChangeEditMode( GRAAL_CREATE_SEGMENT, + GraalPromptCreateSegment ); + } + else + { + Label = XmStringCreateSimple( "Wire" ); + + GraalChangeEditMode( GRAAL_CREATE_SEGMENT_WIRE, + GraalPromptCreateSegment ); + } + + XtVaSetValues( MyWidget, XmNlabelString, Label, + XmNresizable , False, + NULL ); + + XmStringFree( Label ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeSegmentWidth | +| | +\------------------------------------------------------------*/ + +void CallbackChangeSegmentWidth( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalChangeSegmentWidthDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeSegmentName | +| | +\------------------------------------------------------------*/ + +void CallbackChangeSegmentName( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalChangeSegmentNameDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeSegmentClose | +| | +\------------------------------------------------------------*/ + +void CallbackChangeSegmentClose( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalExitPanel( &GraalCreateSegmentPanel ); + + GraalChangeEditMode( GRAAL_EDIT_MEASURE, + GraalPromptEditMeasure ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Via | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackChangeViaType | +| | +\------------------------------------------------------------*/ + +void CallbackChangeViaType( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalViaType = (int)ClientData; + + GraalChangeEditMode( GRAAL_CREATE_VIA, + GraalPromptCreateVia ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalChangeViaType | +| | +\------------------------------------------------------------*/ + +void GraalChangeViaType( TypeUp ) + + int TypeUp; +{ + int MbkType; + int Step; + + if ( TypeUp ) Step = 1; + else Step = -1; + + MbkType = GraalViaType; + + do + { + MbkType += Step; + + if ( MbkType >= MBK_MAX_VIA ) MbkType = 0; + else + if ( MbkType < 0 ) MbkType = MBK_MAX_VIA - 1; + } + while ( GRAAL_VIA_NAME_TABLE[ MbkType ][ 0 ] == (char *)0 ); + + GraalViaType = MbkType; +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeViaName | +| | +\------------------------------------------------------------*/ + +void CallbackChangeViaName( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalChangeViaNameDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeViaClose | +| | +\------------------------------------------------------------*/ + +void CallbackChangeViaClose( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalExitPanel( &GraalCreateViaPanel ); + + GraalChangeEditMode( GRAAL_EDIT_MEASURE, + GraalPromptEditMeasure ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Big Via | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackChangeBigViaType | +| | +\------------------------------------------------------------*/ + +void CallbackChangeBigViaType( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalBigViaType = (int)ClientData; + + GraalChangeEditMode( GRAAL_CREATE_BIGVIA, + GraalPromptCreateBigVia ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalChangeBigViaType | +| | +\------------------------------------------------------------*/ + +void GraalChangeBigViaType( TypeUp ) + + int TypeUp; +{ + int MbkType; + int Step; + + if ( TypeUp ) Step = 1; + else Step = -1; + + MbkType = GraalBigViaType; + + do + { + MbkType += Step; + + if ( MbkType >= MBK_MAX_VIA ) MbkType = 0; + else + if ( MbkType < 0 ) MbkType = MBK_MAX_VIA - 1; + } + while ( GRAAL_BIGVIA_NAME_TABLE[ MbkType ][ 0 ] == (char *)0 ); + + GraalBigViaType = MbkType; +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeBigViaName | +| | +\------------------------------------------------------------*/ + +void CallbackChangeBigViaName( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalChangeBigViaNameDialog ); + + rdsend(); +} + + +/*------------------------------------------------------------\ +| | +| CallbackChangeBigViaClose | +| | +\------------------------------------------------------------*/ + +void CallbackChangeBigViaClose( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalExitPanel( &GraalCreateBigViaPanel ); + + GraalChangeEditMode( GRAAL_EDIT_MEASURE, + GraalPromptEditMeasure ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Transistor | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackChangeTransistorType | +| | +\------------------------------------------------------------*/ + +void CallbackChangeTransistorType( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalTransistorType = (int)ClientData; + GraalTransistorWidth = GRAAL_SEGMENT_VALUE_TABLE[ GraalTransistorType ][0]; + + if ( GraalTransistorWire == GRAAL_FALSE ) + { + GraalChangeEditMode( GRAAL_CREATE_TRANSISTOR, + GraalPromptCreateTransistor ); + } + else + { + GraalChangeEditMode( GRAAL_CREATE_TRANSISTOR_WIRE, + GraalPromptCreateTransistor ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalChangeTransistorType | +| | +\------------------------------------------------------------*/ + +void GraalChangeTransistorType( TypeUp ) + + int TypeUp; +{ + int MbkType; + int Step; + + if ( TypeUp ) Step = 1; + else Step = -1; + + MbkType = GraalTransistorType; + + do + { + MbkType += Step; + + if ( MbkType >= MBK_MAX_LAYER ) MbkType = 0; + else + if ( MbkType < 0 ) MbkType = MBK_MAX_LAYER - 1; + } + while ( GRAAL_TRANSISTOR_NAME_TABLE[ MbkType ][ 0 ] == (char *)0 ); + + GraalTransistorType = MbkType; + GraalTransistorWidth = GRAAL_SEGMENT_VALUE_TABLE[ MbkType ][0]; +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeTransistorWidth | +| | +\------------------------------------------------------------*/ + +void CallbackChangeTransistorWidth( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalChangeTransistorWidthDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeTransistorName | +| | +\------------------------------------------------------------*/ + +void CallbackChangeTransistorName( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalChangeTransistorNameDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeTransistorWire | +| | +\------------------------------------------------------------*/ + +void CallbackChangeTransistorWire( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + XmString Label; + + rdsbegin(); + + GraalTransistorWire = ! GraalTransistorWire; + + if ( GraalTransistorWire == GRAAL_FALSE ) + { + Label = XmStringCreateSimple( "Simple" ); + + GraalChangeEditMode( GRAAL_CREATE_TRANSISTOR, + GraalPromptCreateTransistor ); + } + else + { + Label = XmStringCreateSimple( "Wire" ); + + GraalChangeEditMode( GRAAL_CREATE_TRANSISTOR_WIRE, + GraalPromptCreateTransistor ); + } + + XtVaSetValues( MyWidget, XmNlabelString, Label, + XmNresizable , False, + NULL ); + + XmStringFree( Label ); + + rdsend(); +} + + +/*------------------------------------------------------------\ +| | +| CallbackChangeTransistorClose | +| | +\------------------------------------------------------------*/ + +void CallbackChangeTransistorClose( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalExitPanel( &GraalCreateTransistorPanel ); + + GraalChangeEditMode( GRAAL_EDIT_MEASURE, + GraalPromptEditMeasure ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Connector | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackChangeConnectorLayer | +| | +\------------------------------------------------------------*/ + +void CallbackChangeConnectorLayer( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalConnectorLayer = (int)ClientData; + GraalConnectorWidth = GRAAL_SEGMENT_VALUE_TABLE[ GraalConnectorLayer ][0]; + + GraalChangeEditMode( GRAAL_CREATE_CONNECTOR, + GraalPromptCreateConnector ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalChangeConnectorLayer | +| | +\------------------------------------------------------------*/ + +void GraalChangeConnectorLayer( LayerUp ) + + int LayerUp; +{ + int MbkLayer; + int Step; + + if ( LayerUp ) Step = 1; + else Step = -1; + + MbkLayer = GraalConnectorLayer; + + do + { + MbkLayer += Step; + + if ( MbkLayer >= MBK_MAX_LAYER ) MbkLayer = 0; + else + if ( MbkLayer < 0 ) MbkLayer = MBK_MAX_LAYER - 1; + } + while ( GRAAL_CONNECTOR_NAME_TABLE[ MbkLayer ][ 0 ] == (char *)0 ); + + GraalConnectorLayer = MbkLayer; + GraalConnectorWidth = GRAAL_SEGMENT_VALUE_TABLE[ MbkLayer ][0]; +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeConnectorWidth | +| | +\------------------------------------------------------------*/ + +void CallbackChangeConnectorWidth( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalChangeConnectorWidthDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeConnectorOrient | +| | +\------------------------------------------------------------*/ + +void CallbackChangeConnectorOrient( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalConnectorOrient = (int)ClientData; + + GraalChangeEditMode( GRAAL_CREATE_CONNECTOR, + GraalPromptCreateConnector ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeConnectorClose | +| | +\------------------------------------------------------------*/ + +void CallbackChangeConnectorClose( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalExitPanel( &GraalCreateConnectorPanel ); + + GraalChangeEditMode( GRAAL_EDIT_MEASURE, + GraalPromptEditMeasure ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Reference | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackChangeReferenceType | +| | +\------------------------------------------------------------*/ + +void CallbackChangeReferenceType( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalReferenceType = (int)ClientData; + + GraalChangeEditMode( GRAAL_CREATE_REFERENCE, + GraalPromptCreateReference ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalChangeReferenceType | +| | +\------------------------------------------------------------*/ + +void GraalChangeReferenceType( TypeUp ) + + int TypeUp; +{ + int MbkType; + int Step; + + if ( TypeUp ) Step = 1; + else Step = -1; + + MbkType = GraalReferenceType; + + do + { + MbkType += Step; + + if ( MbkType >= MBK_MAX_REFERENCE ) MbkType = 0; + else + if ( MbkType < 0 ) MbkType = MBK_MAX_REFERENCE - 1; + } + while ( GRAAL_REFERENCE_NAME_TABLE[ MbkType ][ 0 ] == (char *)0 ); + + GraalReferenceType = MbkType; +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeReferenceClose | +| | +\------------------------------------------------------------*/ + +void CallbackChangeReferenceClose( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalExitPanel( &GraalCreateReferencePanel ); + + GraalChangeEditMode( GRAAL_EDIT_MEASURE, + GraalPromptEditMeasure ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Instance | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackChangeInstanceSym | +| | +\------------------------------------------------------------*/ + +void CallbackChangeInstanceSym( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalInstanceSym = (int)ClientData; + + GraalChangeEditMode( GRAAL_CREATE_INSTANCE, + GraalPromptCreateInstance ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackChangeInstanceClose | +| | +\------------------------------------------------------------*/ + +void CallbackChangeInstanceClose( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalExitPanel( &GraalCreateInstancePanel ); + + GraalChangeEditMode( GRAAL_EDIT_MEASURE, + GraalPromptEditMeasure ); + + rdsend(); +} diff --git a/alliance/src/graal/src/GMC_panel.h b/alliance/src/graal/src/GMC_panel.h new file mode 100644 index 00000000..93eef057 --- /dev/null +++ b/alliance/src/graal/src/GMC_panel.h @@ -0,0 +1,117 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Panel.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_CREATE_PANEL +# define GRAAL_CREATE_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define GRAAL_CREATE_SEGMENT_X 790 +# define GRAAL_CREATE_SEGMENT_Y 230 +# define GRAAL_CREATE_VIA_X 790 +# define GRAAL_CREATE_VIA_Y 330 +# define GRAAL_CREATE_BIGVIA_X 790 +# define GRAAL_CREATE_BIGVIA_Y 330 +# define GRAAL_CREATE_TRANSISTOR_X 790 +# define GRAAL_CREATE_TRANSISTOR_Y 330 +# define GRAAL_CREATE_CONNECTOR_X 790 +# define GRAAL_CREATE_CONNECTOR_Y 330 +# define GRAAL_CREATE_REFERENCE_X 790 +# define GRAAL_CREATE_REFERENCE_Y 330 +# define GRAAL_CREATE_INSTANCE_X 790 +# define GRAAL_CREATE_INSTANCE_Y 330 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackChangeSegmentLayer(); + extern void CallbackChangeSegmentWidth(); + extern void CallbackChangeSegmentName(); + extern void CallbackChangeSegmentWire(); + extern void CallbackChangeSegmentClose(); + + extern void CallbackChangeViaType(); + extern void CallbackChangeViaName(); + extern void CallbackChangeViaClose(); + + extern void CallbackChangeBigViaType(); + extern void CallbackChangeBigViaName(); + extern void CallbackChangeBigViaClose(); + + extern void CallbackChangeTransistorType(); + extern void CallbackChangeTransistorWidth(); + extern void CallbackChangeTransistorName(); + extern void CallbackChangeTransistorWire(); + extern void CallbackChangeTransistorClose(); + + extern void CallbackChangeConnectorLayer(); + extern void CallbackChangeConnectorWidth(); + extern void CallbackChangeConnectorOrient(); + extern void CallbackChangeConnectorClose(); + + extern void CallbackChangeReferenceType(); + extern void CallbackChangeReferenceClose(); + + extern void CallbackChangeInstanceSym(); + extern void CallbackChangeInstanceClose(); + +# endif diff --git a/alliance/src/graal/src/GME.h b/alliance/src/graal/src/GME.h new file mode 100644 index 00000000..34b6f91a --- /dev/null +++ b/alliance/src/graal/src/GME.h @@ -0,0 +1,129 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Gme101.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_GME +# define GRAAL_GME + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern GraalMenuItem GraalEditMenu[]; + extern GraalMenuItem GraalWindowMenu[]; + extern GraalPanelItem GraalEditGlobalPanel; + extern GraalPanelItem GraalWindowGlobalPanel; + extern GraalPanelItem GraalEditSearchPanel; + extern GraalPanelItem GraalEditSearchViewPanel; + extern GraalPanelItem GraalEditIdentifyPanel; + extern GraalPanelItem GraalEditSelectPanel; + extern GraalPanelItem GraalModifySegmentPanel; + extern GraalPanelItem GraalModifyTransistorPanel; + extern GraalPanelItem GraalModifyConnectorPanel; + extern GraalPanelItem GraalModifyReferencePanel; + extern GraalPanelItem GraalModifyInstancePanel; + extern GraalPanelItem GraalModifyViaPanel; + extern GraalPanelItem GraalModifyBigViaPanel; + + extern int GraalEditGlobalDefaultValues[ 5 ]; + extern int GraalWindowGlobalDefaultValues[ 5 ]; + extern int GraalEditSearchDefaultValues[ 5 ]; + extern int GraalEditIdentifyDefaultValues[ 5 ]; + extern int GraalEditSelectDefaultValues[ 5 ]; + extern int GraalEditSearchViewDefaultValues[ 5 ]; + extern int GraalModifySegmentDefaultValues[ 5 ]; + extern int GraalModifyTransistorDefaultValues[ 5 ]; + extern int GraalModifyConnectorDefaultValues[ 5 ]; + extern int GraalModifyReferenceDefaultValues[ 5 ]; + extern int GraalModifyInstanceDefaultValues[ 5 ]; + extern int GraalModifyViaDefaultValues[ 5 ]; + extern int GraalModifyBigViaDefaultValues[ 5 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalBuidlPanelModify(); + extern void GraalBuildEditDialog(); + + extern void GraalEditSelectPointDelete(); + extern void GraalEditSelectWindowDelete(); + extern void GraalEditSelectPointCopy(); + extern void GraalEditSelectWindowCopy(); + extern void GraalEditSelectPointMove(); + extern void GraalEditSelectWindowMove(); + extern void GraalEditSelectPointModify(); + extern void GraalEditSelectWindowModify(); + + extern void GraalEditIdentify(); + extern void GraalEditUnselectAll(); + + extern void GraalEditSelectPoint(); + extern void GraalEditSelectWindow(); + extern void GraalEditSelectFence(); + + extern void GraalEditUndo(); + extern void GraalEditRedo(); + extern void GraalEditCopy(); + extern void GraalEditMove(); + extern void GraalEditDelete(); + extern void GraalEditModify(); + extern void GraalEditStretch(); + + extern void GraalToolsSelectEqui(); + extern void GraalToolsSelectFlatten(); + extern void GraalToolsSelectUnflatten(); + extern void GraalToolsSelectRealFlatten(); + extern void GraalToolsSelectHierarchyDown(); + +# endif diff --git a/alliance/src/graal/src/GME_dialog.c b/alliance/src/graal/src/GME_dialog.c new file mode 100644 index 00000000..3226219c --- /dev/null +++ b/alliance/src/graal/src/GME_dialog.c @@ -0,0 +1,1409 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Dialog.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GSB.h" +# include "GRM.h" +# include "GMX.h" +# include "GTB.h" +# include "GME.h" + +# include "GME_dialog.h" +# include "GME_modify.h" +# include "GME_search.h" +# include "GME_edit.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Search Dialog | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Search Connector Dialog | +| | +\------------------------------------------------------------*/ + + GraalDialogItem GraalSearchConnectorDialog = + + { + "Connector name", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackSearchConnectorOk, + (XtPointer)NULL, + (void *)CallbackSearchConnectorCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Search Instance Dialog | +| | +\------------------------------------------------------------*/ + + GraalDialogItem GraalSearchInstanceDialog = + + { + "Instance name", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackSearchInstanceOk, + (XtPointer)NULL, + (void *)CallbackSearchInstanceCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Search Via Dialog | +| | +\------------------------------------------------------------*/ + + GraalDialogItem GraalSearchViaDialog = + + { + "Via name", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackSearchViaOk, + (XtPointer)NULL, + (void *)CallbackSearchViaCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Search Reference Dialog | +| | +\------------------------------------------------------------*/ + + GraalDialogItem GraalSearchReferenceDialog = + + { + "Reference name", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackSearchReferenceOk, + (XtPointer)NULL, + (void *)CallbackSearchReferenceCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Search Segment Dialog | +| | +\------------------------------------------------------------*/ + + GraalDialogItem GraalSearchSegmentDialog = + + { + "Segment name", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackSearchSegmentOk, + (XtPointer)NULL, + (void *)CallbackSearchSegmentCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Modify Dialog | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Segment Dialog | +| | +\------------------------------------------------------------*/ + + GraalDialogItem GraalModifySegmentWidthDialog = + + { + "Segment width", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackModifySegmentWidthOk, + (XtPointer)NULL, + (void *)CallbackModifySegmentWidthCancel, + (XtPointer)NULL + }; + + GraalDialogItem GraalModifySegmentNameDialog = + + { + "Segment name", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackModifySegmentNameOk, + (XtPointer)NULL, + (void *)CallbackModifySegmentNameCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Transistor Dialog | +| | +\------------------------------------------------------------*/ + + GraalDialogItem GraalModifyTransistorWidthDialog = + + { + "Transistor width", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackModifyTransistorWidthOk, + (XtPointer)NULL, + (void *)CallbackModifyTransistorWidthCancel, + (XtPointer)NULL + }; + + GraalDialogItem GraalModifyTransistorNameDialog = + + { + "Transistor name", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackModifyTransistorNameOk, + (XtPointer)NULL, + (void *)CallbackModifyTransistorNameCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Connector Dialog | +| | +\------------------------------------------------------------*/ + + GraalDialogItem GraalModifyConnectorWidthDialog = + + { + "Connector width", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackModifyConnectorWidthOk, + (XtPointer)NULL, + (void *)CallbackModifyConnectorWidthCancel, + (XtPointer)NULL + }; + + GraalDialogItem GraalModifyConnectorNameDialog = + + { + "Connector name", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackModifyConnectorNameOk, + (XtPointer)NULL, + (void *)CallbackModifyConnectorNameCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Reference Dialog | +| | +\------------------------------------------------------------*/ + + GraalDialogItem GraalModifyReferenceNameDialog = + + { + "Reference name", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackModifyReferenceNameOk, + (XtPointer)NULL, + (void *)CallbackModifyReferenceNameCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Instance Dialog | +| | +\------------------------------------------------------------*/ + + GraalDialogItem GraalModifyInstanceNameDialog = + + { + "Instance name", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackModifyInstanceNameOk, + (XtPointer)NULL, + (void *)CallbackModifyInstanceNameCancel, + (XtPointer)NULL + }; + + GraalDialogItem GraalModifyInstanceModelDialog = + + { + "Instance model", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackModifyInstanceModelOk, + (XtPointer)NULL, + (void *)CallbackModifyInstanceModelCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Via Dialog | +| | +\------------------------------------------------------------*/ + + GraalDialogItem GraalModifyViaNameDialog = + + { + "Via name", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackModifyViaNameOk, + (XtPointer)NULL, + (void *)CallbackModifyViaNameCancel, + (XtPointer)NULL + }; + + GraalDialogItem GraalModifyBigViaNameDialog = + + { + "BigVia name", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackModifyBigViaNameOk, + (XtPointer)NULL, + (void *)CallbackModifyBigViaNameCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalBuildEditDialog | +| | +\------------------------------------------------------------*/ + +void GraalBuildEditDialog() + +{ + rdsbegin(); + + GraalBuildDialog( GraalMainWindow, &GraalSearchConnectorDialog ); + GraalBuildDialog( GraalMainWindow, &GraalSearchInstanceDialog ); + GraalBuildDialog( GraalMainWindow, &GraalSearchReferenceDialog ); + GraalBuildDialog( GraalMainWindow, &GraalSearchSegmentDialog ); + GraalBuildDialog( GraalMainWindow, &GraalModifySegmentWidthDialog ); + GraalBuildDialog( GraalMainWindow, &GraalModifySegmentNameDialog ); + GraalBuildDialog( GraalMainWindow, &GraalModifyViaNameDialog ); + GraalBuildDialog( GraalMainWindow, &GraalModifyBigViaNameDialog ); + GraalBuildDialog( GraalMainWindow, &GraalModifyTransistorWidthDialog ); + GraalBuildDialog( GraalMainWindow, &GraalModifyTransistorNameDialog ); + GraalBuildDialog( GraalMainWindow, &GraalModifyConnectorWidthDialog ); + GraalBuildDialog( GraalMainWindow, &GraalModifyConnectorNameDialog ); + GraalBuildDialog( GraalMainWindow, &GraalModifyReferenceNameDialog ); + GraalBuildDialog( GraalMainWindow, &GraalModifyInstanceNameDialog ); + GraalBuildDialog( GraalMainWindow, &GraalModifyInstanceModelDialog ); + GraalBuildDialog( GraalMainWindow, &GraalSearchConnectorDialog ); + GraalBuildDialog( GraalMainWindow, &GraalSearchInstanceDialog ); + GraalBuildDialog( GraalMainWindow, &GraalSearchReferenceDialog ); + GraalBuildDialog( GraalMainWindow, &GraalSearchSegmentDialog ); + GraalBuildDialog( GraalMainWindow, &GraalSearchViaDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Dialog | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback For Modify | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackModifySegmentWidthOk | +| | +\------------------------------------------------------------*/ + +void CallbackModifySegmentWidthOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *WidthSet; + long NewWidth; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &WidthSet ); + + XtUnmanageChild( GraalModifySegmentWidthDialog.WIDGET ); + + GraalExitDialog(); + + if ( WidthSet != (char *)NULL ) + { + NewWidth = atoi( WidthSet ); + + if ( NewWidth >= GRAAL_SEGMENT_VALUE_TABLE[ GraalSegmentMLayer ][0] ) + { + GraalSegmentMWidth = NewWidth; + } + else + { + GraalErrorMessage( GraalMainWindow, "Incorrect segment width !" ); + } + + GraalPromptModifySegment(); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifySegmentWidthCancel | +| | +\------------------------------------------------------------*/ + +void CallbackModifySegmentWidthCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalModifySegmentWidthDialog.WIDGET ); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifySegmentNameOk | +| | +\------------------------------------------------------------*/ + +void CallbackModifySegmentNameOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *NameSet; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &NameSet ); + + XtUnmanageChild( GraalModifySegmentNameDialog.WIDGET ); + + GraalExitDialog(); + + NameSet = GraalPostTreatString( NameSet ); + + if ( NameSet != (char *)NULL ) + { + NameSet = namealloc( NameSet ); + } + else + if ( ( GraalSegmentMLayer >= CALU1 ) && + ( GraalSegmentMLayer <= CALU9 ) ) + { + NameSet = GraalSegmentMName; + GraalErrorMessage( GraalMainWindow, "Connector must have name !" ); + } + + GraalSegmentMName = NameSet; + + GraalPromptModifySegment(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifySegmentNameCancel | +| | +\------------------------------------------------------------*/ + +void CallbackModifySegmentNameCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalModifySegmentNameDialog.WIDGET ); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Transistor | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackModifyTransistorWidthOk | +| | +\------------------------------------------------------------*/ + +void CallbackModifyTransistorWidthOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *WidthSet; + long NewWidth; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &WidthSet ); + + XtUnmanageChild( GraalModifyTransistorWidthDialog.WIDGET ); + + GraalExitDialog(); + + if ( WidthSet != (char *)NULL ) + { + NewWidth = atoi( WidthSet ); + + if ( NewWidth >= GRAAL_SEGMENT_VALUE_TABLE[ GraalTransistorMType ][0] ) + { + GraalTransistorMWidth = NewWidth; + } + else + { + GraalErrorMessage( GraalMainWindow, "Incorrect transistor width !" ); + } + + GraalPromptModifyTransistor(); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyTransistorWidthCancel | +| | +\------------------------------------------------------------*/ + +void CallbackModifyTransistorWidthCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalModifyTransistorWidthDialog.WIDGET ); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyTransistorNameOk | +| | +\------------------------------------------------------------*/ + +void CallbackModifyTransistorNameOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *NameSet; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &NameSet ); + + XtUnmanageChild( GraalModifyTransistorNameDialog.WIDGET ); + + GraalExitDialog(); + + NameSet = GraalPostTreatString( NameSet ); + + if ( NameSet != (char *)NULL ) + { + NameSet = namealloc( NameSet ); + } + + GraalTransistorMName = NameSet; + + GraalPromptModifyTransistor(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyTransistorNameCancel | +| | +\------------------------------------------------------------*/ + +void CallbackModifyTransistorNameCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalModifyTransistorNameDialog.WIDGET ); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Connector | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackModifyConnectorWidthOk | +| | +\------------------------------------------------------------*/ + +void CallbackModifyConnectorWidthOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *WidthSet; + long NewWidth; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &WidthSet ); + + XtUnmanageChild( GraalModifyConnectorWidthDialog.WIDGET ); + + GraalExitDialog(); + + if ( WidthSet != (char *)NULL ) + { + NewWidth = atoi( WidthSet ); + + if ( NewWidth >= GRAAL_SEGMENT_VALUE_TABLE[ GraalConnectorMLayer ][0] ) + { + GraalConnectorMWidth = NewWidth; + } + else + { + GraalErrorMessage( GraalMainWindow, "Incorrect connector width !" ); + } + + GraalPromptModifyConnector(); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyConnectorWidthCancel | +| | +\------------------------------------------------------------*/ + +void CallbackModifyConnectorWidthCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalModifyConnectorWidthDialog.WIDGET ); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyConnectorNameOk | +| | +\------------------------------------------------------------*/ + +void CallbackModifyConnectorNameOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *NameSet; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &NameSet ); + + XtUnmanageChild( GraalModifyConnectorNameDialog.WIDGET ); + + GraalExitDialog(); + + NameSet = GraalPostTreatString( NameSet ); + + if ( NameSet != (char *)NULL ) + { + NameSet = namealloc( NameSet ); + + GraalConnectorMName = NameSet; + + GraalPromptModifyConnector(); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyConnectorNameCancel | +| | +\------------------------------------------------------------*/ + +void CallbackModifyConnectorNameCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalModifyConnectorNameDialog.WIDGET ); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Reference | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackModifyReferenceNameOk | +| | +\------------------------------------------------------------*/ + +void CallbackModifyReferenceNameOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *NameSet; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &NameSet ); + + XtUnmanageChild( GraalModifyReferenceNameDialog.WIDGET ); + + GraalExitDialog(); + + NameSet = GraalPostTreatString( NameSet ); + + if ( NameSet != (char *)NULL ) + { + NameSet = namealloc( NameSet ); + + GraalReferenceMName = NameSet; + + GraalPromptModifyReference(); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyReferenceNameCancel | +| | +\------------------------------------------------------------*/ + +void CallbackModifyReferenceNameCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalModifyReferenceNameDialog.WIDGET ); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Instance | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackModifyInstanceNameOk | +| | +\------------------------------------------------------------*/ + +void CallbackModifyInstanceNameOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *NameSet; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &NameSet ); + + XtUnmanageChild( GraalModifyInstanceNameDialog.WIDGET ); + + GraalExitDialog(); + + NameSet = GraalPostTreatString( NameSet ); + + if ( NameSet != (char *)NULL ) + { + NameSet = namealloc( NameSet ); + + GraalInstanceMName = NameSet; + } + + GraalPromptModifyInstance(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyInstanceNameCancel | +| | +\------------------------------------------------------------*/ + +void CallbackModifyInstanceNameCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalModifyInstanceNameDialog.WIDGET ); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyInstanceModelOk | +| | +\------------------------------------------------------------*/ + +void CallbackModifyInstanceModelOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *ModelSet; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &ModelSet ); + + XtUnmanageChild( GraalModifyInstanceModelDialog.WIDGET ); + + GraalExitDialog(); + + ModelSet = GraalPostTreatString( ModelSet ); + + if ( ModelSet != (char *)NULL ) + { + ModelSet = namealloc( ModelSet ); + + GraalInstanceMModel = ModelSet; + } + + GraalPromptModifyInstance(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyInstanceModelCancel | +| | +\------------------------------------------------------------*/ + +void CallbackModifyInstanceModelCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalModifyInstanceModelDialog.WIDGET ); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyViaNameOk | +| | +\------------------------------------------------------------*/ + +void CallbackModifyViaNameOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *NameSet; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &NameSet ); + + XtUnmanageChild( GraalModifyViaNameDialog.WIDGET ); + + GraalExitDialog(); + + NameSet = GraalPostTreatString( NameSet ); + + if ( NameSet != (char *)NULL ) + { + NameSet = namealloc( NameSet ); + } + + GraalViaMName = NameSet; + + GraalPromptModifyVia(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyViaNameCancel | +| | +\------------------------------------------------------------*/ + +void CallbackModifyViaNameCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalModifyViaNameDialog.WIDGET ); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyBigViaNameOk | +| | +\------------------------------------------------------------*/ + +void CallbackModifyBigViaNameOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *NameSet; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &NameSet ); + + XtUnmanageChild( GraalModifyBigViaNameDialog.WIDGET ); + + GraalExitDialog(); + + NameSet = GraalPostTreatString( NameSet ); + + if ( NameSet != (char *)NULL ) + { + NameSet = namealloc( NameSet ); + } + + GraalViaMName = NameSet; + + GraalPromptModifyBigVia(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyBigViaNameCancel | +| | +\------------------------------------------------------------*/ + +void CallbackModifyBigViaNameCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalModifyBigViaNameDialog.WIDGET ); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Search Callback | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback For Connector | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackSearchConnectorOk | +| | +\------------------------------------------------------------*/ + +void CallbackSearchConnectorOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *NameSet; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &NameSet ); + + XtUnmanageChild( GraalSearchConnectorDialog.WIDGET ); + + GraalExitDialog(); + + NameSet = GraalPostTreatString( NameSet ); + + if ( NameSet != (char *)NULL ) + { + NameSet = namealloc( NameSet ); + + GraalEditSearchConnector( NameSet ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSearchConnectorCancel | +| | +\------------------------------------------------------------*/ + +void CallbackSearchConnectorCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalSearchConnectorDialog.WIDGET ); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Instance | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackSearchInstanceOk | +| | +\------------------------------------------------------------*/ + +void CallbackSearchInstanceOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *NameSet; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &NameSet ); + + XtUnmanageChild( GraalSearchInstanceDialog.WIDGET ); + + GraalExitDialog(); + + NameSet = GraalPostTreatString( NameSet ); + + if ( NameSet != (char *)NULL ) + { + NameSet = namealloc( NameSet ); + + GraalEditSearchInstance( NameSet ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSearchInstanceCancel | +| | +\------------------------------------------------------------*/ + +void CallbackSearchInstanceCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalSearchInstanceDialog.WIDGET ); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Reference | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackSearchReferenceOk | +| | +\------------------------------------------------------------*/ + +void CallbackSearchReferenceOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *NameSet; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &NameSet ); + + XtUnmanageChild( GraalSearchReferenceDialog.WIDGET ); + + GraalExitDialog(); + + NameSet = GraalPostTreatString( NameSet ); + + if ( NameSet != (char *)NULL ) + { + NameSet = namealloc( NameSet ); + + GraalEditSearchReference( NameSet ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSearchReferenceCancel | +| | +\------------------------------------------------------------*/ + +void CallbackSearchReferenceCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalSearchReferenceDialog.WIDGET ); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Segment | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackSearchSegmentOk | +| | +\------------------------------------------------------------*/ + +void CallbackSearchSegmentOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *NameSet; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &NameSet ); + + XtUnmanageChild( GraalSearchSegmentDialog.WIDGET ); + + GraalExitDialog(); + + NameSet = GraalPostTreatString( NameSet ); + + if ( NameSet != (char *)NULL ) + { + NameSet = namealloc( NameSet ); + + GraalEditSearchSegment( NameSet ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSearchSegmentCancel | +| | +\------------------------------------------------------------*/ + +void CallbackSearchSegmentCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalSearchSegmentDialog.WIDGET ); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Via | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackSearchViaOk | +| | +\------------------------------------------------------------*/ + +void CallbackSearchViaOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *NameSet; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &NameSet ); + + XtUnmanageChild( GraalSearchViaDialog.WIDGET ); + + GraalExitDialog(); + + NameSet = GraalPostTreatString( NameSet ); + + if ( NameSet != (char *)NULL ) + { + NameSet = namealloc( NameSet ); + + GraalEditSearchVia( NameSet ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSearchViaCancel | +| | +\------------------------------------------------------------*/ + +void CallbackSearchViaCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalSearchViaDialog.WIDGET ); + + GraalExitDialog(); + + rdsend(); +} + diff --git a/alliance/src/graal/src/GME_dialog.h b/alliance/src/graal/src/GME_dialog.h new file mode 100644 index 00000000..5e607f99 --- /dev/null +++ b/alliance/src/graal/src/GME_dialog.h @@ -0,0 +1,134 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Dialog.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_EDIT_DIALOG +# define GRAAL_EDIT_DIALOG + + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern GraalDialogItem GraalSearchConnectorDialog; + extern GraalDialogItem GraalSearchInstanceDialog; + extern GraalDialogItem GraalSearchReferenceDialog; + extern GraalDialogItem GraalSearchViaDialog; + extern GraalDialogItem GraalSearchSegmentDialog; + + extern GraalDialogItem GraalModifySegmentWidthDialog; + extern GraalDialogItem GraalModifySegmentNameDialog; + extern GraalDialogItem GraalModifyTransistorWidthDialog; + extern GraalDialogItem GraalModifyTransistorNameDialog; + extern GraalDialogItem GraalModifyConnectorWidthDialog; + extern GraalDialogItem GraalModifyConnectorNameDialog; + extern GraalDialogItem GraalModifyReferenceNameDialog; + extern GraalDialogItem GraalModifyInstanceNameDialog; + extern GraalDialogItem GraalModifyInstanceModelDialog; + extern GraalDialogItem GraalModifyViaNameDialog; + extern GraalDialogItem GraalModifyBigViaNameDialog; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackModifySegmentWidthOk(); + extern void CallbackModifySegmentWidthCancel(); + extern void CallbackModifySegmentNameOk(); + extern void CallbackModifySegmentNameCancel(); + + extern void CallbackModifyTransistorWidthOk(); + extern void CallbackModifyTransistorWidthCancel(); + extern void CallbackModifyTransistorNameOk(); + extern void CallbackModifyTransistorNameCancel(); + + extern void CallbackModifyConnectorWidthOk(); + extern void CallbackModifyConnectorWidthCancel(); + extern void CallbackModifyConnectorNameOk(); + extern void CallbackModifyConnectorNameCancel(); + + extern void CallbackModifyViaNameOk(); + extern void CallbackModifyViaNameCancel(); + extern void CallbackModifyBigViaNameOk(); + extern void CallbackModifyBigViaNameCancel(); + + extern void CallbackModifyInstanceNameOk(); + extern void CallbackModifyInstanceNameCancel(); + + extern void CallbackModifyInstanceModelOk(); + extern void CallbackModifyInstanceModelCancel(); + + extern void CallbackModifyReferenceNameOk(); + extern void CallbackModifyReferenceNameCancel(); + + extern void CallbackSearchConnectorOk(); + extern void CallbackSearchConnectorCancel(); + + extern void CallbackSearchInstanceOk(); + extern void CallbackSearchInstanceCancel(); + + extern void CallbackSearchReferenceOk(); + extern void CallbackSearchReferenceCancel(); + + extern void CallbackSearchSegmentOk(); + extern void CallbackSearchSegmentCancel(); + + extern void CallbackSearchViaOk(); + extern void CallbackSearchViaCancel(); + +# endif diff --git a/alliance/src/graal/src/GME_edit.c b/alliance/src/graal/src/GME_edit.c new file mode 100644 index 00000000..c7e649e6 --- /dev/null +++ b/alliance/src/graal/src/GME_edit.c @@ -0,0 +1,1508 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Edit.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GRM.h" +# include "GMX.h" +# include "GTB.h" +# include "GSB.h" +# include "GME.h" + +# include "GME_edit.h" +# include "GME_panel.h" +# include "GME_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Identify Buffer | +| | +\------------------------------------------------------------*/ + + static char GraalIdentifyMessage[ GRAAL_IDENTIFY_MESSAGE_SIZE ]; + static char GraalIdentifyBuffer [ GRAAL_IDENTIFY_BUFFER_SIZE ]; + static char *GraalScanIdentify; + static long GraalIdentifyLength; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalEditTreatUndo | +| | +\------------------------------------------------------------*/ + +void GraalEditTreatUndo( HeadUndo ) + + graalundo *HeadUndo; +{ + rdsrec_list *Rec; + graalundorec *UndoRec; + char OneElement; + + if ( ( HeadUndo->UNDO->NEXT != (graalundorec *)NULL ) || + ( GraalHeadEqui != (rdsrec_list *)NULL ) || + ( GraalHeadPeek != (graalpeek *)NULL ) ) + { + OneElement = GRAAL_FALSE; + } + else + { + OneElement = (GraalHeadSelect == (graalselect *)NULL); + } + + GraalDelSelect(); + GraalDelEqui(); + GraalDelPeek(); + GraalRecomputeBound = GRAAL_TRUE; + + for ( UndoRec = HeadUndo->UNDO; + UndoRec != (graalundorec *)NULL; + UndoRec = UndoRec->NEXT ) + { + Rec = UndoRec->RECTANGLE; + + if ( GetRdsLayer( Rec ) != RDS_ABOX ) + { + if ( IsGraalDeleted( Rec ) ) + { + GraalUndeleteRectangle( Rec ); + if ( OneElement ) GraalDisplayRectangle( Rec ); + } + else + { + GraalDeleteRectangle( Rec ); + if ( OneElement ) GraalDisplayRectangle( Rec ); + } + } + else + { + if ( IsRdsFigure( Rec ) ) + { + if ( IsGraalDeleted( Rec ) ) + { + ClearGraalDeleted( Rec ); + + GraalFigureMbk->XAB1 = Rec->X * GRAAL_SCALE_X / GRAAL_RDS_LAMBDA; + GraalFigureMbk->YAB1 = Rec->Y * GRAAL_SCALE_X / GRAAL_RDS_LAMBDA; + GraalFigureMbk->XAB2 = ( Rec->X + Rec->DX ) * GRAAL_SCALE_X / GRAAL_RDS_LAMBDA; + GraalFigureMbk->YAB2 = ( Rec->Y + Rec->DY ) * GRAAL_SCALE_X / GRAAL_RDS_LAMBDA; + } + else + { + GraalFigureMbk->XAB1 = 0; + GraalFigureMbk->XAB2 = 0; + GraalFigureMbk->YAB1 = 0; + GraalFigureMbk->YAB2 = 0; + + GraalDeleteRectangle( Rec ); + } + } + else + { + if ( IsGraalDeleted( Rec ) ) + { + ClearGraalDeleted( Rec ); + } + else + { + GraalDeleteRectangle( Rec ); + } + } + + OneElement = GRAAL_FALSE; + } + } + + HeadUndo->UNDO = (graalundorec *)reverse( (chain_list *)HeadUndo->UNDO ); + + if ( ! OneElement ) + { + GraalZoomRefresh(); + } +} + +/*------------------------------------------------------------\ +| | +| GraalEditRedo | +| | +\------------------------------------------------------------*/ + +void GraalEditRedo() + +{ + graalundo *NewUndo; + + rdsbegin(); + + if ( GraalHeadRedo != (graalundo *)NULL ) + { + GraalEditTreatUndo( GraalHeadRedo ); + + NewUndo = GraalHeadRedo; + GraalHeadRedo = GraalHeadRedo->NEXT; + NewUndo->NEXT = GraalHeadUndo; + GraalHeadUndo = NewUndo; + } + else + { + GraalWarningMessage( GraalMainWindow, "Nothing to Redo !" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEditUndo | +| | +\------------------------------------------------------------*/ + +void GraalEditUndo() + +{ + graalundo *NewRedo; + + rdsbegin(); + + if ( GraalHeadUndo != (graalundo *)NULL ) + { + GraalEditTreatUndo( GraalHeadUndo ); + + NewRedo = GraalHeadUndo; + GraalHeadUndo = GraalHeadUndo->NEXT; + NewRedo->NEXT = GraalHeadRedo; + GraalHeadRedo = NewRedo; + } + else + { + GraalWarningMessage( GraalMainWindow, "Nothing to undo !" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalAddIdentify | +| | +\------------------------------------------------------------*/ + +char GraalAddIdentify( Rectangle ) + + rdsrec_list *Rectangle; +{ + void *Pointer; + char Orient; + char MbkLayer; + long Length; + + rdsbegin(); + + GraalIdentifyBuffer[0] = '\0'; + Pointer = GRAAL_MBK( Rectangle ); + + if ( IsRdsSegment( Rectangle ) ) + { + MbkLayer = ((phseg_list *)Pointer)->LAYER; + + if ( GET_LYNX_TRANSISTOR_TYPE( MbkLayer ) != RDS_LYNX_TRANSISTOR_EMPTY ) + { + sprintf( GraalIdentifyBuffer, + "TRANSISTOR :\n\n NAME : %s\n TYPE : %s\n X1 : %.2f\n Y1 : %.2f\n X2 : %.2f \n Y2 : %.2f\n WIDTH : %.2f\n\n", + (((phseg_list *)Pointer)->NAME != (char *)0) ? ((phseg_list *)Pointer)->NAME : "None", + GRAAL_TRANSISTOR_NAME_TABLE[ ((phseg_list *)Pointer)->LAYER ][0], + (float)((phseg_list *)Pointer)->X1 / (float)SCALE_X, + (float)((phseg_list *)Pointer)->Y1 / (float)SCALE_X, + (float)((phseg_list *)Pointer)->X2 / (float)SCALE_X, + (float)((phseg_list *)Pointer)->Y2 / (float)SCALE_X, + (float)((phseg_list *)Pointer)->WIDTH / (float)SCALE_X ); + } + else + { + sprintf( GraalIdentifyBuffer, + "SEGMENT :\n\n NAME : %s\n LAYER : %s\n X1 : %.2f\n Y1 : %.2f\n X2 : %.2f\n Y2 : %.2f\n WIDTH : %.2f\n\n", + (((phseg_list *)Pointer)->NAME != (char *)0) ? ((phseg_list *)Pointer)->NAME : "None", + GRAAL_SEGMENT_NAME_TABLE[ ((phseg_list *)Pointer)->LAYER ][0], + (float)((phseg_list *)Pointer)->X1 / (float)SCALE_X, + (float)((phseg_list *)Pointer)->Y1 / (float)SCALE_X, + (float)((phseg_list *)Pointer)->X2 / (float)SCALE_X, + (float)((phseg_list *)Pointer)->Y2 / (float)SCALE_X, + (float)((phseg_list *)Pointer)->WIDTH / (float)SCALE_X ); + } + } + else + if ( IsRdsConnector( Rectangle ) ) + { + switch( ((phcon_list *)Pointer)->ORIENT ) + { + case NORTH : Orient = GRAAL_NORTH; + break; + case SOUTH : Orient = GRAAL_SOUTH; + break; + case EAST : Orient = GRAAL_EAST; + break; + default : Orient = GRAAL_WEST; + } + + sprintf( GraalIdentifyBuffer, + "CONNECTOR :\n\n NAME : %s\n LAYER : %s\n XCON : %.2f\n YCON : %.2f\n WIDTH : %.2f\n ORIENT : %s\n INDEX : %ld\n\n", + (((phcon_list *)Pointer)->NAME != (char *)0) ? ((phcon_list *)Pointer)->NAME : "None", + GRAAL_CONNECTOR_NAME_TABLE[ ((phcon_list *)Pointer)->LAYER ][0], + (float)((phcon_list *)Pointer)->XCON / (float)SCALE_X, + (float)((phcon_list *)Pointer)->YCON / (float)SCALE_X, + (float)((phcon_list *)Pointer)->WIDTH / (float)SCALE_X, + GRAAL_ORIENT_NAME_TABLE[ Orient ][0], + ((phcon_list *)Pointer)->INDEX ); + } + else + if ( IsRdsVia( Rectangle ) ) + { + if ( ( ((phvia_list *)Pointer)->DX == 0 ) && + ( ((phvia_list *)Pointer)->DY == 0 ) ) + { + sprintf( GraalIdentifyBuffer, + "VIA :\n\n NAME : %s\n TYPE: %s\n XVIA : %.2f\n YVIA : %.2f\n\n", + (((phvia_list *)Pointer)->NAME != (char *)0) ? ((phvia_list *)Pointer)->NAME : "None", + GRAAL_VIA_NAME_TABLE[ ((phvia_list *)Pointer)->TYPE ][0], + (float)((phvia_list *)Pointer)->XVIA / (float)SCALE_X, + (float)((phvia_list *)Pointer)->YVIA / (float)SCALE_X ); + } + else + { + sprintf( GraalIdentifyBuffer, + "BIGVIA :\n\n NAME: %s\n TYPE: %s\n XVIA : %.2f\n YVIA : %.2f\n DX : %.2f\n DY : %.2f\n\n", + (((phvia_list *)Pointer)->NAME != (char *)0) ? ((phvia_list *)Pointer)->NAME : "None", + GRAAL_BIGVIA_NAME_TABLE[ ((phvia_list *)Pointer)->TYPE ][0], + (float)((phvia_list *)Pointer)->XVIA / (float)SCALE_X, + (float)((phvia_list *)Pointer)->YVIA / (float)SCALE_X, + (float)((phvia_list *)Pointer)->DX / (float)SCALE_X, + (float)((phvia_list *)Pointer)->DY / (float)SCALE_X ); + } + } + else + if ( IsRdsReference( Rectangle ) ) + { + sprintf( GraalIdentifyBuffer, + "REFERENCE :\n\n NAME : %s\n TYPE : %s\n XREF : %.2f\n YREF : %.2f\n\n", + (((phref_list *)Pointer)->NAME != (char *)0) ? ((phref_list *)Pointer)->NAME : "None", + ( ! strcmp( ((phref_list *)Pointer)->FIGNAME, "ref_ref" ) ) ? "Ref_Ref" : "Ref_Con", + (float)((phref_list *)Pointer)->XREF / (float)SCALE_X, + (float)((phref_list *)Pointer)->YREF / (float)SCALE_X ); + } + else + if ( IsRdsInstance( Rectangle ) ) + { + Orient = ((phins_list *)Pointer)->TRANSF; + + sprintf( GraalIdentifyBuffer, + "INSTANCE :\n\n NAME : %s\n MODEL : %s\n TRANSF : %s\n XINS : %.2f\n YINS : %.2f\n\n", + ((phins_list *)Pointer)->INSNAME, + ((phins_list *)Pointer)->FIGNAME, + GRAAL_SYMMETRY_NAME_TABLE[ Orient ][0], + (float)((phins_list *)Pointer)->XINS / (float)SCALE_X, + (float)((phins_list *)Pointer)->YINS / (float)SCALE_X ); + } + if ( IsRdsFigure( Rectangle ) ) + { + sprintf( GraalIdentifyBuffer, + "ABUTMENT BOX :\n\n NAME : %s\n XAB1 : %.2f\n YAB1 : %.2f\n XAB2 : %.2f\n YAB2 : %.2f\n\n", + ((phfig_list *)Pointer)->NAME, + (float)((phfig_list *)Pointer)->XAB1 / (float)SCALE_X, + (float)((phfig_list *)Pointer)->YAB1 / (float)SCALE_X, + (float)((phfig_list *)Pointer)->XAB2 / (float)SCALE_X, + (float)((phfig_list *)Pointer)->YAB2 / (float)SCALE_X ); + } + + Length = strlen( GraalIdentifyBuffer ); + + if ( ( GraalIdentifyLength + Length ) < ( GRAAL_IDENTIFY_MESSAGE_SIZE - 1 ) ) + { + strcpy( GraalScanIdentify, GraalIdentifyBuffer ); + + GraalScanIdentify += Length; + GraalIdentifyLength += Length; + + rdsend(); + return( GRAAL_TRUE ); + } + + strcpy( GraalScanIdentify, "#" ); + + rdsend(); + return( GRAAL_FALSE ); +} + +/*------------------------------------------------------------\ +| | +| GraalEditIdentify | +| | +\------------------------------------------------------------*/ + +void GraalEditIdentify() +{ + graalselect *Select; + + rdsbegin(); + + strcpy( GraalIdentifyMessage, "No element found !" ); + GraalScanIdentify = GraalIdentifyMessage; + GraalIdentifyLength = 0; + + for ( Select = GraalHeadSelect; + Select != (graalselect *)NULL; + Select = Select->NEXT ) + { + if ( ! GraalAddIdentify( Select->RECTANGLE ) ) break; + } + + GraalDelSelect(); + + GraalDisplayIdentifyMessage( GraalIdentifyMessage ); + GraalEnterPanel( &GraalEditIdentifyPanel ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEditCopy | +| | +\------------------------------------------------------------*/ + +void GraalEditCopy( LambdaX1, LambdaY1, LambdaX2, LambdaY2, Mode ) + + long LambdaX1; + long LambdaY1; + long LambdaX2; + long LambdaY2; + char Mode; +{ + graalselect *Select; + rdsrec_list *Rectangle; + rdsrec_list *NewRec; + void *Element; + void *Pointer; + char Orient; + char FirstUndo; + char MbkOrient; + long DeltaX; + long DeltaY; + long X1; + long X2; + long Y1; + long Y2; + + rdsbegin(); + + DeltaX = ( LambdaX2 - LambdaX1 ) * GRAAL_SCALE_X; + DeltaY = ( LambdaY2 - LambdaY1 ) * GRAAL_SCALE_X; + + FirstUndo = 1; + + for ( Select = GraalHeadSelect; + Select != (graalselect *)NULL; + Select = Select->NEXT ) + { + Rectangle = Select->RECTANGLE; + + if ( IsRdsSegment( Rectangle ) ) + { + if ( FirstUndo ) + { + GraalAddUndo(); + + FirstUndo = 0; + } + + Pointer = GRAAL_MBK( Rectangle ); + + X1 = ((phseg_list *)Pointer)->X1 + DeltaX; + Y1 = ((phseg_list *)Pointer)->Y1 + DeltaY; + X2 = ((phseg_list *)Pointer)->X2 + DeltaX; + Y2 = ((phseg_list *)Pointer)->Y2 + DeltaY; + + Element = (void *) + + addphseg( GraalFigureMbk, + ((phseg_list *)Pointer)->LAYER, + ((phseg_list *)Pointer)->WIDTH, + X1, Y1, X2, Y2, + ((phseg_list *)Pointer)->NAME ); + + ((phseg_list *)Element)->TYPE = ((phseg_list *)Pointer)->TYPE; + ((phseg_list *)Element)->USER = (void *)(&GraalFigureMbk->PHSEG); + + if ( ((phseg_list *)Element)->NEXT != (phseg_list *)NULL ) + { + ((phseg_list *)Element)->NEXT->USER = (void *)(&((phseg_list *)Element)->NEXT); + } + + NewRec = GraalAddSegment( ((phseg_list *)Element) ); + + GraalAddUndoRec( NewRec ); + } + else + if ( IsRdsVia( Rectangle ) ) + { + if ( FirstUndo ) + { + GraalAddUndo(); + + FirstUndo = 0; + } + + Pointer = GRAAL_MBK( Rectangle ); + + X1 = ((phvia_list *)Pointer)->XVIA + DeltaX; + Y1 = ((phvia_list *)Pointer)->YVIA + DeltaY; + + Element = (void *) + + addphvia( GraalFigureMbk, + ((phvia_list *)Pointer)->TYPE, X1, Y1, + ((phvia_list *)Pointer)->DX, ((phvia_list *)Pointer)->DY, + ((phvia_list *)Pointer)->NAME ); + + ((phvia_list *)Element)->USER = (void *)(&GraalFigureMbk->PHVIA); + + if ( ((phvia_list *)Element)->NEXT != (phvia_list *)NULL ) + { + ((phvia_list *)Element)->NEXT->USER = (void *)(&((phvia_list *)Element)->NEXT); + } + + NewRec = GraalAddVia( ((phvia_list *)Element) ); + + GraalAddUndoRec( NewRec ); + } + else + if ( IsRdsReference( Rectangle ) ) + { + if ( FirstUndo ) + { + GraalAddUndo(); + + FirstUndo = 0; + } + + Pointer = GRAAL_MBK( Rectangle ); + + X1 = ((phref_list *)Pointer)->XREF + DeltaX; + Y1 = ((phref_list *)Pointer)->YREF + DeltaY; + + Element = (void *) + + addphref( GraalFigureMbk, + ((phref_list *)Pointer)->FIGNAME, + Rectangle->NAME, X1, Y1 ); + + ((phref_list *)Element)->USER = (void *)(&GraalFigureMbk->PHREF); + + if ( ((phref_list *)Element)->NEXT != (phref_list *)NULL ) + { + ((phref_list *)Element)->NEXT->USER = (void *)(&((phref_list *)Element)->NEXT); + } + + NewRec = GraalAddReference( ((phvia_list *)Element) ); + + GraalAddUndoRec( NewRec ); + } + else + if ( IsRdsConnector( Rectangle ) ) + { + if ( FirstUndo ) + { + GraalAddUndo(); + + FirstUndo = 0; + } + + Pointer = GRAAL_MBK( Rectangle ); + + X1 = ((phcon_list *)Pointer)->XCON + DeltaX; + Y1 = ((phcon_list *)Pointer)->YCON + DeltaY; + + Element = (void *) + + addphcon( GraalFigureMbk, + ((phcon_list *)Pointer)->ORIENT, + Rectangle->NAME, + X1, Y1, + ((phcon_list *)Pointer)->LAYER, + ((phcon_list *)Pointer)->WIDTH ); + + ((phcon_list *)Element)->USER = (void *)(&GraalFigureMbk->PHCON); + + if ( ((phcon_list *)Element)->NEXT != (phcon_list *)NULL ) + { + ((phcon_list *)Element)->NEXT->USER = (void *)(&((phcon_list *)Element)->NEXT); + } + + NewRec = GraalAddConnector( ((phcon_list *)Element) ); + + GraalAddUndoRec( NewRec ); + } + } + + GraalDelEqui(); + GraalDelPeek(); + GraalDelSelect(); + GraalZoomRefresh(); + + if ( Mode == 0 ) + { + GraalChangeEditMode( GRAAL_SELECT_POINT_COPY, + GraalPromptSelectPointCopy ); + } + else + { + GraalChangeEditMode( GRAAL_SELECT_WINDOW_COPY, + GraalPromptSelectWindowCopy ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEditMove | +| | +\------------------------------------------------------------*/ + +void GraalEditMove( LambdaX1, LambdaY1, LambdaX2, LambdaY2, Mode ) + + long LambdaX1; + long LambdaY1; + long LambdaX2; + long LambdaY2; + char Mode; +{ + graalselect *Select; + rdsrec_list *Rectangle; + rdsrec_list *NewRec; + rdsins_list *Instance; + phins_list *SaveInstance; + graalconrec *ConRec; + void *Element; + void *Pointer; + char Orient; + char MbkOrient; + char FirstUndo; + long DeltaX; + long DeltaY; + long X1; + long X2; + long Y1; + long Y2; + + rdsbegin(); + + DeltaX = ( LambdaX2 - LambdaX1 ) * GRAAL_SCALE_X; + DeltaY = ( LambdaY2 - LambdaY1 ) * GRAAL_SCALE_X; + + FirstUndo = 1; + + for ( Select = GraalHeadSelect; + Select != (graalselect *)NULL; + Select = Select->NEXT ) + { + if ( IsRdsFigure( Select->RECTANGLE ) ) + { + FirstUndo = 0; + + GraalAddUndo(); + GraalDeleteRectangle( Select->RECTANGLE ); + GraalAddUndoRec( Select->RECTANGLE ); + + GraalFigureMbk->XAB1 += DeltaX; + GraalFigureMbk->XAB2 += DeltaX; + GraalFigureMbk->YAB1 += DeltaY; + GraalFigureMbk->YAB2 += DeltaY; + + NewRec = GraalAddAbox(); + GraalAddUndoRec( NewRec ); + + for ( ConRec = GraalHeadConRec; + ConRec != (graalconrec *)NULL; + ConRec = ConRec->NEXT ) + { + Rectangle = ConRec->RECTANGLE; + + if ( ! IsGraalDeleted( Rectangle ) ) + { + Pointer = GRAAL_MBK( Rectangle ); + + X1 = ((phcon_list *)Pointer)->XCON + DeltaX; + Y1 = ((phcon_list *)Pointer)->YCON + DeltaY; + + if ( ( X1 < GraalFigureMbk->XAB1 ) || + ( X1 > GraalFigureMbk->XAB2 ) || + ( Y1 < GraalFigureMbk->YAB1 ) || + ( Y1 > GraalFigureMbk->YAB2 ) ) continue; + + if ( ( X1 != GraalFigureMbk->XAB1 ) && + ( X1 != GraalFigureMbk->XAB2 ) && + ( Y1 != GraalFigureMbk->YAB1 ) && + ( Y1 != GraalFigureMbk->YAB2 ) ) continue; + + GraalDeleteRectangle( Rectangle ); + GraalRejectRectangle( Rectangle ); + GraalAddUndoRec( Rectangle ); + + Element = (void *) + + addphcon( GraalFigureMbk, + ((phcon_list *)Pointer)->ORIENT, + Rectangle->NAME, + X1, Y1, + ((phcon_list *)Pointer)->LAYER, + ((phcon_list *)Pointer)->WIDTH ); + + ((phcon_list *)Element)->USER = (void *)(&GraalFigureMbk->PHCON); + + if ( ((phcon_list *)Element)->NEXT != (phcon_list *)NULL ) + { + ((phcon_list *)Element)->NEXT->USER = (void *)(&((phcon_list *)Element)->NEXT); + } + + NewRec = GraalAddConnector( ((phcon_list *)Element) ); + GraalAddUndoRec( NewRec ); + } + } + + break; + } + } + + for ( Select = GraalHeadSelect; + Select != (graalselect *)NULL; + Select = Select->NEXT ) + { + Rectangle = Select->RECTANGLE; + + if ( ! IsGraalAccepted( Rectangle ) ) continue; + + if ( IsRdsSegment( Rectangle ) ) + { + if ( FirstUndo ) + { + GraalAddUndo(); + + FirstUndo = 0; + } + + GraalDeleteRectangle( Rectangle ); + GraalAddUndoRec( Rectangle ); + + Pointer = GRAAL_MBK( Rectangle ); + + X1 = ((phseg_list *)Pointer)->X1 + DeltaX; + Y1 = ((phseg_list *)Pointer)->Y1 + DeltaY; + X2 = ((phseg_list *)Pointer)->X2 + DeltaX; + Y2 = ((phseg_list *)Pointer)->Y2 + DeltaY; + + Element = (void *) + + addphseg( GraalFigureMbk, + ((phseg_list *)Pointer)->LAYER, + ((phseg_list *)Pointer)->WIDTH, + X1, Y1, X2, Y2, + ((phseg_list *)Pointer)->NAME ); + + ((phseg_list *)Element)->TYPE = ((phseg_list *)Pointer)->TYPE; + ((phseg_list *)Element)->USER = (void *)(&GraalFigureMbk->PHSEG); + + if ( ((phseg_list *)Element)->NEXT != (phseg_list *)NULL ) + { + ((phseg_list *)Element)->NEXT->USER = (void *)(&((phseg_list *)Element)->NEXT); + } + + NewRec = GraalAddSegment( ((phseg_list *)Element) ); + GraalAddUndoRec( NewRec ); + } + else + if ( IsRdsVia( Rectangle ) ) + { + if ( FirstUndo ) + { + GraalAddUndo(); + + FirstUndo = 0; + } + + GraalDeleteRectangle( Rectangle ); + GraalAddUndoRec( Rectangle ); + + Pointer = GRAAL_MBK( Rectangle ); + + X1 = ((phvia_list *)Pointer)->XVIA + DeltaX; + Y1 = ((phvia_list *)Pointer)->YVIA + DeltaY; + + Element = (void *) + + addphvia( GraalFigureMbk, + ((phvia_list *)Pointer)->TYPE, X1, Y1, + ((phvia_list *)Pointer)->DX, ((phvia_list *)Pointer)->DY, + ((phvia_list *)Pointer)->NAME ); + + ((phvia_list *)Element)->USER = (void *)(&GraalFigureMbk->PHVIA); + + if ( ((phvia_list *)Element)->NEXT != (phvia_list *)NULL ) + { + ((phvia_list *)Element)->NEXT->USER = (void *)(&((phvia_list *)Element)->NEXT); + } + + NewRec = GraalAddVia( ((phvia_list *)Element) ); + + GraalAddUndoRec( NewRec ); + } + else + if ( IsRdsReference( Rectangle ) ) + { + if ( FirstUndo ) + { + GraalAddUndo(); + + FirstUndo = 0; + } + + GraalDeleteRectangle( Rectangle ); + GraalAddUndoRec( Rectangle ); + + Pointer = GRAAL_MBK( Rectangle ); + + X1 = ((phref_list *)Pointer)->XREF + DeltaX; + Y1 = ((phref_list *)Pointer)->YREF + DeltaY; + + Element = (void *) + + addphref( GraalFigureMbk, + ((phref_list *)Pointer)->FIGNAME, + Rectangle->NAME, X1, Y1 ); + + ((phref_list *)Element)->USER = (void *)(&GraalFigureMbk->PHREF); + + if ( ((phref_list *)Element)->NEXT != (phref_list *)NULL ) + { + ((phref_list *)Element)->NEXT->USER = (void *)(&((phref_list *)Element)->NEXT); + } + + NewRec = GraalAddReference( ((phvia_list *)Element) ); + + GraalAddUndoRec( NewRec ); + } + else + if ( IsRdsConnector( Rectangle ) ) + { + if ( FirstUndo ) + { + GraalAddUndo(); + + FirstUndo = 0; + } + + GraalDeleteRectangle( Rectangle ); + GraalAddUndoRec( Rectangle ); + + Pointer = GRAAL_MBK( Rectangle ); + + X1 = ((phcon_list *)Pointer)->XCON + DeltaX; + Y1 = ((phcon_list *)Pointer)->YCON + DeltaY; + + Element = (void *) + + addphcon( GraalFigureMbk, + ((phcon_list *)Pointer)->ORIENT, + Rectangle->NAME, + X1, Y1, + ((phcon_list *)Pointer)->LAYER, + ((phcon_list *)Pointer)->WIDTH ); + + ((phcon_list *)Element)->USER = (void *)(&GraalFigureMbk->PHCON); + + if ( ((phcon_list *)Element)->NEXT != (phcon_list *)NULL ) + { + ((phcon_list *)Element)->NEXT->USER = (void *)(&((phcon_list *)Element)->NEXT); + } + + NewRec = GraalAddConnector( ((phcon_list *)Element) ); + + GraalAddUndoRec( NewRec ); + } + else + if ( IsRdsInstance( Rectangle ) ) + { + if ( FirstUndo ) + { + GraalAddUndo(); + + FirstUndo = 0; + } + + GraalDeleteRectangle( Rectangle ); + GraalAddUndoRec( Rectangle ); + + Pointer = GRAAL_MBK( Rectangle ); + + X1 = ((phins_list *)Pointer)->XINS + DeltaX; + Y1 = ((phins_list *)Pointer)->YINS + DeltaY; + + SaveInstance = GraalFigureMbk->PHINS; + GraalFigureMbk->PHINS = (phins_list *)NULL; + + Element = (void *) + + addphins( GraalFigureMbk, + ((phins_list *)Pointer)->FIGNAME, + ((phins_list *)Pointer)->INSNAME, + ((phins_list *)Pointer)->TRANSF, + X1, Y1 ); + + ((phins_list *)Element)->NEXT = SaveInstance; + ((phins_list *)Element)->USER = (void *)(&GraalFigureMbk->PHINS); + + if ( SaveInstance != (phins_list *)NULL ) + { + SaveInstance->USER = (void *)(&((phins_list *)Element)->NEXT); + } + + Instance = GraalAddInstance( ((phins_list *)Element) ); + + GraalDisplayToolsMessage(); + + if ( Instance == (rdsins_list *)NULL ) + { + GraalErrorMessage( GraalMainWindow, "Unable to load instance model !" ); + } + else + { + NewRec = Instance->LAYERTAB[ RDS_ABOX ]; + + GraalAddUndoRec( NewRec ); + } + } + } + + GraalDelEqui(); + GraalDelPeek(); + GraalDelSelect(); + GraalZoomRefresh(); + + if ( Mode == 0 ) + { + GraalChangeEditMode( GRAAL_SELECT_POINT_MOVE, + GraalPromptSelectPointMove ); + } + else + { + GraalChangeEditMode( GRAAL_SELECT_WINDOW_MOVE, + GraalPromptSelectWindowMove ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEditDelete | +| | +\------------------------------------------------------------*/ + +void GraalEditDelete() +{ + graalselect *Select; + rdsrec_list *Rectangle; + char FirstUndo; + graalconrec *ConRec; + + rdsbegin(); + + FirstUndo = 1; + + for ( Select = GraalHeadSelect; + Select != (graalselect *)NULL; + Select = Select->NEXT ) + { + if ( IsRdsFigure( Select->RECTANGLE ) ) + { + FirstUndo = 0; + + GraalAddUndo(); + GraalDeleteRectangle( Select->RECTANGLE ); + GraalAddUndoRec( Select->RECTANGLE ); + + GraalFigureMbk->XAB1 = 0; + GraalFigureMbk->XAB2 = 0; + GraalFigureMbk->YAB1 = 0; + GraalFigureMbk->YAB2 = 0; + + for ( ConRec = GraalHeadConRec; + ConRec != (graalconrec *)NULL; + ConRec = ConRec->NEXT ) + { + Rectangle = ConRec->RECTANGLE; + + if ( ! IsGraalDeleted( Rectangle ) ) + { + GraalRejectRectangle( Rectangle ); + GraalDeleteRectangle( Rectangle ); + GraalAddUndoRec( Rectangle ); + } + } + + break; + } + } + + for ( Select = GraalHeadSelect; + Select != (graalselect *)NULL; + Select = Select->NEXT ) + { + Rectangle = Select->RECTANGLE; + + if ( ! IsGraalAccepted( Rectangle ) ) continue; + + if ( ( IsRdsSegment( Rectangle ) ) || + ( IsRdsVia( Rectangle ) ) || + ( IsRdsReference( Rectangle ) ) || + ( IsRdsConnector( Rectangle ) ) || + ( IsRdsInstance( Rectangle ) ) ) + { + if ( FirstUndo ) + { + GraalAddUndo(); + FirstUndo = 0; + } + + GraalDeleteRectangle( Rectangle ); + GraalAddUndoRec( Rectangle ); + } + } + + GraalDelEqui(); + GraalDelPeek(); + GraalDelSelect(); + GraalZoomRefresh(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEditStretch | +| | +\------------------------------------------------------------*/ + +void GraalEditStretch( LambdaX1, LambdaY1, LambdaX2, LambdaY2, Mode ) + + long LambdaX1; + long LambdaY1; + long LambdaX2; + long LambdaY2; + char Mode; +{ + graalselect *Select; + rdsrec_list *Rectangle; + rdsrec_list *NewRec; + graalconrec *ConRec; + void *Element; + void *Pointer; + char FirstUndo; + char Orient; + char Stretch; + long Delta; + long Delta1; + long Delta2; + long Length; + long X1; + long X2; + long Y1; + long Y2; + long Xab1; + long Xab2; + long Yab1; + long Yab2; + long Xvia; + long Yvia; + long DXvia; + long DYvia; + + rdsbegin(); + + Orient = 0; + + LambdaX1 = LambdaX1 * GRAAL_SCALE_X; + LambdaX2 = LambdaX2 * GRAAL_SCALE_X; + LambdaY1 = LambdaY1 * GRAAL_SCALE_X; + LambdaY2 = LambdaY2 * GRAAL_SCALE_X; + + if ( LambdaX2 != LambdaX1 ) + { + Delta = LambdaX2 - LambdaX1; + Orient = ( Delta > 0 ) ? GRAAL_EAST : GRAAL_WEST; + } + else + { + Delta = LambdaY2 - LambdaY1; + Orient = ( Delta > 0 ) ? GRAAL_NORTH : GRAAL_SOUTH; + } + + if ( Delta != 0 ) + { + FirstUndo = 1; + + for ( Select = GraalHeadSelect; + Select != (graalselect *)NULL; + Select = Select->NEXT ) + { + Rectangle = Select->RECTANGLE; + + if ( IsRdsFigure( Rectangle ) ) + { + X1 = GraalFigureMbk->XAB1; + X2 = GraalFigureMbk->XAB2; + Y1 = GraalFigureMbk->YAB1; + Y2 = GraalFigureMbk->YAB2; + + Stretch = 0; + + if ( ( Orient == GRAAL_EAST ) || + ( Orient == GRAAL_WEST ) ) + { + Delta1 = X1 - LambdaX1; + Delta2 = X2 - LambdaX1; + + if ( Delta1 < 0 ) Delta1 = -Delta1; + if ( Delta2 < 0 ) Delta2 = -Delta2; + + if ( Delta1 < Delta2 ) X1 += Delta; + else X2 += Delta; + + if ( X2 > X1 ) + { + Stretch = 1; + } + } + else + { + Delta1 = Y1 - LambdaY1; + Delta2 = Y2 - LambdaY1; + + if ( Delta1 < 0 ) Delta1 = -Delta1; + if ( Delta2 < 0 ) Delta2 = -Delta2; + + if ( Delta1 < Delta2 ) Y1 += Delta; + else Y2 += Delta; + + if ( Y2 > Y1 ) + { + Stretch = 1; + } + } + + if ( Stretch ) + { + if ( FirstUndo ) + { + GraalAddUndo(); + + FirstUndo = 0; + } + + GraalDeleteRectangle( Rectangle ); + GraalAddUndoRec( Rectangle ); + + + Xab1 = GraalFigureMbk->XAB1; + Xab2 = GraalFigureMbk->XAB2; + Yab1 = GraalFigureMbk->YAB1; + Yab2 = GraalFigureMbk->YAB2; + + GraalFigureMbk->XAB1 = X1; + GraalFigureMbk->YAB1 = Y1; + GraalFigureMbk->XAB2 = X2; + GraalFigureMbk->YAB2 = Y2; + + NewRec = GraalAddAbox(); + GraalAddUndoRec( NewRec ); + + for ( ConRec = GraalHeadConRec; + ConRec != (graalconrec *)NULL; + ConRec = ConRec->NEXT ) + { + Rectangle = ConRec->RECTANGLE; + + if ( ! IsGraalDeleted( Rectangle ) ) + { + Stretch = 0; + Pointer = GRAAL_MBK( Rectangle ); + + X1 = ((phcon_list *)Pointer)->XCON; + Y1 = ((phcon_list *)Pointer)->YCON; + + if ( ( X1 < Xab1 ) || + ( X1 > Xab2 ) || + ( Y1 < Yab1 ) || + ( Y1 > Yab2 ) ) continue; + + if ( ( X1 != Xab1 ) && + ( X1 != Xab2 ) && + ( Y1 != Yab1 ) && + ( Y1 != Yab2 ) ) continue; + + if ( ( X1 != GraalFigureMbk->XAB1 ) && + ( X1 != GraalFigureMbk->XAB2 ) && + ( Y1 != GraalFigureMbk->YAB1 ) && + ( Y1 != GraalFigureMbk->YAB2 ) ) + { + switch ( Orient ) + { + case GRAAL_SOUTH: + case GRAAL_NORTH: Y1 += Delta; + + break; + + case GRAAL_WEST: + case GRAAL_EAST: X1 += Delta; + + break; + } + + Stretch = 1; + } + + if ( X1 < GraalFigureMbk->XAB1 ) + { + X1 = GraalFigureMbk->XAB1; Stretch = 1; + } + + if ( X1 > GraalFigureMbk->XAB2 ) + { + X1 = GraalFigureMbk->XAB2; Stretch = 1; + } + + if ( Y1 < GraalFigureMbk->YAB1 ) + { + Y1 = GraalFigureMbk->YAB1; Stretch = 1; + } + + if ( Y1 > GraalFigureMbk->YAB2 ) + { + Y1 = GraalFigureMbk->YAB2; Stretch = 1; + } + + if ( Stretch ) + { + GraalDeleteRectangle( Rectangle ); + GraalRejectRectangle( Rectangle ); + GraalAddUndoRec( Rectangle ); + + Element = (void *) + + addphcon( GraalFigureMbk, + ((phcon_list *)Pointer)->ORIENT, + Rectangle->NAME, + X1, Y1, + ((phcon_list *)Pointer)->LAYER, + ((phcon_list *)Pointer)->WIDTH ); + + ((phcon_list *)Element)->USER = (void *)(&GraalFigureMbk->PHCON); + + if ( ((phcon_list *)Element)->NEXT != (phcon_list *)NULL ) + { + ((phcon_list *)Element)->NEXT->USER = + + (void *)(&((phcon_list *)Element)->NEXT); + } + + NewRec = GraalAddConnector( ((phcon_list *)Element) ); + GraalAddUndoRec( NewRec ); + } + } + } + } + + break; + } + } + + for ( Select = GraalHeadSelect; + Select != (graalselect *)NULL; + Select = Select->NEXT ) + { + Rectangle = Select->RECTANGLE; + + if ( IsRdsSegment( Rectangle ) ) + { + Pointer = GRAAL_MBK( Rectangle ); + + X1 = ((phseg_list *)Pointer)->X1; + Y1 = ((phseg_list *)Pointer)->Y1; + X2 = ((phseg_list *)Pointer)->X2; + Y2 = ((phseg_list *)Pointer)->Y2; + + Length = GRAAL_SEGMENT_VALUE_TABLE[ ((phseg_list *)Pointer)->LAYER ][1] * GRAAL_SCALE_X; + + Stretch = 0; + + switch ( ((phseg_list *)Pointer)->TYPE ) + { + case RIGHT : + case LEFT : + + if ( ( Orient == GRAAL_EAST ) || + ( Orient == GRAAL_WEST ) ) + { + Delta1 = X1 - LambdaX1; + Delta2 = X2 - LambdaX1; + + if ( Delta1 < 0 ) Delta1 = -Delta1; + if ( Delta2 < 0 ) Delta2 = -Delta2; + + if ( Delta1 < Delta2 ) X1 += Delta; + else X2 += Delta; + + if ( ( X2 - X1 ) >= Length ) + { + Stretch = 1; + } + } + + break; + + case UP : + case DOWN : + + if ( ( Orient == GRAAL_NORTH ) || + ( Orient == GRAAL_SOUTH ) ) + { + Delta1 = Y1 - LambdaY1; + Delta2 = Y2 - LambdaY1; + + if ( Delta1 < 0 ) Delta1 = -Delta1; + if ( Delta2 < 0 ) Delta2 = -Delta2; + + if ( Delta1 < Delta2 ) Y1 += Delta; + else Y2 += Delta; + + if ( ( Y2 - Y1 ) >= Length ) + { + Stretch = 1; + } + } + + break; + } + + if ( Stretch ) + { + if ( FirstUndo ) + { + GraalAddUndo(); + + FirstUndo = 0; + } + + GraalDeleteRectangle( Rectangle ); + GraalAddUndoRec( Rectangle ); + + Element = (void *) + + addphseg( GraalFigureMbk, + ((phseg_list *)Pointer)->LAYER, + ((phseg_list *)Pointer)->WIDTH, + X1, Y1, X2, Y2, + ((phseg_list *)Pointer)->NAME ); + + ((phseg_list *)Element)->TYPE = ((phseg_list *)Pointer)->TYPE; + ((phseg_list *)Element)->USER = (void *)(&GraalFigureMbk->PHSEG); + + if ( ((phseg_list *)Element)->NEXT != (phseg_list *)NULL ) + { + ((phseg_list *)Element)->NEXT->USER = (void *)(&((phseg_list *)Element)->NEXT); + } + + NewRec = GraalAddSegment( ((phseg_list *)Element) ); + GraalAddUndoRec( NewRec ); + } + } + else + if ( IsRdsVia( Rectangle ) ) + { + Pointer = GRAAL_MBK( Rectangle ); + + Xvia = ((phvia_list *)Pointer)->XVIA; + Yvia = ((phvia_list *)Pointer)->YVIA; + DXvia = ((phvia_list *)Pointer)->DX; + DYvia = ((phvia_list *)Pointer)->DY; + + X1 = Xvia - (DXvia >> 1); + Y1 = Yvia - (DYvia >> 1); + X2 = X1 + DXvia; + Y2 = Y1 + DYvia; + + Length = GRAAL_BIGVIA_VALUE_TABLE[ ((phvia_list *)Pointer)->TYPE ][0] * GRAAL_SCALE_X; + + Stretch = 0; + + if ( ( Orient == GRAAL_EAST ) || + ( Orient == GRAAL_WEST ) ) + { + Delta1 = X1 - LambdaX1; + Delta2 = X2 - LambdaX1; + + if ( Delta1 < 0 ) Delta1 = -Delta1; + if ( Delta2 < 0 ) Delta2 = -Delta2; + + if ( Delta1 < Delta2 ) X1 += Delta; + else X2 += Delta; + + if ( ( X2 - X1 ) >= Length ) + { + Stretch = 1; + } + } + else + if ( ( Orient == GRAAL_NORTH ) || + ( Orient == GRAAL_SOUTH ) ) + { + Delta1 = Y1 - LambdaY1; + Delta2 = Y2 - LambdaY1; + + if ( Delta1 < 0 ) Delta1 = -Delta1; + if ( Delta2 < 0 ) Delta2 = -Delta2; + + if ( Delta1 < Delta2 ) Y1 += Delta; + else Y2 += Delta; + + if ( ( Y2 - Y1 ) >= Length ) + { + Stretch = 1; + } + } + + if ( Stretch ) + { + DXvia = X2 - X1; + DYvia = Y2 - Y1; + Xvia = X1 + (DXvia >> 1); + Yvia = Y1 + (DYvia >> 1); + + if ( FirstUndo ) + { + GraalAddUndo(); + + FirstUndo = 0; + } + + GraalDeleteRectangle( Rectangle ); + GraalAddUndoRec( Rectangle ); + + Element = (void *) + + addphvia( GraalFigureMbk, + ((phvia_list *)Pointer)->TYPE, Xvia, Yvia, DXvia, DYvia, + ((phvia_list *)Pointer)->NAME ); + + ((phvia_list *)Element)->USER = (void *)(&GraalFigureMbk->PHVIA); + + if ( ((phvia_list *)Element)->NEXT != (phvia_list *)NULL ) + { + ((phvia_list *)Element)->NEXT->USER = (void *)(&((phvia_list *)Element)->NEXT); + } + + NewRec = GraalAddVia( ((phvia_list *)Element) ); + + GraalAddUndoRec( NewRec ); + } + } + } + } + + GraalDelEqui(); + GraalDelPeek(); + GraalDelSelect(); + GraalZoomRefresh(); + + if ( Mode == 0 ) + { + GraalChangeEditMode( GRAAL_SELECT_POINT_STRETCH, + GraalPromptSelectPointStretch ); + } + else + { + GraalChangeEditMode( GRAAL_SELECT_WINDOW_STRETCH, + GraalPromptSelectWindowStretch ); + } + + rdsend(); +} diff --git a/alliance/src/graal/src/GME_edit.h b/alliance/src/graal/src/GME_edit.h new file mode 100644 index 00000000..d391b272 --- /dev/null +++ b/alliance/src/graal/src/GME_edit.h @@ -0,0 +1,68 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Edit.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_EDIT +# define GRAAL_EDIT + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define GRAAL_IDENTIFY_BUFFER_SIZE 256 +# define GRAAL_IDENTIFY_MESSAGE_SIZE 4096 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GME_menu.c b/alliance/src/graal/src/GME_menu.c new file mode 100644 index 00000000..747e7919 --- /dev/null +++ b/alliance/src/graal/src/GME_menu.c @@ -0,0 +1,636 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Menu.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "GSB.h" +# include "GTB.h" +# include "GRM.h" +# include "GMV.h" +# include "GME.h" +# include "GMX.h" + +# include "GME_menu.h" +# include "GME_edit.h" +# include "GME_modify.h" +# include "GME_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + GraalMenuItem GraalEditMenu[] = + + { + { + "Undo", + 'U', + "CtrlU", + "Ctrl U", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditUndo, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Redo", + 'R', + "CtrlR", + "Ctrl R", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditRedo, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Copy", + 'C', + "CtrlC", + "Ctrl C", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditCopy, + (XtPointer)0, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Move", + 'M', + "CtrlM", + "Ctrl M", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditMove, + (XtPointer)0, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Delete", + 'D', + "CtrlD", + "Ctrl D", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditDelete, + (XtPointer)0, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Stretch", + 'S', + "CtrlS", + "Ctrl S", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditStretch, + (XtPointer)0, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Modify ", + 'y', + "CtrlY", + "Ctrl Y", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditModify, + (XtPointer)0, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Identify", + 'I', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditIdentify, + (XtPointer)0, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Search ", + 'h', + "CtrlH", + "Ctrl H", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditSearch, + (XtPointer)0, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + NULL + }; + + GraalMenuItem GraalWindowMenu[] = + + { + { + "Undo", + 'U', + "MetaU", + "Meta U", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditUndo, + (XtPointer)1, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Redo", + 'R', + "MetaR", + "Meta R", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditRedo, + (XtPointer)1, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Copy", + 'C', + "MetaC", + "Meta C", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditCopy, + (XtPointer)1, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Move", + 'M', + "MetaM", + "Meta M", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditMove, + (XtPointer)1, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Delete", + 'D', + "MetaD", + "Meta D", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditDelete, + (XtPointer)1, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Stretch", + 'S', + "MetaS", + "Meta S", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditStretch, + (XtPointer)1, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Modify ", + 'y', + "MetaY", + "Meta Y", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditModify, + (XtPointer)1, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Identify ", + 'I', + "MetaI", + "Meta I", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditIdentify, + (XtPointer)1, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackEditIdentify | +| | +\------------------------------------------------------------*/ + +void CallbackEditIdentify( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( ClientData ) + { + GraalEnterPanel( &GraalWindowGlobalPanel ); + + GraalChangeEditMode( GRAAL_SELECT_WINDOW_IDENTIFY, + GraalPromptSelectWindowIdentify ); + } + else + { + GraalEnterPanel( &GraalEditGlobalPanel ); + + GraalChangeEditMode( GRAAL_SELECT_POINT_IDENTIFY, + GraalPromptSelectPointIdentify ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditCopy | +| | +\------------------------------------------------------------*/ + +void CallbackEditCopy( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( ClientData ) + { + GraalEnterPanel( &GraalWindowGlobalPanel ); + + GraalChangeEditMode( GRAAL_SELECT_WINDOW_COPY, + GraalPromptSelectWindowCopy ); + } + else + { + GraalEnterPanel( &GraalEditGlobalPanel ); + + GraalChangeEditMode( GRAAL_SELECT_POINT_COPY, + GraalPromptSelectPointCopy ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditMove | +| | +\------------------------------------------------------------*/ + +void CallbackEditMove( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( ClientData ) + { + GraalEnterPanel( &GraalWindowGlobalPanel ); + + GraalChangeEditMode( GRAAL_SELECT_WINDOW_MOVE, + GraalPromptSelectWindowMove ); + } + else + { + GraalEnterPanel( &GraalEditGlobalPanel ); + + GraalChangeEditMode( GRAAL_SELECT_POINT_MOVE, + GraalPromptSelectPointMove ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditDelete | +| | +\------------------------------------------------------------*/ + +void CallbackEditDelete( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( ClientData ) + { + GraalEnterPanel( &GraalWindowGlobalPanel ); + + GraalChangeEditMode( GRAAL_SELECT_WINDOW_DELETE, + GraalPromptSelectWindowDelete ); + } + else + { + GraalEnterPanel( &GraalEditGlobalPanel ); + + GraalChangeEditMode( GRAAL_SELECT_POINT_DELETE, + GraalPromptSelectPointDelete ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditStretch | +| | +\------------------------------------------------------------*/ + +void CallbackEditStretch( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( ClientData ) + { + GraalEnterPanel( &GraalWindowGlobalPanel ); + + GraalChangeEditMode( GRAAL_SELECT_WINDOW_STRETCH, + GraalPromptSelectWindowStretch ); + } + else + { + GraalEnterPanel( &GraalEditGlobalPanel ); + + GraalChangeEditMode( GRAAL_SELECT_POINT_STRETCH, + GraalPromptSelectPointStretch ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditModify | +| | +\------------------------------------------------------------*/ + +void CallbackEditModify( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( ClientData ) + { + GraalEnterPanel( &GraalWindowGlobalPanel ); + + GraalChangeEditMode( GRAAL_SELECT_WINDOW_MODIFY, + GraalPromptSelectWindowModify ); + } + else + { + GraalEnterPanel( &GraalEditGlobalPanel ); + + GraalChangeEditMode( GRAAL_SELECT_POINT_MODIFY, + GraalPromptSelectPointModify ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditSearch | +| | +\------------------------------------------------------------*/ + +void CallbackEditSearch( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterPanel( &GraalEditSearchPanel ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditUndo | +| | +\------------------------------------------------------------*/ + +void CallbackEditUndo( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEditUndo(); + + if ( ClientData ) + { + GraalEnterPanel( &GraalWindowGlobalPanel ); + } + else + { + GraalEnterPanel( &GraalEditGlobalPanel ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditRedo | +| | +\------------------------------------------------------------*/ + +void CallbackEditRedo( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEditRedo(); + + if ( ClientData ) + { + GraalEnterPanel( &GraalWindowGlobalPanel ); + } + else + { + GraalEnterPanel( &GraalEditGlobalPanel ); + } + + rdsend(); +} + diff --git a/alliance/src/graal/src/GME_menu.h b/alliance/src/graal/src/GME_menu.h new file mode 100644 index 00000000..5a639d33 --- /dev/null +++ b/alliance/src/graal/src/GME_menu.h @@ -0,0 +1,80 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Menu.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_MENU +# define GRAAL_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackEditUndo(); + extern void CallbackEditRedo(); + extern void CallbackEditCopy(); + extern void CallbackEditMove(); + extern void CallbackEditDelete(); + extern void CallbackEditStretch(); + extern void CallbackEditModify(); + extern void CallbackEditIdentify(); + extern void CallbackEditSearch(); + +# endif diff --git a/alliance/src/graal/src/GME_message.c b/alliance/src/graal/src/GME_message.c new file mode 100644 index 00000000..7bf06909 --- /dev/null +++ b/alliance/src/graal/src/GME_message.c @@ -0,0 +1,644 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Message.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GRM.h" +# include "GMX.h" +# include "GTB.h" +# include "GSB.h" +# include "GME.h" +# include "GME_modify.h" +# include "GME_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static char MessageBuffer[ 512 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalPromptSelectPointIdentify | +| | +\------------------------------------------------------------*/ + +void GraalPromptSelectPointIdentify() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE , "Identify" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO , "Select object" ); + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter select point" ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptSelectWindowIdentify | +| | +\------------------------------------------------------------*/ + +void GraalPromptSelectWindowIdentify() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Identify" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO, "Select window" ); + + switch ( GraalCountEventEdit ) + { + case 0 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter first corner" ); + + break; + + case 1 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter next corner" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptSelectPointCopy | +| | +\------------------------------------------------------------*/ + +void GraalPromptSelectPointCopy() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE , "Copy" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO , "Select object" ); + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter select point" ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptSelectWindowCopy | +| | +\------------------------------------------------------------*/ + +void GraalPromptSelectWindowCopy() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Copy" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO, "Select window" ); + + switch ( GraalCountEventEdit ) + { + case 0 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter first corner" ); + + break; + + case 1 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter next corner" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptEditCopy | +| | +\------------------------------------------------------------*/ + +void GraalPromptEditCopy() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Copy" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO, "Select vector" ); + + switch ( GraalCountEventEdit ) + { + case 0 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter source point" ); + + break; + + case 1 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter target point" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptSelectPointMove | +| | +\------------------------------------------------------------*/ + +void GraalPromptSelectPointMove() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE , "Move" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO , "Select object" ); + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter select point" ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptSelectWindowMove | +| | +\------------------------------------------------------------*/ + +void GraalPromptSelectWindowMove() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Move" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO, "Select window" ); + + switch ( GraalCountEventEdit ) + { + case 0 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter first corner" ); + + break; + + case 1 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter next corner" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptEditMove | +| | +\------------------------------------------------------------*/ + +void GraalPromptEditMove() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Move" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO, "Select vector" ); + + switch ( GraalCountEventEdit ) + { + case 0 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter source point" ); + + break; + + case 1 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter target point" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptSelectPointDelete | +| | +\------------------------------------------------------------*/ + +void GraalPromptSelectPointDelete() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE , "Delete" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO , "Select object" ); + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter select point" ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptSelectWindowDelete | +| | +\------------------------------------------------------------*/ + +void GraalPromptSelectWindowDelete() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Delete" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO, "Select window" ); + + switch ( GraalCountEventEdit ) + { + case 0 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter first corner" ); + + break; + + case 1 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter next corner" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptSelectPointStretch | +| | +\------------------------------------------------------------*/ + +void GraalPromptSelectPointStretch() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE , "Stretch" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO , "Select object" ); + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter select point" ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptSelectWindowStretch | +| | +\------------------------------------------------------------*/ + +void GraalPromptSelectWindowStretch() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Stretch" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO, "Select window" ); + + switch ( GraalCountEventEdit ) + { + case 0 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter first corner" ); + + break; + + case 1 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter next corner" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptEditStretch | +| | +\------------------------------------------------------------*/ + +void GraalPromptEditStretch() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Stretch" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO, "Select vector" ); + + switch ( GraalCountEventEdit ) + { + case 0 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter source point" ); + + break; + + case 1 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter target point" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptSelectPointModify | +| | +\------------------------------------------------------------*/ + +void GraalPromptSelectPointModify() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE , "Modify" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO , "Select object" ); + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter select point" ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptSelectWindowModify | +| | +\------------------------------------------------------------*/ + +void GraalPromptSelectWindowModify() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Modify" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO, "Select window" ); + + switch ( GraalCountEventEdit ) + { + case 0 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter first corner" ); + + break; + + case 1 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter next corner" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptModifySegment | +| | +\------------------------------------------------------------*/ + +void GraalPromptModifySegment() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Modify Segment" ); + + sprintf( MessageBuffer, "Layer: %s Width: %2d Name: %s", + GRAAL_SEGMENT_NAME_TABLE[ GraalSegmentMLayer ][0] , + GraalSegmentMWidth, + ( GraalSegmentMName ) ? GraalSegmentMName : "none" ); + + GraalDisplayMessage( GRAAL_MESSAGE_INFO, MessageBuffer ); + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter new properties for this segment" ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptModifyConnector | +| | +\------------------------------------------------------------*/ + +void GraalPromptModifyConnector() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Modify Connector" ); + + sprintf( MessageBuffer, "Layer: %s Width: %2d Orient: %s Name: %s", + GRAAL_CONNECTOR_NAME_TABLE[ GraalConnectorMLayer ][0], + GraalConnectorMWidth, + GRAAL_ORIENT_NAME_TABLE[ GraalConnectorMOrient ][0], + ( GraalConnectorMName ) ? GraalConnectorMName : "none" ); + + GraalDisplayMessage( GRAAL_MESSAGE_INFO, MessageBuffer ); + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter new properties for this connector" ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptModifyReference | +| | +\------------------------------------------------------------*/ + +void GraalPromptModifyReference() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Modify Reference" ); + + if ( GraalReferenceMName != (char *)NULL ) + { + sprintf( MessageBuffer, "Type: %s Name: %s", + GRAAL_REFERENCE_NAME_TABLE[GraalReferenceMType][0], + GraalReferenceMName ); + } + else + { + sprintf( MessageBuffer, "Type: %s Name: none", + GRAAL_REFERENCE_NAME_TABLE[GraalReferenceMType][0] ); + } + + GraalDisplayMessage( GRAAL_MESSAGE_INFO, MessageBuffer ); + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter new properties for this reference" ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptModifyVia | +| | +\------------------------------------------------------------*/ + +void GraalPromptModifyVia() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Modify Via" ); + + sprintf( MessageBuffer, "Type: %s Name: %s", + GRAAL_VIA_NAME_TABLE[ GraalViaMType ][0], + GraalViaMName ? GraalViaMName : "none" ); + + GraalDisplayMessage( GRAAL_MESSAGE_INFO, MessageBuffer ); + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter new properties for this via" ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptModifyBigVia | +| | +\------------------------------------------------------------*/ + +void GraalPromptModifyBigVia() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Modify big Via" ); + + sprintf( MessageBuffer, "Type: %s Name: %s", + GRAAL_BIGVIA_NAME_TABLE[ GraalViaMType ][0], + GraalViaMName ? GraalViaMName : "none" ); + + GraalDisplayMessage( GRAAL_MESSAGE_INFO, MessageBuffer ); + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter new properties for this big via" ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptModifyTransistor | +| | +\------------------------------------------------------------*/ + +void GraalPromptModifyTransistor() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Modify Transistor" ); + + if ( GraalTransistorMName == (char *)NULL ) + { + sprintf( MessageBuffer, "Type: %s Width: %2d Name: None", + GRAAL_TRANSISTOR_NAME_TABLE[ GraalTransistorMType ][0], + GraalTransistorMWidth ); + } + else + { + sprintf( MessageBuffer, "Type: %s Width: %2d Name: %s", + GRAAL_TRANSISTOR_NAME_TABLE[ GraalTransistorMType ][0], + GraalTransistorMWidth, GraalTransistorMName ); + } + + GraalDisplayMessage( GRAAL_MESSAGE_INFO, MessageBuffer ); + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter new properties for this transistor" ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptModifyInstance | +| | +\------------------------------------------------------------*/ + +void GraalPromptModifyInstance() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Modify Instance" ); + + sprintf( MessageBuffer, "Symmetry: %s Model: %s Name: %s", + GRAAL_SYMMETRY_NAME_TABLE[ GraalInstanceMSym ][0], + GraalInstanceMModel, GraalInstanceMName ); + + GraalDisplayMessage( GRAAL_MESSAGE_INFO, MessageBuffer ); + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter new properties for this instance" ); + + rdsend(); +} diff --git a/alliance/src/graal/src/GME_message.h b/alliance/src/graal/src/GME_message.h new file mode 100644 index 00000000..b5bd7e0d --- /dev/null +++ b/alliance/src/graal/src/GME_message.h @@ -0,0 +1,95 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Message.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_MESSAGE +# define GRAAL_MESSAGE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalPromptSelectPointIdentify(); + extern void GraalPromptSelectPointCopy(); + extern void GraalPromptSelectPointMove(); + extern void GraalPromptSelectPointDelete(); + extern void GraalPromptSelectPointStretch(); + extern void GraalPromptSelectPointModify(); + + extern void GraalPromptSelectWindowIdentify(); + extern void GraalPromptSelectWindowCopy(); + extern void GraalPromptSelectWindowMove(); + extern void GraalPromptSelectWindowDelete(); + extern void GraalPromptSelectWindowStretch(); + extern void GraalPromptSelectWindowModify(); + + extern void GraalPromptEditCopy(); + extern void GraalPromptEditMove(); + extern void GraalPromptEditStretch(); + + extern void GraalPromptModifySegment(); + extern void GraalPromptModifyConnector(); + extern void GraalPromptModifyTransistor(); + extern void GraalPromptModifyReference(); + extern void GraalPromptModifyVia(); + extern void GraalPromptModifyBigVia(); + +# endif diff --git a/alliance/src/graal/src/GME_modify.c b/alliance/src/graal/src/GME_modify.c new file mode 100644 index 00000000..5a9985f6 --- /dev/null +++ b/alliance/src/graal/src/GME_modify.c @@ -0,0 +1,847 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Modify.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GSB.h" +# include "GRM.h" +# include "GMX.h" +# include "GTB.h" +# include "GME.h" + +# include "GME_modify.h" +# include "GME_panel.h" +# include "GME_edit.h" +# include "GME_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + char GraalModifyAbort = 0; + char GraalModifyLock = 0; + char GraalModifyApply = 0; + +/*------------------------------------------------------------\ +| | +| Segment & Wire | +| | +\------------------------------------------------------------*/ + + char GraalSegmentMLayer; + long GraalSegmentMWidth; + char *GraalSegmentMName; + +/*------------------------------------------------------------\ +| | +| Via | +| | +\------------------------------------------------------------*/ + + char GraalViaMType; + char *GraalViaMName; + +/*------------------------------------------------------------\ +| | +| Transistor | +| | +\------------------------------------------------------------*/ + + char GraalTransistorMType; + char *GraalTransistorMName; + long GraalTransistorMWidth; + +/*------------------------------------------------------------\ +| | +| Connector | +| | +\------------------------------------------------------------*/ + + char GraalConnectorMLayer; + long GraalConnectorMWidth; + char *GraalConnectorMName; + char GraalConnectorMOrient; + + char GraalSaveConnectorMOrient; + +/*------------------------------------------------------------\ +| | +| Reference | +| | +\------------------------------------------------------------*/ + + char GraalReferenceMType; + char *GraalReferenceMName; + + char GraalSaveReferenceMType; + +/*------------------------------------------------------------\ +| | +| Instance | +| | +\------------------------------------------------------------*/ + + char GraalInstanceMSym; + char *GraalInstanceMName; + char *GraalInstanceMModel; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Changed Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalTransistorChanged | +| | +\------------------------------------------------------------*/ + +char GraalTransistorChanged( Transistor ) + + phseg_list *Transistor; +{ + return + + ( ( Transistor->NAME != GraalTransistorMName ) || + ( Transistor->LAYER != GraalTransistorMType ) || + ( ( Transistor->WIDTH / SCALE_X ) != GraalTransistorMWidth ) ); +} + +/*------------------------------------------------------------\ +| | +| GraalSegmentChanged | +| | +\------------------------------------------------------------*/ + +char GraalSegmentChanged( Segment ) + + phseg_list *Segment; +{ + return + + ( ( Segment->NAME != GraalSegmentMName ) || + ( Segment->LAYER != GraalSegmentMLayer ) || + ( ( Segment->WIDTH / SCALE_X ) != GraalSegmentMWidth ) ); +} + +/*------------------------------------------------------------\ +| | +| GraalViaChanged | +| | +\------------------------------------------------------------*/ + +char GraalViaChanged( Via ) + + phseg_list *Via; +{ + return ( ( Via->TYPE != GraalViaMType ) || + ( Via->NAME != GraalViaMName ) ); +} + +/*------------------------------------------------------------\ +| | +| GraalConnectorChanged | +| | +\------------------------------------------------------------*/ + +char GraalConnectorChanged( Connector ) + + phcon_list *Connector; +{ + return + + ( ( Connector->NAME != GraalConnectorMName ) || + ( Connector->LAYER != GraalConnectorMLayer ) || + ( ( Connector->WIDTH / SCALE_X ) != GraalConnectorMWidth ) || + ( GraalSaveConnectorMOrient != GraalConnectorMOrient ) ); +} + +/*------------------------------------------------------------\ +| | +| GraalReferenceChanged | +| | +\------------------------------------------------------------*/ + +char GraalReferenceChanged( Reference ) + + phref_list *Reference; +{ + return + + ( ( Reference->NAME != GraalReferenceMName ) || + ( GraalSaveReferenceMType != GraalReferenceMType ) ); +} + +/*------------------------------------------------------------\ +| | +| GraalInstanceChanged | +| | +\------------------------------------------------------------*/ + +char GraalInstanceChanged( Instance ) + + phins_list *Instance; +{ + return + + ( ( Instance->INSNAME != GraalInstanceMName ) || + ( Instance->TRANSF != GraalInstanceMSym ) || + ( Instance->FIGNAME != GraalInstanceMModel ) ); +} + +/*------------------------------------------------------------\ +| | +| GraalEditModify | +| | +\------------------------------------------------------------*/ + +void GraalEditModify() + +{ + graalselect *Select; + rdsrec_list *Rectangle; + rdsrec_list *NewRec; + rdsins_list *Instance; + phins_list *SaveInstance; + void *Pointer; + void *Element; + char FirstUndo; + char Orient; + char MbkOrient; + char MbkLayer; + + rdsbegin(); + + FirstUndo = 1; + + GraalModifyAbort = 0; + GraalModifyApply = 0; + GraalModifyLock = 0; + + for ( Select = GraalHeadSelect; + Select != (graalselect *)NULL; + Select = Select->NEXT ) + { + Rectangle = Select->RECTANGLE; + + if ( IsRdsSegment( Rectangle ) ) + { + Pointer = GRAAL_MBK( Rectangle ); + + MbkLayer = ((phseg_list *)Pointer)->LAYER; + + if ( GET_LYNX_TRANSISTOR_TYPE( MbkLayer ) != RDS_LYNX_TRANSISTOR_EMPTY ) + { + GraalAcceptRectangle( Rectangle ); + GraalDisplayRectangle( Rectangle ); + + GraalTransistorMWidth = ((phseg_list *)Pointer)->WIDTH / SCALE_X; + GraalTransistorMType = ((phseg_list *)Pointer)->LAYER; + GraalTransistorMName = ((phseg_list *)Pointer)->NAME; + + GraalPromptModifyTransistor(); + GraalEnterPanel( &GraalModifyTransistorPanel ); + + GraalModifyLock = GRAAL_TRUE; + + while ( GraalModifyLock ) + { + GraalLimitedLoop( GraalModifyTransistorPanel.PANEL ); + } + + GraalRejectRectangle( Rectangle ); + GraalDisplayRectangle( Rectangle ); + + if ( GraalModifyAbort ) break; + + if ( GraalModifyApply ) + { + if ( ! GraalTransistorChanged( (phseg_list *)Pointer ) ) + + continue; + + if ( FirstUndo ) + { + GraalAddUndo(); + + FirstUndo = 0; + } + + GraalDeleteRectangle( Rectangle ); + GraalAddUndoRec( Rectangle ); + + Element = (void *) + + addphseg( GraalFigureMbk, + GraalTransistorMType , + GraalTransistorMWidth * SCALE_X, + ((phseg_list *)Pointer)->X1, + ((phseg_list *)Pointer)->Y1, + ((phseg_list *)Pointer)->X2, + ((phseg_list *)Pointer)->Y2, + GraalTransistorMName ); + + ((phseg_list *)Element)->TYPE = ((phseg_list *)Pointer)->TYPE; + ((phseg_list *)Element)->USER = (void *)(&GraalFigureMbk->PHSEG); + + if ( ((phseg_list *)Element)->NEXT != (phseg_list *)NULL ) + { + ((phseg_list *)Element)->NEXT->USER = (void *)(&((phseg_list *)Element)->NEXT); + } + + NewRec = GraalAddSegment( ((phseg_list *)Element) ); + GraalAddUndoRec( NewRec ); + + GraalDisplayRectangle( NewRec ); + } + } + } + } + + GraalExitPanel( &GraalModifyTransistorPanel ); + + if ( ! GraalModifyAbort ) + + for ( Select = GraalHeadSelect; + Select != (graalselect *)NULL; + Select = Select->NEXT ) + { + Rectangle = Select->RECTANGLE; + + Pointer = GRAAL_MBK( Rectangle ); + + if ( IsRdsSegment( Rectangle ) ) + { + if ( ( ((phseg_list *)Pointer)->LAYER != NTRANS ) && + ( ((phseg_list *)Pointer)->LAYER != PTRANS ) ) + { + GraalAcceptRectangle( Rectangle ); + GraalDisplayRectangle( Rectangle ); + + GraalSegmentMWidth = ((phseg_list *)Pointer)->WIDTH / SCALE_X; + GraalSegmentMLayer = ((phseg_list *)Pointer)->LAYER; + GraalSegmentMName = ((phseg_list *)Pointer)->NAME; + + GraalPromptModifySegment(); + GraalEnterPanel( &GraalModifySegmentPanel ); + + GraalModifyLock = GRAAL_TRUE; + + while ( GraalModifyLock ) + { + GraalLimitedLoop( GraalModifySegmentPanel.PANEL ); + } + + GraalRejectRectangle( Rectangle ); + GraalDisplayRectangle( Rectangle ); + + if ( GraalModifyAbort ) break; + + if ( GraalModifyApply ) + { + if ( ! GraalSegmentChanged( (phseg_list *)Pointer ) ) + + continue; + + if ( FirstUndo ) + { + GraalAddUndo(); + + FirstUndo = 0; + } + + GraalDeleteRectangle( Rectangle ); + GraalAddUndoRec( Rectangle ); + + Element = (void *) + + addphseg( GraalFigureMbk, + GraalSegmentMLayer, + GraalSegmentMWidth * SCALE_X, + ((phseg_list *)Pointer)->X1, + ((phseg_list *)Pointer)->Y1, + ((phseg_list *)Pointer)->X2, + ((phseg_list *)Pointer)->Y2, + GraalSegmentMName ); + + ((phseg_list *)Element)->TYPE = ((phseg_list *)Pointer)->TYPE; + ((phseg_list *)Element)->USER = (void *)(&GraalFigureMbk->PHSEG); + + if ( ((phseg_list *)Element)->NEXT != (phseg_list *)NULL ) + { + ((phseg_list *)Element)->NEXT->USER = (void *)(&((phseg_list *)Element)->NEXT); + } + + NewRec = GraalAddSegment( ((phseg_list *)Element) ); + GraalAddUndoRec( NewRec ); + + GraalDisplayRectangle( NewRec ); + } + } + } + } + + GraalExitPanel( &GraalModifySegmentPanel ); + + if ( ! GraalModifyAbort ) + + for ( Select = GraalHeadSelect; + Select != (graalselect *)NULL; + Select = Select->NEXT ) + { + Rectangle = Select->RECTANGLE; + + if ( IsRdsVia( Rectangle ) ) + { + GraalAcceptRectangle( Rectangle ); + GraalDisplayRectangle( Rectangle ); + + Pointer = GRAAL_MBK( Rectangle ); + + if ( ( ((phvia_list *)Pointer)->DX == 0 ) && + ( ((phvia_list *)Pointer)->DY == 0 ) ) + { + GraalViaMType = ((phvia_list *)Pointer)->TYPE; + GraalViaMName = ((phvia_list *)Pointer)->NAME; + + GraalPromptModifyVia(); + GraalEnterPanel( &GraalModifyViaPanel ); + + GraalModifyLock = GRAAL_TRUE; + + while ( GraalModifyLock ) + { + GraalLimitedLoop( GraalModifyViaPanel.PANEL ); + } + } + else + { + GraalViaMType = ((phvia_list *)Pointer)->TYPE; + GraalViaMName = ((phvia_list *)Pointer)->NAME; + + GraalPromptModifyBigVia(); + GraalEnterPanel( &GraalModifyBigViaPanel ); + + GraalModifyLock = GRAAL_TRUE; + + while ( GraalModifyLock ) + { + GraalLimitedLoop( GraalModifyBigViaPanel.PANEL ); + } + } + + GraalRejectRectangle( Rectangle ); + GraalDisplayRectangle( Rectangle ); + + if ( GraalModifyAbort ) break; + + if ( GraalModifyApply ) + { + if ( ! GraalViaChanged( (phvia_list *)Pointer ) ) + + continue; + + if ( FirstUndo ) + { + GraalAddUndo(); + + FirstUndo = 0; + } + + GraalDeleteRectangle( Rectangle ); + GraalAddUndoRec( Rectangle ); + + Element = (void *) + + addphvia( GraalFigureMbk, + GraalViaMType, + ((phvia_list *)Pointer)->XVIA, + ((phvia_list *)Pointer)->YVIA, + ((phvia_list *)Pointer)->DX, + ((phvia_list *)Pointer)->DY, GraalViaMName ); + + ((phvia_list *)Element)->USER = (void *)(&GraalFigureMbk->PHVIA); + + if ( ((phvia_list *)Element)->NEXT != (phvia_list *)NULL ) + { + ((phvia_list *)Element)->NEXT->USER = (void *)(&((phvia_list *)Element)->NEXT); + } + + NewRec = GraalAddVia( ((phvia_list *)Element) ); + GraalAddUndoRec( NewRec ); + + GraalDisplayRectangle( NewRec ); + } + } + } + + GraalExitPanel( &GraalModifyViaPanel ); + GraalExitPanel( &GraalModifyBigViaPanel ); + + if ( ! GraalModifyAbort ) + + for ( Select = GraalHeadSelect; + Select != (graalselect *)NULL; + Select = Select->NEXT ) + { + Rectangle = Select->RECTANGLE; + + if ( IsRdsReference( Rectangle ) ) + { + GraalAcceptRectangle( Rectangle ); + GraalDisplayRectangle( Rectangle ); + + Pointer = GRAAL_MBK( Rectangle ); + + GraalReferenceMName = ((phref_list *)Pointer)->NAME; + GraalReferenceMType = + + (strcmp( ((phref_list *)Pointer)->FIGNAME, "ref_ref" )) ? + MBK_REF_CON : MBK_REF_REF; + + GraalSaveReferenceMType = GraalReferenceMType; + + GraalPromptModifyReference(); + GraalEnterPanel( &GraalModifyReferencePanel ); + + GraalModifyLock = GRAAL_TRUE; + + while ( GraalModifyLock ) + { + GraalLimitedLoop( GraalModifyReferencePanel.PANEL ); + } + + GraalRejectRectangle( Rectangle ); + GraalDisplayRectangle( Rectangle ); + + if ( GraalModifyAbort ) break; + + if ( GraalModifyApply ) + { + if ( ! GraalReferenceChanged( (phref_list *)Pointer ) ) + + continue; + + if ( FirstUndo ) + { + GraalAddUndo(); + + FirstUndo = 0; + } + + GraalDeleteRectangle( Rectangle ); + GraalAddUndoRec( Rectangle ); + + Element = (void *) + + addphref( GraalFigureMbk, + (GraalReferenceMType == MBK_REF_REF) ? "ref_ref":"ref_con" , + GraalReferenceMName, + ((phref_list *)Pointer)->XREF, + ((phref_list *)Pointer)->YREF ); + + ((phref_list *)Element)->USER = (void *)(&GraalFigureMbk->PHREF); + + if ( ((phref_list *)Element)->NEXT != (phref_list *)NULL ) + { + ((phref_list *)Element)->NEXT->USER = (void *)(&((phref_list *)Element)->NEXT); + } + + NewRec = GraalAddReference( ((phref_list *)Element) ); + GraalAddUndoRec( NewRec ); + + GraalDisplayRectangle( NewRec ); + } + } + } + + GraalExitPanel( &GraalModifyReferencePanel ); + + if ( ! GraalModifyAbort ) + + for ( Select = GraalHeadSelect; + Select != (graalselect *)NULL; + Select = Select->NEXT ) + { + Rectangle = Select->RECTANGLE; + + if ( IsRdsConnector( Rectangle ) ) + { + GraalAcceptRectangle( Rectangle ); + GraalDisplayRectangle( Rectangle ); + + Pointer = GRAAL_MBK( Rectangle ); + + GraalConnectorMName = ((phcon_list *)Pointer)->NAME; + GraalConnectorMLayer = ((phcon_list *)Pointer)->LAYER; + GraalConnectorMWidth = ((phcon_list *)Pointer)->WIDTH / SCALE_X; + + switch( ((phcon_list *)Pointer)->ORIENT ) + { + case NORTH : GraalConnectorMOrient = GRAAL_NORTH; break; + case SOUTH : GraalConnectorMOrient = GRAAL_SOUTH; break; + case EAST : GraalConnectorMOrient = GRAAL_EAST; break; + case WEST : GraalConnectorMOrient = GRAAL_WEST; break; + } + + GraalSaveConnectorMOrient = GraalConnectorMOrient; + + GraalPromptModifyConnector(); + GraalEnterPanel( &GraalModifyConnectorPanel ); + + GraalModifyLock = GRAAL_TRUE; + + while ( GraalModifyLock ) + { + GraalLimitedLoop( GraalModifyConnectorPanel.PANEL ); + } + + GraalRejectRectangle( Rectangle ); + GraalDisplayRectangle( Rectangle ); + + if ( GraalModifyAbort ) break; + + if ( GraalModifyApply ) + { + if ( ! GraalConnectorChanged( (phcon_list *)Pointer ) ) + + continue; + + if ( FirstUndo ) + { + GraalAddUndo(); + + FirstUndo = 0; + } + + switch( GraalConnectorMOrient ) + { + case GRAAL_NORTH : MbkOrient = NORTH; break; + case GRAAL_SOUTH : MbkOrient = SOUTH; break; + case GRAAL_EAST : MbkOrient = EAST; break; + case GRAAL_WEST : MbkOrient = WEST; break; + } + + GraalDeleteRectangle( Rectangle ); + GraalAddUndoRec( Rectangle ); + + Element = (void *) + + addphcon( GraalFigureMbk, + MbkOrient, + GraalConnectorMName, + ((phcon_list *)Pointer)->XCON, + ((phcon_list *)Pointer)->YCON, + GraalConnectorMLayer, + GraalConnectorMWidth * SCALE_X ); + + ((phcon_list *)Element)->USER = (void *)(&GraalFigureMbk->PHCON); + + if ( ((phcon_list *)Element)->NEXT != (phcon_list *)NULL ) + { + ((phcon_list *)Element)->NEXT->USER = (void *)(&((phcon_list *)Element)->NEXT); + } + + NewRec = GraalAddConnector( ((phcon_list *)Element) ); + GraalAddUndoRec( NewRec ); + + GraalDisplayRectangle( NewRec ); + } + } + } + + GraalExitPanel( &GraalModifyConnectorPanel ); + + if ( ! GraalModifyAbort ) + + for ( Select = GraalHeadSelect; + Select != (graalselect *)NULL; + Select = Select->NEXT ) + { + Rectangle = Select->RECTANGLE; + + if ( IsRdsInstance( Rectangle ) ) + { + GraalAcceptRectangle( Rectangle ); + GraalDisplayRectangle( Rectangle ); + + Pointer = GRAAL_MBK( Rectangle ); + + GraalInstanceMName = ((phins_list *)Pointer)->INSNAME; + GraalInstanceMModel = ((phins_list *)Pointer)->FIGNAME; + GraalInstanceMSym = ((phins_list *)Pointer)->TRANSF; + + GraalPromptModifyInstance(); + GraalEnterPanel( &GraalModifyInstancePanel ); + + GraalModifyLock = GRAAL_TRUE; + + while ( GraalModifyLock ) + { + GraalLimitedLoop( GraalModifyInstancePanel.PANEL ); + } + + GraalRejectRectangle( Rectangle ); + GraalDisplayRectangle( Rectangle ); + + if ( GraalModifyAbort ) break; + + if ( GraalModifyApply ) + { + if ( ! GraalInstanceChanged( (phins_list *)Pointer ) ) + + continue; + + GraalDeleteRectangle( Rectangle ); + + for ( Instance = GraalFigureRds->INSTANCE; + Instance != (rdsins_list *)NULL; + Instance = Instance->NEXT ) + { + if ( Instance->INSNAME == GraalInstanceMName ) + { + if ( ! IsGraalDeleted( Instance->LAYERTAB[ RDS_ABOX ] ) ) + { + GraalErrorMessage( GraalMainWindow, + "All instances must have different names !" ); + break; + } + } + } + + if ( Instance == (rdsins_list *)NULL ) + { + if ( FirstUndo ) + { + GraalAddUndo(); + + FirstUndo = 0; + } + + GraalAddUndoRec( Rectangle ); + + SaveInstance = GraalFigureMbk->PHINS; + GraalFigureMbk->PHINS = (phins_list *)NULL; + + Element = (void *) + + addphins( GraalFigureMbk, + GraalInstanceMModel, + GraalInstanceMName, + GraalInstanceMSym, + ((phins_list *)Pointer)->XINS, + ((phins_list *)Pointer)->YINS ); + + ((phins_list *)Element)->NEXT = SaveInstance; + ((phins_list *)Element)->USER = (void *)(&GraalFigureMbk->PHINS); + + if ( SaveInstance != (phins_list *)NULL ) + { + SaveInstance->USER = (void *)(&((phins_list *)Element)->NEXT); + } + + Instance = GraalAddInstance( ((phins_list *)Element) ); + + GraalDisplayToolsMessage(); + + if ( Instance == (rdsins_list *)NULL ) + { + GraalFigureMbk->PHINS = SaveInstance; + mbkfree( Element ); + + GraalErrorMessage( GraalMainWindow, "Unable to load instance model !" ); + } + else + { + NewRec = Instance->LAYERTAB[ RDS_ABOX ]; + + GraalAddUndoRec( NewRec ); + } + + GraalZoomRefresh(); + } + else + { + GraalUndeleteRectangle( Rectangle ); + } + } + } + } + + GraalExitPanel( &GraalModifyInstancePanel ); + + GraalDelEqui(); + GraalDelPeek(); + GraalDelSelect(); + GraalZoomRefresh(); + + + rdsend(); +} diff --git a/alliance/src/graal/src/GME_modify.h b/alliance/src/graal/src/GME_modify.h new file mode 100644 index 00000000..bea039ce --- /dev/null +++ b/alliance/src/graal/src/GME_modify.h @@ -0,0 +1,134 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Modify.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_MODIFY +# define GRAAL_MODIFY + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char GraalModifyAbort; + extern char GraalModifyLock; + extern char GraalModifyApply; + +/*------------------------------------------------------------\ +| | +| Lock | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Segment | +| | +\------------------------------------------------------------*/ + + extern char GraalSegmentMLayer; + extern long GraalSegmentMWidth; + extern char *GraalSegmentMName; + +/*------------------------------------------------------------\ +| | +| Via | +| | +\------------------------------------------------------------*/ + + extern char GraalViaMType; + extern char *GraalViaMName; + +/*------------------------------------------------------------\ +| | +| Transistor | +| | +\------------------------------------------------------------*/ + + extern char GraalTransistorMType; + extern char *GraalTransistorMName; + extern long GraalTransistorMWidth; + +/*------------------------------------------------------------\ +| | +| Connector | +| | +\------------------------------------------------------------*/ + + extern char GraalConnectorMLayer; + extern long GraalConnectorMWidth; + extern char *GraalConnectorMName; + extern char GraalConnectorMOrient; + +/*------------------------------------------------------------\ +| | +| Reference | +| | +\------------------------------------------------------------*/ + + extern char GraalReferenceMType; + extern char *GraalReferenceMName; + +/*------------------------------------------------------------\ +| | +| Instance | +| | +\------------------------------------------------------------*/ + + extern char GraalInstanceMSym; + extern char *GraalInstanceMName; + extern char *GraalInstanceMModel; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + +# endif diff --git a/alliance/src/graal/src/GME_panel.c b/alliance/src/graal/src/GME_panel.c new file mode 100644 index 00000000..9861261f --- /dev/null +++ b/alliance/src/graal/src/GME_panel.c @@ -0,0 +1,5162 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Panel.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GRM.h" +# include "GMX.h" +# include "GTB.h" +# include "GSB.h" +# include "GME.h" + +# include "GME_panel.h" +# include "GME_message.h" +# include "GME_dialog.h" +# include "GME_modify.h" +# include "GME_search.h" +# include "GME_select.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Panel | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Search View Panel | +| | +\------------------------------------------------------------*/ + + static GraalPanelButtonItem GraalEditSearchViewButton[] = + + { + { + "Continue", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackEditSearchViewContinue, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Abort", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 1, + 1, 1, + CallbackEditSearchViewAbort, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalEditSearchViewPanel = + + { + "View search", + 1, + 0, + GRAAL_EDIT_VIEW_SEARCH_X, + GRAAL_EDIT_VIEW_SEARCH_Y, + 100, + 50, + 1, + 2, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + 2, + GraalEditSearchViewButton + }; + + int GraalEditSearchViewDefaultValues[ 5 ] = + + { + GRAAL_EDIT_VIEW_SEARCH_X, + GRAAL_EDIT_VIEW_SEARCH_Y, + 100, 50, 0 + }; + +/*------------------------------------------------------------\ +| | +| Identify Edit Panel | +| | +\------------------------------------------------------------*/ + + + GraalPanelButtonItem GraalEditIdentifyButton[] = + + { + { + "Text", + "Nothing", NULL, 0, 0, + NULL, + NULL, + 0, 0, + 8, 9, + NULL, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Close", + NULL, NULL, 0, 0, + NULL, + NULL, + 3, 9, + 2, 1, + CallbackEditCloseIdentify, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalEditIdentifyPanel = + + { + "Identify", + 1, + 0, + GRAAL_EDIT_IDENTIFY_X, + GRAAL_EDIT_IDENTIFY_Y, + 360, + 250, + 8, + 10, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + 2, + GraalEditIdentifyButton + }; + + int GraalEditIdentifyDefaultValues[ 5 ] = + + { + GRAAL_EDIT_IDENTIFY_X, + GRAAL_EDIT_IDENTIFY_Y, + 360, 250, 0 + }; + +/*------------------------------------------------------------\ +| | +| Select Panel | +| | +\------------------------------------------------------------*/ + + GraalPanelButtonItem GraalEditSelectButton[] = + + { + { + "Select", + "List", + "List", 0, 0, + NULL, + NULL, + 0, 0, + 8, 9, + CallbackEditSelectList, + (XtPointer)1, + (Widget)NULL + } + , + { + "Accept", + NULL, NULL, 0, 0, + NULL, + NULL, + 1, 9, + 2, 1, + CallbackEditSelectAccept, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Cancel", + NULL, NULL, 0, 0, + NULL, + NULL, + 5, 9, + 2, 1, + CallbackEditSelectCancel, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalEditSelectPanel = + + { + "Select", + 1, + 0, + GRAAL_EDIT_SELECT_X, + GRAAL_EDIT_SELECT_Y, + 360, + 250, + 8, + 10, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + 3, + GraalEditSelectButton + }; + + int GraalEditSelectDefaultValues[ 5 ] = + + { + GRAAL_EDIT_IDENTIFY_X, + GRAAL_EDIT_IDENTIFY_Y, + 360, 250, 0 + }; + +/*------------------------------------------------------------\ +| | +| Search Element Panel | +| | +\------------------------------------------------------------*/ + + static GraalPanelButtonItem GraalEditSearchButton[] = + + { + { + "Connector", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackEditSearchConnector, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Instance", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 1, + 1, 1, + CallbackEditSearchInstance, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Reference", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 2, + 1, 1, + CallbackEditSearchReference, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Segment", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 3, + 1, 1, + CallbackEditSearchSegment, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Via", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 4, + 1, 1, + CallbackEditSearchVia, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Close", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 5, + 1, 1, + CallbackEditCloseSearch, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalEditSearchPanel = + + { + "Search", + 1, + 0, + GRAAL_EDIT_SEARCH_X, + GRAAL_EDIT_SEARCH_Y, + 100, + 150, + 1, + 6, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + 6, + GraalEditSearchButton + }; + + int GraalEditSearchDefaultValues[ 5 ] = + + { + GRAAL_EDIT_SEARCH_X, + GRAAL_EDIT_SEARCH_Y, + 100, 150, 0 + }; + +/*------------------------------------------------------------\ +| | +| Modify Segment Panel | +| | +\------------------------------------------------------------*/ + + static GraalPanelButtonItem GraalModifySegmentButton[MBK_MAX_LAYER+4] = + + { + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifySegmentLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Width", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackModifySegmentWidth, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Name", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackModifySegmentName, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Apply", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackModifySegmentApply, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Cancel", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackModifySegmentCancel, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalModifySegmentPanel = + + { + "Modify Segment", + 1, + 0, + GRAAL_MODIFY_SEGMENT_X, + GRAAL_MODIFY_SEGMENT_Y, + 100, + 500, + 2, + (MBK_MAX_LAYER + 4) / 2, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + MBK_MAX_LAYER + 4, + GraalModifySegmentButton + }; + + int GraalModifySegmentDefaultValues[ 5 ] = + + { + GRAAL_MODIFY_SEGMENT_X, + GRAAL_MODIFY_SEGMENT_Y, + 100, 500, 0 + }; + +/*------------------------------------------------------------\ +| | +| Via Panel | +| | +\------------------------------------------------------------*/ + + static GraalPanelButtonItem GraalModifyViaButton[MBK_MAX_VIA + 3] = + + { + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Name", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyViaName, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Apply", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 10, + 1, 1, + CallbackModifyViaApply, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Cancel", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 11, + 1, 1, + CallbackModifyViaCancel, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalModifyViaPanel = + + { + "Modify Via", + 1, + 0, + GRAAL_MODIFY_VIA_X, + GRAAL_MODIFY_VIA_Y, + 100, + 300, + 1, + MBK_MAX_VIA + 3, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + MBK_MAX_VIA + 3, + GraalModifyViaButton + }; + + int GraalModifyViaDefaultValues[ 5 ] = + + { + GRAAL_MODIFY_VIA_X, + GRAAL_MODIFY_VIA_Y, + 100, 300, 0 + }; + +/*------------------------------------------------------------\ +| | +| BigVia Panel | +| | +\------------------------------------------------------------*/ + + static GraalPanelButtonItem GraalModifyBigViaButton[MBK_MAX_VIA + 3] = + + { + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyBigViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyBigViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyBigViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyBigViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyBigViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyBigViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyBigViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyBigViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyBigViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyBigViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyBigViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyBigViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyBigViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyBigViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyBigViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyBigViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyBigViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyBigViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyBigViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyBigViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyBigViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyBigViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyBigViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyBigViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyBigViaType, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Name", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyBigViaName, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Apply", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 10, + 1, 1, + CallbackModifyBigViaApply, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Cancel", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 11, + 1, 1, + CallbackModifyBigViaCancel, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalModifyBigViaPanel = + + { + "Modify BigVia", + 1, + 0, + GRAAL_MODIFY_BIGVIA_X, + GRAAL_MODIFY_BIGVIA_Y, + 100, + 300, + 1, + MBK_MAX_VIA + 3, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + MBK_MAX_VIA + 3, + GraalModifyBigViaButton + }; + + int GraalModifyBigViaDefaultValues[ 5 ] = + + { + GRAAL_MODIFY_BIGVIA_X, + GRAAL_MODIFY_BIGVIA_Y, + 100, 300, 0 + }; + + +/*------------------------------------------------------------\ +| | +| Transistor Panel | +| | +\------------------------------------------------------------*/ + + static GraalPanelButtonItem GraalModifyTransistorButton[MBK_MAX_LAYER+4] = + + { + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyTransistorType, + (XtPointer)0, + (Widget)NULL + } + , + { + "Width", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackModifyTransistorWidth, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Name", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackModifyTransistorName, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Apply", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackModifyTransistorApply, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Cancel", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackModifyTransistorCancel, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalModifyTransistorPanel = + + { + "Modify Transistor", + 1, + 0, + GRAAL_MODIFY_TRANSISTOR_X, + GRAAL_MODIFY_TRANSISTOR_Y, + 100, + 300, + 2, + (MBK_MAX_LAYER + 4) / 2, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + MBK_MAX_LAYER + 4, + GraalModifyTransistorButton + }; + + int GraalModifyTransistorDefaultValues[ 5 ] = + + { + GRAAL_MODIFY_TRANSISTOR_X, + GRAAL_MODIFY_TRANSISTOR_Y, + 100, 300, 0 + }; + +/*------------------------------------------------------------\ +| | +| Connector Panel | +| | +\------------------------------------------------------------*/ + + static GraalPanelButtonItem GraalModifyConnectorButton[MBK_MAX_LAYER+MBK_MAX_ORIENT+4] = + + { + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyConnectorLayer, + (XtPointer)0, + (Widget)NULL + } + , + { + "Width", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackModifyConnectorWidth, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackModifyConnectorOrient, + (XtPointer)GRAAL_NORTH, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackModifyConnectorOrient, + (XtPointer)GRAAL_SOUTH, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackModifyConnectorOrient, + (XtPointer)GRAAL_EAST, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackModifyConnectorOrient, + (XtPointer)GRAAL_WEST, + (Widget)NULL + } + , + { + "Name", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackModifyConnectorName, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Apply", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackModifyConnectorApply, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Cancel", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackModifyConnectorCancel, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalModifyConnectorPanel = + + { + "Modify Connector", + 1, + 0, + GRAAL_MODIFY_CONNECTOR_X, + GRAAL_MODIFY_CONNECTOR_Y, + 100, + 375, + 2, + (MBK_MAX_LAYER+MBK_MAX_ORIENT+4) / 2, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (MBK_MAX_LAYER+MBK_MAX_ORIENT+4), + GraalModifyConnectorButton + }; + + int GraalModifyConnectorDefaultValues[ 5 ] = + + { + GRAAL_MODIFY_CONNECTOR_X, + GRAAL_MODIFY_CONNECTOR_Y, + 100, 375, 0 + }; + +/*------------------------------------------------------------\ +| | +| Reference Panel | +| | +\------------------------------------------------------------*/ + + static GraalPanelButtonItem GraalModifyReferenceButton[MBK_MAX_REFERENCE+3] = + + { + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyReferenceType, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyReferenceType, + (XtPointer)0, + (Widget)NULL + } + , + { + "Name", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyReferenceName, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Apply", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyReferenceApply, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Cancel", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyReferenceCancel, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalModifyReferencePanel = + + { + "Modify Reference", + 1, + 0, + GRAAL_MODIFY_REFERENCE_X, + GRAAL_MODIFY_REFERENCE_Y, + 100, + 125, + 1, + MBK_MAX_REFERENCE + 3, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + MBK_MAX_REFERENCE + 3, + GraalModifyReferenceButton + }; + + int GraalModifyReferenceDefaultValues[ 5 ] = + + { + GRAAL_MODIFY_REFERENCE_X, + GRAAL_MODIFY_REFERENCE_Y, + 100, 125, 0 + }; + +/*------------------------------------------------------------\ +| | +| Instance Panel | +| | +\------------------------------------------------------------*/ + + static GraalPanelButtonItem GraalModifyInstanceButton[MBK_MAX_SYMMETRY+4] = + + { + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyInstanceSym, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyInstanceSym, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyInstanceSym, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyInstanceSym, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyInstanceSym, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyInstanceSym, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyInstanceSym, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyInstanceSym, + (XtPointer)0, + (Widget)NULL + } + , + { + "Name", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyInstanceName, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Model", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyInstanceModel, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Apply", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyInstanceApply, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Cancel", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackModifyInstanceCancel, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalModifyInstancePanel = + + { + "Modify Instance", + 1, + 0, + GRAAL_MODIFY_INSTANCE_X, + GRAAL_MODIFY_INSTANCE_Y, + 100, + 300, + 1, + MBK_MAX_SYMMETRY + 4, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + MBK_MAX_SYMMETRY + 4, + GraalModifyInstanceButton + }; + + int GraalModifyInstanceDefaultValues[ 5 ] = + + { + GRAAL_MODIFY_INSTANCE_X, + GRAAL_MODIFY_INSTANCE_Y, + 100, 300, 0 + }; + + +/*------------------------------------------------------------\ +| | +| Global Edit | +| | +\------------------------------------------------------------*/ + + static GraalPanelButtonItem GraalEditGlobalButton[] = + + { + { + "Undo", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackEditGlobalUndo, + (XtPointer)0, + (Widget)NULL + } + , + { + "Redo", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 1, + 1, 1, + CallbackEditGlobalRedo, + (XtPointer)0, + (Widget)NULL + } + , + { + "Copy", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 2, + 1, 1, + CallbackEditGlobalCopy, + (XtPointer)0, + (Widget)NULL + } + , + { + "Move", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 3, + 1, 1, + CallbackEditGlobalMove, + (XtPointer)0, + (Widget)NULL + } + , + { + "Delete", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 4, + 1, 1, + CallbackEditGlobalDelete, + (XtPointer)0, + (Widget)NULL + } + , + { + "Stretch", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 5, + 1, 1, + CallbackEditGlobalStretch, + (XtPointer)0, + (Widget)NULL + } + , + { + "Modify", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 6, + 1, 1, + CallbackEditGlobalModify, + (XtPointer)0, + (Widget)NULL + } + , + { + "Identify", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 7, + 1, 1, + CallbackEditGlobalIdentify, + (XtPointer)0, + (Widget)NULL + } + , + { + "Close", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 8, + 1, 1, + CallbackEditCloseGlobal, + (XtPointer)0, + (Widget)NULL + } + }; + + GraalPanelItem GraalEditGlobalPanel = + + { + "Edit", + 1, + 0, + GRAAL_EDIT_GLOBAL_X, + GRAAL_EDIT_GLOBAL_Y, + 100, + 225, + 1, + 9, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + 9, + GraalEditGlobalButton + }; + + int GraalEditGlobalDefaultValues[ 5 ] = + + { + GRAAL_EDIT_GLOBAL_X, + GRAAL_EDIT_GLOBAL_Y, + 100, 225, 0 + }; + +/*------------------------------------------------------------\ +| | +| Global Window | +| | +\------------------------------------------------------------*/ + + static GraalPanelButtonItem GraalWindowGlobalButton[] = + + { + { + "Undo", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackEditGlobalUndo, + (XtPointer)0, + (Widget)NULL + } + , + { + "Redo", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 1, + 1, 1, + CallbackEditGlobalRedo, + (XtPointer)0, + (Widget)NULL + } + , + { + "Copy", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 2, + 1, 1, + CallbackEditGlobalCopy, + (XtPointer)1, + (Widget)NULL + } + , + { + "Move", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 3, + 1, 1, + CallbackEditGlobalMove, + (XtPointer)1, + (Widget)NULL + } + , + { + "Delete", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 4, + 1, 1, + CallbackEditGlobalDelete, + (XtPointer)1, + (Widget)NULL + } + , + { + "Stretch", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 5, + 1, 1, + CallbackEditGlobalStretch, + (XtPointer)1, + (Widget)NULL + } + , + { + "Modify", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 6, + 1, 1, + CallbackEditGlobalModify, + (XtPointer)1, + (Widget)NULL + } + , + { + "Identify", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 7, + 1, 1, + CallbackEditGlobalIdentify, + (XtPointer)1, + (Widget)NULL + } + , + { + "Close", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 8, + 1, 1, + CallbackEditCloseGlobal, + (XtPointer)1, + (Widget)NULL + } + , + NULL + }; + + GraalPanelItem GraalWindowGlobalPanel = + + { + "Window", + 1, + 0, + GRAAL_WINDOW_GLOBAL_X, + GRAAL_WINDOW_GLOBAL_Y, + 100, + 225, + 1, + 9, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + 9, + GraalWindowGlobalButton + }; + + int GraalWindowGlobalDefaultValues[ 5 ] = + + { + GRAAL_WINDOW_GLOBAL_X, + GRAAL_WINDOW_GLOBAL_Y, + 100, 225, 0 + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalBuildPanelModify | +| | +\------------------------------------------------------------*/ + +void GraalBuildPanelModify() + +{ + GraalPanelButtonItem *Button; + long Index; + unsigned char X1; + unsigned char Y1; + + X1 = 0; + Y1 = 0; + + for ( Index = 0; Index < MBK_MAX_LAYER; Index++ ) + { + if ( GRAAL_SEGMENT_NAME_TABLE[ Index ][ 0 ] != (char *)NULL ) + { + Button = &GraalModifySegmentButton[ Index ]; + + Button->LABEL = GRAAL_SEGMENT_NAME_TABLE[ Index ][ 0 ]; + Button->FOREGROUND = GRAAL_SEGMENT_NAME_TABLE[ Index ][ 1 ]; + Button->BACKGROUND = GRAAL_SEGMENT_NAME_TABLE[ Index ][ 2 ]; + + Button->X = X1; + Button->Y = Y1; + Button->CALLDATA = (XtPointer)Index; + + if ( X1 == 1 ) + { + X1 = 0; Y1 = Y1 + 1; + } + else + { + X1 = X1 + 1; + } + } + } + + if ( X1 == 1 ) Y1 = Y1 + 1; + + for ( Index = 0; Index < 4; Index++ ) + { + GraalModifySegmentButton[ MBK_MAX_LAYER + Index ].Y = Y1; + Y1 = Y1 + 1; + } + + GraalModifySegmentPanel.ROW = Y1; + GraalModifySegmentDefaultValues[ 3 ] = Y1 * 25; + + + Y1 = 0; + + for ( Index = 0; Index < MBK_MAX_VIA; Index++ ) + { + if ( GRAAL_VIA_NAME_TABLE[ Index ][ 0 ] != (char *)NULL ) + { + Button = &GraalModifyViaButton[ Index ]; + + Button->LABEL = GRAAL_VIA_NAME_TABLE[ Index ][ 0 ]; + Button->FOREGROUND = GRAAL_VIA_NAME_TABLE[ Index ][ 1 ]; + Button->BACKGROUND = GRAAL_VIA_NAME_TABLE[ Index ][ 2 ]; + + Button->Y = Y1; + Button->CALLDATA = (XtPointer)Index; + + Y1 = Y1 + 1; + } + } + + for ( Index = 0; Index < 3; Index++ ) + { + GraalModifyViaButton[ MBK_MAX_VIA + Index ].Y = Y1; + Y1 = Y1 + 1; + } + + GraalModifyViaPanel.ROW = Y1; + GraalModifyViaDefaultValues[ 3 ] = Y1 * 25; + + Y1 = 0; + + for ( Index = 0; Index < MBK_MAX_VIA; Index++ ) + { + if ( GRAAL_BIGVIA_NAME_TABLE[ Index ][ 0 ] != (char *)NULL ) + { + Button = &GraalModifyBigViaButton[ Index ]; + + Button->LABEL = GRAAL_BIGVIA_NAME_TABLE[ Index ][ 0 ]; + Button->FOREGROUND = GRAAL_BIGVIA_NAME_TABLE[ Index ][ 1 ]; + Button->BACKGROUND = GRAAL_BIGVIA_NAME_TABLE[ Index ][ 2 ]; + + Button->Y = Y1; + Button->CALLDATA = (XtPointer)Index; + + Y1 = Y1 + 1; + } + } + + for ( Index = 0; Index < 3; Index++ ) + { + GraalModifyBigViaButton[ MBK_MAX_VIA + Index ].Y = Y1; + Y1 = Y1 + 1; + } + + GraalModifyBigViaPanel.ROW = Y1; + GraalModifyBigViaDefaultValues[ 3 ] = Y1 * 25; + + X1 = 0; + Y1 = 0; + + for ( Index = 0; Index < MBK_MAX_LAYER; Index++ ) + { + if ( GRAAL_TRANSISTOR_NAME_TABLE[ Index ][ 0 ] != (char *)NULL ) + { + Button = &GraalModifyTransistorButton[ Index ]; + + Button->LABEL = GRAAL_TRANSISTOR_NAME_TABLE[ Index ][ 0 ]; + Button->FOREGROUND = GRAAL_TRANSISTOR_NAME_TABLE[ Index ][ 1 ]; + Button->BACKGROUND = GRAAL_TRANSISTOR_NAME_TABLE[ Index ][ 2 ]; + + + Button->X = X1; + Button->Y = Y1; + Button->CALLDATA = (XtPointer)Index; + + if ( X1 == 1 ) + { + X1 = 0; Y1 = Y1 + 1; + } + else + { + X1 = X1 + 1; + } + } + } + + if ( X1 == 1 ) Y1 = Y1 + 1; + + for ( Index = 0; Index < 4; Index++ ) + { + GraalModifyTransistorButton[ MBK_MAX_LAYER + Index ].Y = Y1; + Y1 = Y1 + 1; + } + + GraalModifyTransistorPanel.ROW = Y1; + GraalModifyTransistorDefaultValues[ 3 ] = Y1 * 25; + + X1 = 0; + Y1 = 0; + + for ( Index = 0; Index < MBK_MAX_LAYER; Index++ ) + { + if ( GRAAL_CONNECTOR_NAME_TABLE[ Index ][ 0 ] != (char *)NULL ) + { + Button = &GraalModifyConnectorButton[ Index ]; + + Button->LABEL = GRAAL_CONNECTOR_NAME_TABLE[ Index ][ 0 ]; + Button->FOREGROUND = GRAAL_CONNECTOR_NAME_TABLE[ Index ][ 1 ]; + Button->BACKGROUND = GRAAL_CONNECTOR_NAME_TABLE[ Index ][ 2 ]; + + Button->X = X1; + Button->Y = Y1; + Button->CALLDATA = (XtPointer)Index; + + if ( X1 == 1 ) + { + X1 = 0; Y1 = Y1 + 1; + } + else + { + X1 = X1 + 1; + } + } + } + + if ( X1 == 1 ) + { + Y1 = Y1 + 1; X1 = 0; + } + + GraalModifyConnectorButton[ MBK_MAX_LAYER ].Y = Y1; + + Y1 = Y1 + 1; + + for ( Index = 0; Index < MBK_MAX_ORIENT; Index++ ) + { + if ( GRAAL_ORIENT_NAME_TABLE[ Index ][ 0 ] != (char *)NULL ) + { + Button = &GraalModifyConnectorButton[ Index + MBK_MAX_LAYER + 1 ]; + + Button->LABEL = GRAAL_ORIENT_NAME_TABLE[ Index ][ 0 ]; + Button->FOREGROUND = GRAAL_ORIENT_NAME_TABLE[ Index ][ 1 ]; + Button->BACKGROUND = GRAAL_ORIENT_NAME_TABLE[ Index ][ 2 ]; + + Button->Y = Y1; + Button->CALLDATA = (XtPointer)Index; + + Y1 = Y1 + 1; + } + } + + for ( Index = 0; Index < 3; Index++ ) + { + GraalModifyConnectorButton[ MBK_MAX_LAYER + + MBK_MAX_ORIENT + Index + 1 ].Y = Y1; + Y1 = Y1 + 1; + } + + GraalModifyConnectorPanel.ROW = Y1; + GraalModifyConnectorDefaultValues[ 3 ] = Y1 * 25; + + Y1 = 0; + + for ( Index = 0; Index < MBK_MAX_REFERENCE; Index++ ) + { + if ( GRAAL_REFERENCE_NAME_TABLE[ Index ][ 0 ] != (char *)NULL ) + { + Button = &GraalModifyReferenceButton[ Index ]; + + Button->LABEL = GRAAL_REFERENCE_NAME_TABLE[ Index ][ 0 ]; + Button->FOREGROUND = GRAAL_REFERENCE_NAME_TABLE[ Index ][ 1 ]; + Button->BACKGROUND = GRAAL_REFERENCE_NAME_TABLE[ Index ][ 2 ]; + + Button->Y = Y1; + Button->CALLDATA = (XtPointer)Index; + + Y1 = Y1 + 1; + } + } + + for ( Index = 0; Index < 3; Index++ ) + { + GraalModifyReferenceButton[ MBK_MAX_REFERENCE + Index ].Y = Y1; + Y1 = Y1 + 1; + } + + GraalModifyReferencePanel.ROW = Y1; + GraalModifyReferenceDefaultValues[ 3 ] = Y1 * 25; + + Y1 = 0; + + for ( Index = 0; Index < MBK_MAX_SYMMETRY; Index++ ) + { + if ( GRAAL_SYMMETRY_NAME_TABLE[ Index ][ 0 ] != (char *)NULL ) + { + Button = &GraalModifyInstanceButton[ Index ]; + + Button->LABEL = GRAAL_SYMMETRY_NAME_TABLE[ Index ][ 0 ]; + Button->FOREGROUND = GRAAL_SYMMETRY_NAME_TABLE[ Index ][ 1 ]; + Button->BACKGROUND = GRAAL_SYMMETRY_NAME_TABLE[ Index ][ 2 ]; + + Button->Y = Y1; + Button->CALLDATA = (XtPointer)Index; + + Y1 = Y1 + 1; + } + } + + for ( Index = 0; Index < 4; Index++ ) + { + GraalModifyInstanceButton[ MBK_MAX_SYMMETRY + Index ].Y = Y1; + Y1 = Y1 + 1; + } + + GraalModifyInstancePanel.ROW = Y1; + GraalModifyInstanceDefaultValues[ 3 ] = Y1 * 25; +} + +/*------------------------------------------------------------\ +| | +| Callback For Global Edit | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackEditGlobalUndo | +| | +\------------------------------------------------------------*/ + +void CallbackEditGlobalUndo( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEditUndo(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditGlobalRedo | +| | +\------------------------------------------------------------*/ + +void CallbackEditGlobalRedo( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEditRedo(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditGlobalCopy | +| | +\------------------------------------------------------------*/ + +void CallbackEditGlobalCopy( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( ClientData ) + { + GraalChangeEditMode( GRAAL_SELECT_WINDOW_COPY, + GraalPromptSelectWindowCopy ); + } + else + { + GraalChangeEditMode( GRAAL_SELECT_POINT_COPY, + GraalPromptSelectPointCopy ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditGlobalMove | +| | +\------------------------------------------------------------*/ + +void CallbackEditGlobalMove( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( ClientData ) + { + GraalChangeEditMode( GRAAL_SELECT_WINDOW_MOVE, + GraalPromptSelectWindowMove ); + } + else + { + GraalChangeEditMode( GRAAL_SELECT_POINT_MOVE, + GraalPromptSelectPointMove ); + } + + rdsend(); +} +/*------------------------------------------------------------\ +| | +| CallbackEditGlobalDelete | +| | +\------------------------------------------------------------*/ + +void CallbackEditGlobalDelete( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( ClientData ) + { + GraalChangeEditMode( GRAAL_SELECT_WINDOW_DELETE, + GraalPromptSelectWindowDelete ); + } + else + { + GraalChangeEditMode( GRAAL_SELECT_POINT_DELETE, + GraalPromptSelectPointDelete ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditGlobalStretch | +| | +\------------------------------------------------------------*/ + +void CallbackEditGlobalStretch( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( ClientData ) + { + GraalChangeEditMode( GRAAL_SELECT_WINDOW_STRETCH, + GraalPromptSelectWindowStretch ); + } + else + { + GraalChangeEditMode( GRAAL_SELECT_POINT_STRETCH, + GraalPromptSelectPointStretch ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditGlobalModify | +| | +\------------------------------------------------------------*/ + +void CallbackEditGlobalModify( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( ClientData ) + { + GraalChangeEditMode( GRAAL_SELECT_WINDOW_MODIFY, + GraalPromptSelectWindowModify ); + } + else + { + GraalChangeEditMode( GRAAL_SELECT_POINT_MODIFY, + GraalPromptSelectPointModify ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditGlobalIdentify | +| | +\------------------------------------------------------------*/ + +void CallbackEditGlobalIdentify( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( ClientData ) + { + GraalChangeEditMode( GRAAL_SELECT_WINDOW_IDENTIFY, + GraalPromptSelectWindowIdentify ); + } + else + { + GraalChangeEditMode( GRAAL_SELECT_POINT_IDENTIFY, + GraalPromptSelectPointIdentify ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditCloseGlobal | +| | +\------------------------------------------------------------*/ + +void CallbackEditCloseGlobal( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( ClientData ) + { + GraalExitPanel( &GraalWindowGlobalPanel ); + } + else + { + GraalExitPanel( &GraalEditGlobalPanel ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Search | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackEditSearchConnector | +| | +\------------------------------------------------------------*/ + +void CallbackEditSearchConnector( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalSearchConnectorDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditSearchInstance | +| | +\------------------------------------------------------------*/ + +void CallbackEditSearchInstance( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalSearchInstanceDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditSearchReference | +| | +\------------------------------------------------------------*/ + +void CallbackEditSearchReference( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalSearchReferenceDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditSearchSegment | +| | +\------------------------------------------------------------*/ + +void CallbackEditSearchSegment( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalSearchSegmentDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditSearchVia | +| | +\------------------------------------------------------------*/ + +void CallbackEditSearchVia( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalSearchViaDialog ); + + rdsend(); +} + + +/*------------------------------------------------------------\ +| | +| CallbackEditCloseSearch | +| | +\------------------------------------------------------------*/ + +void CallbackEditCloseSearch( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalExitPanel( &GraalEditSearchPanel ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For View Search | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackEditSearchViewContinue | +| | +\------------------------------------------------------------*/ + +void CallbackEditSearchViewContinue( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditSearchViewAbort | +| | +\------------------------------------------------------------*/ + +void CallbackEditSearchViewAbort( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalSearchAbort = GRAAL_TRUE; + + GraalExitDialog(); + + rdsbegin(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Identify | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackEditCloseIdentify | +| | +\------------------------------------------------------------*/ + +void CallbackEditCloseIdentify( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalExitPanel( &GraalEditIdentifyPanel ); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDisplayIdentifyMessage | +| | +\------------------------------------------------------------*/ + +void GraalDisplayIdentifyMessage( Message ) + + char *Message; +{ + rdsbegin(); + + XmTextSetString( GraalEditIdentifyButton[0].BUTTON, Message ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Select | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackEditSelectList | +| | +\------------------------------------------------------------*/ + +void CallbackEditSelectList( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmListCallbackStruct *CallData; +{ + rdsbegin(); + + if ( ClientData == (caddr_t)NULL ) + { + CallbackEditSelectAccept( MyWidget, (caddr_t)NULL, (caddr_t)NULL ); + } + else + { + GraalEditSelectRectangle( CallData->item_position - 1 ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditSelectAccept | +| | +\------------------------------------------------------------*/ + +void CallbackEditSelectAccept( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalExitPanel( &GraalEditSelectPanel ); + + GraalExitDialog(); + + GraalEditSelectAccept(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditSelectCancel | +| | +\------------------------------------------------------------*/ + +void CallbackEditSelectCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalExitPanel( &GraalEditSelectPanel ); + + GraalExitDialog(); + + GraalEditSelectCancel(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDisplaySelectList | +| | +\------------------------------------------------------------*/ + +void GraalDisplaySelectList( Message ) + + char *Message; +{ + XmString Label; + + rdsbegin(); + + if ( Message == (char *)NULL ) + { + XmListDeleteAllItems( GraalEditSelectButton[ 0 ].BUTTON ); + } + else + { + Label = XmStringCreateSimple( Message ); + XmListAddItem( GraalEditSelectButton[ 0 ].BUTTON , Label , 0 ); + XmStringFree( Label ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Modify Segment | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackModifySegmentLayer | +| | +\------------------------------------------------------------*/ + +void CallbackModifySegmentLayer( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + long MinWidth; + int NewLayer; + + rdsbegin(); + + NewLayer = (int)ClientData; + + if ( ( GraalSegmentMName == (char *)0 ) && + ( ( NewLayer >= CALU1 ) && + ( NewLayer <= CALU9 ) ) ) + { + NewLayer = GraalSegmentMLayer; + GraalErrorMessage( GraalMainWindow, "Connector must have name !" ); + } + + GraalSegmentMLayer = NewLayer; + MinWidth = GRAAL_SEGMENT_VALUE_TABLE[ GraalSegmentMLayer ][0]; + + if ( GraalSegmentMWidth < MinWidth ) GraalSegmentMWidth = MinWidth; + + GraalPromptModifySegment(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifySegmentWidth | +| | +\------------------------------------------------------------*/ + +void CallbackModifySegmentWidth( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalModifySegmentWidthDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifySegmentName | +| | +\------------------------------------------------------------*/ + +void CallbackModifySegmentName( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalModifySegmentNameDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifySegmentApply | +| | +\------------------------------------------------------------*/ + +void CallbackModifySegmentApply( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalModifyLock = GRAAL_FALSE; + GraalModifyAbort = GRAAL_FALSE; + GraalModifyApply = GRAAL_TRUE; + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifySegmentCancel | +| | +\------------------------------------------------------------*/ + +void CallbackModifySegmentCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalModifyLock = GRAAL_FALSE; + GraalModifyAbort = GRAAL_TRUE; + GraalModifyApply = GRAAL_FALSE; + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Modify Transistor | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackModifyTransistorType | +| | +\------------------------------------------------------------*/ + +void CallbackModifyTransistorType( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + long MinWidth; + + rdsbegin(); + + GraalTransistorMType = (int)ClientData; + MinWidth = GRAAL_SEGMENT_VALUE_TABLE[ GraalTransistorMType ][0]; + + if ( GraalTransistorMWidth < MinWidth ) GraalTransistorMWidth = MinWidth; + + GraalPromptModifyTransistor(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyTransistorWidth | +| | +\------------------------------------------------------------*/ + +void CallbackModifyTransistorWidth( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalModifyTransistorWidthDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyTransistorName | +| | +\------------------------------------------------------------*/ + +void CallbackModifyTransistorName( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalModifyTransistorNameDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyTransistorApply | +| | +\------------------------------------------------------------*/ + +void CallbackModifyTransistorApply( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalModifyLock = GRAAL_FALSE; + GraalModifyAbort = GRAAL_FALSE; + GraalModifyApply = GRAAL_TRUE; + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyTransistorCancel | +| | +\------------------------------------------------------------*/ + +void CallbackModifyTransistorCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalModifyLock = GRAAL_FALSE; + GraalModifyAbort = GRAAL_TRUE; + GraalModifyApply = GRAAL_FALSE; + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Modify Connector | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackModifyConnectorLayer | +| | +\------------------------------------------------------------*/ + +void CallbackModifyConnectorLayer( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + long MinWidth; + + rdsbegin(); + + GraalConnectorMLayer = (int)ClientData; + MinWidth = GRAAL_SEGMENT_VALUE_TABLE[ GraalConnectorMLayer ][0]; + + if ( GraalConnectorMWidth < MinWidth ) GraalConnectorMWidth = MinWidth; + + GraalPromptModifyConnector(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyConnectorOrient | +| | +\------------------------------------------------------------*/ + +void CallbackModifyConnectorOrient( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalConnectorMOrient = (int)ClientData; + + GraalPromptModifyConnector(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyConnectorName | +| | +\------------------------------------------------------------*/ + +void CallbackModifyConnectorName( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalModifyConnectorNameDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyConnectorWidth | +| | +\------------------------------------------------------------*/ + +void CallbackModifyConnectorWidth( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalModifyConnectorWidthDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyConnectorApply | +| | +\------------------------------------------------------------*/ + +void CallbackModifyConnectorApply( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalModifyLock = GRAAL_FALSE; + GraalModifyAbort = GRAAL_FALSE; + GraalModifyApply = GRAAL_TRUE; + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyConnectorCancel | +| | +\------------------------------------------------------------*/ + +void CallbackModifyConnectorCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalModifyLock = GRAAL_FALSE; + GraalModifyAbort = GRAAL_TRUE; + GraalModifyApply = GRAAL_FALSE; + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Modify Reference | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackModifyReferenceType | +| | +\------------------------------------------------------------*/ + +void CallbackModifyReferenceType( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalReferenceMType = (int)ClientData; + + GraalPromptModifyReference(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyReferenceName | +| | +\------------------------------------------------------------*/ + +void CallbackModifyReferenceName( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalModifyReferenceNameDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyReferenceApply | +| | +\------------------------------------------------------------*/ + +void CallbackModifyReferenceApply( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalModifyLock = GRAAL_FALSE; + GraalModifyAbort = GRAAL_FALSE; + GraalModifyApply = GRAAL_TRUE; + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyReferenceCancel | +| | +\------------------------------------------------------------*/ + +void CallbackModifyReferenceCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalModifyLock = GRAAL_FALSE; + GraalModifyAbort = GRAAL_TRUE; + GraalModifyApply = GRAAL_FALSE; + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Modify Instance | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackModifyInstanceSym | +| | +\------------------------------------------------------------*/ + +void CallbackModifyInstanceSym( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalInstanceMSym = (int)ClientData; + + GraalPromptModifyInstance(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyInstanceName | +| | +\------------------------------------------------------------*/ + +void CallbackModifyInstanceName( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalModifyInstanceNameDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyInstanceModel | +| | +\------------------------------------------------------------*/ + +void CallbackModifyInstanceModel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalModifyInstanceModelDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyInstanceApply | +| | +\------------------------------------------------------------*/ + +void CallbackModifyInstanceApply( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalModifyLock = GRAAL_FALSE; + GraalModifyAbort = GRAAL_FALSE; + GraalModifyApply = GRAAL_TRUE; + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyInstanceCancel | +| | +\------------------------------------------------------------*/ + +void CallbackModifyInstanceCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalModifyLock = GRAAL_FALSE; + GraalModifyAbort = GRAAL_TRUE; + GraalModifyApply = GRAAL_FALSE; + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Modify Via | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackModifyViaType | +| | +\------------------------------------------------------------*/ + +void CallbackModifyViaType( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalViaMType = (int)ClientData; + + GraalPromptModifyVia(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyViaName | +| | +\------------------------------------------------------------*/ + +void CallbackModifyViaName( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalModifyViaNameDialog ); + + rdsend(); +} + + +/*------------------------------------------------------------\ +| | +| CallbackModifyViaApply | +| | +\------------------------------------------------------------*/ + +void CallbackModifyViaApply( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalModifyLock = GRAAL_FALSE; + GraalModifyAbort = GRAAL_FALSE; + GraalModifyApply = GRAAL_TRUE; + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyViaCancel | +| | +\------------------------------------------------------------*/ + +void CallbackModifyViaCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalModifyLock = GRAAL_FALSE; + GraalModifyAbort = GRAAL_TRUE; + GraalModifyApply = GRAAL_FALSE; + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Modify BigVia | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackModifyBigViaType | +| | +\------------------------------------------------------------*/ + +void CallbackModifyBigViaType( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalViaMType = (int)ClientData; + + GraalPromptModifyBigVia(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyBigViaName | +| | +\------------------------------------------------------------*/ + +void CallbackModifyBigViaName( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalModifyBigViaNameDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyBigViaApply | +| | +\------------------------------------------------------------*/ + +void CallbackModifyBigViaApply( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalModifyLock = GRAAL_FALSE; + GraalModifyAbort = GRAAL_FALSE; + GraalModifyApply = GRAAL_TRUE; + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackModifyBigViaCancel | +| | +\------------------------------------------------------------*/ + +void CallbackModifyBigViaCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalModifyLock = GRAAL_FALSE; + GraalModifyAbort = GRAAL_TRUE; + GraalModifyApply = GRAAL_FALSE; + + GraalExitDialog(); + + rdsend(); +} diff --git a/alliance/src/graal/src/GME_panel.h b/alliance/src/graal/src/GME_panel.h new file mode 100644 index 00000000..6c69e320 --- /dev/null +++ b/alliance/src/graal/src/GME_panel.h @@ -0,0 +1,172 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Panel.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_EDIT_PANEL +# define GRAAL_EDIT_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define GRAAL_WINDOW_GLOBAL_X 690 +# define GRAAL_WINDOW_GLOBAL_Y 205 + +# define GRAAL_EDIT_GLOBAL_X 890 +# define GRAAL_EDIT_GLOBAL_Y 205 + +# define GRAAL_EDIT_SEARCH_X 890 +# define GRAAL_EDIT_SEARCH_Y 450 +# define GRAAL_EDIT_VIEW_SEARCH_X 790 +# define GRAAL_EDIT_VIEW_SEARCH_Y 450 + +# define GRAAL_EDIT_SELECT_X 330 +# define GRAAL_EDIT_SELECT_Y 280 + +# define GRAAL_EDIT_IDENTIFY_X 330 +# define GRAAL_EDIT_IDENTIFY_Y 280 + +# define GRAAL_MODIFY_SEGMENT_X 790 +# define GRAAL_MODIFY_SEGMENT_Y 230 +# define GRAAL_MODIFY_VIA_X 790 +# define GRAAL_MODIFY_VIA_Y 330 +# define GRAAL_MODIFY_BIGVIA_X 790 +# define GRAAL_MODIFY_BIGVIA_Y 330 +# define GRAAL_MODIFY_TRANSISTOR_X 790 +# define GRAAL_MODIFY_TRANSISTOR_Y 330 +# define GRAAL_MODIFY_CONNECTOR_X 790 +# define GRAAL_MODIFY_CONNECTOR_Y 330 +# define GRAAL_MODIFY_REFERENCE_X 790 +# define GRAAL_MODIFY_REFERENCE_Y 330 +# define GRAAL_MODIFY_INSTANCE_X 790 +# define GRAAL_MODIFY_INSTANCE_Y 330 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackEditGlobalUndo(); + extern void CallbackEditGlobalRedo(); + extern void CallbackEditGlobalCopy(); + extern void CallbackEditGlobalMove(); + extern void CallbackEditGlobalDelete(); + extern void CallbackEditGlobalStretch(); + extern void CallbackEditGlobalModify(); + extern void CallbackEditGlobalIdentify(); + extern void CallbackEditCloseGlobal(); + + extern void CallbackEditSearchConnector(); + extern void CallbackEditSearchInstance(); + extern void CallbackEditSearchReference(); + extern void CallbackEditSearchVia(); + extern void CallbackEditSearchSegment(); + extern void CallbackEditCloseSearch(); + + extern void CallbackEditCloseIdentify(); + + extern void CallbackEditSelectList(); + extern void CallbackEditSelectAccept(); + extern void CallbackEditSelectCancel(); + + extern void CallbackEditSearchViewContinue(); + extern void CallbackEditSearchViewAbort(); + + extern void CallbackModifySegmentLayer(); + extern void CallbackModifySegmentWidth(); + extern void CallbackModifySegmentName(); + extern void CallbackModifySegmentApply(); + extern void CallbackModifySegmentCancel(); + + extern void CallbackModifyConnectorLayer(); + extern void CallbackModifyConnectorWidth(); + extern void CallbackModifyConnectorOrient(); + extern void CallbackModifyConnectorName(); + extern void CallbackModifyConnectorApply(); + extern void CallbackModifyConnectorCancel(); + + extern void CallbackModifyReferenceType(); + extern void CallbackModifyReferenceName(); + extern void CallbackModifyReferenceApply(); + extern void CallbackModifyReferenceCancel(); + + extern void CallbackModifyInstanceSym(); + extern void CallbackModifyInstanceName(); + extern void CallbackModifyInstanceModel(); + extern void CallbackModifyInstanceApply(); + extern void CallbackModifyInstanceCancel(); + + extern void CallbackModifyTransistorType(); + extern void CallbackModifyTransistorWidth(); + extern void CallbackModifyTransistorName(); + extern void CallbackModifyTransistorApply(); + extern void CallbackModifyTransistorCancel(); + + extern void CallbackModifyViaType(); + extern void CallbackModifyViaName(); + extern void CallbackModifyViaApply(); + extern void CallbackModifyViaCancel(); + + extern void CallbackModifyBigViaType(); + extern void CallbackModifyBigViaName(); + extern void CallbackModifyBigViaApply(); + extern void CallbackModifyBigViaCancel(); + + extern void GraalDisplayIdentifyMessage(); + extern void GraalDisplaySelectList(); + +# endif diff --git a/alliance/src/graal/src/GME_search.c b/alliance/src/graal/src/GME_search.c new file mode 100644 index 00000000..54cd9c6b --- /dev/null +++ b/alliance/src/graal/src/GME_search.c @@ -0,0 +1,580 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Search.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GSB.h" +# include "GRM.h" +# include "GMX.h" +# include "GTB.h" +# include "GMV.h" +# include "GME.h" + +# include "GME_search.h" +# include "GME_panel.h" +# include "GME_edit.h" +# include "GME_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + char GraalSearchAbort; + int GraalSearchNumber; + char *GraalSearchString; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalEditInitializeSearch | +| | +\------------------------------------------------------------*/ + +void GraalEditInitializeSearch( Name ) + + char *Name; +{ + char *Star; + + rdsbegin(); + + Star = strrchr( Name, '*' ); + + if ( Star != (char *)NULL ) + { + GraalSearchNumber = (int)(Star - Name); + } + else + { + GraalSearchNumber = 0; + } + + GraalSearchString = Name; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEditSearchCompare | +| | +\------------------------------------------------------------*/ + +int GraalEditSearchCompare( Name ) + + char *Name; +{ + if ( Name != (char *)NULL ) + { + if ( GraalSearchNumber ) + { + return( ! strncmp( GraalSearchString, Name, GraalSearchNumber ) ); + } + else + { + return( Name == GraalSearchString ); + } + } + + return( 0 ); +} + +/*------------------------------------------------------------\ +| | +| GraalEditSearchConnector | +| | +\------------------------------------------------------------*/ + +void GraalEditSearchConnector( ConnectorName ) + + char *ConnectorName; +{ + graalconrec *ScanCon; + graalsearch *Search; + rdsrec_list *Rec; + long X1; + long Y1; + + rdsbegin(); + + GraalEditInitializeSearch( ConnectorName ); + + for ( ScanCon = GraalHeadConRec; + ScanCon != (graalconrec *)NULL; + ScanCon = ScanCon->NEXT ) + { + Rec = ScanCon->RECTANGLE; + + if ( ( ! IsGraalDeleted( Rec ) ) && + ( GraalEditSearchCompare( Rec->NAME ) ) ) + { + GraalAddSearch( Rec ); + } + } + + if ( GraalHeadSearch == (graalsearch *)NULL ) + { + GraalWarningMessage( GraalMainWindow, "No connector found !" ); + } + else + { + for ( Search = GraalHeadSearch; + Search != (graalsearch *)NULL; + Search = Search->NEXT ) + { + Rec = Search->RECTANGLE; + + X1 = ( Rec->X + ( Rec->DX >> 1 ) ) / GRAAL_RDS_LAMBDA; + Y1 = ( Rec->Y + ( Rec->DY >> 1 ) ) / GRAAL_RDS_LAMBDA; + + GraalZoomCenter( X1, Y1 ); + + if ( Search->NEXT != (graalsearch *)NULL ) + { + GraalSearchAbort = GRAAL_FALSE; + + GraalEnterPanel( &GraalEditSearchViewPanel ); + GraalLimitedLoop( GraalEditSearchViewPanel.PANEL ); + + if ( GraalSearchAbort ) break; + } + } + + GraalDelSearch(); + + GraalExitPanel( &GraalEditSearchViewPanel ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEditSearchInstance | +| | +\------------------------------------------------------------*/ + +void GraalEditSearchInstance( InstanceName ) + + char *InstanceName; +{ + graalsearch *Search; + rdsins_list *Instance; + rdsrec_list *Rec; + long X1; + long Y1; + + if ( GraalFigureMbk == (phfig_list *)NULL ) return; + + rdsbegin(); + + GraalEditInitializeSearch( InstanceName ); + + for ( Instance = GraalFigureRds->INSTANCE; + Instance != (rdsins_list *)NULL; + Instance = Instance->NEXT ) + { + if ( ( ! IsGraalDeleted( Instance->LAYERTAB[ RDS_ABOX ] ) ) && + ( GraalEditSearchCompare( Instance->INSNAME ) ) ) + { + GraalAddSearch( Instance->LAYERTAB[ RDS_ABOX ] ); + } + } + + if ( GraalHeadSearch == (graalsearch *)NULL ) + { + GraalWarningMessage( GraalMainWindow, "No instance found !" ); + } + else + { + for ( Search = GraalHeadSearch; + Search != (graalsearch *)NULL; + Search = Search->NEXT ) + { + Rec = Search->RECTANGLE; + + X1 = ( Rec->X + ( Rec->DX >> 1 ) ) / GRAAL_RDS_LAMBDA; + Y1 = ( Rec->Y + ( Rec->DY >> 1 ) ) / GRAAL_RDS_LAMBDA; + + GraalZoomCenter( X1, Y1 ); + + if ( Search->NEXT != (graalsearch *)NULL ) + { + GraalSearchAbort = GRAAL_FALSE; + + GraalEnterPanel( &GraalEditSearchViewPanel ); + GraalLimitedLoop( GraalEditSearchViewPanel.PANEL ); + + if ( GraalSearchAbort ) break; + } + } + + GraalDelSearch(); + + GraalExitPanel( &GraalEditSearchViewPanel ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEditSearchSegment | +| | +\------------------------------------------------------------*/ + +void GraalEditSearchSegment( SegmentName ) + + char *SegmentName; +{ + graalsearch *Search; + rdsins_list *Instance; + rdsfig_list *Figure; + rdsrec_list *Rec; + char Layer; + long X1; + long Y1; + + if ( GraalFigureMbk == (phfig_list *)NULL ) return; + + rdsbegin(); + + GraalEditInitializeSearch( SegmentName ); + + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + for ( Rec = GraalFigureRds->LAYERTAB[ Layer ]; + Rec != (rdsrec_list *)NULL; + Rec = Rec->NEXT ) + { + if ( ( ! IsGraalDeleted( Rec ) ) && + ( IsRdsSegment( Rec ) ) && + ( GraalEditSearchCompare( Rec->NAME ) ) ) + { + GraalAddSearch( Rec ); + } + } + } + + for ( Instance = GraalFigureRds->INSTANCE; + Instance != (rdsins_list *)NULL; + Instance = Instance->NEXT ) + { + if ( IsGraalDeleted( Instance->LAYERTAB[ RDS_ABOX ] ) ) + + continue; + + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + for ( Rec = Instance->LAYERTAB[ Layer ]; + Rec != (rdsrec_list *)NULL; + Rec = Rec->NEXT ) + { + if ( ( IsRdsSegment( Rec ) ) && + ( GraalEditSearchCompare( Rec->NAME ) ) ) + { + GraalAddSearch( Rec ); + } + } + } + } + + if ( GraalHeadSearch == (graalsearch *)NULL ) + { + GraalWarningMessage( GraalMainWindow, "No segment found !" ); + } + else + { + for ( Search = GraalHeadSearch; + Search != (graalsearch *)NULL; + Search = Search->NEXT ) + { + Rec = Search->RECTANGLE; + + X1 = ( Rec->X + ( Rec->DX >> 1 ) ) / GRAAL_RDS_LAMBDA; + Y1 = ( Rec->Y + ( Rec->DY >> 1 ) ) / GRAAL_RDS_LAMBDA; + + GraalZoomCenter( X1, Y1 ); + + if ( Search->NEXT != (graalsearch *)NULL ) + { + GraalSearchAbort = GRAAL_FALSE; + + GraalEnterPanel( &GraalEditSearchViewPanel ); + GraalLimitedLoop( GraalEditSearchViewPanel.PANEL ); + + if ( GraalSearchAbort ) break; + } + } + + GraalDelSearch(); + + GraalExitPanel( &GraalEditSearchViewPanel ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEditSearchReference | +| | +\------------------------------------------------------------*/ + +void GraalEditSearchReference( ReferenceName ) + + char *ReferenceName; +{ + graalsearch *Search; + rdsins_list *Instance; + rdsfig_list *Figure; + rdsrec_list *Rec; + char Layer; + long X1; + long Y1; + + if ( GraalFigureMbk == (phfig_list *)NULL ) return; + + rdsbegin(); + + GraalEditInitializeSearch( ReferenceName ); + + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + for ( Rec = GraalFigureRds->LAYERTAB[ Layer ]; + Rec != (rdsrec_list *)NULL; + Rec = Rec->NEXT ) + { + if ( ( ! IsGraalDeleted( Rec ) ) && + ( IsRdsReference( Rec ) ) && + ( GraalEditSearchCompare( Rec->NAME ) ) ) + { + GraalAddSearch( Rec ); + } + } + } + + for ( Instance = GraalFigureRds->INSTANCE; + Instance != (rdsins_list *)NULL; + Instance = Instance->NEXT ) + { + if ( IsGraalDeleted( Instance->LAYERTAB[ RDS_ABOX ] ) ) + + continue; + + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + for ( Rec = Instance->LAYERTAB[ Layer ]; + Rec != (rdsrec_list *)NULL; + Rec = Rec->NEXT ) + { + if ( ( IsRdsReference( Rec ) ) && + ( GraalEditSearchCompare( Rec->NAME ) ) ) + { + GraalAddSearch( Rec ); + } + } + } + } + + if ( GraalHeadSearch == (graalsearch *)NULL ) + { + GraalWarningMessage( GraalMainWindow, "No reference found !" ); + } + else + { + for ( Search = GraalHeadSearch; + Search != (graalsearch *)NULL; + Search = Search->NEXT ) + { + Rec = Search->RECTANGLE; + + X1 = ( Rec->X + ( Rec->DX >> 1 ) ) / GRAAL_RDS_LAMBDA; + Y1 = ( Rec->Y + ( Rec->DY >> 1 ) ) / GRAAL_RDS_LAMBDA; + + GraalZoomCenter( X1, Y1 ); + + if ( Search->NEXT != (graalsearch *)NULL ) + { + GraalSearchAbort = GRAAL_FALSE; + + GraalEnterPanel( &GraalEditSearchViewPanel ); + GraalLimitedLoop( GraalEditSearchViewPanel.PANEL ); + + if ( GraalSearchAbort ) break; + } + } + + GraalDelSearch(); + + GraalExitPanel( &GraalEditSearchViewPanel ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEditSearchVia | +| | +\------------------------------------------------------------*/ + +void GraalEditSearchVia( ViaName ) + + char *ViaName; +{ + graalsearch *Search; + rdsins_list *Instance; + rdsfig_list *Figure; + rdsrec_list *Rec; + char Layer; + long X1; + long Y1; + + if ( GraalFigureMbk == (phfig_list *)NULL ) return; + + rdsbegin(); + + GraalEditInitializeSearch( ViaName ); + + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + for ( Rec = GraalFigureRds->LAYERTAB[ Layer ]; + Rec != (rdsrec_list *)NULL; + Rec = Rec->NEXT ) + { + if ( ( ! IsGraalDeleted( Rec ) ) && + ( IsRdsVia( Rec ) ) && + ( GraalEditSearchCompare( Rec->NAME ) ) ) + { + GraalAddSearch( Rec ); + } + } + } + + for ( Instance = GraalFigureRds->INSTANCE; + Instance != (rdsins_list *)NULL; + Instance = Instance->NEXT ) + { + if ( IsGraalDeleted( Instance->LAYERTAB[ RDS_ABOX ] ) ) + + continue; + + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + for ( Rec = Instance->LAYERTAB[ Layer ]; + Rec != (rdsrec_list *)NULL; + Rec = Rec->NEXT ) + { + if ( ( IsRdsVia( Rec ) ) && + ( GraalEditSearchCompare( Rec->NAME ) ) ) + { + GraalAddSearch( Rec ); + } + } + } + } + + if ( GraalHeadSearch == (graalsearch *)NULL ) + { + GraalWarningMessage( GraalMainWindow, "No via found !" ); + } + else + { + for ( Search = GraalHeadSearch; + Search != (graalsearch *)NULL; + Search = Search->NEXT ) + { + Rec = Search->RECTANGLE; + + X1 = ( Rec->X + ( Rec->DX >> 1 ) ) / GRAAL_RDS_LAMBDA; + Y1 = ( Rec->Y + ( Rec->DY >> 1 ) ) / GRAAL_RDS_LAMBDA; + + GraalZoomCenter( X1, Y1 ); + + if ( Search->NEXT != (graalsearch *)NULL ) + { + GraalSearchAbort = GRAAL_FALSE; + + GraalEnterPanel( &GraalEditSearchViewPanel ); + GraalLimitedLoop( GraalEditSearchViewPanel.PANEL ); + + if ( GraalSearchAbort ) break; + } + } + + GraalDelSearch(); + + GraalExitPanel( &GraalEditSearchViewPanel ); + } + + rdsend(); +} + diff --git a/alliance/src/graal/src/GME_search.h b/alliance/src/graal/src/GME_search.h new file mode 100644 index 00000000..1ef71fe4 --- /dev/null +++ b/alliance/src/graal/src/GME_search.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Search.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_SEARCH_H +# define GRAAL_SEARCH_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char GraalSearchAbort; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalEditSearchConnector(); + extern void GraalEditSearchInstance(); + extern void GraalEditSearchSegment(); + extern void GraalEditSearchReference(); + +# endif diff --git a/alliance/src/graal/src/GME_select.c b/alliance/src/graal/src/GME_select.c new file mode 100644 index 00000000..15951514 --- /dev/null +++ b/alliance/src/graal/src/GME_select.c @@ -0,0 +1,1723 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Select.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GRM.h" +# include "GMX.h" +# include "GTB.h" +# include "GSB.h" +# include "GME.h" +# include "GMT.h" + +# include "GME_select.h" +# include "GME_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Select Buffer | +| | +\------------------------------------------------------------*/ + + static char GraalSelectBuffer [ GRAAL_SELECT_BUFFER_SIZE ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalAddSelectList | +| | +\------------------------------------------------------------*/ + +void GraalAddSelectList( Rectangle ) + + rdsrec_list *Rectangle; +{ + void *Pointer; + int MbkLayer; + int Orient; + + rdsbegin(); + + GraalSelectBuffer[0] = '\0'; + Pointer = GRAAL_MBK( Rectangle ); + + if ( IsRdsSegment( Rectangle ) ) + { + MbkLayer = ((phseg_list *)Pointer)->LAYER; + + if ( GET_LYNX_TRANSISTOR_TYPE( MbkLayer ) != RDS_LYNX_TRANSISTOR_EMPTY ) + { + sprintf( GraalSelectBuffer, + " TRANSISTOR : %s", + GRAAL_TRANSISTOR_NAME_TABLE[ ((phseg_list *)Pointer)->LAYER ][0] ); + } + else + { + sprintf( GraalSelectBuffer, + " SEGMENT %s : %s", + ( Rectangle->NAME != (char *)NULL ) ? Rectangle->NAME : "None", + GRAAL_SEGMENT_NAME_TABLE[ ((phseg_list *)Pointer)->LAYER ][0] ); + } + } + else + if ( IsRdsConnector( Rectangle ) ) + { + switch( ((phcon_list *)Pointer)->ORIENT ) + { + case NORTH : Orient = GRAAL_NORTH; + break; + case SOUTH : Orient = GRAAL_SOUTH; + break; + case EAST : Orient = GRAAL_EAST; + break; + default : Orient = GRAAL_WEST; + } + + sprintf( GraalSelectBuffer, + " CONNECTOR %s : %s %s", + ( Rectangle->NAME != (char *)NULL ) ? Rectangle->NAME : "None", + GRAAL_CONNECTOR_NAME_TABLE[ ((phcon_list *)Pointer)->LAYER ][0], + GRAAL_ORIENT_NAME_TABLE[ Orient ][0] ); + } + else + if ( IsRdsVia( Rectangle ) ) + { + if ( ( ((phvia_list *)Pointer)->DX == 0 ) && + ( ((phvia_list *)Pointer)->DY == 0 ) ) + { + sprintf( GraalSelectBuffer, + " VIA : %s", + GRAAL_VIA_NAME_TABLE[ ((phvia_list *)Pointer)->TYPE ][0] ); + } + else + { + sprintf( GraalSelectBuffer, + " BIGVIA : %s", + GRAAL_BIGVIA_NAME_TABLE[ ((phvia_list *)Pointer)->TYPE ][0] ); + } + } + else + if ( IsRdsReference( Rectangle ) ) + { + sprintf( GraalSelectBuffer, + " REFERENCE %s : %s", + ( Rectangle->NAME != (char *)NULL ) ? Rectangle->NAME : "None", + ( ! strcmp( ((phref_list *)Pointer)->FIGNAME, "ref_ref" ) ) ? "Ref_Ref" : "Ref_Con" ); + } + else + if ( IsRdsInstance( Rectangle ) ) + { + sprintf( GraalSelectBuffer, + " INSTANCE %s : %s", + ((phins_list *)Pointer)->INSNAME, + ((phins_list *)Pointer)->FIGNAME ); + } + if ( IsRdsFigure( Rectangle ) ) + { + sprintf( GraalSelectBuffer, + " ABUTMENT BOX : %s", + ((phfig_list *)Pointer)->NAME ); + } + + GraalDisplaySelectList( GraalSelectBuffer ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEditSelectRectangle | +| | +\------------------------------------------------------------*/ + +void GraalEditSelectRectangle( Number ) + + int Number; +{ + int Counter; + graalselect *Select; + + rdsbegin(); + + Select = GraalHeadSelect; + + for ( Counter = 0; Counter < Number; Counter++ ) + { + Select = Select->NEXT; + } + + if ( IsGraalAccepted( Select->RECTANGLE ) ) + { + GraalRejectRectangle( Select->RECTANGLE ); + } + else + { + GraalAcceptRectangle( Select->RECTANGLE ); + } + + GraalDisplayRectangle( Select->RECTANGLE ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEditSelectAccept | +| | +\------------------------------------------------------------*/ + +void GraalEditSelectAccept() +{ + rdsbegin(); + + GraalPurgeSelect(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEditSelectCancel | +| | +\------------------------------------------------------------*/ + +void GraalEditSelectCancel() +{ + rdsbegin(); + + GraalEditUnselectAll(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Select Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalEditUnselectAll | +| | +\------------------------------------------------------------*/ + +void GraalEditUnselectAll() +{ + rdsrec_list *Rectangle; + + rdsbegin(); + + if ( GraalHeadSelect != (graalselect *)NULL ) + { + if ( GraalHeadSelect->NEXT == (graalselect *)NULL ) + { + Rectangle = GraalHeadSelect->RECTANGLE; + GraalDelSelect(); + GraalDisplayRectangle( Rectangle ); + } + else + { + GraalDelSelect(); + GraalZoomRefresh(); + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEditSelectPoint | +| | +\------------------------------------------------------------*/ + +void GraalEditSelectPoint( LambdaX1, LambdaY1 ) + + long LambdaX1; + long LambdaY1; +{ + long Offset; + graalwin *ScanWin; + graalwinrec *ScanWinRec; + rdsrec_list *Rec; + rdsrec_list *CheckRec; + graalselect *Select; + char ScanRec; + char Layer; + char StaticLayer; + long X; + long Y; + + rdsbegin(); + + if ( GraalFigureMbk != (phfig_list *)NULL ) + { + LambdaX1 = LambdaX1 * GRAAL_RDS_LAMBDA; + LambdaY1 = LambdaY1 * GRAAL_RDS_LAMBDA; + + X = ( LambdaX1 - GraalWindowXmin ) / GraalWindowSide; + Y = ( LambdaY1 - GraalWindowYmin ) / GraalWindowSide; + + if ( X < 0 ) X = 0; + if ( X > GraalWindowDx ) X = GraalWindowDx - 1; + if ( Y < 0 ) Y = 0; + if ( Y > GraalWindowDy ) Y = GraalWindowDy - 1; + + Offset = Y * GraalWindowDx + X; + + ScanWin = &GraalWindowTable[ Offset ]; + + if ( ScanWin->LAYERTAB != (graalwinrec **)NULL ) + { + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + StaticLayer = RDS_STATIC_LAYER[ Layer ]; + + if ( GRAAL_RDS_ACTIVE_LAYER_TABLE[ StaticLayer ] != 1 ) continue; + + for ( ScanWinRec = ScanWin->LAYERTAB[ Layer ]; + ScanWinRec != (graalwinrec *)NULL; + ScanWinRec = ScanWinRec->NEXT ) + { + for ( ScanRec = 0; ScanRec < GRAAL_MAX_REC ; ScanRec++ ) + { + Rec = ScanWinRec->RECTAB[ ScanRec ]; + + if ( ( Rec != (rdsrec_list *)NULL ) && + ( ! IsGraalDeleted( Rec ) ) && + ( ! IsGraalCut( Rec ) ) && + ( ! IsGraalSelected( Rec ) ) && + ( ! IsGraalDruc( Rec ) ) && + ( Rec->X <= LambdaX1 ) && + ( Rec->Y <= LambdaY1 ) && + ( ( Rec->X + Rec->DX ) >= LambdaX1 ) && + ( ( Rec->Y + Rec->DY ) >= LambdaY1 ) ) + { + if ( IsRdsFigRec( Rec ) ) + { + if ( Layer == RDS_ABOX ) + { + if ( ( Rec->X == LambdaX1 ) || + ( ( Rec->X + Rec->DX ) == LambdaX1 ) ) + { + if ( ( LambdaY1 < Rec->Y ) || + ( LambdaY1 > ( Rec->Y + Rec->DY ) ) ) + + continue; + } + else + if ( ( Rec->Y == LambdaY1 ) || + ( ( Rec->Y + Rec->DY ) == LambdaY1 ) ) + { + if ( ( LambdaX1 < Rec->X ) || + ( LambdaX1 > ( Rec->X + Rec->DX ) ) ) + + continue; + } + else continue; + } + + CheckRec = (rdsrec_list *)Rec->USER; + + while ( Rec != CheckRec ) + { + StaticLayer = RDS_STATIC_LAYER[ GetRdsLayer( CheckRec ) ]; + + if ( GRAAL_RDS_ACTIVE_LAYER_TABLE[ StaticLayer ] != 1 ) + + break; + + CheckRec = (rdsrec_list *)CheckRec->USER; + } + + if ( Rec == CheckRec ) + { + GraalAddSelect( Rec ); + } + } + else + { + if ( Layer == RDS_ABOX ) + { + GraalAddSelect( Rec ); + } + } + } + } + } + } + } + + for ( Select = GraalHeadSelect; + Select != (graalselect *)NULL; + Select = Select->NEXT ) + { + GraalUnselectRectangle( Select->RECTANGLE ); + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEditSelectWindow | +| | +\------------------------------------------------------------*/ + +void GraalEditSelectWindow( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ) + + long LambdaX1; + long LambdaY1; + long LambdaX2; + long LambdaY2; +{ + long Offset; + graalwin *ScanWin; + graalwinrec *ScanWinRec; + rdsrec_list *Rec; + rdsrec_list *CheckRec; + graalselect *Select; + char ScanRec; + char Layer; + char StaticLayer; + long Xmin; + long Ymin; + long Xmax; + long Ymax; + long X; + long Y; + long Swap; + + rdsbegin(); + + if ( ( LambdaX1 != LambdaX2 ) && + ( LambdaY1 != LambdaY2 ) ) + { + if ( LambdaX1 > LambdaX2 ) + { + Swap = LambdaX1; LambdaX1 = LambdaX2; LambdaX2 = Swap; + } + + if ( LambdaY1 > LambdaY2 ) + { + Swap = LambdaY1; LambdaY1 = LambdaY2; LambdaY2 = Swap; + } + } + + if ( GraalFigureMbk != (phfig_list *)NULL ) + { + LambdaX1 = LambdaX1 * GRAAL_RDS_LAMBDA; + LambdaX2 = LambdaX2 * GRAAL_RDS_LAMBDA; + LambdaY1 = LambdaY1 * GRAAL_RDS_LAMBDA; + LambdaY2 = LambdaY2 * GRAAL_RDS_LAMBDA; + + Xmin = ( LambdaX1 - GraalWindowXmin ) / GraalWindowSide; + Xmax = ( LambdaX2 - GraalWindowXmin ) / GraalWindowSide; + Ymin = ( LambdaY1 - GraalWindowYmin ) / GraalWindowSide; + Ymax = ( LambdaY2 - GraalWindowYmin ) / GraalWindowSide; + + if ( Xmin < 0 ) Xmin = 0; + if ( Xmin > GraalWindowDx ) Xmin = GraalWindowDx - 1; + if ( Ymin < 0 ) Ymin = 0; + if ( Ymin > GraalWindowDy ) Ymin = GraalWindowDy - 1; + + if ( Xmax < 0 ) Xmax = 0; + if ( Xmax > GraalWindowDx ) Xmax = GraalWindowDx - 1; + if ( Ymax < 0 ) Ymax = 0; + if ( Ymax > GraalWindowDy ) Ymax = GraalWindowDy - 1; + + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + StaticLayer = RDS_STATIC_LAYER[ Layer ]; + + if ( GRAAL_RDS_ACTIVE_LAYER_TABLE[ StaticLayer ] != 1 ) continue; + + Y = Ymin; + + while ( Y <= Ymax ) + { + X = Xmin; + + while ( X <= Xmax ) + { + Offset = ( Y * GraalWindowDx ) + X; + + ScanWin = &GraalWindowTable[ Offset ]; + + if ( ScanWin->LAYERTAB != (graalwinrec **)NULL ) + { + for ( ScanWinRec = ScanWin->LAYERTAB[ Layer ]; + ScanWinRec != (graalwinrec *)NULL; + ScanWinRec = ScanWinRec->NEXT ) + { + for ( ScanRec = 0; ScanRec < GRAAL_MAX_REC ; ScanRec++ ) + { + Rec = ScanWinRec->RECTAB[ ScanRec ]; + + if ( ( Rec != (rdsrec_list *)NULL ) && + ( ! IsGraalDeleted( Rec ) ) && + ( ! IsGraalCut( Rec ) ) && + ( ! IsGraalAccepted( Rec ) ) && + ( ! IsGraalSelected( Rec ) ) && + ( ! IsGraalDruc( Rec ) ) && + ( Rec->X >= LambdaX1 ) && + ( Rec->Y >= LambdaY1 ) && + ( ( Rec->X + Rec->DX ) <= LambdaX2 ) && + ( ( Rec->Y + Rec->DY ) <= LambdaY2 ) ) + { + if ( ( IsRdsFigRec( Rec ) ) || + ( IsRdsInstance( Rec ) ) ) + { + CheckRec = (rdsrec_list *)Rec->USER; + + while ( Rec != CheckRec ) + { + StaticLayer = RDS_STATIC_LAYER[ GetRdsLayer( CheckRec ) ]; + + if ( GRAAL_RDS_ACTIVE_LAYER_TABLE[ StaticLayer ] != 1 ) + + break; + + CheckRec = (rdsrec_list *)CheckRec->USER; + } + + if ( Rec == CheckRec ) GraalAddSelect( Rec ); + } + } + } + } + } + + X = X + 1; + } + + Y = Y + 1; + } + } + + for ( Select = GraalHeadSelect; + Select != (graalselect *)NULL; + Select = Select->NEXT ) + { + GraalUnselectRectangle( Select->RECTANGLE ); + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEditSelectFence | +| | +\------------------------------------------------------------*/ + +void GraalEditSelectFence( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ) + + long LambdaX1; + long LambdaY1; + long LambdaX2; + long LambdaY2; +{ + long Offset; + graalwin *ScanWin; + graalwinrec *ScanWinRec; + rdsrec_list *Rec; + rdsrec_list *CheckRec; + graalselect *Select; + char ScanRec; + char Layer; + char StaticLayer; + long Xmin; + long Ymin; + long Xmax; + long Ymax; + long X; + long Y; + long Swap; + + rdsbegin(); + + if ( ( LambdaX1 != LambdaX2 ) && + ( LambdaY1 != LambdaY2 ) ) + { + if ( LambdaX1 > LambdaX2 ) + { + Swap = LambdaX1; LambdaX1 = LambdaX2; LambdaX2 = Swap; + } + + if ( LambdaY1 > LambdaY2 ) + { + Swap = LambdaY1; LambdaY1 = LambdaY2; LambdaY2 = Swap; + } + } + + if ( GraalFigureMbk != (phfig_list *)NULL ) + { + LambdaX1 = LambdaX1 * GRAAL_RDS_LAMBDA; + LambdaX2 = LambdaX2 * GRAAL_RDS_LAMBDA; + LambdaY1 = LambdaY1 * GRAAL_RDS_LAMBDA; + LambdaY2 = LambdaY2 * GRAAL_RDS_LAMBDA; + + Xmin = ( LambdaX1 - GraalWindowXmin ) / GraalWindowSide; + Xmax = ( LambdaX2 - GraalWindowXmin ) / GraalWindowSide; + Ymin = ( LambdaY1 - GraalWindowYmin ) / GraalWindowSide; + Ymax = ( LambdaY2 - GraalWindowYmin ) / GraalWindowSide; + + if ( Xmin < 0 ) Xmin = 0; + if ( Xmin > GraalWindowDx ) Xmin = GraalWindowDx - 1; + if ( Ymin < 0 ) Ymin = 0; + if ( Ymin > GraalWindowDy ) Ymin = GraalWindowDy - 1; + + if ( Xmax < 0 ) Xmax = 0; + if ( Xmax > GraalWindowDx ) Xmax = GraalWindowDx - 1; + if ( Ymax < 0 ) Ymax = 0; + if ( Ymax > GraalWindowDy ) Ymax = GraalWindowDy - 1; + + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + StaticLayer = RDS_STATIC_LAYER[ Layer ]; + + if ( GRAAL_RDS_ACTIVE_LAYER_TABLE[ StaticLayer ] != 1 ) continue; + + Y = Ymin; + + while ( Y <= Ymax ) + { + X = Xmin; + + while ( X <= Xmax ) + { + Offset = ( Y * GraalWindowDx ) + X; + + ScanWin = &GraalWindowTable[ Offset ]; + + if ( ScanWin->LAYERTAB != (graalwinrec **)NULL ) + { + for ( ScanWinRec = ScanWin->LAYERTAB[ Layer ]; + ScanWinRec != (graalwinrec *)NULL; + ScanWinRec = ScanWinRec->NEXT ) + { + for ( ScanRec = 0; ScanRec < GRAAL_MAX_REC ; ScanRec++ ) + { + Rec = ScanWinRec->RECTAB[ ScanRec ]; + + if ( ( Rec != (rdsrec_list *)NULL ) && + ( ! IsGraalDeleted( Rec ) ) && + ( ! IsGraalCut( Rec ) ) && + ( ! IsGraalAccepted( Rec ) ) && + ( ! IsGraalSelected( Rec ) ) && + ( ! IsGraalDruc( Rec ) ) && + ( ( Rec->X + Rec->DX ) >= LambdaX1 ) && + ( ( Rec->Y + Rec->DY ) >= LambdaY1 ) && + ( ( Rec->X ) <= LambdaX2 ) && + ( ( Rec->Y ) <= LambdaY2 ) ) + { + if ( ( IsRdsFigRec( Rec ) ) || + ( IsRdsInstance( Rec ) ) ) + { + CheckRec = (rdsrec_list *)Rec->USER; + + while ( Rec != CheckRec ) + { + StaticLayer = RDS_STATIC_LAYER[ GetRdsLayer( CheckRec ) ]; + + if ( GRAAL_RDS_ACTIVE_LAYER_TABLE[ StaticLayer ] != 1 ) + + break; + + CheckRec = (rdsrec_list *)CheckRec->USER; + } + + if ( Rec == CheckRec ) GraalAddSelect( Rec ); + } + } + } + } + } + + X = X + 1; + } + + Y = Y + 1; + } + } + + for ( Select = GraalHeadSelect; + Select != (graalselect *)NULL; + Select = Select->NEXT ) + { + GraalUnselectRectangle( Select->RECTANGLE ); + } + } + + rdsend(); +} + + +/*------------------------------------------------------------\ +| | +| GraalEditSelectPointCopy | +| | +\------------------------------------------------------------*/ + +void GraalEditSelectPointCopy( LambdaX1, LambdaY1 ) + + long LambdaX1; + long LambdaY1; +{ + graalselect *Select; + graalselect *DelSelect; + graalselect **Previous; + + rdsbegin(); + + GraalEditSelectPoint( LambdaX1, LambdaY1 ); + + GraalDisplaySelectList( (char *)NULL ); + + Previous = &GraalHeadSelect; + Select = GraalHeadSelect; + + while ( Select != (graalselect *)NULL ) + { + if ( IsRdsFigure( Select->RECTANGLE ) || + IsRdsInstance( Select->RECTANGLE ) ) + { + DelSelect = Select; + Select = Select->NEXT; + *Previous = Select; + + GraalFreeSelect( DelSelect ); + } + else + { + GraalAddSelectList( Select->RECTANGLE ); + + Previous = &Select->NEXT; + Select = Select->NEXT; + } + } + + if ( GraalHeadSelect == (graalselect *)NULL ) + { + GraalWarningMessage( GraalMainWindow, "No element found !" ); + } + else + { + if ( GraalHeadSelect->NEXT != (graalselect *)NULL ) + { + GraalEnterPanel( &GraalEditSelectPanel ); + GraalLimitedLoop( GraalEditSelectPanel.PANEL ); + } + else + { + GraalAcceptRectangle( GraalHeadSelect->RECTANGLE ); + GraalDisplayRectangle( GraalHeadSelect->RECTANGLE ); + } + + if ( GraalHeadSelect != (graalselect *)NULL ) + { + GraalContinueEditMode( GRAAL_EDIT_COPY_POINT, + GraalPromptEditCopy, 1 ); + } + else + { + GraalChangeEditMode( GRAAL_SELECT_POINT_COPY, + GraalPromptSelectPointCopy ); + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEditSelectWindowCopy | +| | +\------------------------------------------------------------*/ + +void GraalEditSelectWindowCopy( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ) + + long LambdaX1; + long LambdaY1; + long LambdaX2; + long LambdaY2; +{ + graalselect *Select; + graalselect *DelSelect; + graalselect **Previous; + + rdsbegin(); + + GraalEditSelectWindow( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ); + + Previous = &GraalHeadSelect; + Select = GraalHeadSelect; + + while ( Select != (graalselect *)NULL ) + { + if ( IsRdsFigure( Select->RECTANGLE ) || + IsRdsInstance( Select->RECTANGLE ) ) + { + DelSelect = Select; + Select = Select->NEXT; + *Previous = Select; + + GraalFreeSelect( DelSelect ); + } + else + { + GraalAcceptRectangle( Select->RECTANGLE ); + + Previous = &Select->NEXT; + Select = Select->NEXT; + } + } + + if ( GraalHeadSelect == (graalselect *)NULL ) + { + GraalWarningMessage( GraalMainWindow, "No element found !" ); + + GraalChangeEditMode( GRAAL_SELECT_WINDOW_COPY, + GraalPromptSelectWindowCopy ); + } + else + { + if ( GraalHeadSelect->NEXT == (graalselect *)NULL ) + { + GraalDisplayRectangle( GraalHeadSelect->RECTANGLE ); + } + else + { + GraalZoomRefresh(); + } + + GraalContinueEditMode( GRAAL_EDIT_COPY_WINDOW, + GraalPromptEditCopy, 0 ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEditSelectPointMove | +| | +\------------------------------------------------------------*/ + +void GraalEditSelectPointMove( LambdaX1, LambdaY1 ) + + long LambdaX1; + long LambdaY1; +{ + graalselect *Select; + + rdsbegin(); + + GraalEditSelectPoint( LambdaX1, LambdaY1 ); + + GraalDisplaySelectList( (char *)NULL ); + + for ( Select = GraalHeadSelect; + Select != (graalselect *)NULL; + Select = Select->NEXT ) + { + GraalAddSelectList( Select->RECTANGLE ); + } + + if ( GraalHeadSelect == (graalselect *)NULL ) + { + GraalWarningMessage( GraalMainWindow, "No element found !" ); + } + else + { + if ( GraalHeadSelect->NEXT != (graalselect *)NULL ) + { + GraalEnterPanel( &GraalEditSelectPanel ); + GraalLimitedLoop( GraalEditSelectPanel.PANEL ); + } + else + { + GraalAcceptRectangle( GraalHeadSelect->RECTANGLE ); + GraalDisplayRectangle( GraalHeadSelect->RECTANGLE ); + } + + if ( GraalHeadSelect != (graalselect *)NULL ) + { + GraalContinueEditMode( GRAAL_EDIT_MOVE_POINT, + GraalPromptEditMove, 1 ); + } + else + { + GraalChangeEditMode( GRAAL_SELECT_POINT_MOVE, + GraalPromptSelectPointMove ); + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEditSelectWindowMove | +| | +\------------------------------------------------------------*/ + +void GraalEditSelectWindowMove( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ) + + long LambdaX1; + long LambdaY1; + long LambdaX2; + long LambdaY2; +{ + graalselect *Select; + + rdsbegin(); + + GraalEditSelectWindow( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ); + + for ( Select = GraalHeadSelect; + Select != (graalselect *)NULL; + Select = Select->NEXT ) + { + GraalAcceptRectangle( Select->RECTANGLE ); + } + + if ( GraalHeadSelect == (graalselect *)NULL ) + { + GraalWarningMessage( GraalMainWindow, "No element found !" ); + + GraalChangeEditMode( GRAAL_SELECT_WINDOW_MOVE, + GraalPromptSelectWindowMove ); + } + else + { + if ( GraalHeadSelect->NEXT == (graalselect *)NULL ) + { + GraalDisplayRectangle( GraalHeadSelect->RECTANGLE ); + } + else + { + GraalZoomRefresh(); + } + + GraalContinueEditMode( GRAAL_EDIT_MOVE_WINDOW, + GraalPromptEditMove, 0 ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEditSelectPointDelete | +| | +\------------------------------------------------------------*/ + +void GraalEditSelectPointDelete( LambdaX1, LambdaY1 ) + + long LambdaX1; + long LambdaY1; +{ + graalselect *Select; + + rdsbegin(); + + GraalEditSelectPoint( LambdaX1, LambdaY1 ); + + GraalDisplaySelectList( (char *)NULL ); + + for ( Select = GraalHeadSelect; + Select != (graalselect *)NULL; + Select = Select->NEXT ) + { + GraalAddSelectList( Select->RECTANGLE ); + } + + if ( GraalHeadSelect == (graalselect *)NULL ) + { + GraalWarningMessage( GraalMainWindow, "No element found !" ); + } + else + { + if ( GraalHeadSelect->NEXT != (graalselect *)NULL ) + { + GraalEnterPanel( &GraalEditSelectPanel ); + GraalLimitedLoop( GraalEditSelectPanel.PANEL ); + } + else + { + GraalAcceptRectangle( GraalHeadSelect->RECTANGLE ); + GraalDisplayRectangle( GraalHeadSelect->RECTANGLE ); + } + + if ( GraalHeadSelect != (graalselect *)NULL ) + { + GraalEditDelete(); + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEditSelectWindowDelete | +| | +\------------------------------------------------------------*/ + +void GraalEditSelectWindowDelete( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ) + + long LambdaX1; + long LambdaY1; + long LambdaX2; + long LambdaY2; +{ + graalselect *Select; + + rdsbegin(); + + GraalEditSelectWindow( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ); + + for ( Select = GraalHeadSelect; + Select != (graalselect *)NULL; + Select = Select->NEXT ) + { + GraalAcceptRectangle( Select->RECTANGLE ); + } + + if ( GraalHeadSelect == (graalselect *)NULL ) + { + GraalWarningMessage( GraalMainWindow, "No element found !" ); + } + else + { + if ( GraalHeadSelect->NEXT == (graalselect *)NULL ) + { + GraalDisplayRectangle( GraalHeadSelect->RECTANGLE ); + } + else + { + GraalZoomRefresh(); + } + + GraalEditDelete(); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEditSelectWindowStretch | +| | +\------------------------------------------------------------*/ + +void GraalEditSelectWindowStretch( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ) + + long LambdaX1; + long LambdaY1; + long LambdaX2; + long LambdaY2; +{ + graalselect *Select; + graalselect *DelSelect; + graalselect **Previous; + void *Pointer; + + rdsbegin(); + + GraalEditSelectWindow( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ); + + Previous = &GraalHeadSelect; + Select = GraalHeadSelect; + + while ( Select != (graalselect *)NULL ) + { + Pointer = GRAAL_MBK( Select->RECTANGLE ); + + if ( ( IsRdsSegment( Select->RECTANGLE ) ) || + ( IsRdsFigure( Select->RECTANGLE ) ) || + ( ( IsRdsVia( Select->RECTANGLE ) ) && + ( ( ((phvia_list *)Pointer)->DX != 0 ) || + ( ((phvia_list *)Pointer)->DY != 0 ) ) ) ) + { + GraalAcceptRectangle( Select->RECTANGLE ); + + Previous = &Select->NEXT; + Select = Select->NEXT; + } + else + { + DelSelect = Select; + Select = Select->NEXT; + *Previous = Select; + + GraalFreeSelect( DelSelect ); + } + } + + if ( GraalHeadSelect == (graalselect *)NULL ) + { + GraalWarningMessage( GraalMainWindow, "No element found !" ); + + GraalChangeEditMode( GRAAL_SELECT_WINDOW_STRETCH, + GraalPromptSelectWindowStretch ); + } + else + { + if ( GraalHeadSelect->NEXT == (graalselect *)NULL ) + { + GraalDisplayRectangle( GraalHeadSelect->RECTANGLE ); + } + else + { + GraalZoomRefresh(); + } + + GraalContinueEditMode( GRAAL_EDIT_STRETCH_WINDOW, + GraalPromptEditStretch, 0 ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEditSelectPointStretch | +| | +\------------------------------------------------------------*/ + +void GraalEditSelectPointStretch( LambdaX1, LambdaY1 ) + + long LambdaX1; + long LambdaY1; +{ + graalselect *Select; + graalselect *DelSelect; + graalselect **Previous; + void *Pointer; + + rdsbegin(); + + GraalEditSelectPoint( LambdaX1, LambdaY1 ); + + GraalDisplaySelectList( (char *)NULL ); + + Previous = &GraalHeadSelect; + Select = GraalHeadSelect; + + while ( Select != (graalselect *)NULL ) + { + Pointer = GRAAL_MBK( Select->RECTANGLE ); + + if ( ( IsRdsSegment( Select->RECTANGLE ) ) || + ( IsRdsFigure( Select->RECTANGLE ) ) || + ( ( IsRdsVia( Select->RECTANGLE ) ) && + ( ( ((phvia_list *)Pointer)->DX != 0 ) || + ( ((phvia_list *)Pointer)->DY != 0 ) ) ) ) + { + GraalAddSelectList( Select->RECTANGLE ); + + Previous = &Select->NEXT; + Select = Select->NEXT; + } + else + { + DelSelect = Select; + Select = Select->NEXT; + *Previous = Select; + + GraalFreeSelect( DelSelect ); + } + } + + if ( GraalHeadSelect == (graalselect *)NULL ) + { + GraalWarningMessage( GraalMainWindow, "No element found !" ); + } + else + { + if ( GraalHeadSelect->NEXT != (graalselect *)NULL ) + { + GraalEnterPanel( &GraalEditSelectPanel ); + GraalLimitedLoop( GraalEditSelectPanel.PANEL ); + } + else + { + GraalAcceptRectangle( GraalHeadSelect->RECTANGLE ); + GraalDisplayRectangle( GraalHeadSelect->RECTANGLE ); + } + + if ( GraalHeadSelect != (graalselect *)NULL ) + { + GraalContinueEditMode( GRAAL_EDIT_STRETCH_POINT, + GraalPromptEditStretch, 1 ); + } + else + { + GraalChangeEditMode( GRAAL_SELECT_POINT_STRETCH, + GraalPromptSelectPointStretch ); + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEditSelectPointModify | +| | +\------------------------------------------------------------*/ + +void GraalEditSelectPointModify( LambdaX1, LambdaY1 ) + + long LambdaX1; + long LambdaY1; +{ + graalselect *Select; + graalselect *DelSelect; + graalselect **Previous; + + rdsbegin(); + + GraalEditSelectPoint( LambdaX1, LambdaY1 ); + + GraalDisplaySelectList( (char *)NULL ); + + Previous = &GraalHeadSelect; + Select = GraalHeadSelect; + + while ( Select != (graalselect *)NULL ) + { + if ( ! IsRdsFigure( Select->RECTANGLE ) ) + { + GraalAddSelectList( Select->RECTANGLE ); + + Previous = &Select->NEXT; + Select = Select->NEXT; + } + else + { + DelSelect = Select; + Select = Select->NEXT; + *Previous = Select; + + GraalFreeSelect( DelSelect ); + } + } + + if ( GraalHeadSelect == (graalselect *)NULL ) + { + GraalWarningMessage( GraalMainWindow, "No element found !" ); + } + else + { + if ( GraalHeadSelect->NEXT != (graalselect *)NULL ) + { + GraalEnterPanel( &GraalEditSelectPanel ); + GraalLimitedLoop( GraalEditSelectPanel.PANEL ); + } + + if ( GraalHeadSelect != (graalselect *)NULL ) + { + GraalEditModify(); + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEditSelectWindowModify | +| | +\------------------------------------------------------------*/ + +void GraalEditSelectWindowModify( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ) + + long LambdaX1; + long LambdaY1; + long LambdaX2; + long LambdaY2; +{ + graalselect *Select; + graalselect *DelSelect; + graalselect **Previous; + + rdsbegin(); + + GraalEditSelectWindow( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ); + + Previous = &GraalHeadSelect; + Select = GraalHeadSelect; + + while ( Select != (graalselect *)NULL ) + { + if ( ! IsRdsFigure( Select->RECTANGLE ) ) + { + Previous = &Select->NEXT; + Select = Select->NEXT; + } + else + { + DelSelect = Select; + Select = Select->NEXT; + *Previous = Select; + + GraalFreeSelect( DelSelect ); + } + } + + if ( GraalHeadSelect == (graalselect *)NULL ) + { + GraalWarningMessage( GraalMainWindow, "No element found !" ); + } + else + { + GraalEditModify(); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalToolsSelectEqui | +| | +\------------------------------------------------------------*/ + +void GraalToolsSelectEqui( LambdaX1, LambdaY1 ) + + long LambdaX1; + long LambdaY1; +{ + graalselect *Select; + graalselect *DelSelect; + graalselect **Previous; + void *Pointer; + char Delete; + char MbkLayer; + char ViaType; + + rdsbegin(); + + GraalEditSelectPoint( LambdaX1, LambdaY1 ); + + GraalDisplaySelectList( (char *)NULL ); + + Previous = &GraalHeadSelect; + Select = GraalHeadSelect; + + while ( Select != (graalselect *)NULL ) + { + Delete = 0; + + if ( IsRdsSegment( Select->RECTANGLE ) ) + { + Pointer = GRAAL_MBK( Select->RECTANGLE ); + + MbkLayer = ((phseg_list *)Pointer)->LAYER; + + if ( GET_LYNX_TRANSISTOR_TYPE( MbkLayer ) != RDS_LYNX_TRANSISTOR_EMPTY ) + + Delete = 1; + } + else + if ( IsRdsVia( Select->RECTANGLE ) ) + { + Pointer = GRAAL_MBK( Select->RECTANGLE ); + ViaType = ((phvia_list *)Pointer)->TYPE; + + for ( MbkLayer = 0; MbkLayer < MBK_MAX_LAYER; MbkLayer++ ) + { + if ( GET_LYNX_TRANSISTOR_CX( MbkLayer ) == ViaType ) + { + Delete = 1; break; + } + } + } + else + if ( ( IsRdsInstance( Select->RECTANGLE ) ) || + ( IsRdsFigure( Select->RECTANGLE ) ) ) + + Delete = 1; + + if ( Delete ) + { + DelSelect = Select; + Select = Select->NEXT; + *Previous = Select; + + GraalFreeSelect( DelSelect ); + } + else + { + GraalAddSelectList( Select->RECTANGLE ); + + Previous = &Select->NEXT; + Select = Select->NEXT; + } + } + + if ( GraalHeadSelect == (graalselect *)NULL ) + { + GraalWarningMessage( GraalMainWindow, "No element found !" ); + } + else + { + if ( GraalHeadSelect->NEXT != (graalselect *)NULL ) + { + GraalEnterPanel( &GraalEditSelectPanel ); + GraalLimitedLoop( GraalEditSelectPanel.PANEL ); + } + else + { + GraalAcceptRectangle( GraalHeadSelect->RECTANGLE ); + GraalDisplayRectangle( GraalHeadSelect->RECTANGLE ); + } + + if ( GraalHeadSelect != (graalselect *)NULL ) + { + GraalToolsEqui(); + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalToolsSelectFlatten | +| | +\------------------------------------------------------------*/ + +void GraalToolsSelectFlatten( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ) + + long LambdaX1; + long LambdaY1; + long LambdaX2; + long LambdaY2; +{ + graalselect *Select; + graalselect *DelSelect; + graalselect **Previous; + + rdsbegin(); + + GraalEditSelectFence( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ); + + Previous = &GraalHeadSelect; + Select = GraalHeadSelect; + + while ( Select != (graalselect *)NULL ) + { + if ( ( ! IsRdsInstance( Select->RECTANGLE ) ) || + ( IsGraalFlatten( Select->RECTANGLE ) ) ) + { + DelSelect = Select; + Select = Select->NEXT; + *Previous = Select; + + GraalFreeSelect( DelSelect ); + } + else + { + GraalAcceptRectangle( Select->RECTANGLE ); + + Previous = &Select->NEXT; + Select = Select->NEXT; + } + } + + if ( GraalHeadSelect == (graalselect *)NULL ) + { + GraalWarningMessage( GraalMainWindow, "No instance found !" ); + } + else + { + if ( GraalHeadSelect->NEXT == (graalselect *)NULL ) + { + GraalDisplayRectangle( GraalHeadSelect->RECTANGLE ); + } + else + { + GraalZoomRefresh(); + } + + GraalToolsFlatten(); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalToolsSelectUnflatten | +| | +\------------------------------------------------------------*/ + +void GraalToolsSelectUnflatten( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ) + + long LambdaX1; + long LambdaY1; + long LambdaX2; + long LambdaY2; +{ + graalselect *Select; + graalselect *DelSelect; + graalselect **Previous; + + rdsbegin(); + + GraalEditSelectFence( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ); + + Previous = &GraalHeadSelect; + Select = GraalHeadSelect; + + while ( Select != (graalselect *)NULL ) + { + if ( ( ! IsRdsInstance( Select->RECTANGLE ) ) || + ( ! IsGraalFlatten( Select->RECTANGLE ) ) ) + { + DelSelect = Select; + Select = Select->NEXT; + *Previous = Select; + + GraalFreeSelect( DelSelect ); + } + else + { + GraalAcceptRectangle( Select->RECTANGLE ); + + Previous = &Select->NEXT; + Select = Select->NEXT; + } + } + + if ( GraalHeadSelect == (graalselect *)NULL ) + { + GraalWarningMessage( GraalMainWindow, "No instance found !" ); + } + else + { + if ( GraalHeadSelect->NEXT == (graalselect *)NULL ) + { + GraalDisplayRectangle( GraalHeadSelect->RECTANGLE ); + } + else + { + GraalZoomRefresh(); + } + + GraalToolsUnflatten(); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalToolsSelectRealFlatten | +| | +\------------------------------------------------------------*/ + +void GraalToolsSelectRealFlatten( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ) + + long LambdaX1; + long LambdaY1; + long LambdaX2; + long LambdaY2; +{ + graalselect *Select; + graalselect *DelSelect; + graalselect **Previous; + + rdsbegin(); + + GraalEditSelectFence( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ); + + Previous = &GraalHeadSelect; + Select = GraalHeadSelect; + + while ( Select != (graalselect *)NULL ) + { + if ( ( ! IsRdsInstance( Select->RECTANGLE ) ) || + ( IsGraalFlatten( Select->RECTANGLE ) ) ) + { + DelSelect = Select; + Select = Select->NEXT; + *Previous = Select; + + GraalFreeSelect( DelSelect ); + } + else + { + GraalAcceptRectangle( Select->RECTANGLE ); + + Previous = &Select->NEXT; + Select = Select->NEXT; + } + } + + if ( GraalHeadSelect == (graalselect *)NULL ) + { + GraalWarningMessage( GraalMainWindow, "No instance found !" ); + } + else + { + if ( GraalHeadSelect->NEXT == (graalselect *)NULL ) + { + GraalDisplayRectangle( GraalHeadSelect->RECTANGLE ); + } + else + { + GraalZoomRefresh(); + } + + GraalToolsRealFlatten(); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalToolsSelectHierarchyDown | +| | +\------------------------------------------------------------*/ + +void GraalToolsSelectHierarchyDown( LambdaX1, LambdaY1 ) + + long LambdaX1; + long LambdaY1; +{ + graalselect *Select; + graalselect *DelSelect; + graalselect **Previous; + + rdsbegin(); + + GraalEditSelectPoint( LambdaX1, LambdaY1 ); + + GraalDisplaySelectList( (char *)NULL ); + + Previous = &GraalHeadSelect; + Select = GraalHeadSelect; + + while ( Select != (graalselect *)NULL ) + { + if ( ! IsRdsInstance( Select->RECTANGLE ) ) + { + DelSelect = Select; + Select = Select->NEXT; + *Previous = Select; + + GraalFreeSelect( DelSelect ); + } + else + { + GraalAddSelectList( Select->RECTANGLE ); + + Previous = &Select->NEXT; + Select = Select->NEXT; + } + } + + if ( GraalHeadSelect == (graalselect *)NULL ) + { + GraalWarningMessage( GraalMainWindow, "No instance found !" ); + } + else + { + if ( GraalHeadSelect->NEXT != (graalselect *)NULL ) + { + GraalEnterPanel( &GraalEditSelectPanel ); + GraalLimitedLoop( GraalEditSelectPanel.PANEL ); + } + else + { + GraalAcceptRectangle( GraalHeadSelect->RECTANGLE ); + GraalDisplayRectangle( GraalHeadSelect->RECTANGLE ); + } + + if ( GraalHeadSelect != (graalselect *)NULL ) + { + GraalToolsHierarchyDown(); + } + } + + rdsend(); +} diff --git a/alliance/src/graal/src/GME_select.h b/alliance/src/graal/src/GME_select.h new file mode 100644 index 00000000..a39dab4b --- /dev/null +++ b/alliance/src/graal/src/GME_select.h @@ -0,0 +1,69 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Select.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_SELECT +# define GRAAL_SELECT + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define GRAAL_SELECT_BUFFER_SIZE 256 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalEditSelectRectangle(); + +# endif diff --git a/alliance/src/graal/src/GMF.h b/alliance/src/graal/src/GMF.h new file mode 100644 index 00000000..740f4a5b --- /dev/null +++ b/alliance/src/graal/src/GMF.h @@ -0,0 +1,81 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : gmf101.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_GMF +# define GRAAL_GMF + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern GraalMenuItem GraalFileMenu []; + extern char *GRAAL_WORK_LIB; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalBuildFileDialog(); + extern void GraalBuildPanelLibrary(); + + extern void CallbackEnterLibrary(); + + extern void GraalAddDirectoryToCataLibrary(); + +# endif diff --git a/alliance/src/graal/src/GMF_dialog.c b/alliance/src/graal/src/GMF_dialog.c new file mode 100644 index 00000000..49a0aba4 --- /dev/null +++ b/alliance/src/graal/src/GMF_dialog.c @@ -0,0 +1,319 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Dialog.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GRM.h" +# include "GMX.h" +# include "GTB.h" +# include "GSB.h" +# include "GMF.h" + +# include "GMF_dialog.h" +# include "GMF_file.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| File Dialog | +| | +\------------------------------------------------------------*/ + + GraalDialogItem GraalFileOpenDialog = + + { + "Open File", + GRAAL_DIALOG_FILE, + (Widget)NULL, + (void *)CallbackFileOpenOk, + (XtPointer)NULL, + (void *)CallbackFileOpenCancel, + (XtPointer)NULL + }; + + GraalDialogItem GraalFileQuitDialog = + + { + "Do you really want to quit Graal ?", + GRAAL_DIALOG_WARNING, + (Widget)NULL, + (void *)CallbackFileQuitOk, + (XtPointer)NULL, + (void *)CallbackFileQuitCancel, + (XtPointer)NULL + }; + + GraalDialogItem GraalFileSaveAsDialog = + + { + "Save As", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackFileSaveAsOk, + (XtPointer)NULL, + (void *)CallbackFileSaveAsCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalBuildFileDialog | +| | +\------------------------------------------------------------*/ + +void GraalBuildFileDialog() + +{ + rdsbegin(); + + GraalBuildDialog( GraalMainWindow, &GraalFileSaveAsDialog ); + GraalBuildDialog( GraalMainWindow, &GraalFileOpenDialog ); + GraalBuildDialog( GraalMainWindow, &GraalFileQuitDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileQuitOk | +| | +\------------------------------------------------------------*/ + +void CallbackFileQuitOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalExitDialog(); + + if ( GraalHeadUndo != (graalundo *)NULL ) + { + CallbackFileSaveAs( NULL, NULL, NULL ); + GraalHeadUndo = (graalundo *)0; + } + + XtCloseDisplay( XtDisplay( XtParent( MyWidget ) ) ); + GraalExitErrorMessage( 0 ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileQuitCancel | +| | +\------------------------------------------------------------*/ + +void CallbackFileQuitCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileSaveAsOk | +| | +\------------------------------------------------------------*/ + +void CallbackFileSaveAsOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *FileName; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &FileName ); + + FileName = GraalPostTreatString( FileName ); + + XtUnmanageChild( GraalFileSaveAsDialog.WIDGET ); + + GraalExitDialog(); + + GraalFileSaveAs( FileName ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileSaveAsCancel | +| | +\------------------------------------------------------------*/ + +void CallbackFileSaveAsCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalFileSaveAsDialog.WIDGET ); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileOpenOk | +| | +\------------------------------------------------------------*/ + +void CallbackFileOpenOk( MyWidget, ClientData, FileStruct ) + + Widget MyWidget; + caddr_t ClientData; + XmFileSelectionBoxCallbackStruct *FileStruct; +{ + char *FileName; + + rdsbegin(); + + XtUnmanageChild( GraalFileOpenDialog.WIDGET ); + + GraalExitDialog(); + + if ( FileStruct->value != NULL ) + { + XmStringGetLtoR( FileStruct->value, + XmSTRING_DEFAULT_CHARSET, + &FileName + ); + + FileName = GraalPostTreatString( FileName ); + + if ( FileName != (char *)NULL ) + { + if ( GraalHeadUndo != (graalundo *)NULL ) + { + CallbackFileSaveAs( NULL, NULL, NULL ); + } + + GraalFileOpen( FileName, 1 ); + + GraalChangeEditMode( GRAAL_EDIT_MEASURE, + GraalPromptEditMeasure ); + } + else + { + GraalErrorMessage( GraalMainWindow, "Unable to load this file !" ); + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileOpenCancel | +| | +\------------------------------------------------------------*/ + +void CallbackFileOpenCancel( MyWidget, ClientData, FileStruct ) + + Widget MyWidget; + caddr_t ClientData; + XmFileSelectionBoxCallbackStruct *FileStruct; +{ + rdsbegin(); + + XtUnmanageChild( GraalFileOpenDialog.WIDGET ); + + GraalExitDialog(); + + rdsend(); +} diff --git a/alliance/src/graal/src/GMF_dialog.h b/alliance/src/graal/src/GMF_dialog.h new file mode 100644 index 00000000..6c07bf9e --- /dev/null +++ b/alliance/src/graal/src/GMF_dialog.h @@ -0,0 +1,82 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Dialog.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_FILE_DIALOG +# define GRAAL_FILE_DIALOG + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern GraalDialogItem GraalFileOpenDialog; + extern GraalDialogItem GraalFileQuitDialog; + extern GraalDialogItem GraalFileSaveAsDialog; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackFileQuitOk(); + extern void CallbackFileQuitCancel(); + extern void CallbackFileOpenOk(); + extern void CallbackFileOpenCancel(); + extern void CallbackFileSaveAsOk(); + extern void CallbackFileSaveAsCancel(); + +# endif diff --git a/alliance/src/graal/src/GMF_file.c b/alliance/src/graal/src/GMF_file.c new file mode 100644 index 00000000..f9f6f3eb --- /dev/null +++ b/alliance/src/graal/src/GMF_file.c @@ -0,0 +1,330 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : File.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GRM.h" +# include "GMX.h" +# include "GTB.h" +# include "GSB.h" +# include "GMF.h" + +# include "GMF_file.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + char GraalFileFilter[ 10 ] = "*."; + char GraalFileExtention[ 10 ] = "."; + + char GraalFileBuffer[ 128 ]; + char GraalFileDirectoryBuffer[ 512 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalFileNew | +| | +\------------------------------------------------------------*/ + +void GraalFileNew() +{ + rdsbegin(); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + + if ( GraalFigureMbk != (phfig_list *)NULL ) + { + GraalDelEqui(); + GraalDelPeek(); + GraalDelSelect(); + GraalDelDrucFigure(); + GraalDelFigure(); + } + + GraalChangeTopLevelTitle( (char *)NULL ); + + GraalRecomputeBound = GRAAL_TRUE; + + GraalInitializeZoom(); + GraalInitializeUndo(); + GraalClearGraphicWindow( 0, 0, GraalGraphicDx, GraalGraphicDy ); + + GraalRefreshGraphicWindow( 0, 0, + GraalGraphicDx, GraalGraphicDy ); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_NORMAL_CURSOR ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalFileSave | +| | +\------------------------------------------------------------*/ + +void GraalFileSave() +{ + char Ok; + + rdsbegin(); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + + Ok = GraalSaveFigure(); + + GraalDisplayToolsMessage(); + + if ( ! Ok ) + { + GraalErrorMessage( GraalMainWindow, "Unable to save this figure !" ); + } + + GraalInitializeUndo(); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_NORMAL_CURSOR ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalFileSaveAs | +| | +\------------------------------------------------------------*/ + +void GraalFileSaveAs( FileName ) + + char *FileName; +{ + rdsins_list *InstanceRds; + char Ok; + + rdsbegin(); + + if ( FileName == (char *)NULL ) + { + FileName = GraalFigureMbk->NAME; + } + else + { + FileName = namealloc( FileName ); + } + + for ( InstanceRds = GraalFigureRds->INSTANCE; + InstanceRds != (rdsins_list *)NULL; + InstanceRds = InstanceRds->NEXT ) + { + if ( InstanceRds->FIGNAME == FileName ) break; + } + + if ( InstanceRds != (rdsins_list *)NULL ) + { + GraalErrorMessage( GraalMainWindow, + "A figure cannot be part of itself !" ); + } + else + { + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + + GraalFigureMbk->NAME = FileName; + GraalFigureRds->NAME = FileName; + + GraalChangeTopLevelTitle( GraalFigureMbk->NAME ); + + if ( GraalFigureRds->LAYERTAB[ RDS_ABOX ] != (rdsrec_list *)NULL ) + { + GraalFigureRds->LAYERTAB[ RDS_ABOX ]->NAME = FileName; + } + + Ok = GraalSaveFigure(); + + GraalDisplayToolsMessage(); + + if ( ! Ok ) + { + GraalErrorMessage( GraalMainWindow, "Unable to save this figure !" ); + } + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_NORMAL_CURSOR ); + } + + GraalInitializeUndo(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalFileOpen | +| | +\------------------------------------------------------------*/ + +void GraalFileOpen( FileName, DisplayFigure ) + + char *FileName; + int DisplayFigure; +{ + int Index; + char *SWAP_WORK_LIB = WORK_LIB; + + rdsbegin(); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + GraalUndisplayCursor(); + + if ( GraalFigureMbk != (phfig_list *)NULL ) + { + GraalDelEqui(); + GraalDelPeek(); + GraalDelSelect(); + GraalDelDrucFigure(); + GraalInitializeUndo(); + GraalDelFigure(); + } + + GraalRecomputeBound = GRAAL_TRUE; + + if ( GRAAL_WORK_LIB == (char *)NULL ) + { + GRAAL_WORK_LIB = WORK_LIB; + } + + for ( Index = strlen( FileName ); Index >= 0; Index-- ) + { + if ( FileName[ Index ] == '/' ) break; + } + + if ( Index >= 0 ) + { + strcpy( GraalFileDirectoryBuffer, FileName ); + strcpy( GraalFileBuffer, FileName + Index + 1); + + GraalFileDirectoryBuffer[ Index + 1 ] = '\0'; + + WORK_LIB = GraalFileDirectoryBuffer; + } + else + { + strcpy( GraalFileBuffer, FileName ); + + WORK_LIB = GRAAL_WORK_LIB; + } + + Index = strlen( GraalFileBuffer ) - strlen( GraalFileExtention ); + + if ( Index >= 0 ) + { + if ( ! strcmp( GraalFileBuffer + Index, GraalFileExtention ) ) + { + GraalFileBuffer[ Index ] = '\0'; + } + } + + GraalFigureMbk = Graalgetphfig( GraalFileBuffer, 'A' ); + + GraalInitializeUndo(); + + GraalDisplayToolsMessage(); + + if ( GraalFigureMbk == (phfig_list *)NULL ) + { + GraalErrorMessage( GraalMainWindow, "Unable to open this figure !" ); + GraalChangeTopLevelTitle( (char *)NULL ); + GraalInitializeZoom(); + GraalClearGraphicWindow( 0, 0, GraalGraphicDx, GraalGraphicDy ); + } + else + { + GraalAddFigure(); + GraalChangeTopLevelTitle( GraalFigureMbk->NAME ); + GraalInitializeZoom(); + + if ( DisplayFigure ) + { + GraalDisplayFigure( 0, 0, GraalGraphicDx, GraalGraphicDy ); + } + } + + if ( DisplayFigure ) + { + GraalRefreshGraphicWindow( 0, 0, + GraalGraphicDx, GraalGraphicDy ); + } + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_NORMAL_CURSOR ); + GraalDisplayCursor(); + + WORK_LIB = SWAP_WORK_LIB; + + rdsend(); +} diff --git a/alliance/src/graal/src/GMF_file.h b/alliance/src/graal/src/GMF_file.h new file mode 100644 index 00000000..8f0dc96c --- /dev/null +++ b/alliance/src/graal/src/GMF_file.h @@ -0,0 +1,79 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : File.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_FILE +# define GRAAL_FILE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char GraalFileFilter[ 10 ]; + extern char GraalFileExtention[ 10 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalFileNew(); + extern void GraalFileSave(); + extern void GraalFileOpen(); + extern void GraalFileSaveAs(); + +# endif diff --git a/alliance/src/graal/src/GMF_menu.c b/alliance/src/graal/src/GMF_menu.c new file mode 100644 index 00000000..065717b1 --- /dev/null +++ b/alliance/src/graal/src/GMF_menu.c @@ -0,0 +1,327 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Menu.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GRM.h" +# include "GMX.h" +# include "GTB.h" +# include "GSB.h" +# include "GMF.h" + +# include "GMF_menu.h" +# include "GMF_dialog.h" +# include "GMF_file.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Menu | +| | +\------------------------------------------------------------*/ + + GraalMenuItem GraalFileMenu[] = + + { + { + "New", + 'N', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackFileNew, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Open", + 'O', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackFileOpen, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Save ", + 'S', + "CtrlW", + "Ctrl W", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackFileSave, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Save As", + 'A', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackFileSaveAs, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Quit ", + 'Q', + "CtrlQ", + "Ctrl Q", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackFileQuit, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackFileNew | +| | +\------------------------------------------------------------*/ + +void CallbackFileNew( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( GraalHeadUndo != (graalundo *)NULL ) + { + CallbackFileSaveAs( NULL, NULL, NULL ); + } + + GraalFileNew(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileOpen | +| | +\------------------------------------------------------------*/ + +void CallbackFileOpen( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + XmString Filter; + + rdsbegin(); + + if ( GraalFileFilter[2] == '\0' ) + { + strcat( GraalFileFilter, IN_PH ); + strcat( GraalFileExtention, IN_PH ); + + Filter = XmStringCreateSimple( GraalFileFilter ); + + XtVaSetValues( GraalFileOpenDialog.WIDGET, + XmNpattern, Filter, NULL); + + XmStringFree( Filter ); + } + + GraalEnterDialog( &GraalFileOpenDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileSave | +| | +\------------------------------------------------------------*/ + +void CallbackFileSave( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( GraalFigureMbk != (phfig_list *)NULL ) + { + if ( ( GraalFigureMbk->NAME == (char *)NULL ) || + ( ! strcmp( GraalFigureMbk->NAME, + GRAAL_DEFAULT_FIGURE_NAME ) ) ) + + { + CallbackFileSaveAs( NULL, NULL, NULL ); + } + else + { + GraalFileSave(); + } + } + else + { + GraalErrorMessage( GraalMainWindow, "No current figure !" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileSaveAs | +| | +\------------------------------------------------------------*/ + +void CallbackFileSaveAs( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + Arg Args; + XmString SaveAsString; + + rdsbegin(); + + if ( GraalFigureMbk == (phfig_list *)NULL ) + { + GraalErrorMessage( GraalMainWindow, "No current figure !" ); + } + else + { + SaveAsString = XmStringCreateLtoR( GraalFigureMbk->NAME, + XmSTRING_DEFAULT_CHARSET ); + + XtVaSetValues( GraalFileSaveAsDialog.WIDGET, + XmNtextString, SaveAsString, NULL ); + + XmStringFree( SaveAsString ); + + GraalEnterDialog( &GraalFileSaveAsDialog ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileQuit | +| | +\------------------------------------------------------------*/ + +void CallbackFileQuit( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalFileQuitDialog ); + + rdsend(); +} diff --git a/alliance/src/graal/src/GMF_menu.h b/alliance/src/graal/src/GMF_menu.h new file mode 100644 index 00000000..849a37b4 --- /dev/null +++ b/alliance/src/graal/src/GMF_menu.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Menu.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_FILE_MENU +# define GRAAL_FILE_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackFileNew(); + extern void CallbackFileOpen(); + extern void CallbackFileSave(); + extern void CallbackFileSaveAs(); + extern void CallbackFileQuit(); + +# endif diff --git a/alliance/src/graal/src/GMF_panel.c b/alliance/src/graal/src/GMF_panel.c new file mode 100644 index 00000000..d63d7abb --- /dev/null +++ b/alliance/src/graal/src/GMF_panel.c @@ -0,0 +1,886 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Panel.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GRM.h" +# include "GMX.h" +# include "GTB.h" +# include "GSB.h" +# include "GMF.h" + +# include "GMF_panel.h" +# include "GMF_dialog.h" +# include "GMC_dialog.h" +# include "GMT_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + GraalPanelItem GraalLibraryPanel = + + { + "Library", + 1, + 0, + GRAAL_LIBRARY_X, + GRAAL_LIBRARY_Y, + 250, + 375, + 1, + 1, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + 0, + (GraalPanelButtonItem *)NULL + }; + + int GraalLibraryDefaultValues[ 5 ] = + + { + GRAAL_LIBRARY_X, + GRAAL_LIBRARY_Y, + 250, 375, 0 + }; + + static char **GRAAL_CATA_LIB = (char **)NULL; + static char *GRAAL_DEFAULT_LIB = (char *)NULL; + char *GRAAL_WORK_LIB = (char *)NULL; + + static char GraalFirstLibrary = 1; + +/*------------------------------------------------------------\ +| | +| Buffer | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Widget For Library Panel | +| | +\------------------------------------------------------------*/ + + Widget GraalLibraryListLabel; + Widget GraalLibraryList; + + Widget GraalLibraryButtonOk; + Widget GraalLibraryButtonUpdate; + Widget GraalLibraryButtonCancel; + + Widget GraalLibraryCataLabel; + Widget GraalLibraryCata; + + Widget GraalLibraryWorkLabel; + Widget GraalLibraryWork; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalIsDirectory | +| | +\------------------------------------------------------------*/ + +char GraalIsDirectory( FileName ) + + char *FileName; +{ + struct stat Buffer; + + rdsbegin(); + + if ( stat( FileName, &Buffer ) != -1 ) + { + if ( ( Buffer.st_mode & S_IFMT ) == S_IFDIR ) + { + rdsend(); + return( 1 ); + } + } + + rdsend(); + return( 0 ); +} + +/*-----------------------------------------------------------*\ +| | +| GraalAddDirectoryToCataLibrary | +| | +\------------------------------------------------------------*/ + +void GraalAddDirectoryToCataLibrary( Directory ) + + char *Directory; +{ + char **NewCataLib; + int Index; + + if ( ! GraalIsDirectory( Directory ) ) return; + + for ( Index = 0; + CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + if ( ! strcmp( CATA_LIB[ Index ], Directory ) ) return; + } + + NewCataLib = (char **)rdsallocblock( sizeof(char *) * ( Index + 2 )); + + for ( Index = 0; + CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + NewCataLib[ Index ] = CATA_LIB[ Index ]; + } + + NewCataLib[ Index ] = rdsallocblock( strlen( Directory ) + 1 ); + strcpy( NewCataLib[ Index ], Directory ); + + rdsfreeblock( CATA_LIB ); + CATA_LIB = NewCataLib; +} + +/*------------------------------------------------------------\ +| | +| GraalSetLibraryList | +| | +\------------------------------------------------------------*/ + +void GraalSetLibraryList() +{ + int Index; + XmString Label; + + rdsbegin(); + + XmListDeleteAllItems( GraalLibraryList ); + + for ( Index = 0; + GRAAL_CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + Label = XmStringCreateSimple( GRAAL_CATA_LIB[ Index ] ); + XmListAddItem( GraalLibraryList , Label , 0 ); + XmStringFree( Label ); + } + + Label = XmStringCreateSimple( GRAAL_WORK_LIB ); + XmListAddItem( GraalLibraryList , Label , 0 ); + XmStringFree( Label ); + + GRAAL_DEFAULT_LIB = (char *)NULL; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalSetWorkLibrary | +| | +\------------------------------------------------------------*/ + +void GraalSetWorkLibrary() +{ + rdsbegin(); + + XmTextSetString( GraalLibraryWork, GRAAL_WORK_LIB ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalSetCataLibrary | +| | +\------------------------------------------------------------*/ + +void GraalSetCataLibrary() +{ + int Index; + long Length; + char *Buffer; + char *Scan; + + rdsbegin(); + + for ( Index = 0, Length = 0; + GRAAL_CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + Length = Length + strlen( GRAAL_CATA_LIB[ Index ] ) + 1; + } + + Buffer = rdsallocblock( Length + 1 ); + Scan = Buffer; + + for ( Index = 0; + GRAAL_CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + strcpy( Scan, GRAAL_CATA_LIB[ Index ] ); + strcat( Scan, "\n" ); + + Scan = Scan + strlen( Scan ); + } + + XmTextSetString( GraalLibraryCata, Buffer ); + + rdsfreeblock( Buffer ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalInitializeLibrary | +| | +\------------------------------------------------------------*/ + +void GraalInitializeLibrary() +{ + int Index; + + rdsbegin(); + + for ( Index = 0; CATA_LIB[ Index ] != (char *)NULL; Index++ ); + + GRAAL_CATA_LIB = (char **)rdsallocblock( sizeof(char *) * ( Index + 1 )); + + for ( Index = 0; + CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + GRAAL_CATA_LIB[ Index ] = rdsallocblock( strlen( CATA_LIB[ Index ] ) + 1 ); + strcpy( GRAAL_CATA_LIB[ Index ], CATA_LIB[ Index ] ); + } + + GRAAL_CATA_LIB[ Index ] = (char *)NULL; + + GRAAL_WORK_LIB = rdsallocblock( strlen( WORK_LIB ) + 1 ); + strcpy( GRAAL_WORK_LIB, WORK_LIB ); + + GraalSetCataLibrary(); + GraalSetWorkLibrary(); + GraalSetLibraryList(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalGetCataLibrary | +| | +\------------------------------------------------------------*/ + + void GraalGetCataLibrary() + { + char *NewCata; + char *Scan; + int Index; + int Count; + int Length; + + rdsbegin(); + + for ( Index = 0; + GRAAL_CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + rdsfreeblock( GRAAL_CATA_LIB[ Index ] ); + } + + rdsfreeblock( GRAAL_CATA_LIB ); + + NewCata = XmTextGetString( GraalLibraryCata ); + + Count = 1; + + for ( Index = 0; NewCata[ Index ] != '\0'; Index++ ) + { + if ( NewCata[ Index ] == '\n' ) + { + Count = Count + 1; + } + } + + GRAAL_CATA_LIB = (char **)rdsallocblock( sizeof(char *) * ( Count + 1 )); + + Count = 0; + Scan = NewCata; + + for ( Index = 0; NewCata[ Index ] != '\0'; Index++ ) + { + if ( NewCata[ Index ] == '\n' ) + { + NewCata[ Index ] = '\0'; + + Length = strlen( Scan ); + + if ( ( Length > 0 ) && + ( GraalIsDirectory( Scan ) ) ) + { + GRAAL_CATA_LIB[ Count ] = rdsallocblock( Length + 1 ); + strcpy( GRAAL_CATA_LIB[ Count ], Scan ); + Count = Count + 1; + } + + Scan = NewCata + Index + 1; + } + else + if ( NewCata[ Index ] == ' ' ) + { + NewCata[ Index ] = '\0'; + } + } + + Length = strlen( Scan ); + + if ( Length > 0 ) + { + GRAAL_CATA_LIB[ Count ] = rdsallocblock( Length + 1 ); + strcpy( GRAAL_CATA_LIB[ Count ], Scan ); + Count = Count + 1; + } + + GRAAL_CATA_LIB[ Count ] = (char *)NULL; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalGetWorkLibrary | +| | +\------------------------------------------------------------*/ + +void GraalGetWorkLibrary() +{ + char *NewWork; + + rdsbegin(); + + rdsfreeblock( GRAAL_WORK_LIB ); + + NewWork = XmTextGetString( GraalLibraryWork ); + + if ( GraalIsDirectory( NewWork ) ) + { + GRAAL_WORK_LIB = rdsallocblock( strlen( NewWork ) + 1 ); + strcpy( GRAAL_WORK_LIB, NewWork ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLibraryList | +| | +\------------------------------------------------------------*/ + +void CallbackLibraryList( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmListCallbackStruct *CallData; +{ + rdsbegin(); + + GRAAL_DEFAULT_LIB = GRAAL_CATA_LIB[ CallData->item_position - 1 ]; + + if ( GRAAL_DEFAULT_LIB == (char *)NULL ) + { + GRAAL_DEFAULT_LIB = GRAAL_WORK_LIB; + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLibraryOk | +| | +\------------------------------------------------------------*/ + +void CallbackLibraryOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + XmString Label; + int Index; + + rdsbegin(); + + GraalExitPanel( &GraalLibraryPanel ); + + GraalExitDialog(); + + if ( GraalFirstLibrary == 0 ) + { + for ( Index = 0; + CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + rdsfreeblock( CATA_LIB[ Index ] ); + } + + rdsfreeblock( CATA_LIB ); + rdsfreeblock( WORK_LIB ); + } + + GraalFirstLibrary = 0; + + CATA_LIB = GRAAL_CATA_LIB; + WORK_LIB = GRAAL_WORK_LIB; + + if ( GRAAL_DEFAULT_LIB != (char *)NULL ) + { + Label = XmStringCreateSimple( GRAAL_DEFAULT_LIB ); + + XtVaSetValues( GraalFileOpenDialog.WIDGET, + XmNdirectory, Label, NULL ); + + XtVaSetValues( GraalChangeInstanceModelDialog.WIDGET, + XmNdirectory, Label, NULL ); + + XtVaSetValues( GraalToolsLoadErrorDialog.WIDGET, + XmNdirectory, Label, NULL ); + + XmStringFree( Label ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLibraryUpdate | +| | +\------------------------------------------------------------*/ + +void CallbackLibraryUpdate( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalGetCataLibrary(); + GraalGetWorkLibrary(); + GraalSetLibraryList(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLibraryCancel | +| | +\------------------------------------------------------------*/ + +void CallbackLibraryCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + int Index; + + rdsbegin(); + + for ( Index = 0; + GRAAL_CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + rdsfreeblock( GRAAL_CATA_LIB[ Index ] ); + } + + rdsfreeblock( GRAAL_CATA_LIB ); + rdsfreeblock( GRAAL_WORK_LIB ); + + GraalExitPanel( &GraalLibraryPanel ); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEnterLibrary | +| | +\------------------------------------------------------------*/ + +void CallbackEnterLibrary( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalInitializeLibrary(); + + GraalEnterPanel( &GraalLibraryPanel ); + GraalLimitedLoop( GraalLibraryPanel.PANEL ); + GraalReEnterDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalBuildPanelLibrary | +| | +\------------------------------------------------------------*/ + +void GraalBuildPanelLibrary() +{ + Arg Args[15]; + XmString Label; + + rdsbegin(); + + XtSetArg( Args[0], XmNshadowType , XmSHADOW_ETCHED_IN ); + XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING ); + XtSetArg( Args[2], XmNtitle , GraalLibraryPanel.TITLE ); + + GraalLibraryPanel.PANEL = + + XmCreateFormDialog( GraalMainWindow, "GraalLibraryPanel", Args, 3); + + XtAddCallback( GraalLibraryPanel.PANEL, XmNdestroyCallback, + GraalDestroyDialogCallback, NULL ); + + GraalLibraryPanel.PANEL_FORM = + + XtVaCreateManagedWidget( "GraalLibraryPanelForm", + xmFormWidgetClass, + GraalLibraryPanel.PANEL, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , 10, + NULL + ); + + GraalLibraryPanel.FRAME = + + XtVaCreateManagedWidget( "GraalLibraryFrame", + xmFrameWidgetClass, + GraalLibraryPanel.PANEL_FORM, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + NULL + ); + + GraalLibraryPanel.FORM = + + XtVaCreateManagedWidget( "GraalLibraryForm", + xmFormWidgetClass, + GraalLibraryPanel.FRAME, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , 120, + NULL + ); + + GraalLibraryButtonUpdate = + + XtVaCreateManagedWidget( "Update", + xmPushButtonWidgetClass, + GraalLibraryPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 10, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 40, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 105, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 115, + NULL + ); + + GraalLibraryButtonOk = + + XtVaCreateManagedWidget( "Ok", + xmPushButtonWidgetClass, + GraalLibraryPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 50, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 70, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 105, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 115, + NULL + ); + + GraalLibraryButtonCancel = + + XtVaCreateManagedWidget( "Cancel", + xmPushButtonWidgetClass, + GraalLibraryPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 80, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 110, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 105, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 115, + NULL + ); + + Label = XmStringCreateSimple( "Directories" ); + + GraalLibraryListLabel = + + XtVaCreateManagedWidget( "GraalLibraryListLabel", + xmLabelGadgetClass , + GraalLibraryPanel.FORM, + XmNlabelString , Label, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 5, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 5, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 10, + NULL ); + + XmStringFree( Label ); + + XtSetArg( Args[0] , XmNtopAttachment , XmATTACH_POSITION ); + XtSetArg( Args[1] , XmNtopPosition , 10 ); + XtSetArg( Args[2] , XmNbottomAttachment , XmATTACH_POSITION ); + XtSetArg( Args[3] , XmNbottomPosition , 40 ); + XtSetArg( Args[4] , XmNrightAttachment , XmATTACH_POSITION ); + XtSetArg( Args[5] , XmNrightPosition , 115 ); + XtSetArg( Args[6] , XmNleftAttachment , XmATTACH_POSITION ); + XtSetArg( Args[7] , XmNleftPosition , 5 ); + XtSetArg( Args[8] , XmNscrollBarDisplayPolicy, XmSTATIC ); + XtSetArg( Args[9] , XmNscrollHorizontal , True ); + XtSetArg( Args[10] , XmNscrollVertical , True ); + XtSetArg( Args[11] , XmNlistSizePolicy , XmCONSTANT ); + + GraalLibraryList = + + XmCreateScrolledList( GraalLibraryPanel.FORM, + "GraalLibraryList", Args, 12 ); + + Label = XmStringCreateSimple( "Catalog libraries" ); + + GraalLibraryCataLabel = + + XtVaCreateManagedWidget( "GraalLibraryCataLabel", + xmLabelGadgetClass , + GraalLibraryPanel.FORM, + XmNlabelString , Label, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 5, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 45, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 50, + NULL ); + + XmStringFree( Label ); + + XtSetArg( Args[0] , XmNrows , 4 ); + XtSetArg( Args[1] , XmNeditable , True ); + XtSetArg( Args[2] , XmNcursorPositionVisible , True ); + XtSetArg( Args[3] , XmNscrollHorizontal , True ); + XtSetArg( Args[4] , XmNscrollVertical , True ); + XtSetArg( Args[5] , XmNeditMode , XmMULTI_LINE_EDIT ); + XtSetArg( Args[6] , XmNtopAttachment , XmATTACH_POSITION ); + XtSetArg( Args[7] , XmNtopPosition , 50 ); + XtSetArg( Args[8] , XmNleftAttachment , XmATTACH_POSITION ); + XtSetArg( Args[9] , XmNleftPosition , 5 ); + XtSetArg( Args[10] , XmNrightAttachment , XmATTACH_POSITION ); + XtSetArg( Args[11] , XmNrightPosition , 115 ); + XtSetArg( Args[12] , XmNbottomAttachment , XmATTACH_POSITION ); + XtSetArg( Args[13] , XmNbottomPosition , 80 ); + + GraalLibraryCata = + + XmCreateScrolledText( GraalLibraryPanel.FORM, + "GraalLibraryCata", Args, 14 ); + + Label = XmStringCreateSimple( "Work library" ); + + GraalLibraryWorkLabel = + + XtVaCreateManagedWidget( "GraalLibraryWorkLabel", + xmLabelGadgetClass , + GraalLibraryPanel.FORM, + XmNlabelString , Label, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 5, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 85, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 90, + NULL ); + XmStringFree( Label ); + + XtSetArg( Args[0] , XmNrows , 1 ); + XtSetArg( Args[1] , XmNeditable , True ); + XtSetArg( Args[2] , XmNeditMode , XmSINGLE_LINE_EDIT ); + XtSetArg( Args[3] , XmNscrollHorizontal , False ); + XtSetArg( Args[4] , XmNscrollVertical , False ); + XtSetArg( Args[5] , XmNcursorPositionVisible , True ); + XtSetArg( Args[6] , XmNtopAttachment , XmATTACH_POSITION ); + XtSetArg( Args[7] , XmNtopPosition , 90 ); + XtSetArg( Args[8] , XmNleftAttachment , XmATTACH_POSITION ); + XtSetArg( Args[9] , XmNleftPosition , 5 ); + XtSetArg( Args[10] , XmNrightAttachment , XmATTACH_POSITION ); + XtSetArg( Args[11] , XmNrightPosition , 115 ); + XtSetArg( Args[12] , XmNbottomAttachment , XmATTACH_POSITION ); + XtSetArg( Args[13] , XmNbottomPosition , 100 ); + + GraalLibraryWork = + + XmCreateText( GraalLibraryPanel.FORM, + "GraalLibraryWork", Args, 14 ); + + XtManageChild( GraalLibraryWork ); + XtManageChild( GraalLibraryList ); + XtManageChild( GraalLibraryCata ); + + XtAddCallback( GraalLibraryList, + XmNdefaultActionCallback, + CallbackLibraryList, NULL ); + + XtAddCallback( GraalLibraryButtonOk, + XmNactivateCallback, + CallbackLibraryOk, NULL ); + + XtAddCallback( GraalLibraryButtonCancel, + XmNactivateCallback, + CallbackLibraryCancel, NULL ); + + XtAddCallback( GraalLibraryButtonUpdate, + XmNactivateCallback, + CallbackLibraryUpdate, NULL ); + + XtVaSetValues( GraalLibraryPanel.PANEL, + XmNheight, GraalLibraryPanel.HEIGHT, + XmNwidth , GraalLibraryPanel.WIDTH, + XmNx , GraalLibraryPanel.X, + XmNy , GraalLibraryPanel.Y, + NULL ); + + Label = XmStringCreateSimple( "Library" ); + + XtVaSetValues( XmFileSelectionBoxGetChild( GraalFileOpenDialog.WIDGET, + XmDIALOG_HELP_BUTTON ), + XmNlabelString, Label, NULL ); + + XtVaSetValues( XmFileSelectionBoxGetChild( GraalChangeInstanceModelDialog.WIDGET, + XmDIALOG_HELP_BUTTON ), + XmNlabelString, Label, NULL ); + + XtVaSetValues( XmFileSelectionBoxGetChild( GraalToolsLoadErrorDialog.WIDGET, + XmDIALOG_HELP_BUTTON ), + XmNlabelString, Label, NULL ); + + XmStringFree( Label ); + + XtAddCallback( XmFileSelectionBoxGetChild( GraalFileOpenDialog.WIDGET, + XmDIALOG_HELP_BUTTON ), + XmNactivateCallback, CallbackEnterLibrary, NULL ); + + XtAddCallback( XmFileSelectionBoxGetChild( GraalChangeInstanceModelDialog.WIDGET, + XmDIALOG_HELP_BUTTON ), + XmNactivateCallback, CallbackEnterLibrary, NULL ); + + XtAddCallback( XmFileSelectionBoxGetChild( GraalToolsLoadErrorDialog.WIDGET, + XmDIALOG_HELP_BUTTON ), + XmNactivateCallback, CallbackEnterLibrary, NULL ); + rdsend(); +} diff --git a/alliance/src/graal/src/GMF_panel.h b/alliance/src/graal/src/GMF_panel.h new file mode 100644 index 00000000..deac6831 --- /dev/null +++ b/alliance/src/graal/src/GMF_panel.h @@ -0,0 +1,80 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Panel.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_FILE_PANEL +# define GRAAL_FILE_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define GRAAL_LIBRARY_X 100 +# define GRAAL_LIBRARY_Y 230 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackLibraryList(); + extern void CallbackLibraryOk(); + extern void CallbackLibraryUpdate(); + extern void CallbackLibraryCancel(); + extern void CallbackEnterLibrary(); + +# endif diff --git a/alliance/src/graal/src/GMH.h b/alliance/src/graal/src/GMH.h new file mode 100644 index 00000000..f835b2f3 --- /dev/null +++ b/alliance/src/graal/src/GMH.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : GMH101.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_GMH +# define GRAAL_GMH + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern GraalMenuItem GraalHelpMenu[]; + extern GraalPanelItem GraalHelpPresentPanel; + + extern int GraalHelpPresentDefaultValues[5]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalBuildPresentPanel(); + extern void GraalEnterPresentPanel(); + +# endif diff --git a/alliance/src/graal/src/GMH_help.c b/alliance/src/graal/src/GMH_help.c new file mode 100644 index 00000000..a7ccf0f7 --- /dev/null +++ b/alliance/src/graal/src/GMH_help.c @@ -0,0 +1,79 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Help.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "GTB.h" +# include "GSB.h" +# include "GMH.h" +# include "GMX.h" + +# include "GMH_help.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ diff --git a/alliance/src/graal/src/GMH_help.h b/alliance/src/graal/src/GMH_help.h new file mode 100644 index 00000000..2cc8beb6 --- /dev/null +++ b/alliance/src/graal/src/GMH_help.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Help.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_HELP +# define GRAAL_HELP + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GMH_menu.c b/alliance/src/graal/src/GMH_menu.c new file mode 100644 index 00000000..6ffc71c2 --- /dev/null +++ b/alliance/src/graal/src/GMH_menu.c @@ -0,0 +1,126 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Menu.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "GTB.h" +# include "GSB.h" +# include "GMH.h" +# include "GMX.h" + +# include "GMH_menu.h" +# include "GMH_panel.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Help Menu | +| | +\------------------------------------------------------------*/ + + GraalMenuItem GraalHelpMenu[] = + + { + { + "About Graal", + 'G', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackHelpAbout, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackHelpAbout | +| | +\------------------------------------------------------------*/ + +void CallbackHelpAbout( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterPresentPanel(); + + rdsend(); +} diff --git a/alliance/src/graal/src/GMH_menu.h b/alliance/src/graal/src/GMH_menu.h new file mode 100644 index 00000000..4e378fcd --- /dev/null +++ b/alliance/src/graal/src/GMH_menu.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Menu.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_HELP_MENU +# define GRAAL_HELP_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackHelpAbout(); + +# endif diff --git a/alliance/src/graal/src/GMH_panel.c b/alliance/src/graal/src/GMH_panel.c new file mode 100644 index 00000000..a26c18d9 --- /dev/null +++ b/alliance/src/graal/src/GMH_panel.c @@ -0,0 +1,326 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Panel.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "GSB.h" +# include "GTB.h" +# include "GMX.h" +# include "GMH.h" + +# include "GMH_panel.h" +# include "LIP6bw.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + GraalPanelItem GraalHelpPresentPanel = + + { + "Graal present", + 1, + 0, + GRAAL_HELP_PRESENT_X, + GRAAL_HELP_PRESENT_Y, + 700, + 360, + 1, + 1, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + 0, + (GraalPanelButtonItem *)NULL + }; + + int GraalHelpPresentDefaultValues[ 5 ] = + + { + GRAAL_HELP_PRESENT_X, + GRAAL_HELP_PRESENT_Y, + 700, 360, 0 + }; + + + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalBuildPresentPanel | +| | +\------------------------------------------------------------*/ + +void GraalBuildPresentPanel() + +{ + Widget PanelLabel; + Widget PanelButton; + Pixmap PanelPixmap; + XmString PanelString; + XmString PanelString1; + XmString PanelString2; + XmFontList PanelFontList; + XFontStruct *PanelFont; + Display *PanelDisplay; + char Buffer[ 64 ]; + Arg Args[3]; + + rdsbegin(); + + PanelDisplay = XtDisplay( GraalMainWindow ); + PanelFont = XLoadQueryFont( PanelDisplay, "-*-helvetica-bold-o-*--24-*" ); + PanelFontList = XmFontListCreate( PanelFont, "Panel_charset1" ); + PanelFont = XLoadQueryFont( PanelDisplay, "-*-helvetica-bold-r-*--18-*" ); + PanelFontList = XmFontListAdd( PanelFontList, PanelFont, "Panel_charset2" ); + PanelFont = XLoadQueryFont( PanelDisplay, "-*-helvetica-bold-r-*--12-*" ); + PanelFontList = XmFontListAdd( PanelFontList, PanelFont, "Panel_charset4" ); + + XtSetArg( Args[0], XmNshadowType , XmSHADOW_ETCHED_IN ); + XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING ); + XtSetArg( Args[2], XmNtitle , "Graal present" ); + + GraalHelpPresentPanel.PANEL = + + XmCreateFormDialog( GraalMainWindow, GraalHelpPresentPanel.TITLE, Args, 3); + + XtAddCallback( GraalHelpPresentPanel.PANEL, XmNdestroyCallback, + GraalDestroyDialogCallback, NULL ); + + GraalHelpPresentPanel.PANEL_FORM = + + XtVaCreateManagedWidget( "", + xmFormWidgetClass, + GraalHelpPresentPanel.PANEL, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + NULL + ); + + GraalHelpPresentPanel.FRAME = + + XtVaCreateManagedWidget( "", + xmFrameWidgetClass, + GraalHelpPresentPanel.PANEL_FORM, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 05, + XmNbottomAttachment, XmATTACH_POSITION, + XmNbottomPosition , 95, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 05, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 95, + NULL + ); + + GraalHelpPresentPanel.FORM = + + XtVaCreateManagedWidget( "", + xmFormWidgetClass, + GraalHelpPresentPanel.FRAME, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 05, + XmNbottomAttachment, XmATTACH_POSITION, + XmNbottomPosition , 95, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 05, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 95, + NULL + ); + + PanelPixmap = GraalCreatePixmap( GraalMainWindow, + LIP6bw_bits, + LIP6bw_width, + LIP6bw_height); + + + PanelLabel = XtVaCreateManagedWidget( "", + xmLabelGadgetClass, + GraalHelpPresentPanel.FORM, + XmNlabelType , XmPIXMAP, + XmNlabelPixmap , PanelPixmap, + NULL + ); + + sprintf( Buffer, "ALLIANCE CAD SYSTEM %s\n", ALLIANCE_VERSION ); + + PanelString = XmStringCreateLtoR( Buffer, "Panel_charset2" ); + + PanelLabel = XtVaCreateManagedWidget( "", + xmLabelWidgetClass, + GraalHelpPresentPanel.FORM, + XmNfontList , PanelFontList, + XmNlabelString , PanelString, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 15, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 75, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 25, + NULL + ); + XmStringFree( PanelString ); + + PanelString1 = XmStringCreateLtoR( "Graal" , "Panel_charset1" ); + PanelString2 = XmStringCreateLtoR( "\n( Click On IT )", "Panel_charset4" ); + PanelString = XmStringConcat( PanelString1, PanelString2 ); + + PanelButton = XtVaCreateManagedWidget( "", + xmPushButtonWidgetClass, + GraalHelpPresentPanel.FORM, + XmNfontList , PanelFontList, + XmNlabelString , PanelString, + XmNshadowThickness , 3, + XmNtopAttachment , XmATTACH_WIDGET, + XmNtopWidget , PanelLabel, + XmNtopOffset , 5, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 60, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 40, + NULL + ); + XmStringFree( PanelString ); + XmStringFree( PanelString1 ); + XmStringFree( PanelString2 ); + + XtAddCallback( PanelButton, + XmNactivateCallback, + GraalExitDialogCallback, NULL ); + + sprintf( Buffer, "\nGraphic layout editor\nVersion %s", GRAAL_VERSION ); + + PanelString = XmStringCreateLtoR( Buffer, "Panel_charset2" ); + + PanelLabel = XtVaCreateManagedWidget( "", + xmLabelWidgetClass, + GraalHelpPresentPanel.FORM, + XmNfontList , PanelFontList, + XmNlabelString , PanelString, + XmNtopAttachment , XmATTACH_WIDGET, + XmNtopWidget , PanelButton, + XmNtopOffset , 5, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 75, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 25, + NULL + ); + XmStringFree( PanelString ); + + PanelString = XmStringCreateLtoR( "copyright \251 1996-2000 ASIM, \ +CAO-VLSI Team\nWritten by Ludovic Jacomme and Frederic Venot\nE-mail support: alliance-support@asim.lip6.fr", "Panel_charset4" ); + + PanelLabel = XtVaCreateManagedWidget( "", + xmLabelWidgetClass, + GraalHelpPresentPanel.FORM, + XmNfontList , PanelFontList, + XmNlabelString , PanelString, + XmNtopAttachment , XmATTACH_WIDGET, + XmNtopWidget , PanelLabel, + XmNtopOffset , 5, + XmNrightAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + NULL + ); + XmStringFree( PanelString ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEnterPresentPanel | +| | +\------------------------------------------------------------*/ + +void GraalEnterPresentPanel() + +{ + rdsbegin(); + + GraalEnterPanel( &GraalHelpPresentPanel ); + + GraalLimitedLoop( GraalHelpPresentPanel.PANEL ); + + GraalExitPanel( &GraalHelpPresentPanel ); + + rdsend(); +} diff --git a/alliance/src/graal/src/GMH_panel.h b/alliance/src/graal/src/GMH_panel.h new file mode 100644 index 00000000..38561138 --- /dev/null +++ b/alliance/src/graal/src/GMH_panel.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Panel.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_HELP_PANEL +# define GRAAL_HELP_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define GRAAL_HELP_PRESENT_X 180 +# define GRAAL_HELP_PRESENT_Y 200 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GMS.h b/alliance/src/graal/src/GMS.h new file mode 100644 index 00000000..c94e5122 --- /dev/null +++ b/alliance/src/graal/src/GMS.h @@ -0,0 +1,79 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : GMS101.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_GMS +# define GRAAL_GMS + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern GraalMenuItem GraalSetupMenu[]; + extern GraalPanelItem GraalSetupInformationsPanel; + + extern int GraalSetupInformationsDefaultValues[ 5 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackSetupLoadConfig(); + extern void CallbackSetupSaveConfig(); + extern void CallbackSetupDefaultConfig(); + extern void CallbackSetupInformations(); + + extern void GraalLoadConfig(); + extern void GraalLoadTopLevelConfig(); + +# endif diff --git a/alliance/src/graal/src/GMS_dialog.c b/alliance/src/graal/src/GMS_dialog.c new file mode 100644 index 00000000..1c22a2b5 --- /dev/null +++ b/alliance/src/graal/src/GMS_dialog.c @@ -0,0 +1,84 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Dialog.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GRM.h" +# include "GMX.h" +# include "GTB.h" +# include "GSB.h" +# include "GMS.h" + +# include "GMS_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ diff --git a/alliance/src/graal/src/GMS_dialog.h b/alliance/src/graal/src/GMS_dialog.h new file mode 100644 index 00000000..54a317e3 --- /dev/null +++ b/alliance/src/graal/src/GMS_dialog.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Dialog.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_SETUP_DIALOG +# define GRAAL_SETUP_DIALOG + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GMS_menu.c b/alliance/src/graal/src/GMS_menu.c new file mode 100644 index 00000000..d903af95 --- /dev/null +++ b/alliance/src/graal/src/GMS_menu.c @@ -0,0 +1,233 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Menu.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "GTB.h" +# include "GSB.h" +# include "GMS.h" + +# include "GMS_menu.h" +# include "GMS_panel.h" +# include "GMS_setup.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + GraalMenuItem GraalSetupMenu[] = + + { + { + "Default Config", + 'D', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackSetupDefaultConfig, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Load Config", + 'L', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackSetupLoadConfig, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Save Config", + 'S', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackSetupSaveConfig, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Informations", + 'I', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackSetupInformations, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + NULL + }; + + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackSetupLoadConfig | +| | +\------------------------------------------------------------*/ + +void CallbackSetupLoadConfig( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalLoadConfig( GRAAL_TRUE ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSetupSaveConfig | +| | +\------------------------------------------------------------*/ + +void CallbackSetupSaveConfig( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalSaveConfig(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSetupDefaultConfig | +| | +\------------------------------------------------------------*/ + +void CallbackSetupDefaultConfig( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalDefaultConfig(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSetupInformations | +| | +\------------------------------------------------------------*/ + +void CallbackSetupInformations( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalDisplayInformations(); + + rdsend(); +} + diff --git a/alliance/src/graal/src/GMS_menu.h b/alliance/src/graal/src/GMS_menu.h new file mode 100644 index 00000000..e52b4af7 --- /dev/null +++ b/alliance/src/graal/src/GMS_menu.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Menu.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_SETUP_MENU +# define GRAAL_SETUP_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GMS_panel.c b/alliance/src/graal/src/GMS_panel.c new file mode 100644 index 00000000..cefbc95f --- /dev/null +++ b/alliance/src/graal/src/GMS_panel.c @@ -0,0 +1,175 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Panel.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GTB.h" +# include "GSB.h" +# include "GRM.h" +# include "GMS.h" + +# include "GMS_panel.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Panel | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Panel Informations | +| | +\------------------------------------------------------------*/ + + GraalPanelButtonItem GraalSetupInformationsButton[] = + + { + { + "Text", + "Nothing", NULL, 0, 0, + NULL, + NULL, + 0, 0, + 8, 9, + NULL, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Close", + NULL, NULL, 0, 0, + NULL, + NULL, + 3, 9, + 2, 1, + GraalExitDialogCallback, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalSetupInformationsPanel = + + { + "Informations", + 1, + 0, + GRAAL_SETUP_INFORMATIONS_X, + GRAAL_SETUP_INFORMATIONS_Y, + 360, + 250, + 8, + 10, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + 2, + GraalSetupInformationsButton + }; + + int GraalSetupInformationsDefaultValues[ 5 ] = + + { + GRAAL_SETUP_INFORMATIONS_X, + GRAAL_SETUP_INFORMATIONS_Y, + 360, 250, 0 + }; + +/*------------------------------------------------------------\ +| | +| Callback For Informations | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalDisplayInformations | +| | +\------------------------------------------------------------*/ + +void GraalDisplayInformations() + +{ + char *Message; + + rdsbegin(); + + Message = GraalGetInformations(); + + XmTextSetString( GraalSetupInformationsButton[0].BUTTON, Message ); + + GraalEnterPanel( &GraalSetupInformationsPanel ); + + GraalLimitedLoop( GraalSetupInformationsPanel.PANEL ); + + GraalExitPanel( &GraalSetupInformationsPanel ); + + rdsend(); +} diff --git a/alliance/src/graal/src/GMS_panel.h b/alliance/src/graal/src/GMS_panel.h new file mode 100644 index 00000000..15d1420d --- /dev/null +++ b/alliance/src/graal/src/GMS_panel.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Panel.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_SETUP_PANEL +# define GRAAL_SETUP_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define GRAAL_SETUP_INFORMATIONS_X 330 +# define GRAAL_SETUP_INFORMATIONS_Y 280 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalDisplayInformations(); + +# endif diff --git a/alliance/src/graal/src/GMS_setup.c b/alliance/src/graal/src/GMS_setup.c new file mode 100644 index 00000000..9ba8f320 --- /dev/null +++ b/alliance/src/graal/src/GMS_setup.c @@ -0,0 +1,643 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Setup.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "GTB.h" +# include "GSB.h" +# include "GMX.h" +# include "GMF.h" +# include "GME.h" +# include "GMC.h" +# include "GMV.h" +# include "GMT.h" +# include "GMS.h" +# include "GMH.h" + +# include "GMS_setup.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static FILE *FileConfig; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Set Panel New Values | +| | +\------------------------------------------------------------*/ + +void GraalSetPanelValues( Panel, Values ) + + GraalPanelItem *Panel; + int *Values; +{ + rdsbegin(); + + Panel->COMPUTE = 1; + Panel->X = Values[0]; + Panel->Y = Values[1]; + Panel->WIDTH = Values[2]; + Panel->HEIGHT = Values[3]; + Panel->MANAGED = Values[4]; + + XtVaSetValues( Panel->PANEL, + XmNx , Values[0], + XmNy , Values[1], + XmNwidth , Values[2], + XmNheight , Values[3], + NULL ); + + if ( Panel->MANAGED ) + { + GraalEnterPanel( Panel ); + } + else + { + XtUnmanageChild( Panel->PANEL ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Write TopLevel Values | +| | +\------------------------------------------------------------*/ + +void GraalWriteTopLevelValues() + +{ + Dimension Values[5]; + + rdsbegin(); + + XtVaGetValues( GraalTopLevel, + XmNx , &Values[0], + XmNy , &Values[1], + XmNwidth , &Values[2], + XmNheight , &Values[3], + NULL ); + + Values[0] = Values[0] - GRAAL_TOPLEVEL_TRANSLATE_X; + Values[1] = Values[1] - GRAAL_TOPLEVEL_TRANSLATE_Y; + Values[4] = 1; + + fprintf( FileConfig, "VERSION: %s\n", GRAAL_VERSION ); + fprintf( FileConfig, "X: %d, Y: %d, WIDTH: %d, HEIGHT: %d, MANAGED: %d\n", + Values[0], Values[1], Values[2], Values[3], Values[4] ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Write Panel Values | +| | +\------------------------------------------------------------*/ + +void GraalWritePanelValues( Panel ) + + GraalPanelItem *Panel; +{ + Dimension Values[5]; + + rdsbegin(); + + if ( Panel->COMPUTE == 0 ) + { + XtVaGetValues( Panel->PANEL, + XmNx , &Values[0], + XmNy , &Values[1], + XmNwidth , &Values[2], + XmNheight , &Values[3], + NULL ); + + Values[0] = Values[0] - GRAAL_PANEL_TRANSLATE_X; + Values[1] = Values[1] - GRAAL_PANEL_TRANSLATE_Y; + } + else + { + Values[0] = Panel->X; + Values[1] = Panel->Y; + Values[2] = Panel->WIDTH; + Values[3] = Panel->HEIGHT; + } + + Values[2] /= Panel->COLUMN; + Values[3] /= Panel->ROW; + + Values[4] = Panel->MANAGED; + + fprintf( FileConfig, "X: %d, Y: %d, WIDTH: %d, HEIGHT: %d, MANAGED: %d\n", + Values[0], Values[1], Values[2], Values[3], Values[4] ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Read Panel Values | +| | +\------------------------------------------------------------*/ + +void GraalReadPanelValues( Panel ) + + GraalPanelItem *Panel; +{ + int Values[5]; + + rdsbegin(); + + fscanf( FileConfig, "X: %d, Y: %d, WIDTH: %d, HEIGHT: %d, MANAGED: %d\n", + &Values[0], &Values[1], &Values[2], &Values[3], &Values[4] ); + + Values[2] *= Panel->COLUMN; + Values[3] *= Panel->ROW; + + GraalSetPanelValues( Panel, Values ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Read Panel Values | +| | +\------------------------------------------------------------*/ + +char GraalReadTopLevelValues() + +{ + int Values[5]; + char Version[64]; + + rdsbegin(); + + fscanf( FileConfig, "VERSION: %s\n", Version ); + + if ( strcmp( Version, GRAAL_VERSION ) ) + { + rdsend(); + return( 0 ); + } + + fscanf( FileConfig, "X: %d, Y: %d, WIDTH: %d, HEIGHT: %d, MANAGED: %d\n", + &Values[0], &Values[1], &Values[2], &Values[3], &Values[4] ); + + XtVaSetValues( GraalTopLevel, + XmNx , Values[0], + XmNy , Values[1], + XmNwidth , Values[2], + XmNheight , Values[3], + NULL ); + rdsend(); + return( 1 ); +} + +/*------------------------------------------------------------\ +| | +| ReadActiveLayers | +| | +\------------------------------------------------------------*/ + +void GraalReadActiveLayers() + +{ + char Layer; + int Value; + + rdsbegin(); + + for ( Layer = 0; Layer < RDS_ALL_LAYER; Layer++ ) + { + fscanf( FileConfig, "ACTIVE: %d\n", &Value ); + + if ( ( GRAAL_RDS_LAYER_NAME_TABLE[ Layer ][ 0 ] != (char *)NULL ) && + ( RDS_DYNAMIC_LAYER[ Layer ] != RDS_LAYER_UNUSED ) ) + { + GRAAL_RDS_ACTIVE_LAYER_TABLE[ Layer ] = Value; + } + else + { + GRAAL_RDS_ACTIVE_LAYER_TABLE[ Layer ] = -1; + } + } + + for ( Layer = 0; Layer < GRAAL_MAX_ACTIVE_NAME; Layer++ ) + { + fscanf( FileConfig, "ACTIVE: %d\n", &Value ); + + GRAAL_RDS_ACTIVE_NAME_TABLE[ Layer ] = Value; + } + + fscanf( FileConfig, "FILLMODE: %d\n", &Value ); + + GRAAL_FILL_MODE = Value; + + fscanf( FileConfig, "INTERFACE: %d\n", &Value ); + + GRAAL_INSTANCE_INTERFACE = Value; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| WriteActiveLayers | +| | +\------------------------------------------------------------*/ + +void GraalWriteActiveLayers() + +{ + char Layer; + + rdsbegin(); + + for ( Layer = 0; Layer < RDS_ALL_LAYER; Layer++ ) + { + fprintf( FileConfig, "ACTIVE: %d\n", + ( GRAAL_RDS_ACTIVE_LAYER_TABLE[ Layer ] != 0 ) ); + } + + for ( Layer = 0; Layer < GRAAL_MAX_ACTIVE_NAME; Layer++ ) + { + fprintf( FileConfig, "ACTIVE: %d\n", + GRAAL_RDS_ACTIVE_NAME_TABLE[ Layer ] ); + } + + fprintf( FileConfig, "FILLMODE: %d\n", + GRAAL_FILL_MODE ); + + fprintf( FileConfig, "INTERFACE: %d\n", + GRAAL_INSTANCE_INTERFACE ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDefaultTopLevelValues | +| | +\------------------------------------------------------------*/ + +void GraalDefaultTopLevelValues() + +{ + rdsbegin(); + + XtVaSetValues( GraalTopLevel, + XmNheight , GRAAL_TOPLEVEL_HEIGHT, + XmNwidth , GRAAL_TOPLEVEL_WIDTH, + XmNx , GRAAL_TOPLEVEL_X, + XmNy , GRAAL_TOPLEVEL_Y, + NULL + ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDefaultConfig | +| | +\------------------------------------------------------------*/ + +void GraalDefaultConfig() + +{ + char Layer; + + rdsbegin(); + + GraalDefaultTopLevelValues(); + + GraalSetPanelValues( &GraalViewArrowsPanel, + GraalViewArrowsDefaultValues ); + GraalSetPanelValues( &GraalViewZoomPanel, + GraalViewZoomDefaultValues ); + GraalSetPanelValues( &GraalViewLayerPanel, + GraalViewLayerDefaultValues ); + GraalSetPanelValues( &GraalViewGridPanel, + GraalViewGridDefaultValues ); + GraalSetPanelValues( &GraalViewMapPanel, + GraalViewMapDefaultValues ); + GraalSetPanelValues( &GraalEditGlobalPanel, + GraalEditGlobalDefaultValues ); + GraalSetPanelValues( &GraalWindowGlobalPanel, + GraalWindowGlobalDefaultValues ); + GraalSetPanelValues( &GraalEditSelectPanel, + GraalEditSelectDefaultValues ); + GraalSetPanelValues( &GraalEditIdentifyPanel, + GraalEditIdentifyDefaultValues ); + GraalSetPanelValues( &GraalEditSearchPanel, + GraalEditSearchDefaultValues ); + GraalSetPanelValues( &GraalEditSearchViewPanel, + GraalEditSearchViewDefaultValues ); + GraalSetPanelValues( &GraalModifySegmentPanel, + GraalModifySegmentDefaultValues ); + GraalSetPanelValues( &GraalModifyViaPanel, + GraalModifyViaDefaultValues ); + GraalSetPanelValues( &GraalModifyBigViaPanel, + GraalModifyBigViaDefaultValues ); + GraalSetPanelValues( &GraalModifyTransistorPanel, + GraalModifyTransistorDefaultValues ); + GraalSetPanelValues( &GraalModifyConnectorPanel, + GraalModifyConnectorDefaultValues ); + GraalSetPanelValues( &GraalModifyReferencePanel, + GraalModifyReferenceDefaultValues ); + GraalSetPanelValues( &GraalModifyInstancePanel, + GraalModifyInstanceDefaultValues ); + GraalSetPanelValues( &GraalCreateSegmentPanel, + GraalCreateSegmentDefaultValues ); + GraalSetPanelValues( &GraalCreateViaPanel, + GraalCreateViaDefaultValues ); + GraalSetPanelValues( &GraalCreateBigViaPanel, + GraalCreateBigViaDefaultValues ); + GraalSetPanelValues( &GraalCreateTransistorPanel, + GraalCreateTransistorDefaultValues ); + GraalSetPanelValues( &GraalCreateConnectorPanel, + GraalCreateConnectorDefaultValues ); + GraalSetPanelValues( &GraalCreateReferencePanel, + GraalCreateReferenceDefaultValues ); + GraalSetPanelValues( &GraalCreateInstancePanel, + GraalCreateInstanceDefaultValues ); + GraalSetPanelValues( &GraalToolsGlobalPanel, + GraalToolsGlobalDefaultValues ); + GraalSetPanelValues( &GraalToolsMessagePanel, + GraalToolsMessageDefaultValues ); + GraalSetPanelValues( &GraalToolsDrucPanel, + GraalToolsDrucDefaultValues ); + GraalSetPanelValues( &GraalToolsHierarchyPanel, + GraalToolsHierarchyDefaultValues ); + GraalSetPanelValues( &GraalSetupInformationsPanel, + GraalSetupInformationsDefaultValues ); + GraalSetPanelValues( &GraalHelpPresentPanel, + GraalHelpPresentDefaultValues ); + + for ( Layer = 0; Layer < RDS_ALL_LAYER; Layer++ ) + { + if ( ( GRAAL_RDS_LAYER_NAME_TABLE[ Layer ][ 0 ] != (char *)NULL ) && + ( RDS_DYNAMIC_LAYER[ Layer ] != RDS_LAYER_UNUSED ) ) + { + GRAAL_RDS_ACTIVE_LAYER_TABLE[ Layer ] = 1; + } + else + { + GRAAL_RDS_ACTIVE_LAYER_TABLE[ Layer ] = -1; + } + } + + for ( Layer = 0; Layer < GRAAL_MAX_ACTIVE_NAME; Layer++ ) + { + GRAAL_RDS_ACTIVE_NAME_TABLE[ Layer ] = 1; + } + + GRAAL_FILL_MODE = GRAAL_FILL_MODE_PATTERN; + GRAAL_INSTANCE_INTERFACE = GRAAL_TRUE; + + GraalInitializeLayer(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalLoadTopLevelConfig | +| | +\------------------------------------------------------------*/ + +void GraalLoadTopLevelConfig() + +{ + rdsbegin(); + + FileConfig = fopen( GRAAL_GMS_FILE_NAME, "r" ); + + if ( FileConfig == (FILE *)NULL ) + { + GraalDefaultTopLevelValues(); + } + else + { + if ( ! GraalReadTopLevelValues() ) + { + GraalDefaultTopLevelValues(); + } + + fclose( FileConfig ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalLoadConfig | +| | +\------------------------------------------------------------*/ + +void GraalLoadConfig( Message ) + + char Message; +{ + rdsbegin(); + + FileConfig = fopen( GRAAL_GMS_FILE_NAME, "r" ); + + if ( FileConfig == (FILE *)NULL ) + { + if ( Message ) + { + GraalErrorMessage( GraalMainWindow, + "Unable to open config file !" ); + } + else + { + GraalDefaultConfig(); + } + } + else + { + if ( GraalReadTopLevelValues() ) + { + GraalReadPanelValues( &GraalViewArrowsPanel ); + GraalReadPanelValues( &GraalViewZoomPanel ); + GraalReadPanelValues( &GraalViewLayerPanel ); + GraalReadPanelValues( &GraalViewGridPanel ); + GraalReadPanelValues( &GraalViewMapPanel ); + GraalReadPanelValues( &GraalEditGlobalPanel ); + GraalReadPanelValues( &GraalWindowGlobalPanel ); + GraalReadPanelValues( &GraalEditSelectPanel ); + GraalReadPanelValues( &GraalEditIdentifyPanel ); + GraalReadPanelValues( &GraalEditSearchPanel ); + GraalReadPanelValues( &GraalEditSearchViewPanel ); + GraalReadPanelValues( &GraalModifySegmentPanel ); + GraalReadPanelValues( &GraalModifyViaPanel ); + GraalReadPanelValues( &GraalModifyBigViaPanel ); + GraalReadPanelValues( &GraalModifyTransistorPanel ); + GraalReadPanelValues( &GraalModifyConnectorPanel ); + GraalReadPanelValues( &GraalModifyReferencePanel ); + GraalReadPanelValues( &GraalModifyInstancePanel ); + GraalReadPanelValues( &GraalCreateSegmentPanel ); + GraalReadPanelValues( &GraalCreateViaPanel ); + GraalReadPanelValues( &GraalCreateBigViaPanel ); + GraalReadPanelValues( &GraalCreateTransistorPanel ); + GraalReadPanelValues( &GraalCreateConnectorPanel ); + GraalReadPanelValues( &GraalCreateReferencePanel ); + GraalReadPanelValues( &GraalCreateInstancePanel ); + GraalReadPanelValues( &GraalToolsGlobalPanel ); + GraalReadPanelValues( &GraalToolsMessagePanel ); + GraalReadPanelValues( &GraalToolsDrucPanel ); + GraalReadPanelValues( &GraalToolsHierarchyPanel ); + GraalReadPanelValues( &GraalSetupInformationsPanel ); + GraalReadPanelValues( &GraalHelpPresentPanel ); + + GraalReadActiveLayers(); + GraalInitializeLayer(); + } + else + if ( Message ) + { + GraalErrorMessage( GraalMainWindow, + "Bad version, unable to open config file !" ); + } + else + { + GraalDefaultConfig(); + } + + fclose( FileConfig ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalSaveConfig | +| | +\------------------------------------------------------------*/ + +void GraalSaveConfig() + +{ + rdsbegin(); + + FileConfig = fopen( GRAAL_GMS_FILE_NAME, "w" ); + + if ( FileConfig == (FILE *)NULL ) + { + GraalErrorMessage( GraalMainWindow, + "Unable to open config file !" ); + } + else + { + GraalWriteTopLevelValues(); + + GraalWritePanelValues( &GraalViewArrowsPanel ); + GraalWritePanelValues( &GraalViewZoomPanel ); + GraalWritePanelValues( &GraalViewLayerPanel ); + GraalWritePanelValues( &GraalViewGridPanel ); + GraalWritePanelValues( &GraalViewMapPanel ); + GraalWritePanelValues( &GraalEditGlobalPanel ); + GraalWritePanelValues( &GraalWindowGlobalPanel ); + GraalWritePanelValues( &GraalEditSelectPanel ); + GraalWritePanelValues( &GraalEditIdentifyPanel ); + GraalWritePanelValues( &GraalEditSearchPanel ); + GraalWritePanelValues( &GraalEditSearchViewPanel ); + GraalWritePanelValues( &GraalModifySegmentPanel ); + GraalWritePanelValues( &GraalModifyViaPanel ); + GraalWritePanelValues( &GraalModifyBigViaPanel ); + GraalWritePanelValues( &GraalModifyTransistorPanel ); + GraalWritePanelValues( &GraalModifyConnectorPanel ); + GraalWritePanelValues( &GraalModifyReferencePanel ); + GraalWritePanelValues( &GraalModifyInstancePanel ); + GraalWritePanelValues( &GraalCreateSegmentPanel ); + GraalWritePanelValues( &GraalCreateViaPanel ); + GraalWritePanelValues( &GraalCreateBigViaPanel ); + GraalWritePanelValues( &GraalCreateTransistorPanel ); + GraalWritePanelValues( &GraalCreateConnectorPanel ); + GraalWritePanelValues( &GraalCreateReferencePanel ); + GraalWritePanelValues( &GraalCreateInstancePanel ); + GraalWritePanelValues( &GraalToolsGlobalPanel ); + GraalWritePanelValues( &GraalToolsMessagePanel ); + GraalWritePanelValues( &GraalToolsDrucPanel ); + GraalWritePanelValues( &GraalToolsHierarchyPanel ); + GraalWritePanelValues( &GraalSetupInformationsPanel ); + GraalWritePanelValues( &GraalHelpPresentPanel ); + + GraalWriteActiveLayers(); + + fclose( FileConfig ); + } + + rdsend(); +} diff --git a/alliance/src/graal/src/GMS_setup.h b/alliance/src/graal/src/GMS_setup.h new file mode 100644 index 00000000..8297229f --- /dev/null +++ b/alliance/src/graal/src/GMS_setup.h @@ -0,0 +1,85 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Setup.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_SETUP +# define GRAAL_SETUP + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define GRAAL_TOPLEVEL_TRANSLATE_X 0 +# define GRAAL_TOPLEVEL_TRANSLATE_Y 0 +# define GRAAL_PANEL_TRANSLATE_X 0 +# define GRAAL_PANEL_TRANSLATE_Y 0 + +# define GRAAL_TOPLEVEL_X 10 +# define GRAAL_TOPLEVEL_Y 10 +# define GRAAL_TOPLEVEL_WIDTH 1024 +# define GRAAL_TOPLEVEL_HEIGHT 768 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalDefaultConfig(); + extern void GraalSaveConfig(); + extern void GraalLoadConfig(); + +# endif diff --git a/alliance/src/graal/src/GMT.h b/alliance/src/graal/src/GMT.h new file mode 100644 index 00000000..dfc09225 --- /dev/null +++ b/alliance/src/graal/src/GMT.h @@ -0,0 +1,90 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : GMT101.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_GMT +# define GRAAL_GMT + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern GraalMenuItem GraalToolsMenu[]; + extern GraalPanelItem GraalToolsGlobalPanel; + extern GraalPanelItem GraalToolsMessagePanel; + extern GraalPanelItem GraalToolsDrucPanel; + extern GraalPanelItem GraalToolsHierarchyPanel; + extern GraalPanelItem GraalToolsHierarchyShowPanel; + + extern int GraalToolsGlobalDefaultValues[ 5 ]; + extern int GraalToolsMessageDefaultValues[ 5 ]; + extern int GraalToolsDrucDefaultValues[ 5 ]; + extern int GraalToolsHierarchyDefaultValues[ 5 ]; + extern int GraalToolsHierarchyShowDefaultValues[ 5 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalToolsPeek(); + extern void GraalToolsEqui(); + extern void GraalToolsFlatten(); + extern void GraalToolsUnflatten(); + extern void GraalToolsRealFlatten(); + extern void GraalToolsHierarchyDown(); + extern void GraalToolsHierarchyShow(); + + extern void GraalDisplayToolsMessage(); + extern void GraalBuildToolsDialog(); + +# endif diff --git a/alliance/src/graal/src/GMT_dialog.c b/alliance/src/graal/src/GMT_dialog.c new file mode 100644 index 00000000..88aacc2b --- /dev/null +++ b/alliance/src/graal/src/GMT_dialog.c @@ -0,0 +1,249 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Dialog.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GRM.h" +# include "GMX.h" +# include "GTB.h" +# include "GSB.h" +# include "GMT.h" + +# include "GMT_dialog.h" +# include "GMT_tools.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| File Dialog | +| | +\------------------------------------------------------------*/ + + GraalDialogItem GraalToolsLoadErrorDialog = + + { + "Load error file", + GRAAL_DIALOG_FILE, + (Widget)NULL, + (void *)CallbackToolsLoadErrorOk, + (XtPointer)NULL, + (void *)CallbackToolsLoadErrorCancel, + (XtPointer)NULL + }; + + GraalDialogItem GraalToolsSavePixmapDialog = + + { + "Save xpm file As", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackToolsSavePixmapOk, + (XtPointer)NULL, + (void *)CallbackToolsSavePixmapCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalBuildToolsDialog | +| | +\------------------------------------------------------------*/ + +void GraalBuildToolsDialog() + +{ + rdsbegin(); + + GraalBuildDialog( GraalMainWindow, &GraalToolsLoadErrorDialog ); + GraalBuildDialog( GraalMainWindow, &GraalToolsSavePixmapDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsLoadErrorOk | +| | +\------------------------------------------------------------*/ + +void CallbackToolsLoadErrorOk( MyWidget, ClientData, FileStruct ) + + Widget MyWidget; + caddr_t ClientData; + XmFileSelectionBoxCallbackStruct *FileStruct; +{ + char *FileName; + + rdsbegin(); + + XtUnmanageChild( GraalToolsLoadErrorDialog.WIDGET ); + + GraalExitDialog(); + + if ( FileStruct->value != NULL ) + { + XmStringGetLtoR( FileStruct->value, + XmSTRING_DEFAULT_CHARSET, + &FileName + ); + + FileName = GraalPostTreatString( FileName ); + + if ( FileName != (char *)NULL ) + { + GraalToolsLoadError( FileName ); + + GraalChangeEditMode( GRAAL_EDIT_MEASURE, + GraalPromptEditMeasure ); + } + else + { + GraalErrorMessage( GraalMainWindow, "Unable to load this file !" ); + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsLoadErrorCancel | +| | +\------------------------------------------------------------*/ + +void CallbackToolsLoadErrorCancel( MyWidget, ClientData, FileStruct ) + + Widget MyWidget; + caddr_t ClientData; + XmFileSelectionBoxCallbackStruct *FileStruct; +{ + rdsbegin(); + + XtUnmanageChild( GraalToolsLoadErrorDialog.WIDGET ); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsSavePixmapOk | +| | +\------------------------------------------------------------*/ + +void CallbackToolsSavePixmapOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *FileName; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &FileName ); + + FileName = GraalPostTreatString( FileName ); + + XtUnmanageChild( GraalToolsSavePixmapDialog.WIDGET ); + + GraalExitDialog(); + + GraalToolsSavePixmap( FileName ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsSavePixmapCancel | +| | +\------------------------------------------------------------*/ + +void CallbackToolsSavePixmapCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalToolsSavePixmapDialog.WIDGET ); + + GraalExitDialog(); + + rdsend(); +} diff --git a/alliance/src/graal/src/GMT_dialog.h b/alliance/src/graal/src/GMT_dialog.h new file mode 100644 index 00000000..6febb6eb --- /dev/null +++ b/alliance/src/graal/src/GMT_dialog.h @@ -0,0 +1,80 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Dialog.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_TOOLS_DIALOG +# define GRAAL_TOOLS_DIALOG + + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern GraalDialogItem GraalToolsLoadErrorDialog; + extern GraalDialogItem GraalToolsSavePixmapDialog; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackToolsLoadErrorOk(); + extern void CallbackToolsLoadErrorCancel(); + extern void CallbackToolsSavePixmapOk(); + extern void CallbackToolsSavePixmapCancel(); + +# endif diff --git a/alliance/src/graal/src/GMT_druc.c b/alliance/src/graal/src/GMT_druc.c new file mode 100644 index 00000000..321d7e5a --- /dev/null +++ b/alliance/src/graal/src/GMT_druc.c @@ -0,0 +1,428 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Druc.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rfm.h" +# include "rpr.h" +# include "vrd.h" +# include "GTB.h" +# include "GSB.h" +# include "GMX.h" +# include "GRM.h" +# include "GMT.h" + +# include "GMT_druc.h" +# include "GMT_panel.h" +# include "GMT_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + char GraalDrucErrorMessage[ GRAAL_DRUC_MESSAGE_SIZE ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalToolsDrucNoMoreError | +| | +\------------------------------------------------------------*/ + +void GraalDisplayDrucNoMoreError() +{ + rdsbegin(); + + sprintf( GraalDrucErrorMessage, "No more error\n" ); + GraalDisplayDrucMessage( GraalDrucErrorMessage ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalToolsDrucError | +| | +\------------------------------------------------------------*/ + +void GraalDisplayDrucError( Rectangle ) + + rdsrec_list *Rectangle; +{ + char *Comment; + long Error; + + rdsbegin(); + + Error = MACRO_REGLE_NUM( Rectangle ); + Comment = drucgeterror( Error ); + + sprintf( GraalDrucErrorMessage, "Rule error %d\n%s", + Error, Comment ); + + GraalDisplayDrucMessage( GraalDrucErrorMessage ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalToolsDrucAbortError | +| | +\------------------------------------------------------------*/ + +void GraalToolsDrucAbortError() +{ + if ( GraalRectangleDruc != (rdsrec_list *)0 ) + { + GraalDeleteRectangle( GraalRectangleDruc ); + GraalDisplayRectangle( GraalRectangleDruc ); + } + + GraalDelDrucFigure(); + GraalExitPanel( &GraalToolsDrucPanel ); +} + +/*------------------------------------------------------------\ +| | +| GraalToolsDrucNextError | +| | +\------------------------------------------------------------*/ + +void GraalToolsDrucNextError() +{ + rdsrec_list *DrucRec; + rdsrec_list *ScanRec; + char Layer; + char Error; + long X1; + long Y1; + + + if ( GraalFigureDruc != (rdsfig_list *)0 ) + { + if ( GraalRectangleDruc != (rdsrec_list *)0 ) + { + GraalDeleteRectangle( GraalRectangleDruc ); + GraalDisplayRectangle( GraalRectangleDruc ); + GraalDelDruc( GraalRectangleDruc ); + + GraalRectangleDruc = (rdsrec_list *)0; + } + + DrucRec = (rdsrec_list *)0; + + if ( GraalCurrentDruc == (rdsrec_list *)0 ) + { + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + for ( GraalCurrentDruc = GraalFigureDruc->LAYERTAB[ Layer ]; + GraalCurrentDruc != (rdsrec_list *)0; + GraalCurrentDruc = GraalCurrentDruc->NEXT ) + { + DrucRec = GraalAddDruc( GraalCurrentDruc ); + if ( DrucRec != (rdsrec_list *)0 ) break; + } + + if ( DrucRec != (rdsrec_list *)0 ) break; + } + } + else + { + ScanRec = GraalCurrentDruc->NEXT; + + while ( ScanRec != (rdsrec_list *)0 ) + { + DrucRec = GraalAddDruc( ScanRec ); + if ( DrucRec != (rdsrec_list *)0 ) break; + + ScanRec = ScanRec->NEXT; + } + + if ( ScanRec == (rdsrec_list *)0 ) + { + for ( Layer = GetRdsLayer( GraalCurrentDruc ) + 1; Layer < RDS_MAX_LAYER; Layer++ ) + { + for ( GraalCurrentDruc = GraalFigureDruc->LAYERTAB[ Layer ]; + GraalCurrentDruc != (rdsrec_list *)0; + GraalCurrentDruc = GraalCurrentDruc->NEXT ) + { + DrucRec = GraalAddDruc( GraalCurrentDruc ); + if ( DrucRec != (rdsrec_list *)0 ) break; + } + + if ( DrucRec != (rdsrec_list *)0 ) break; + } + } + else + { + GraalCurrentDruc = ScanRec; + } + } + + if ( GraalCurrentDruc == (rdsrec_list *)0 ) + { + GraalDisplayDrucNoMoreError(); + + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + for ( ScanRec = GraalFigureDruc->LAYERTAB[ Layer ]; + ScanRec != (rdsrec_list *)0; + ScanRec = ScanRec->NEXT ) + { + ClearGraalDruc( ScanRec ); + } + } + } + else + { + GraalRectangleDruc = DrucRec; + GraalDisplayDrucError( GraalCurrentDruc ); + + X1 = ( DrucRec->X + ( DrucRec->DX >> 1 ) ) / GRAAL_RDS_LAMBDA; + Y1 = ( DrucRec->Y + ( DrucRec->DY >> 1 ) ) / GRAAL_RDS_LAMBDA; + + if ( ( X1 < GraalLambdaGridX ) || + ( Y1 < GraalLambdaGridY ) || + ( X1 > (GraalLambdaGridX + GraalLambdaGridDx) ) || + ( Y1 > (GraalLambdaGridY + GraalLambdaGridDy) ) ) + { + GraalZoomCenter( X1, Y1 ); + } + else + { + GraalDisplayRectangle( DrucRec ); + } + + GraalEnterPanel( &GraalToolsDrucPanel ); + } + } + else + { + GraalExitPanel( &GraalToolsDrucPanel ); + } +} + +/*------------------------------------------------------------\ +| | +| GraalToolsDruc | +| | +\------------------------------------------------------------*/ + +void GraalToolsDruc( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ) + + long LambdaX1; + long LambdaY1; + long LambdaX2; + long LambdaY2; +{ + graalselect *Select; + graalselect *DelSelect; + graalselect **Previous; + rdsrec_list *Rectangle; + rdsrec_list **PrevRectangle; + rdsrec_list *DrucRec; + void *Pointer; + char Layer; + char Error; + long X1; + long Y1; + + rdsbegin(); + + if ( GraalFigureDruc != (rdsfig_list *)0 ) + { + GraalDelDrucFigure(); + } + + GraalEditSelectFence( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ); + + Previous = &GraalHeadSelect; + Select = GraalHeadSelect; + + while ( Select != (graalselect *)NULL ) + { + if ( IsRdsFigure( Select->RECTANGLE ) || + IsRdsInstance( Select->RECTANGLE ) ) + { + DelSelect = Select; + Select = Select->NEXT; + *Previous = Select; + + GraalFreeSelect( DelSelect ); + } + else + { + GraalAcceptRectangle( Select->RECTANGLE ); + + Previous = &Select->NEXT; + Select = Select->NEXT; + } + } + + if ( GraalHeadSelect == (graalselect *)NULL ) + { + GraalWarningMessage( GraalMainWindow, "No element found !" ); + } + else + { + GraalFigureDruc = addrdsfig( "_patrick_", MACRO_PLUS_TAILLE ); + + for ( Select = GraalHeadSelect; + Select != (graalselect *)NULL; + Select = Select->NEXT ) + { + Rectangle = Select->RECTANGLE; + Pointer = GRAAL_MBK( Rectangle ); + + if ( IsRdsSegment( Rectangle ) ) + { + segmbkrds( GraalFigureDruc, (phseg_list *)Pointer, 0 ); + } + else + if ( IsRdsConnector( Rectangle ) ) + { + conmbkrds( GraalFigureDruc, (phcon_list *)Pointer ); + } + else + if ( IsRdsReference( Rectangle ) ) + { + refmbkrds( GraalFigureDruc, (phref_list *)Pointer ); + } + else + if ( IsRdsVia( Rectangle ) ) + { + viambkrds( GraalFigureDruc, (phvia_list *)Pointer, 0 ); + } + } + + GraalDelSelect(); + + if ( ( GraalHeadEqui != (rdsrec_list *)NULL ) || + ( GraalHeadPeek != (graalpeek *)NULL ) ) + { + GraalDelEqui(); + GraalDelPeek(); + GraalZoomRefresh(); + } + + GraalFigureDruc = Graaldrucrdsfig( GraalFigureDruc ); + + GraalDisplayToolsMessage(); + + if ( GraalFigureDruc == (rdsfig_list *)NULL ) + { + GraalErrorMessage( GraalMainWindow, "Unable to execute druc !" ); + } + else + { + Error = GRAAL_FALSE; + + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + for ( Rectangle = GraalFigureDruc->LAYERTAB[ Layer ]; + Rectangle != (rdsrec_list *)NULL; + Rectangle = Rectangle->NEXT ) + { + ClearGraalDruc( Rectangle ); Error = GRAAL_TRUE; + } + } + + if ( Error == GRAAL_FALSE ) + { + GraalWarningMessage( GraalMainWindow, "No design error !" ); + GraalDelDrucFigure(); + GraalExitPanel( &GraalToolsDrucPanel ); + } + else + { + PrevRectangle = &GraalFigureDruc->LAYERTAB[ RDS_USER0 ]; + + for ( Layer = RDS_USER0; Layer <= RDS_USER8; Layer++ ) + { + *PrevRectangle = GraalFigureDruc->LAYERTAB[ Layer ]; + + for ( Rectangle = GraalFigureDruc->LAYERTAB[ Layer ]; + Rectangle != (rdsrec_list *)0; + Rectangle = Rectangle->NEXT ) + { + SetRdsLayer( Rectangle, RDS_USER0 ); + PrevRectangle = &Rectangle->NEXT; + } + + GraalFigureDruc->LAYERTAB[ Layer ] = (rdsrec_list *)0; + } + + *PrevRectangle = GraalFigureDruc->LAYERTAB[ RDS_USER9 ]; + GraalFigureDruc->LAYERTAB[ RDS_USER9 ] = (rdsrec_list *)0; + + GraalCurrentDruc = (rdsrec_list *)0; + GraalToolsDrucNextError(); + } + } + } + + rdsend(); +} diff --git a/alliance/src/graal/src/GMT_druc.h b/alliance/src/graal/src/GMT_druc.h new file mode 100644 index 00000000..6f535ed2 --- /dev/null +++ b/alliance/src/graal/src/GMT_druc.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Druc.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.09.93 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_TOOLS_DRC +# define GRAAL_TOOLS_DRC + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define GRAAL_DRUC_MESSAGE_SIZE 256 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GMT_menu.c b/alliance/src/graal/src/GMT_menu.c new file mode 100644 index 00000000..30f961ca --- /dev/null +++ b/alliance/src/graal/src/GMT_menu.c @@ -0,0 +1,575 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Menu.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rtl.h" +# include "GSB.h" +# include "GTB.h" +# include "GRM.h" +# include "GMV.h" +# include "GMT.h" +# include "GMX.h" + +# include "GMT_menu.h" +# include "GMT_dialog.h" +# include "GMT_tools.h" +# include "GMT_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + GraalMenuItem GraalToolsMenu[] = + + { + { + "Equi", + 'E', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackToolsEqui, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "UnEqui", + 'i', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackToolsUnEqui, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Flat", + 'F', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackToolsFlatInstance, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Unflat", + 't', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackToolsUnflatInstance, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Peek", + 'P', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackToolsPeek, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Unpeek", + 'k', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackToolsUnpeek, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Druc", + 'D', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackToolsDruc, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Real flat", + 'R', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackToolsRealFlatInstance, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Hierarchy", + 'H', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackToolsHierarchy, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Load Error", + 'L', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackToolsLoadError, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Save Image", + 'S', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackToolsSavePixmap, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Message", + 'M', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackToolsMessage, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackToolsEqui | +| | +\------------------------------------------------------------*/ + +void CallbackToolsEqui( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterPanel( &GraalToolsGlobalPanel ); + + if ( GraalHeadEqui != (rdsrec_list *)NULL ) + { + GraalDelEqui(); + GraalZoomRefresh(); + } + + GraalChangeEditMode( GRAAL_TOOLS_EQUI, + GraalPromptToolsEqui ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsUnEqui | +| | +\------------------------------------------------------------*/ + +void CallbackToolsUnEqui( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( GraalHeadEqui != (rdsrec_list *)NULL ) + { + GraalDelEqui(); + GraalZoomRefresh(); + } + + GraalEnterPanel( &GraalToolsGlobalPanel ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsFlatInstance | +| | +\------------------------------------------------------------*/ + +void CallbackToolsFlatInstance( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterPanel( &GraalToolsGlobalPanel ); + + GraalChangeEditMode( GRAAL_TOOLS_FLATTEN, + GraalPromptToolsFlatten ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsRealFlatInstance | +| | +\------------------------------------------------------------*/ + +void CallbackToolsRealFlatInstance( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterPanel( &GraalToolsGlobalPanel ); + + GraalChangeEditMode( GRAAL_TOOLS_REAL_FLATTEN, + GraalPromptToolsRealFlatten ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsUnflatInstance | +| | +\------------------------------------------------------------*/ + +void CallbackToolsUnflatInstance( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterPanel( &GraalToolsGlobalPanel ); + + GraalChangeEditMode( GRAAL_TOOLS_UNFLATTEN, + GraalPromptToolsUnflatten ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsPeek | +| | +\------------------------------------------------------------*/ + +void CallbackToolsPeek( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterPanel( &GraalToolsGlobalPanel ); + + GraalChangeEditMode( GRAAL_TOOLS_PEEK, + GraalPromptToolsPeek ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsUnpeek | +| | +\------------------------------------------------------------*/ + +void CallbackToolsUnpeek( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterPanel( &GraalToolsGlobalPanel ); + + GraalToolsUnpeek(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsDruc | +| | +\------------------------------------------------------------*/ + +void CallbackToolsDruc( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterPanel( &GraalToolsGlobalPanel ); + + GraalChangeEditMode( GRAAL_TOOLS_DRUC, + GraalPromptToolsDruc ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsMessage | +| | +\------------------------------------------------------------*/ + +void CallbackToolsMessage( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterPanel( &GraalToolsMessagePanel ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsHierarchy | +| | +\------------------------------------------------------------*/ + +void CallbackToolsHierarchy( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterPanel( &GraalToolsHierarchyPanel ); + + GraalChangeEditMode( GRAAL_TOOLS_HIERARCHY_DOWN, + GraalPromptToolsHierarchyDown ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsSavePixmap | +| | +\------------------------------------------------------------*/ + +void CallbackToolsSavePixmap( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( GraalFigureMbk != (phfig_list *)NULL ) + { + GraalEnterDialog( &GraalToolsSavePixmapDialog ); + } + else + { + GraalErrorMessage( GraalMainWindow, "No current figure !" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsLoadError | +| | +\------------------------------------------------------------*/ + +void CallbackToolsLoadError( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + XmString Filter; + + rdsbegin(); + + if ( GraalToolsFilter[2] == '\0' ) + { + strcat( GraalToolsFilter, RDS_IN ); + strcat( GraalToolsExtention, RDS_IN ); + + Filter = XmStringCreateSimple( GraalToolsFilter ); + + XtVaSetValues( GraalToolsLoadErrorDialog.WIDGET, + XmNpattern, Filter, NULL); + + XmStringFree( Filter ); + } + + if ( GraalFigureMbk != (phfig_list *)NULL ) + { + GraalEnterDialog( &GraalToolsLoadErrorDialog ); + } + else + { + GraalErrorMessage( GraalMainWindow, "No current figure !" ); + } + + rdsend(); +} diff --git a/alliance/src/graal/src/GMT_menu.h b/alliance/src/graal/src/GMT_menu.h new file mode 100644 index 00000000..40225548 --- /dev/null +++ b/alliance/src/graal/src/GMT_menu.h @@ -0,0 +1,83 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Menu.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_MENU +# define GRAAL_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackToolsEqui(); + extern void CallbackToolsUnEqui(); + extern void CallbackToolsFlatInstance(); + extern void CallbackToolsRealFlatInstance(); + extern void CallbackToolsUnflatInstance(); + extern void CallbackToolsPeek(); + extern void CallbackToolsUnpeek(); + extern void CallbackToolsDruc(); + extern void CallbackToolsMessage(); + extern void CallbackToolsHierarchy(); + extern void CallbackToolsLoadError(); + extern void CallbackToolsSavePixmap(); + +# endif diff --git a/alliance/src/graal/src/GMT_message.c b/alliance/src/graal/src/GMT_message.c new file mode 100644 index 00000000..60295ebf --- /dev/null +++ b/alliance/src/graal/src/GMT_message.c @@ -0,0 +1,286 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Message.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GRM.h" +# include "GMX.h" +# include "GTB.h" +# include "GSB.h" +# include "GMT.h" +# include "GMT_tools.h" +# include "GMT_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalPromptToolsPeek | +| | +\------------------------------------------------------------*/ + +void GraalPromptToolsPeek() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Peek" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO, "Select window" ); + + switch ( GraalCountEventEdit ) + { + case 0 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter first corner" ); + + break; + + case 1 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter next corner" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptToolsDruc | +| | +\------------------------------------------------------------*/ + +void GraalPromptToolsDruc() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Druc" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO, "Select window" ); + + switch ( GraalCountEventEdit ) + { + case 0 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter first corner" ); + + break; + + case 1 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter next corner" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptToolsEqui | +| | +\------------------------------------------------------------*/ + +void GraalPromptToolsEqui() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Equi" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO, "Select object" ); + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter select point" ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptToolsFlatten | +| | +\------------------------------------------------------------*/ + +void GraalPromptToolsFlatten() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Flatten" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO, "Select window" ); + + switch ( GraalCountEventEdit ) + { + case 0 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter first corner" ); + + break; + + case 1 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter next corner" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptToolsRealFlatten | +| | +\------------------------------------------------------------*/ + +void GraalPromptToolsRealFlatten() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Real flatten" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO, "Select window" ); + + switch ( GraalCountEventEdit ) + { + case 0 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter first corner" ); + + break; + + case 1 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter next corner" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptToolsUnflatten | +| | +\------------------------------------------------------------*/ + +void GraalPromptToolsUnflatten() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Unflatten" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO, "Select window" ); + + switch ( GraalCountEventEdit ) + { + case 0 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter first corner" ); + + break; + + case 1 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter next corner" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptToolsHierarchyDown | +| | +\------------------------------------------------------------*/ + +void GraalPromptToolsHierarchyDown() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Go down" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO, "Select instance" ); + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter select point" ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptToolsHierarchyShow | +| | +\------------------------------------------------------------*/ + +void GraalPromptToolsHierarchyShow() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Show path" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO, "Select root point" ); + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter point" ); + + rdsend(); +} diff --git a/alliance/src/graal/src/GMT_message.h b/alliance/src/graal/src/GMT_message.h new file mode 100644 index 00000000..5098618d --- /dev/null +++ b/alliance/src/graal/src/GMT_message.h @@ -0,0 +1,79 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Message.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_MESSAGE +# define GRAAL_MESSAGE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalPromptToolsPeek(); + extern void GraalPromptToolsEqui(); + extern void GraalPromptToolsFlatten(); + extern void GraalPromptToolsRealFlatten(); + extern void GraalPromptToolsUnflatten(); + extern void GraalPromptToolsDruc(); + extern void GraalPromptToolsHierarchyDown(); + extern void GraalPromptToolsHierarchyShow(); + +# endif diff --git a/alliance/src/graal/src/GMT_panel.c b/alliance/src/graal/src/GMT_panel.c new file mode 100644 index 00000000..2206387c --- /dev/null +++ b/alliance/src/graal/src/GMT_panel.c @@ -0,0 +1,983 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Panel.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GRM.h" +# include "GMX.h" +# include "GTB.h" +# include "GSB.h" +# include "GMT.h" + +# include "GMT_panel.h" +# include "GMT_message.h" +# include "GMT_dialog.h" +# include "GMT_tools.h" +# include "GMT_druc.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Panel | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Panel Tools | +| | +\------------------------------------------------------------*/ + + GraalPanelButtonItem GraalToolsGlobalButton[] = + + { + { + "Equi", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackToolsGlobalEqui, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "UnEqui", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 1, + 1, 1, + CallbackToolsGlobalUnEqui, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Flat", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 2, + 1, 1, + CallbackToolsGlobalFlat, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Unflat", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 3, + 1, 1, + CallbackToolsGlobalUnflat, + (XtPointer)NULL, + (Widget)NULL + } + , + + { + "Peek", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 4, + 1, 1, + CallbackToolsGlobalPeek, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Unpeek", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 5, + 1, 1, + CallbackToolsGlobalUnpeek, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Druc", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 6, + 1, 1, + CallbackToolsGlobalDruc, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Real flat", + NULL, NULL, 0, 0, + "Red", + NULL, + 0, 7, + 1, 1, + CallbackToolsGlobalRealFlat, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Close", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 8, + 1, 1, + CallbackToolsCloseGlobal, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalToolsGlobalPanel = + + { + "Tools", + 1, + 0, + GRAAL_TOOLS_GLOBAL_X, + GRAAL_TOOLS_GLOBAL_Y, + 100, + 225, + 1, + 9, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + 9, + GraalToolsGlobalButton + }; + + int GraalToolsGlobalDefaultValues[ 5 ] = + + { + GRAAL_TOOLS_GLOBAL_X, + GRAAL_TOOLS_GLOBAL_Y, + 100, 225, 0 + }; + +/*------------------------------------------------------------\ +| | +| Panel Message | +| | +\------------------------------------------------------------*/ + + GraalPanelButtonItem GraalToolsMessageButton[] = + + { + { + "Text", + "Nothing", NULL, 0, 0, + NULL, + NULL, + 0, 0, + 8, 9, + NULL, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Close", + NULL, NULL, 0, 0, + NULL, + NULL, + 3, 9, + 2, 1, + CallbackToolsCloseMessage, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalToolsMessagePanel = + + { + "Message", + 1, + 0, + GRAAL_TOOLS_MESSAGE_X, + GRAAL_TOOLS_MESSAGE_Y, + 360, + 250, + 8, + 10, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + 2, + GraalToolsMessageButton + }; + + int GraalToolsMessageDefaultValues[ 5 ] = + + { + GRAAL_TOOLS_MESSAGE_X, + GRAAL_TOOLS_MESSAGE_Y, + 360, 250, 0 + }; + +/*------------------------------------------------------------\ +| | +| Druc Panel | +| | +\------------------------------------------------------------*/ + + static GraalPanelButtonItem GraalToolsDrucButton[] = + + { + { + "Text", + "Nothing", NULL, 0, 0, + NULL, + NULL, + 0, 0, + 8, 5, + NULL, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Continue", + NULL, NULL, 0, 0, + NULL, + NULL, + 1, 5, + 2, 1, + CallbackToolsDrucContinue, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Abort", + NULL, NULL, 0, 0, + NULL, + NULL, + 5, 5, + 2, 1, + CallbackToolsDrucAbort, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalToolsDrucPanel = + + { + "Druc error", + 1, + 0, + GRAAL_TOOLS_DRUC_X, + GRAAL_TOOLS_DRUC_Y, + 360, + 150, + 8, + 6, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + 3, + GraalToolsDrucButton + }; + + int GraalToolsDrucDefaultValues[ 5 ] = + + { + GRAAL_TOOLS_DRUC_X, + GRAAL_TOOLS_DRUC_Y, + 360, 150, 0 + }; + +/*------------------------------------------------------------\ +| | +| Hierarchy Panel | +| | +\------------------------------------------------------------*/ + + GraalPanelButtonItem GraalToolsHierarchyButton[] = + + { + { + "Go up", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackToolsHierarchyUp, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Go down", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 1, + 1, 1, + CallbackToolsHierarchyDown, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Show path", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 2, + 1, 1, + CallbackToolsHierarchyShow, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Reload", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 3, + 1, 1, + CallbackToolsHierarchyReload, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Close", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 4, + 1, 1, + CallbackToolsCloseHierarchy, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalToolsHierarchyPanel = + + { + "Hierarchy", + 1, + 0, + GRAAL_TOOLS_HIERARCHY_X, + GRAAL_TOOLS_HIERARCHY_Y, + 100, + 100, + 1, + 5, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + 5, + GraalToolsHierarchyButton + }; + + int GraalToolsHierarchyDefaultValues[ 5 ] = + + { + GRAAL_TOOLS_HIERARCHY_X, + GRAAL_TOOLS_HIERARCHY_Y, + 100, 125, 0 + }; + +/*------------------------------------------------------------\ +| | +| Show Hierarchy Panel | +| | +\------------------------------------------------------------*/ + + GraalPanelButtonItem GraalToolsHierarchyShowButton[] = + + { + { + "Text", + "Nothing", NULL, 0, 0, + NULL, + NULL, + 0, 0, + 8, 9, + NULL, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Close", + NULL, NULL, 0, 0, + NULL, + NULL, + 3, 9, + 2, 1, + CallbackToolsCloseHierarchyShow, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalToolsHierarchyShowPanel = + + { + "Show hierarchy", + 1, + 0, + GRAAL_TOOLS_HIERARCHY_SHOW_X, + GRAAL_TOOLS_HIERARCHY_SHOW_Y, + 360, + 250, + 8, + 10, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + 2, + GraalToolsHierarchyShowButton + }; + + int GraalToolsHierarchyShowDefaultValues[ 5 ] = + + { + GRAAL_TOOLS_HIERARCHY_SHOW_X, + GRAAL_TOOLS_HIERARCHY_SHOW_Y, + 360, 250, 0 + }; + + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback For Tools | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackToolsGlobalEqui | +| | +\------------------------------------------------------------*/ + +void CallbackToolsGlobalEqui( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( GraalHeadEqui != (rdsrec_list *)NULL ) + { + GraalDelEqui(); + GraalZoomRefresh(); + } + + GraalChangeEditMode( GRAAL_TOOLS_EQUI, + GraalPromptToolsEqui ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsGlobalUnEqui | +| | +\------------------------------------------------------------*/ + +void CallbackToolsGlobalUnEqui( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( GraalHeadEqui != (rdsrec_list *)NULL ) + { + GraalDelEqui(); + GraalZoomRefresh(); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsGlobalFlat | +| | +\------------------------------------------------------------*/ + +void CallbackToolsGlobalFlat( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalChangeEditMode( GRAAL_TOOLS_FLATTEN, + GraalPromptToolsFlatten ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsGlobalUnflat | +| | +\------------------------------------------------------------*/ + +void CallbackToolsGlobalUnflat( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalChangeEditMode( GRAAL_TOOLS_UNFLATTEN, + GraalPromptToolsUnflatten ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsGlobalPeek | +| | +\------------------------------------------------------------*/ + +void CallbackToolsGlobalPeek( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalChangeEditMode( GRAAL_TOOLS_PEEK, + GraalPromptToolsPeek ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsGlobalUnpeek | +| | +\------------------------------------------------------------*/ + +void CallbackToolsGlobalUnpeek( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalToolsUnpeek(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsGlobalDruc | +| | +\------------------------------------------------------------*/ + +void CallbackToolsGlobalDruc( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalChangeEditMode( GRAAL_TOOLS_DRUC, + GraalPromptToolsDruc ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsGlobalRealFlat | +| | +\------------------------------------------------------------*/ + +void CallbackToolsGlobalRealFlat( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalChangeEditMode( GRAAL_TOOLS_REAL_FLATTEN, + GraalPromptToolsRealFlatten ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsCloseGlobal | +| | +\------------------------------------------------------------*/ + +void CallbackToolsCloseGlobal( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalExitPanel( &GraalToolsGlobalPanel ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Hierarchy | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackToolsHierarchyUp | +| | +\------------------------------------------------------------*/ + +void CallbackToolsHierarchyUp( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalToolsHierarchyUp(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsHierarchyDown | +| | +\------------------------------------------------------------*/ + +void CallbackToolsHierarchyDown( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalChangeEditMode( GRAAL_TOOLS_HIERARCHY_DOWN, + GraalPromptToolsHierarchyDown ); + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsHierarchyShow | +| | +\------------------------------------------------------------*/ + +void CallbackToolsHierarchyShow( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalChangeEditMode( GRAAL_TOOLS_HIERARCHY_SHOW, + GraalPromptToolsHierarchyShow ); + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsHierarchyReload | +| | +\------------------------------------------------------------*/ + +void CallbackToolsHierarchyReload( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalToolsHierarchyReload(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsCloseHierarchy | +| | +\------------------------------------------------------------*/ + +void CallbackToolsCloseHierarchy( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalToolsDelAllHierarchy(); + GraalExitPanel( &GraalToolsHierarchyPanel ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Message | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackToolsCloseMessage | +| | +\------------------------------------------------------------*/ + +void CallbackToolsCloseMessage( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalExitPanel( &GraalToolsMessagePanel ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDisplayToolsMessage | +| | +\------------------------------------------------------------*/ + +void GraalDisplayToolsMessage() +{ + char *Message; + rdsbegin(); + + Message = GraalGetErrorMessage(); + + if ( Message != (char *)NULL ) + { + XmTextSetString( GraalToolsHierarchyShowButton[0].BUTTON, Message ); + + GraalEnterPanel( &GraalToolsMessagePanel ); + } + else + { + XmTextSetString( GraalToolsMessageButton[0].BUTTON, "" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Druc | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackToolsDrucContinue | +| | +\------------------------------------------------------------*/ + +void CallbackToolsDrucContinue( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalToolsDrucNextError(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsDrucAbort | +| | +\------------------------------------------------------------*/ + +void CallbackToolsDrucAbort( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalToolsDrucAbortError(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDisplayDrucMessage | +| | +\------------------------------------------------------------*/ + +void GraalDisplayDrucMessage( Message ) + + char *Message; +{ + rdsbegin(); + + XmTextSetString( GraalToolsDrucButton[0].BUTTON, Message ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Hierarchy Show | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackToolsCloseHierarchyShow | +| | +\------------------------------------------------------------*/ + +void CallbackToolsCloseHierarchyShow( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalExitPanel( &GraalToolsHierarchyShowPanel ); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDisplayHierarchyShowMessage | +| | +\------------------------------------------------------------*/ + +void GraalDisplayHierarchyShowMessage( Message ) + + char *Message; +{ + rdsbegin(); + + XmTextSetString( GraalToolsHierarchyShowButton[0].BUTTON, Message ); + + rdsend(); +} diff --git a/alliance/src/graal/src/GMT_panel.h b/alliance/src/graal/src/GMT_panel.h new file mode 100644 index 00000000..4db9bc34 --- /dev/null +++ b/alliance/src/graal/src/GMT_panel.h @@ -0,0 +1,109 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Panel.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_TOOLS_PANEL +# define GRAAL_TOOLS_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define GRAAL_TOOLS_GLOBAL_X 990 +# define GRAAL_TOOLS_GLOBAL_Y 505 +# define GRAAL_TOOLS_MESSAGE_X 330 +# define GRAAL_TOOLS_MESSAGE_Y 280 +# define GRAAL_TOOLS_DRUC_X 100 +# define GRAAL_TOOLS_DRUC_Y 230 +# define GRAAL_TOOLS_HIERARCHY_X 890 +# define GRAAL_TOOLS_HIERARCHY_Y 80 +# define GRAAL_TOOLS_HIERARCHY_SHOW_X 330 +# define GRAAL_TOOLS_HIERARCHY_SHOW_Y 280 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackToolsGlobalEqui(); + extern void CallbackToolsGlobalUnEqui(); + extern void CallbackToolsGlobalFlat(); + extern void CallbackToolsGlobalUnflat(); + extern void CallbackToolsGlobalPeek(); + extern void CallbackToolsGlobalUnpeek(); + extern void CallbackToolsGlobalDruc(); + extern void CallbackToolsGlobalRealFlat(); + extern void CallbackToolsCloseGlobal(); + + extern void CallbackToolsCloseMessage(); + + extern void CallbackToolsHierarchyUp(); + extern void CallbackToolsHierarchyDown(); + extern void CallbackToolsHierarchyReload(); + extern void CallbackToolsHierarchyShow(); + extern void CallbackToolsCloseHierarchy(); + + extern void CallbackToolsDrucContinue(); + extern void CallbackToolsDrucAbort(); + + extern void CallbackDisplayDrucMessage(); + + extern void CallbackToolsCloseHierarchyShow(); + + extern void GraalDisplayHierarchyShowMessage(); + +# endif diff --git a/alliance/src/graal/src/GMT_tools.c b/alliance/src/graal/src/GMT_tools.c new file mode 100644 index 00000000..ab2244aa --- /dev/null +++ b/alliance/src/graal/src/GMT_tools.c @@ -0,0 +1,932 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Tools.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# ifdef AUTO_HAS_XPM +# include +# endif + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rfm.h" +# include "rpr.h" +# include "rwi.h" +# include "rut.h" +# include "GTB.h" +# include "GSB.h" +# include "GMX.h" +# include "GMF.h" +# include "GRM.h" +# include "GMT.h" + +# include "GMT_tools.h" +# include "GMT_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + graalhierarchy *GraalHeadHierarchy = (graalhierarchy *)0; + + char GraalToolsFilter[ 10 ] = "*."; + char GraalToolsExtention[ 10 ] = "."; + + char GraalToolsBuffer[ 128 ]; + char GraalToolsDirectoryBuffer[ 512 ]; + +/*------------------------------------------------------------\ +| | +| Hierarchy Show Buffer | +| | +\------------------------------------------------------------*/ + + static char GraalHierarchyShowMessage[ GRAAL_HIERARCHY_SHOW_MESSAGE_SIZE ]; + static char *GraalScanHierarchyShow; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalAllocHierarchy | +| | +\------------------------------------------------------------*/ + +graalhierarchy *GraalAllocHierarchy () + +{ + return ( (graalhierarchy *) rdsalloc ( sizeof ( graalhierarchy ), 1)); +} + +/*------------------------------------------------------------\ +| | +| GraalFreeHierarchy | +| | +\------------------------------------------------------------*/ + +void GraalFreeHierarchy ( FreeHierarchy ) + + graalhierarchy *FreeHierarchy; + +{ + rdsfree( (char *)FreeHierarchy, sizeof(FreeHierarchy) ); +} + +/*------------------------------------------------------------\ +| | +| GraalAddHierarchy | +| | +\------------------------------------------------------------*/ + +void GraalAddHierarchy( Name ) + + char *Name; +{ + graalhierarchy *GraalHierarchy; + + rdsbegin(); + + GraalHierarchy = GraalAllocHierarchy (); + GraalHierarchy->NAME = Name; + GraalHierarchy->X = GraalLambdaGridX; + GraalHierarchy->Y = GraalLambdaGridY; + GraalHierarchy->DX = GraalLambdaGridDx; + GraalHierarchy->DY = GraalLambdaGridDy; + GraalHierarchy->NEXT = GraalHeadHierarchy; + GraalHeadHierarchy = GraalHierarchy; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDelHierarchy | +| | +\------------------------------------------------------------*/ + +char GraalDelHierarchy() + +{ + graalhierarchy *GraalHierarchy; + + if ( GraalHeadHierarchy != (graalhierarchy *) NULL ) + { + rdsbegin(); + + GraalHierarchy = GraalHeadHierarchy; + GraalHeadHierarchy = GraalHeadHierarchy->NEXT; + GraalFreeHierarchy( GraalHierarchy ); + + rdsend(); + return( GRAAL_TRUE ); + } + + return( GRAAL_FALSE ); +} + +/*------------------------------------------------------------\ +| | +| GraalToolsEqui | +| | +\------------------------------------------------------------*/ + +void GraalToolsEqui() + +{ + rdsbegin(); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + + if ( GraalHeadSelect != (graalselect *)NULL ) + { + GraalExtractEqui( GraalHeadSelect->RECTANGLE ); + } + + GraalDelSelect(); + GraalZoomRefresh(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalToolsRealFlatten | +| | +\------------------------------------------------------------*/ + +void GraalToolsRealFlatten() + +{ + graalselect *Select; + graalselect *DelSelect; + graalselect **PrevSelect; + char Buffer[ 512 ]; + + rdsbegin(); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + + GraalDelPeek(); + + Select = GraalHeadSelect; + PrevSelect = &GraalHeadSelect; + + while ( Select != (graalselect *)NULL ) + { + if ( GraalRealFlatInstance( Select->RECTANGLE ) ) + { + DelSelect = Select; + Select = Select->NEXT; + *PrevSelect = Select; + + GraalFreeSelect( DelSelect ); + } + else + { + PrevSelect = &Select->NEXT; + Select = Select->NEXT; + } + } + + GraalDelSelect(); + + GraalZoomRefresh(); + GraalDisplayToolsMessage(); + + sprintf( Buffer, "%s_real_flat", GraalFigureRds->NAME ); + GraalFigureMbk->NAME = namealloc( Buffer ); + + GraalChangeTopLevelTitle( GraalFigureMbk->NAME ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalToolsFlatten | +| | +\------------------------------------------------------------*/ + +void GraalToolsFlatten() + +{ + graalselect *Select; + rdsrec_list *Rectangle; + rdsins_list *Instance; + + rdsbegin(); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + + GraalDelPeek(); + + for ( Select = GraalHeadSelect; + Select != (graalselect *)NULL; + Select = Select->NEXT ) + { + Rectangle = Select->RECTANGLE; + + Instance = (rdsins_list *)GRAAL_PREVIOUS( Rectangle ); + + GraalFlatInstance( Instance ); + } + + GraalDelSelect(); + GraalZoomRefresh(); + GraalDisplayToolsMessage(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalToolsUnflatten | +| | +\------------------------------------------------------------*/ + +void GraalToolsUnflatten() + +{ + graalselect *Select; + rdsrec_list *Rectangle; + rdsins_list *Instance; + + rdsbegin(); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + + for ( Select = GraalHeadSelect; + Select != (graalselect *)NULL; + Select = Select->NEXT ) + { + Rectangle = Select->RECTANGLE; + + Instance = (rdsins_list *)GRAAL_PREVIOUS( Rectangle ); + GraalUnflatInstance( Instance ); + } + + GraalDelSelect(); + GraalZoomRefresh(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalToolsPeek | +| | +\------------------------------------------------------------*/ + +void GraalToolsPeek( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ) + + long LambdaX1; + long LambdaY1; + long LambdaX2; + long LambdaY2; +{ + long Offset; + graalwin *ScanWin; + graalwinrec *ScanWinRec; + rdsrec_list *Rec; + graalpeek *Peek; + char ScanRec; + char Layer; + long XabMin; + long XabMax; + long YabMin; + long YabMax; + long Xmin; + long Xmax; + long Ymin; + long Ymax; + long X; + long Y; + long Swap; + + rdsbegin(); + + if ( ( LambdaX1 != LambdaX2 ) && + ( LambdaY1 != LambdaY2 ) ) + { + if ( LambdaX1 > LambdaX2 ) + { + Swap = LambdaX1; LambdaX1 = LambdaX2; LambdaX2 = Swap; + } + + if ( LambdaY1 > LambdaY2 ) + { + Swap = LambdaY1; LambdaY1 = LambdaY2; LambdaY2 = Swap; + } + } + + if ( GraalFigureMbk != (phfig_list *)NULL ) + { + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + + GraalDelEqui(); + GraalDelPeek(); + + LambdaX1 = LambdaX1 * GRAAL_RDS_LAMBDA; + LambdaX2 = LambdaX2 * GRAAL_RDS_LAMBDA; + LambdaY1 = LambdaY1 * GRAAL_RDS_LAMBDA; + LambdaY2 = LambdaY2 * GRAAL_RDS_LAMBDA; + + XabMin = LambdaX1 - GRAAL_PEEK_BOUND; + YabMin = LambdaY1 - GRAAL_PEEK_BOUND; + XabMax = LambdaX2 + GRAAL_PEEK_BOUND; + YabMax = LambdaY2 + GRAAL_PEEK_BOUND; + + Xmin = ( LambdaX1 - GraalWindowXmin ) / GraalWindowSide; + Xmax = ( LambdaX2 - GraalWindowXmin ) / GraalWindowSide; + Ymin = ( LambdaY1 - GraalWindowYmin ) / GraalWindowSide; + Ymax = ( LambdaY2 - GraalWindowYmin ) / GraalWindowSide; + + if ( Xmin < 0 ) Xmin = 0; + if ( Xmin > GraalWindowDx ) Xmin = GraalWindowDx - 1; + if ( Ymin < 0 ) Ymin = 0; + if ( Ymin > GraalWindowDy ) Ymin = GraalWindowDy - 1; + + if ( Xmax < 0 ) Xmax = 0; + if ( Xmax > GraalWindowDx ) Xmax = GraalWindowDx - 1; + if ( Ymax < 0 ) Ymax = 0; + if ( Ymax > GraalWindowDy ) Ymax = GraalWindowDy - 1; + + Y = Ymin; + + while ( Y <= Ymax ) + { + X = Xmin; + + while ( X <= Xmax ) + { + Offset = ( Y * GraalWindowDx ) + X; + + ScanWin = &GraalWindowTable[ Offset ]; + + if ( ScanWin->LAYERTAB != (graalwinrec **)NULL ) + { + for ( ScanWinRec = ScanWin->LAYERTAB[ RDS_ABOX ]; + ScanWinRec != (graalwinrec *)NULL; + ScanWinRec = ScanWinRec->NEXT ) + { + for ( ScanRec = 0; ScanRec < GRAAL_MAX_REC ; ScanRec++ ) + { + Rec = ScanWinRec->RECTAB[ ScanRec ]; + + if ( ( Rec != (rdsrec_list *)NULL ) && + ( ! IsRdsFigRec( Rec ) ) && + ( ! IsGraalDeleted( Rec ) ) && + ( ! IsGraalFlatten( Rec ) ) && + ( ! IsGraalPeek( Rec ) ) && + ( ( Rec->X + Rec->DX ) >= XabMin ) && + ( ( Rec->Y + Rec->DY ) >= YabMin ) && + ( ( Rec->X ) <= XabMax ) && + ( ( Rec->Y ) <= YabMax ) ) + { + GraalAddPeek( Rec ); + } + } + } + } + + X = X + 1; + } + + Y = Y + 1; + } + + for ( Peek = GraalHeadPeek; + Peek != (graalpeek *)NULL; + Peek = Peek->NEXT ) + { + GraalPeekInstance( Peek->RECTANGLE, + LambdaX1, LambdaY1, + LambdaX2, LambdaY2 ); + } + + GraalZoomRefresh(); + GraalDisplayToolsMessage(); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_NORMAL_CURSOR ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalToolsUnpeek | +| | +\------------------------------------------------------------*/ + +void GraalToolsUnpeek() +{ + if ( GraalHeadPeek != (graalpeek *)NULL ) + { + rdsbegin(); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + GraalDelEqui(); + GraalDelPeek(); + GraalZoomRefresh(); + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_NORMAL_CURSOR ); + + rdsend(); + } +} + +/*------------------------------------------------------------\ +| | +| GraalToolsHierarchyDown | +| | +\------------------------------------------------------------*/ + +void GraalToolsHierarchyDown() +{ + graalselect *Select; + rdsrec_list *Rectangle; + rdsins_list *Instance; + char *ModelName; + + rdsbegin(); + + if ( GraalHeadSelect != (graalselect *)0 ) + { + Rectangle = GraalHeadSelect->RECTANGLE; + Instance = (rdsins_list *)GRAAL_PREVIOUS( Rectangle ); + ModelName = Instance->FIGNAME; + + GraalDelSelect(); + + if ( GraalHeadUndo != (graalundo *)NULL ) + { + CallbackFileSaveAs( NULL, NULL, NULL ); + } + + GraalAddHierarchy( GraalFigureRds->NAME ); + + GraalFileOpen( ModelName, 1 ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalToolsHierarchyShow | +| | +\------------------------------------------------------------*/ + +void GraalToolsHierarchyShow( LambdaX1, LambdaY1 ) + + long LambdaX1; + long LambdaY1; +{ + graalselect *Select; + rdsrec_list *Rectangle; + phins_list *InsMbk; + phins_list *ScanInsMbk; + phfig_list *ModelMbk; + long X; + long Y; + long Xab1; + long Yab1; + long Xab2; + long Yab2; + + rdsbegin(); + + GraalScanHierarchyShow = GraalHierarchyShowMessage; + + if ( GraalFigureMbk == (phfig_list *)0 ) + { + sprintf( GraalScanHierarchyShow, "No current figure !" ); + GraalScanHierarchyShow += strlen( GraalScanHierarchyShow ); + } + else + { + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + + LambdaX1 *= GRAAL_SCALE_X; + LambdaY1 *= GRAAL_SCALE_X; + + sprintf( GraalScanHierarchyShow, "FIGURE %s : (%.2f, %.2f)\n", + GraalFigureMbk->NAME, + (float)LambdaX1 / (float)SCALE_X, + (float)LambdaY1 / (float)SCALE_X ); + + GraalScanHierarchyShow += strlen( GraalScanHierarchyShow ); + + InsMbk = (phins_list *)0; + + for ( Select = GraalHeadSelect; + Select != (graalselect *)NULL; + Select = Select->NEXT ) + { + if ( IsRdsInstance( Select->RECTANGLE ) ) + { + InsMbk = (phins_list *)GRAAL_MBK( Select->RECTANGLE ); + } + } + + GraalDelSelect(); + + while ( InsMbk != (phins_list *)0 ) + { + ModelMbk = Graalgetphfig( InsMbk->FIGNAME, 'A' ); + + sprintf( GraalScanHierarchyShow, "INSTANCE %s (%s,%s)\n", + InsMbk->INSNAME, + InsMbk->FIGNAME, + GRAAL_SYMMETRY_NAME_TABLE[ InsMbk->TRANSF ][0] ); + + GraalScanHierarchyShow += strlen( GraalScanHierarchyShow ); + + if ( ModelMbk == (phfig_list *)0 ) + { + sprintf( GraalScanHierarchyShow, "Unable to load model %s !!\n", + InsMbk->FIGNAME ); + + break; + } + + invxyflat( &X, &Y, LambdaX1, LambdaY1, + InsMbk->XINS , InsMbk->YINS , + ModelMbk->XAB1, ModelMbk->YAB1, + ModelMbk->XAB2, ModelMbk->YAB2, + InsMbk->TRANSF ); + + sprintf( GraalScanHierarchyShow, "MODEL %s : (%.2f, %.2f)\n", + InsMbk->FIGNAME, + (float)X / (float)SCALE_X, + (float)Y / (float)SCALE_X ); + + GraalScanHierarchyShow += strlen( GraalScanHierarchyShow ); + + LambdaX1 = X; + LambdaY1 = Y; + + for ( ScanInsMbk = ModelMbk->PHINS; + ScanInsMbk != (phins_list *)0; + ScanInsMbk = ScanInsMbk->NEXT ) + { + ModelMbk = Graalgetphfig( ScanInsMbk->FIGNAME, 'P' ); + + if ( ModelMbk != (phfig_list *)0 ) + { + xyflat + ( &Xab1 , &Yab1, + ModelMbk->XAB1 , ModelMbk->YAB1, + ScanInsMbk->XINS , ScanInsMbk->YINS, + ModelMbk->XAB1 , ModelMbk->YAB1, + ModelMbk->XAB2 , ModelMbk->YAB2, + ScanInsMbk->TRANSF + ); + + xyflat + ( &Xab2 , &Yab2, + ModelMbk->XAB2 , ModelMbk->YAB2, + ScanInsMbk->XINS , ScanInsMbk->YINS, + ModelMbk->XAB1 , ModelMbk->YAB1, + ModelMbk->XAB2 , ModelMbk->YAB2, + ScanInsMbk->TRANSF + ); + + if ( ( LambdaX1 >= Xab1 ) && + ( LambdaX1 <= Xab2 ) && + ( LambdaY1 >= Yab1 ) && + ( LambdaY1 <= Yab2 ) ) break; + } + } + + InsMbk = ScanInsMbk; + } + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_NORMAL_CURSOR ); + } + + GraalDisplayHierarchyShowMessage( GraalHierarchyShowMessage ); + GraalEnterPanel( &GraalToolsHierarchyShowPanel ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalToolsHierarchyUp | +| | +\------------------------------------------------------------*/ + +void GraalToolsHierarchyUp() +{ + if ( GraalHeadHierarchy == (graalhierarchy *)0 ) + { + GraalErrorMessage( GraalMainWindow, "No previous model !" ); + } + else + { + if ( GraalHeadUndo != (graalundo *)NULL ) + { + CallbackFileSaveAs( NULL, NULL, NULL ); + } + + GraalFileOpen( GraalHeadHierarchy->NAME, 0 ); + + GraalLambdaGridX = GraalHeadHierarchy->X; + GraalLambdaGridY = GraalHeadHierarchy->Y; + GraalLambdaGridDx = GraalHeadHierarchy->DX; + GraalLambdaGridDy = GraalHeadHierarchy->DY; + + GraalComputeLambdaGrid(); + GraalComputeAndDisplayMap(); + + GraalZoomRefresh(); + GraalDelHierarchy(); + } +} + +/*------------------------------------------------------------\ +| | +| GraalToolsHierarchyReload | +| | +\------------------------------------------------------------*/ + +void GraalToolsHierarchyReload() +{ + long SaveLambdaGridX; + long SaveLambdaGridY; + long SaveLambdaGridDx; + long SaveLambdaGridDy; + + if ( GraalFigureMbk != (phfig_list *)NULL ) + { + if ( GraalHeadUndo != (graalundo *)NULL ) + { + CallbackFileSaveAs( NULL, NULL, NULL ); + } + + SaveLambdaGridX = GraalLambdaGridX; + SaveLambdaGridY = GraalLambdaGridY; + SaveLambdaGridDx = GraalLambdaGridDx; + SaveLambdaGridDy = GraalLambdaGridDy; + + GraalFileOpen( GraalFigureRds->NAME, 0 ); + + GraalLambdaGridX = SaveLambdaGridX; + GraalLambdaGridY = SaveLambdaGridY; + GraalLambdaGridDx = SaveLambdaGridDx; + GraalLambdaGridDy = SaveLambdaGridDy; + + GraalComputeLambdaGrid(); + GraalComputeAndDisplayMap(); + + GraalZoomRefresh(); + } +} + +/*------------------------------------------------------------\ +| | +| GraalToolsDelAllHierarchy | +| | +\------------------------------------------------------------*/ + +void GraalToolsDelAllHierarchy() +{ + while ( GraalHeadHierarchy != (graalhierarchy *)0 ) + { + GraalDelHierarchy(); + } +} + +/*------------------------------------------------------------\ +| | +| GraalToolsLoadError | +| | +\------------------------------------------------------------*/ + +void GraalToolsLoadError( FileName ) + + char *FileName; +{ + rdsfig_list *FigureRds; + rdsfig_list *HeadFigureRds; + rdsrec_list *ScanRec; + rdsrec_list *ErrorRec; + int Layer; + int Index; + char *SWAP_WORK_LIB = WORK_LIB; + + rdsbegin(); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + GraalUndisplayCursor(); + + GraalRecomputeBound = GRAAL_TRUE; + + if ( GRAAL_WORK_LIB == (char *)NULL ) + { + GRAAL_WORK_LIB = WORK_LIB; + } + + for ( Index = strlen( FileName ); Index >= 0; Index-- ) + { + if ( FileName[ Index ] == '/' ) break; + } + + if ( Index >= 0 ) + { + strcpy( GraalToolsDirectoryBuffer, FileName ); + strcpy( GraalToolsBuffer, FileName + Index + 1); + + GraalToolsDirectoryBuffer[ Index + 1 ] = '\0'; + + WORK_LIB = GraalToolsDirectoryBuffer; + } + else + { + strcpy( GraalToolsBuffer, FileName ); + + WORK_LIB = GRAAL_WORK_LIB; + } + + Index = strlen( GraalToolsBuffer ) - strlen( GraalToolsExtention ); + + if ( Index >= 0 ) + { + if ( ! strcmp( GraalToolsBuffer + Index, GraalToolsExtention ) ) + { + GraalToolsBuffer[ Index ] = '\0'; + } + } + + HeadFigureRds = HEAD_RDSFIG; + HEAD_RDSFIG = (rdsfig_list *)0; + + FigureRds = Graalgetrdsfig( GraalToolsBuffer, 'V' ); + + if ( FigureRds == (rdsfig_list *)0 ) + { + GraalDisplayToolsMessage(); + GraalErrorMessage( GraalMainWindow, "Unable to open this figure !" ); + } + else + { + FigureRds = Graalrflattenrdsfig( FigureRds, RDS_YES, RDS_NO ); + + if ( FigureRds == (rdsfig_list *)0 ) + { + GraalDisplayToolsMessage(); + GraalErrorMessage( GraalMainWindow, "Unable to open this figure !" ); + } + else + { + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + for ( ScanRec = FigureRds->LAYERTAB[ Layer ]; + ScanRec != (rdsrec_list *)0; + ScanRec = ScanRec->NEXT ) + { + ErrorRec = + + addrdsfigrec( GraalFigureRds, ScanRec->NAME, + GetRdsLayer( ScanRec ), + ScanRec->X , ScanRec->Y, + ScanRec->DX, ScanRec->DY ); + + SetGraalDruc( ErrorRec ); + + if ( ErrorRec->NEXT != (rdsrec_list *)NULL ) + { + GRAAL_PREVIOUS( ErrorRec->NEXT ) = &ErrorRec->NEXT; + } + + GRAAL_PREVIOUS( ErrorRec ) = + + &GraalFigureRds->LAYERTAB[ GetRdsLayer( ErrorRec ) ]; + + GraalInsertRectangle( ErrorRec ); + ErrorRec->USER = (void *)ErrorRec; + } + } + + delrdsfig( FigureRds->NAME ); + } + } + + while ( HEAD_RDSFIG != (rdsfig_list *)0 ) + { + delrdsfig( HEAD_RDSFIG->NAME ); + } + + HeadFigureRds = HEAD_RDSFIG; + HEAD_RDSFIG = HeadFigureRds; + + GraalZoomRefresh(); + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_NORMAL_CURSOR ); + GraalDisplayCursor(); + + WORK_LIB = SWAP_WORK_LIB; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalToolsSavePixmap | +| | +\------------------------------------------------------------*/ + +void GraalToolsSavePixmap( FileName ) + + char *FileName; +{ +# ifdef AUTO_HAS_XPM + XpmAttributes Attribute; + char *XpmFileName; + int Error; + + XpmFileName = rdsallocblock( strlen( FileName ) + 4 ); + sprintf( XpmFileName, "%s.xpm", FileName ); + + Attribute.colormap = GraalColorMap; + Attribute.valuemask = XpmColormap; + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + + Error = XpmWriteFileFromPixmap( GraalGraphicDisplay, + XpmFileName, + GraalGraphicPixmap, + (Pixmap)0, &Attribute ); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_NORMAL_CURSOR ); + + if ( Error ) + { + GraalErrorMessage( GraalMainWindow, "Unable to save xpm file !" ); + } + + rdsfreeblock( XpmFileName ); +# else + + GraalErrorMessage( GraalMainWindow, "XPM cannot be used: Not enabled at compile time !" ); + +# endif +} diff --git a/alliance/src/graal/src/GMT_tools.h b/alliance/src/graal/src/GMT_tools.h new file mode 100644 index 00000000..54133b68 --- /dev/null +++ b/alliance/src/graal/src/GMT_tools.h @@ -0,0 +1,96 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Tools.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_TOOLS +# define GRAAL_TOOLS + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define GRAAL_HIERARCHY_SHOW_MESSAGE_SIZE 4096 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct graalhierarchy + { + struct graalhierarchy *NEXT; + char *NAME; + long X; + long Y; + long DX; + long DY; + + } graalhierarchy; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char GraalToolsFilter[ 10 ]; + extern char GraalToolsExtention[ 10 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalToolsUnpeek(); + extern void GraalToolsDelAllHierarchy(); + extern void GraalToolsHierarchyUp(); + extern void GraalToolsHierarchyReload(); + extern void GraalToolsLoadError(); + extern void GraalToolsSavePixmap(); + +# endif diff --git a/alliance/src/graal/src/GMV.h b/alliance/src/graal/src/GMV.h new file mode 100644 index 00000000..f5eb00d1 --- /dev/null +++ b/alliance/src/graal/src/GMV.h @@ -0,0 +1,134 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : GMV101.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_GMV +# define GRAAL_GMV + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char GraalFirstViewLayer; + +/*------------------------------------------------------------\ +| | +| Panel And Menu | +| | +\------------------------------------------------------------*/ + + extern GraalMenuItem GraalViewMenu[]; + extern GraalPanelItem GraalViewArrowsPanel; + extern GraalPanelItem GraalViewZoomPanel; + extern GraalPanelItem GraalViewGridPanel; + extern GraalPanelItem GraalViewLayerPanel; + extern GraalPanelItem GraalViewMapPanel; + + extern int GraalPercentZoom; + extern int GraalPercentMoveX; + extern int GraalPercentMoveY; + + extern int GraalViewArrowsDefaultValues[5]; + extern int GraalViewZoomDefaultValues[5]; + extern int GraalViewLayerDefaultValues[5]; + extern int GraalViewGridDefaultValues[5]; + extern int GraalViewMapDefaultValues[5]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Values | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Zoom | +| | +\------------------------------------------------------------*/ + + extern void GraalComputeAndDisplayMap(); + extern void GraalInitializeZoom(); + extern void GraalBuildViewDialog(); + extern void GraalBuildPanelMap(); + extern void GraalBuildPanelLayer(); + extern void GraalInitializeMapEvent(); + + extern void GraalZoomCenter(); + extern void GraalZoomRefresh(); + extern void GraalZoomIn(); + extern void GraalZoomPan(); + + extern void GraalZoomUndo(); + + extern void GraalZoomLeft(); + extern void GraalZoomRight(); + extern void GraalZoomUp(); + extern void GraalZoomDown(); + + extern void GraalZoomMore(); + extern void GraalZoomLess(); + + extern void GraalZoomFit(); + + extern void GraalPromptZoomIn(); + extern void GraalPromptZoomPan(); + extern void GraalPromptZoomCenter(); + +# endif diff --git a/alliance/src/graal/src/GMV_dialog.c b/alliance/src/graal/src/GMV_dialog.c new file mode 100644 index 00000000..ed7d8f56 --- /dev/null +++ b/alliance/src/graal/src/GMV_dialog.c @@ -0,0 +1,541 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Dialog.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "GTB.h" +# include "GSB.h" +# include "GMX.h" +# include "GMV.h" + +# include "GMV_dialog.h" +# include "GMV_view.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Dialog Box | +| | +\------------------------------------------------------------*/ + + GraalDialogItem GraalViewZoomSetDialog = + + { + "Zoom set", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackViewZoomSetOk, + (XtPointer)NULL, + (void *)CallbackViewZoomSetCancel, + (XtPointer)NULL + }; + + GraalDialogItem GraalViewZoomGotoDialog = + + { + "Goto X,Y", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackViewZoomGotoOk, + (XtPointer)NULL, + (void *)CallbackViewZoomGotoCancel, + (XtPointer)NULL + }; + + GraalDialogItem GraalViewMoveSetDialog = + + { + "Move set dx,dy", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackViewMoveSetOk, + (XtPointer)NULL, + (void *)CallbackViewMoveSetCancel, + (XtPointer)NULL + }; + + GraalDialogItem GraalViewGridXDialog = + + { + "Grid X", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackViewGridXOk, + (XtPointer)NULL, + (void *)CallbackViewGridXCancel, + (XtPointer)NULL + }; + + GraalDialogItem GraalViewGridYDialog = + + { + "Grid Y", + GRAAL_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackViewGridYOk, + (XtPointer)NULL, + (void *)CallbackViewGridYCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Build Dialog Box | +| | +\------------------------------------------------------------*/ + +void GraalBuildViewDialog() + +{ + rdsbegin(); + + GraalBuildDialog( GraalMainWindow, &GraalViewZoomSetDialog ); + GraalBuildDialog( GraalMainWindow, &GraalViewZoomGotoDialog ); + GraalBuildDialog( GraalMainWindow, &GraalViewMoveSetDialog ); + GraalBuildDialog( GraalMainWindow, &GraalViewGridXDialog ); + GraalBuildDialog( GraalMainWindow, &GraalViewGridYDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Dialog | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackViewZoomSetOk | +| | +\------------------------------------------------------------*/ + +void CallbackViewZoomSetOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *ZoomSet; + int ZoomPercent; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &ZoomSet ); + + XtUnmanageChild( GraalViewZoomSetDialog.WIDGET ); + + GraalExitDialog(); + + if ( ZoomSet != (char *)NULL ) + { + ZoomPercent = atoi( ZoomSet ); + + if ( ( ZoomPercent < GRAAL_PERCENT_ZOOM_MIN ) || + ( ZoomPercent > GRAAL_PERCENT_ZOOM_MAX ) ) + { + GraalErrorMessage( GraalMainWindow, "The value must be between 5% and 95% !" ); + } + else + { + GraalPercentZoom = ZoomPercent; + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewZoomSetCancel | +| | +\------------------------------------------------------------*/ + +void CallbackViewZoomSetCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalViewZoomSetDialog.WIDGET ); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewZoomGotoOk | +| | +\------------------------------------------------------------*/ + +void CallbackViewZoomGotoOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *ZoomGoto; + int Index; + long GotoX; + long GotoY; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &ZoomGoto ); + + XtUnmanageChild( GraalViewZoomGotoDialog.WIDGET ); + + GraalExitDialog(); + + if ( ZoomGoto != (char *)NULL ) + { + for ( Index = 0; ZoomGoto[ Index ]; Index++ ) + { + if ( ZoomGoto[ Index ] == ',' ) + { + ZoomGoto[ Index ] = '\0'; + + if ( Index == 0 ) + { + GotoX = GraalLambdaGridX + ( GraalLambdaGridDx >> 1 ); + } + else + { + GotoX = (float)atof( ZoomGoto ) * (float)GRAAL_SCALE; + } + + if ( ZoomGoto[ Index + 1 ] == '\0' ) + { + GotoY = GraalLambdaGridY + ( GraalLambdaGridDy >> 1 ); + } + else + { + GotoY = (float)atof( ZoomGoto + Index + 1 ) * (float)GRAAL_SCALE; + } + + ZoomGoto = (char *)NULL; + + GraalZoomCenter( GotoX, GotoY ); + + break; + } + } + + if ( ZoomGoto != (char *)NULL ) + { + GraalErrorMessage( GraalMainWindow, "A coordinate must be specified !" ); + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewZoomGotoCancel | +| | +\------------------------------------------------------------*/ + +void CallbackViewZoomGotoCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalViewZoomGotoDialog.WIDGET ); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewMoveSetOk | +| | +\------------------------------------------------------------*/ + +void CallbackViewMoveSetOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *MoveSet; + int MovePercentX; + int MovePercentY; + int Index; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &MoveSet ); + + XtUnmanageChild( GraalViewMoveSetDialog.WIDGET ); + + GraalExitDialog(); + + if ( MoveSet != (char *)NULL ) + { + for ( Index = 0; MoveSet[ Index ]; Index++ ) + { + if ( MoveSet[ Index ] == ',' ) + { + MoveSet[ Index ] = '\0'; + + MovePercentX = atoi( MoveSet ); + MovePercentY = atoi( MoveSet + Index + 1 ); + MoveSet = (char *)NULL; + + break; + } + } + + if ( MoveSet != (char *)NULL ) + { + MovePercentY = MovePercentX = atoi( MoveSet ); + } + + if ( ( MovePercentX < GRAAL_PERCENT_MOVE_MIN ) || + ( MovePercentX > GRAAL_PERCENT_MOVE_MAX ) || + ( MovePercentY < GRAAL_PERCENT_MOVE_MIN ) || + ( MovePercentY > GRAAL_PERCENT_MOVE_MAX ) ) + { + GraalErrorMessage( GraalMainWindow, "The values must be between 5% and 95% !" ); + } + else + { + GraalPercentMoveX = MovePercentX; + GraalPercentMoveY = MovePercentY; + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewMoveSetCancel | +| | +\------------------------------------------------------------*/ + +void CallbackViewMoveSetCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalViewMoveSetDialog.WIDGET ); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewGridXOk | +| | +\------------------------------------------------------------*/ + +void CallbackViewGridXOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *GridSet; + int GridPercent; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &GridSet ); + + XtUnmanageChild( GraalViewGridXDialog.WIDGET ); + + GraalExitDialog(); + + if ( GridSet != (char *)NULL ) + { + GridPercent = atoi( GridSet ); + + if ( GridPercent < 1 ) + { + GraalErrorMessage( GraalMainWindow, "The value must be greater than zero !" ); + } + else + { + GraalLambdaUserGridDx = GridPercent; + GraalZoomRefresh(); + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewGridXCancel | +| | +\------------------------------------------------------------*/ + +void CallbackViewGridXCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalViewGridXDialog.WIDGET ); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewGridYOk | +| | +\------------------------------------------------------------*/ + +void CallbackViewGridYOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *GridSet; + int GridPercent; + + rdsbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &GridSet ); + + XtUnmanageChild( GraalViewGridYDialog.WIDGET ); + + GraalExitDialog(); + + if ( GridSet != (char *)NULL ) + { + GridPercent = atoi( GridSet ); + + if ( GridPercent < 1 ) + { + GraalErrorMessage( GraalMainWindow, "The value must be greater than zero !" ); + } + else + { + GraalLambdaUserGridDy = GridPercent; + GraalZoomRefresh(); + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewGridYCancel | +| | +\------------------------------------------------------------*/ + +void CallbackViewGridYCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + rdsbegin(); + + XtUnmanageChild( GraalViewGridYDialog.WIDGET ); + + GraalExitDialog(); + + rdsend(); +} diff --git a/alliance/src/graal/src/GMV_dialog.h b/alliance/src/graal/src/GMV_dialog.h new file mode 100644 index 00000000..7f0177a4 --- /dev/null +++ b/alliance/src/graal/src/GMV_dialog.h @@ -0,0 +1,93 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Dialog.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_VIEW_DIALOG +# define GRAAL_VIEW_DIALOG + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern GraalDialogItem GraalViewZoomSetDialog; + extern GraalDialogItem GraalViewZoomGotoDialog; + extern GraalDialogItem GraalViewMoveSetDialog; + extern GraalDialogItem GraalViewGridXDialog; + extern GraalDialogItem GraalViewGridYDialog; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback View Dialog | +| | +\------------------------------------------------------------*/ + + extern void CallbackViewZoomGotoOk(); + extern void CallbackViewZoomGotoCancel(); + extern void CallbackViewZoomSetOk(); + extern void CallbackViewZoomSetCancel(); + extern void CallbackViewMoveSetOk(); + extern void CallbackViewMoveSetCancel(); + extern void CallbackViewGridXOk(); + extern void CallbackViewGridXCancel(); + extern void CallbackViewGridYOk(); + extern void CallbackViewGridYCancel(); + +# endif diff --git a/alliance/src/graal/src/GMV_map.c b/alliance/src/graal/src/GMV_map.c new file mode 100644 index 00000000..38880fd8 --- /dev/null +++ b/alliance/src/graal/src/GMV_map.c @@ -0,0 +1,757 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Map.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "GSB.h" +# include "GRM.h" +# include "GTB.h" +# include "GMX.h" +# include "GMV.h" + +# include "GMV_map.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + GraalPanelItem GraalViewMapPanel = + + { + "Map", + 1, + 0, + GRAAL_VIEW_MAP_X, + GRAAL_VIEW_MAP_Y, + 190, + 200, + 1, + 1, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + 0, + (GraalPanelButtonItem *)NULL + }; + + int GraalViewMapDefaultValues[ 5 ] = + + { + GRAAL_VIEW_MAP_X, + GRAAL_VIEW_MAP_Y, + 190, 200, 0 + }; + +/*------------------------------------------------------------\ +| | +| Graphic Map Window | +| | +\------------------------------------------------------------*/ + + Widget GraalMapWindow; + Widget GraalMapButtonCompute; + Widget GraalMapButtonClose; + + Dimension GraalMapDx = 0; + Dimension GraalMapDy = 0; + + static char GraalFirstEnterMap = GRAAL_TRUE; + static char GraalFirstExpose = GRAAL_TRUE; + +/*------------------------------------------------------------\ +| | +| Lambda Map | +| | +\------------------------------------------------------------*/ + + float GraalLambdaMapStep; + + long GraalLambdaMapX; + long GraalLambdaMapY; + long GraalLambdaMapDx; + long GraalLambdaMapDy; + + long GraalBoundMapX; + long GraalBoundMapY; + long GraalBoundMapDx; + long GraalBoundMapDy; + + long GraalPixelMapX; + long GraalPixelMapY; + +/*------------------------------------------------------------\ +| | +| Expose | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Translation | +| | +\------------------------------------------------------------*/ + + static String GraalMapEventTranslation = + + ": CallbackMapEvent( 0 )\n\ + : CallbackMapEvent( 1 )\n\ + : CallbackMapEvent( 2 )"; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Event Callback | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackCloseMap | +| | +\------------------------------------------------------------*/ + +void CallbackCloseMap( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalExitPanel( &GraalViewMapPanel ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackMapCompute | +| | +\------------------------------------------------------------*/ + +void CallbackMapCompute( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalComputeAndDisplayMap(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackMapEvent | +| | +\------------------------------------------------------------*/ + +void CallbackMapEvent ( MyWidget, Event, Args, Argc ) + + Widget MyWidget; + XButtonEvent *Event; + String *Args; + int *Argc; +{ + Display *EventDisplay; + char MouseEvent; + long X; + long Y; + + rdsbegin(); + + EventDisplay = Event->display; + MouseEvent = Args[ 0 ][ 0 ] - '0'; + + X = Event->x; + Y = GraalMapDy - Event->y; + + X = X + GraalPixelMapX; + Y = Y + GraalPixelMapY; + + if ( X < 0 ) + { + X = ((float)(X) / GraalLambdaMapStep) - 0.5 ; + } + else + { + X = ((float)(X) / GraalLambdaMapStep) + 0.5 ; + } + + if ( Y < 0 ) + { + Y = ((float)(Y) / GraalLambdaMapStep) - 0.5 ; + } + else + { + Y = ((float)(Y) / GraalLambdaMapStep) + 0.5 ; + } + + switch ( MouseEvent ) + { + case GRAAL_B1UP : + case GRAAL_B2UP : + case GRAAL_B3UP : + + GraalZoomCenter( X, Y ); + + break; + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackMapResize | +| | +\------------------------------------------------------------*/ + +void CallbackMapResize( MyWidget, ClientData, CallData ) + + Widget MyWidget; + XtPointer ClientData; + XmDrawingAreaCallbackStruct *CallData; +{ + if ( ! GraalFirstExpose ) + { + rdsbegin(); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + GraalResizeMapWindow(); + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_NORMAL_CURSOR ); + + rdsend(); + } +} + +/*------------------------------------------------------------\ +| | +| CallbackMapExpose | +| | +\------------------------------------------------------------*/ + +void CallbackMapExpose( MyWidget, ClientData, CallData ) + + Widget MyWidget; + XtPointer ClientData; + XmDrawingAreaCallbackStruct *CallData; +{ + XExposeEvent *ExposeEvent; + + rdsbegin(); + + ExposeEvent = (XExposeEvent *)CallData->event; + + if ( GraalFirstExpose ) + { + GraalFirstExpose = GRAAL_FALSE; + + GraalInitializeMapWindow(); + } + + GraalRefreshMapWindow(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Initialize Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalsnitializeMapWindow | +| | +\------------------------------------------------------------*/ + +void GraalInitializeMapWindow() + +{ + rdsbegin(); + + XtVaGetValues( GraalMapWindow, + XmNwidth , &GraalMapDx, + XmNheight, &GraalMapDy, + NULL + ); + + GraalInitializeLambdaMap(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Graphic Window Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalRefreshMapWindow | +| | +\------------------------------------------------------------*/ + +void GraalRefreshMapWindow() +{ + rdsbegin(); + + GraalClearMapWindow(); + GraalDisplayLambdaMap(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalClearMapWindow | +| | +\------------------------------------------------------------*/ + +void GraalClearMapWindow() + +{ + XFillRectangle( XtDisplay( GraalMapWindow ), + XtWindow( GraalMapWindow ), + GraalBackgroundGC, + 0, 0, GraalMapDx, GraalMapDy ); +} + +/*------------------------------------------------------------\ +| | +| GraalResizeMapWindow | +| | +\------------------------------------------------------------*/ + +void GraalResizeMapWindow() + +{ + rdsbegin(); + + XtVaGetValues( GraalMapWindow, + XmNwidth, &GraalMapDx, + XmNheight, &GraalMapDy, + NULL + ); + + GraalComputeAndDisplayMap(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalInitializeMapEvent | +| | +\------------------------------------------------------------*/ + +void GraalInitializeMapEvent() + +{ + XtActionsRec NewActions; + + rdsbegin(); + + XtVaSetValues( GraalMapWindow, + XmNtranslations, + XtParseTranslationTable( GraalMapEventTranslation ), + NULL + ); + + NewActions.string = "CallbackMapEvent"; + NewActions.proc = CallbackMapEvent; + + XtAppAddActions( GraalApplication, &NewActions, 1 ); + + XtAddCallback( GraalMapWindow, + XmNresizeCallback, + CallbackMapResize, NULL ); + + XtAddCallback( GraalMapWindow, + XmNexposeCallback, + CallbackMapExpose, NULL ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Lambda Map Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalInitializeLambdaMap | +| | +\------------------------------------------------------------*/ + +void GraalInitializeLambdaMap() + +{ + rdsbegin(); + + if ( ! GraalComputeBound() ) + { + GraalBoundMapX = GRAAL_DEFAULT_MAP_X; + GraalBoundMapY = GRAAL_DEFAULT_MAP_Y; + GraalBoundMapDx = GRAAL_DEFAULT_MAP_DX; + GraalBoundMapDy = GRAAL_DEFAULT_MAP_DY; + } + else + { + GraalBoundMapX = GraalBoundXmin / GRAAL_RDS_LAMBDA; + GraalBoundMapY = GraalBoundYmin / GRAAL_RDS_LAMBDA; + GraalBoundMapDx = GraalBoundXmax / GRAAL_RDS_LAMBDA; + GraalBoundMapDy = GraalBoundYmax / GRAAL_RDS_LAMBDA; + GraalBoundMapDx = GraalBoundMapDx - GraalBoundMapX; + GraalBoundMapDy = GraalBoundMapDy - GraalBoundMapY; + } + + GraalLambdaMapX = GraalBoundMapX - 2; + GraalLambdaMapY = GraalBoundMapY - 2; + GraalLambdaMapDx = GraalBoundMapDx + 4; + GraalLambdaMapDy = GraalBoundMapDy + 4; + + GraalComputeLambdaMap(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalComputeLambdaMap | +| | +\------------------------------------------------------------*/ + +void GraalComputeLambdaMap() + +{ + long Delta; + float StepX; + float StepY; + + rdsbegin(); + + StepX = (float)(GraalMapDx) / (float)(GraalLambdaMapDx); + StepY = (float)(GraalMapDy) / (float)(GraalLambdaMapDy); + + if ( StepX < StepY ) + { + GraalLambdaMapStep = StepX; + Delta = GraalLambdaMapDy; + GraalLambdaMapDy = 1 + ( GraalMapDy / StepX ); + Delta = ( GraalLambdaMapDy - Delta ) >> 1; + GraalLambdaMapY = GraalLambdaMapY - Delta; + } + else + { + GraalLambdaMapStep = StepY; + Delta = GraalLambdaMapDx; + GraalLambdaMapDx = 1 + ( GraalMapDx / StepY ); + Delta = ( GraalLambdaMapDx - Delta ) >> 1; + GraalLambdaMapX = GraalLambdaMapX - Delta; + } + + GraalPixelMapX = (float)(GraalLambdaMapX) * GraalLambdaMapStep; + GraalPixelMapY = (float)(GraalLambdaMapY) * GraalLambdaMapStep; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDisplayLambdaMap | +| | +\------------------------------------------------------------*/ + +void GraalDisplayLambdaMap() +{ + long X1; + long Y1; + long X2; + long Y2; + + rdsbegin(); + + X1 = (float)( GraalBoundMapX ) * GraalLambdaMapStep; + Y1 = (float)( GraalBoundMapY ) * GraalLambdaMapStep; + X2 = (float)( GraalBoundMapX + GraalBoundMapDx ) * GraalLambdaMapStep; + Y2 = (float)( GraalBoundMapY + GraalBoundMapDy ) * GraalLambdaMapStep; + + X1 = X1 - GraalPixelMapX; + X2 = X2 - GraalPixelMapX; + Y1 = Y1 - GraalPixelMapY; + Y2 = Y2 - GraalPixelMapY; + + XDrawRectangle( XtDisplay( GraalMapWindow ), + XtWindow( GraalMapWindow ), + GraalLargeTextGC, + X1, GraalMapDy - Y2, + X2 - X1, Y2 - Y1 ); + + X1 = GraalLambdaGridX + ( GraalLambdaGridDx >> 1 ); + Y1 = GraalLambdaGridY + ( GraalLambdaGridDy >> 1 ); + X1 = (float)( X1 ) * GraalLambdaMapStep; + Y1 = (float)( Y1 ) * GraalLambdaMapStep; + + X1 = X1 - GraalPixelMapX; + Y1 = Y1 - GraalPixelMapY; + Y1 = GraalMapDy - Y1; + + if ( ( X1 > 0 ) && + ( Y1 > 0 ) && + ( X1 < GraalMapDx ) && + ( Y1 < GraalMapDy ) ) + { + XDrawLine( XtDisplay( GraalMapWindow ), + XtWindow( GraalMapWindow ), + GraalLargeTextGC, + X1 - 2, Y1, + X1 + 2, Y1 ); + + XDrawLine( XtDisplay( GraalMapWindow ), + XtWindow( GraalMapWindow ), + GraalLargeTextGC, + X1, Y1 - 2, + X1, Y1 + 2 ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalBuildPanelMap | +| | +\------------------------------------------------------------*/ + +void GraalBuildPanelMap() +{ + Arg Args[3]; + + rdsbegin(); + + XtSetArg( Args[0], XmNshadowType , XmSHADOW_ETCHED_IN ); + XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING ); + XtSetArg( Args[2], XmNtitle , GraalViewMapPanel.TITLE ); + + GraalViewMapPanel.PANEL = + + XmCreateFormDialog( GraalMainWindow, "GraalViewMapPanel", Args, 3); + + XtAddCallback( GraalViewMapPanel.PANEL, XmNdestroyCallback, + GraalDestroyDialogCallback, NULL ); + + GraalViewMapPanel.PANEL_FORM = + + XtVaCreateManagedWidget( "GraalViewMapPanelForm", + xmFormWidgetClass, + GraalViewMapPanel.PANEL, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , 100, + NULL + ); + + GraalViewMapPanel.FRAME = + + XtVaCreateManagedWidget( "GraalViewMapFrame", + xmFrameWidgetClass, + GraalViewMapPanel.PANEL_FORM, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + NULL + ); + + GraalViewMapPanel.FORM = + + XtVaCreateManagedWidget( "GraalViewMapForm", + xmFormWidgetClass, + GraalViewMapPanel.FRAME, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , 100, + NULL + ); + + GraalMapButtonCompute = + + XtVaCreateManagedWidget( "Compute", + xmPushButtonWidgetClass, + GraalViewMapPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 1, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 44, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 89, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 99, + NULL + ); + GraalMapButtonClose = + + XtVaCreateManagedWidget( "Close", + xmPushButtonWidgetClass, + GraalViewMapPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 45, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 99, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 89, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 99, + NULL + ); + + GraalMapWindow = + + XtVaCreateManagedWidget( "GraalMapWindow", + xmDrawingAreaWidgetClass, + GraalViewMapPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 1, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 99, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 1, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 88, + XmNbackground , 1, + XmNforeground , 0, + NULL + ); + + XtAddCallback( GraalMapButtonCompute, + XmNactivateCallback, + CallbackMapCompute, NULL ); + + XtAddCallback( GraalMapButtonClose, + XmNactivateCallback, + CallbackCloseMap, NULL ); + + XtVaSetValues( GraalViewMapPanel.PANEL, + XmNheight, GraalViewMapPanel.HEIGHT, + XmNwidth , GraalViewMapPanel.WIDTH, + XmNx , GraalViewMapPanel.X, + XmNy , GraalViewMapPanel.Y, + NULL ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEnterMapPanel | +| | +\------------------------------------------------------------*/ + +void GraalEnterMapPanel() + +{ + rdsbegin(); + + GraalFirstEnterMap = GRAAL_FALSE; + + GraalEnterPanel( &GraalViewMapPanel ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalComputeAndDisplayMap | +| | +\------------------------------------------------------------*/ + +void GraalComputeAndDisplayMap() + +{ + + if ( ! GraalFirstEnterMap ) + { + rdsbegin(); + + GraalInitializeLambdaMap(); + GraalClearMapWindow(); + GraalDisplayLambdaMap(); + + rdsend(); + } +} diff --git a/alliance/src/graal/src/GMV_map.h b/alliance/src/graal/src/GMV_map.h new file mode 100644 index 00000000..eb9450f8 --- /dev/null +++ b/alliance/src/graal/src/GMV_map.h @@ -0,0 +1,102 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Map.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_MAP +# define GRAAL_MAP + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define GRAAL_B1UP 0 +# define GRAAL_B2UP 1 +# define GRAAL_B3UP 2 + +# define GRAAL_VIEW_MAP_X 25 +# define GRAAL_VIEW_MAP_Y 520 + +# define GRAAL_DEFAULT_MAP_X 0 +# define GRAAL_DEFAULT_MAP_Y 0 +# define GRAAL_DEFAULT_MAP_DX 40 +# define GRAAL_DEFAULT_MAP_DY 40 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern Widget GraalMapPanel; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalComputeLambdaMap(); + extern void GraalInitializeLambdaMap(); + extern void GraalDisplayLambdaMap(); + + extern void GraalEnterMapPanel(); + extern void GraalClearMapWindow(); + extern void GraalResizeMapWindow(); + extern void GraalRefreshMapWindow(); + extern void GraalInitializeMapWindow(); + + extern void CallbackCloseMap(); + extern void CallbackMapCompute(); + extern void CallbackMapResize(); + extern void CallbackMapExpose(); + extern void CallbackMapEvent(); + +# endif diff --git a/alliance/src/graal/src/GMV_menu.c b/alliance/src/graal/src/GMV_menu.c new file mode 100644 index 00000000..db9b506b --- /dev/null +++ b/alliance/src/graal/src/GMV_menu.c @@ -0,0 +1,283 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Menu.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "GTB.h" +# include "GSB.h" +# include "GMX.h" +# include "GMV.h" + +# include "GMV_menu.h" +# include "GMV_dialog.h" +# include "GMV_view.h" +# include "GMV_map.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + char GraalFirstViewLayer = 1; + +/*------------------------------------------------------------\ +| | +| Menu | +| | +\------------------------------------------------------------*/ + + GraalMenuItem GraalViewMenu[] = + + { + { + "Zoom", + 'Z', + "MetaZ", + "Meta Z", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackViewZoom, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Layers", + 'L', + "MetaL", + "Meta L", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackViewLayers, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Map", + 'M', + "MetaP", + "Meta P", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackViewMap, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Arrows", + 'A', + "MetaA", + "Meta A", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackViewArrows, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + { + "Grid ", + 'G', + "MetaG", + "Meta G", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackViewGrid, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (GraalMenuItem *)NULL + } + , + NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback For Menu | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackViewLayers | +| | +\------------------------------------------------------------*/ + +void CallbackViewLayers( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( GraalFirstViewLayer ) + { + GraalInitializeLayer(); + + GraalFirstViewLayer = 0; + } + + GraalEnterPanel( &GraalViewLayerPanel ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewGrid | +| | +\------------------------------------------------------------*/ + +void CallbackViewGrid( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterPanel( &GraalViewGridPanel ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewArrows | +| | +\------------------------------------------------------------*/ + +void CallbackViewArrows( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterPanel( &GraalViewArrowsPanel ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewZoom | +| | +\------------------------------------------------------------*/ + +void CallbackViewZoom( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterPanel( &GraalViewZoomPanel ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewMap | +| | +\------------------------------------------------------------*/ + +void CallbackViewMap( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterMapPanel(); + + rdsend(); +} diff --git a/alliance/src/graal/src/GMV_menu.h b/alliance/src/graal/src/GMV_menu.h new file mode 100644 index 00000000..37213c13 --- /dev/null +++ b/alliance/src/graal/src/GMV_menu.h @@ -0,0 +1,82 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Menu.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 25/02/93 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_VIEW_MENU +# define GRAAL_VIEW_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback View Menu | +| | +\------------------------------------------------------------*/ + + + extern void CallbackViewLayers(); + extern void CallbackViewZoom(); + extern void CallbackViewGrid(); + extern void CallbackViewMap(); + extern void CallbackViewArrows(); + +# endif diff --git a/alliance/src/graal/src/GMV_message.c b/alliance/src/graal/src/GMV_message.c new file mode 100644 index 00000000..ea829020 --- /dev/null +++ b/alliance/src/graal/src/GMV_message.c @@ -0,0 +1,160 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Message.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GRM.h" +# include "GMX.h" +# include "GTB.h" +# include "GSB.h" +# include "GMV.h" +# include "GMV_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalPromptZoomIn | +| | +\------------------------------------------------------------*/ + +void GraalPromptZoomIn() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Zoom In" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO, "Select window" ); + + switch ( GraalCountEventZoom ) + { + case 0 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter first corner" ); + + break; + + case 1 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter second corner" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptZoomPan | +| | +\------------------------------------------------------------*/ + +void GraalPromptZoomPan() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Zoom Pan" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO, "Select line" ); + + switch ( GraalCountEventZoom ) + { + case 0 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter source point" ); + + break; + + case 1 : + + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter target point" ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptZoomCenter | +| | +\------------------------------------------------------------*/ + +void GraalPromptZoomCenter() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE, "Zoom Center" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO, "Select point" ); + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter center point" ); + + rdsend(); +} + diff --git a/alliance/src/graal/src/GMV_message.h b/alliance/src/graal/src/GMV_message.h new file mode 100644 index 00000000..83b36ab4 --- /dev/null +++ b/alliance/src/graal/src/GMV_message.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Message.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_MESSAGE +# define GRAAL_MESSAGE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GMV_panel.c b/alliance/src/graal/src/GMV_panel.c new file mode 100644 index 00000000..5cfeed44 --- /dev/null +++ b/alliance/src/graal/src/GMV_panel.c @@ -0,0 +1,4088 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Panel.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "GSB.h" +# include "GTB.h" +# include "GMX.h" +# include "GMV.h" + +# include "GMV_panel.h" +# include "GMV_dialog.h" +# include "GMV_view.h" +# include "GMV_message.h" +# include "GMX_color.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Panel Pixmap | +| | +\------------------------------------------------------------*/ + + static char GraalPixmapDownArrow[] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xfe, 0xff, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, + 0x00, 0x02, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, + 0x00, 0x02, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, + 0xf0, 0x03, 0x80, 0x1f, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, + 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x20, 0x00, 0x00, 0x08, + 0x40, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, + 0x00, 0x02, 0x80, 0x00, 0x00, 0x04, 0x40, 0x00, 0x00, 0x08, 0x20, 0x00, + 0x00, 0x10, 0x10, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x40, 0x04, 0x00, + 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + static char GraalPixmapLeftArrow[] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x0f, 0x00, 0x00, 0x40, 0x08, 0x00, 0x00, 0x20, 0x08, 0x00, + 0x00, 0x10, 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x04, 0xf8, 0x1f, + 0x00, 0x02, 0x00, 0x10, 0x00, 0x01, 0x00, 0x10, 0x80, 0x00, 0x00, 0x10, + 0x40, 0x00, 0x00, 0x10, 0x20, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, + 0x08, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x20, 0x00, 0x00, 0x10, + 0x40, 0x00, 0x00, 0x10, 0x80, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00, 0x10, + 0x00, 0x02, 0x00, 0x10, 0x00, 0x04, 0xf8, 0x1f, 0x00, 0x08, 0x08, 0x00, + 0x00, 0x10, 0x08, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x40, 0x08, 0x00, + 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + static char GraalPixmapRightArrow[] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xf0, 0x01, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x10, 0x04, 0x00, + 0x00, 0x10, 0x08, 0x00, 0x00, 0x10, 0x10, 0x00, 0xf8, 0x1f, 0x20, 0x00, + 0x08, 0x00, 0x40, 0x00, 0x08, 0x00, 0x80, 0x00, 0x08, 0x00, 0x00, 0x01, + 0x08, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x04, 0x08, 0x00, 0x00, 0x08, + 0x08, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x04, + 0x08, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x01, 0x08, 0x00, 0x80, 0x00, + 0x08, 0x00, 0x40, 0x00, 0xf8, 0x1f, 0x20, 0x00, 0x00, 0x10, 0x10, 0x00, + 0x00, 0x10, 0x08, 0x00, 0x00, 0x10, 0x04, 0x00, 0x00, 0x10, 0x02, 0x00, + 0x00, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + static char GraalPixmapUpArrow[] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x20, 0x02, 0x00, + 0x00, 0x10, 0x04, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x04, 0x10, 0x00, + 0x00, 0x02, 0x20, 0x00, 0x00, 0x01, 0x40, 0x00, 0x80, 0x00, 0x80, 0x00, + 0x40, 0x00, 0x00, 0x01, 0x20, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x04, + 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x08, + 0x08, 0x00, 0x00, 0x08, 0xf8, 0x01, 0xc0, 0x0f, 0x00, 0x01, 0x40, 0x00, + 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x40, 0x00, + 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x40, 0x00, + 0x00, 0x01, 0x40, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + +/*------------------------------------------------------------\ +| | +| Panel Arrows | +| | +\------------------------------------------------------------*/ + + static GraalPanelButtonItem GraalViewArrowsButton[] = + + { + { + "Left", + NULL, GraalPixmapLeftArrow, 32, 32, + NULL, + NULL, + 0, 0, + 1, 2, + CallbackLeftArrow, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Up", + NULL, GraalPixmapUpArrow, 32, 32, + NULL, + NULL, + 1, 0, + 1, 2, + CallbackUpArrow, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Down", + NULL, GraalPixmapDownArrow, 32, 32, + NULL, + NULL, + 0, 2, + 1, 2, + CallbackDownArrow, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Right", + NULL, GraalPixmapRightArrow, 32, 32, + NULL, + NULL, + 1, 2, + 1, 2, + CallbackRightArrow, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Move Set", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 4, + 2, 1, + CallbackMoveSet, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Close", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 5, + 2, 1, + CallbackCloseArrows, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalViewArrowsPanel = + + { + "Arrows", + 1, + 0, + GRAAL_VIEW_ARROWS_X, + GRAAL_VIEW_ARROWS_Y, + 100, + 125, + 2, + 6, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + 6, + GraalViewArrowsButton + }; + + int GraalViewArrowsDefaultValues[ 5 ] = + + { + GRAAL_VIEW_ARROWS_X, + GRAAL_VIEW_ARROWS_Y, + 100, 125 , 1 + }; + +/*------------------------------------------------------------\ +| | +| Panel Zoom | +| | +\------------------------------------------------------------*/ + + GraalPanelButtonItem GraalViewZoomButton[] = + + { + { + "Refresh", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackZoomRefresh, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "UnZoom", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 1, + 1, 1, + CallbackZoomPrevious, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Zoom", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 2, + 1, 1, + CallbackZoomMore, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Mooz", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 3, + 1, 1, + CallbackZoomLess, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Zoom Set", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 4, + 1, 1, + CallbackZoomSet, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Zoom In", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 5, + 1, 1, + CallbackZoomIn, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Center", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 6, + 1, 1, + CallbackZoomCenter, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Goto", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 7, + 1, 1, + CallbackZoomGoto, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Pan", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 8, + 1, 1, + CallbackZoomPan, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Fit", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 9, + 1, 1, + CallbackZoomFit, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Close", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 10, + 1, 1, + CallbackCloseZoom, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalViewZoomPanel = + + { + "Zoom", + 1, + 0, + GRAAL_VIEW_ZOOM_X, + GRAAL_VIEW_ZOOM_Y, + 100, + 275, + 1, + 11, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + 11, + GraalViewZoomButton + }; + + int GraalViewZoomDefaultValues[ 5 ] = + + { + GRAAL_VIEW_ZOOM_X, + GRAAL_VIEW_ZOOM_Y, + 100, 275, 1 + }; + +/*------------------------------------------------------------\ +| | +| Panel Layer | +| | +\------------------------------------------------------------*/ + + static char *GraalViewLayerFillModeName[] = + + { + "Outline", + "Fill", + "Pattern" + }; + + static char *GraalViewLayerInterfaceName[] = + + { + "No interface", + "Interface" + }; + + static char *GraalViewLayerConnectorIndex[] = + + { + "No index", + "Index" + }; + + static char *GraalViewLayerCursorType[] = + + { + "Invert", + "Xor" + }; + + static char *GraalViewLayerForceDisplay[] = + + { + "Quick display", + "Force display" + }; + + static char *GraalViewLayerBlackBoxString[] = + + { + "No string box", + "String box" + }; + + GraalPanelButtonItem GraalViewLayerButton[ 28 + (RDS_ALL_LAYER * 2) ] = + + { + { + "All visible", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackLayerAllVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "All invisible", + NULL, NULL, 0, 0, + NULL, + NULL, + 2, 0, + 2, 1, + CallbackLayerAllInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Fig", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackNameVisible, + (XtPointer)GRAAL_FIGURE_NAME, + (Widget)NULL + } + , + { + "Fig", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackNameInvisible, + (XtPointer)GRAAL_FIGURE_NAME, + (Widget)NULL + } + , + { + "Inst", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackNameVisible, + (XtPointer)GRAAL_INSTANCE_NAME, + (Widget)NULL + } + , + { + "Inst", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackNameInvisible, + (XtPointer)GRAAL_INSTANCE_NAME, + (Widget)NULL + } + , + { + "FCon", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackNameVisible, + (XtPointer)GRAAL_FIGURE_CONNECTOR_NAME, + (Widget)NULL + } + , + { + "FCon", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackNameInvisible, + (XtPointer)GRAAL_FIGURE_CONNECTOR_NAME, + (Widget)NULL + } + , + { + "ICon", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackNameVisible, + (XtPointer)GRAAL_INSTANCE_CONNECTOR_NAME, + (Widget)NULL + } + , + { + "ICon", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackNameInvisible, + (XtPointer)GRAAL_INSTANCE_CONNECTOR_NAME, + (Widget)NULL + } + , + { + "FSeg", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackNameVisible, + (XtPointer)GRAAL_FIGURE_SEGMENT_NAME, + (Widget)NULL + } + , + { + "FSeg", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackNameInvisible, + (XtPointer)GRAAL_FIGURE_SEGMENT_NAME, + (Widget)NULL + } + , + { + "ISeg", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackNameVisible, + (XtPointer)GRAAL_INSTANCE_SEGMENT_NAME, + (Widget)NULL + } + , + { + "ISeg", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackNameInvisible, + (XtPointer)GRAAL_INSTANCE_SEGMENT_NAME, + (Widget)NULL + } + , + { + "FRef", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackNameVisible, + (XtPointer)GRAAL_FIGURE_REFERENCE_NAME, + (Widget)NULL + } + , + { + "FRef", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackNameInvisible, + (XtPointer)GRAAL_FIGURE_REFERENCE_NAME, + (Widget)NULL + } + , + { + "IRef", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackNameVisible, + (XtPointer)GRAAL_INSTANCE_REFERENCE_NAME, + (Widget)NULL + } + , + { + "IRef", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackNameInvisible, + (XtPointer)GRAAL_INSTANCE_REFERENCE_NAME, + (Widget)NULL + } + , + { + "Pattern", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackLayerFillMode, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Interface", + NULL, NULL, 0, 0, + NULL, + NULL, + 2, 0, + 2, 1, + CallbackLayerInterface, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "No index", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackLayerIndex, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Invert", + NULL, NULL, 0, 0, + NULL, + NULL, + 2, 0, + 2, 1, + CallbackLayerCursor, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Quick display", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackLayerForceDisplay, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Scale", + NULL, NULL, 0, 0, + NULL, + NULL, + 2, 0, + 2, 1, + CallbackLayerScale, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "No string box", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackLayerBlackBoxString, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 2, 0, + 2, 1, + NULL, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Apply", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackLayerApply, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Close", + NULL, NULL, 0, 0, + NULL, + NULL, + 2, 0, + 2, 1, + CallbackCloseLayer, + (XtPointer)NULL, + (Widget)NULL + } + }; + + + GraalPanelItem GraalViewLayerPanel = + + { + "Layer", + 1, + 0, + GRAAL_VIEW_LAYER_X, + GRAAL_VIEW_LAYER_Y, + 180, + 575, + 4, + 24, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + ( RDS_ALL_LAYER << 1 ) + + ( GRAAL_MAX_ACTIVE_NAME << 1 ) + 12, + GraalViewLayerButton + }; + + int GraalViewLayerDefaultValues[ 5 ] = + + { + GRAAL_VIEW_LAYER_X, + GRAAL_VIEW_LAYER_Y, + 180, 575, 0 + }; + + static char FirstEnterLayerPanel = 1; + +/*------------------------------------------------------------\ +| | +| Panel Grid | +| | +\------------------------------------------------------------*/ + + GraalPanelButtonItem GraalViewGridButton[] = + + { + { + "Grid X", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackSetGridX, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Grid Y", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 1, + 1, 1, + CallbackSetGridY, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Grid Off", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 2, + 1, 1, + CallbackGridOnOff, + (XtPointer)NULL, + (Widget)NULL + } + , + { + "Close", + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 3, + 1, 1, + CallbackCloseGrid, + (XtPointer)NULL, + (Widget)NULL + } + }; + + GraalPanelItem GraalViewGridPanel = + + { + "Grid", + 1, + 0, + GRAAL_VIEW_GRID_X, + GRAAL_VIEW_GRID_Y, + 90, + 100, + 1, + 4, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + 4, + GraalViewGridButton + }; + + int GraalViewGridDefaultValues[ 5 ] = + + { + GRAAL_VIEW_GRID_X, + GRAAL_VIEW_GRID_Y, + 90, 100, 0 + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalBuildPanelLayer | +| | +\------------------------------------------------------------*/ + +void GraalBuildPanelLayer() +{ + GraalPanelButtonItem *Button; + unsigned char Visible; + long Layer; + unsigned char Index; + unsigned char X1; + unsigned char Y1; + + X1 = 0; + Y1 = 1; + Index = 2; + + for ( Layer = 0; Layer < RDS_ALL_LAYER; Layer++ ) + { + if ( ( GRAAL_RDS_LAYER_NAME_TABLE[ Layer ][ 0 ] != NULL ) && + ( RDS_DYNAMIC_LAYER[ Layer ] != RDS_LAYER_UNUSED ) ) + { + for ( Visible = 0; Visible < 2; Visible++ ) + { + Button = &GraalViewLayerButton[ Index + Visible ]; + + Button->LABEL = GRAAL_RDS_LAYER_NAME_TABLE[ Layer ][ 0 ]; + Button->FOREGROUND = GRAAL_RDS_LAYER_NAME_TABLE[ Layer ][ 1 ]; + Button->BACKGROUND = GRAAL_RDS_LAYER_NAME_TABLE[ Layer ][ 2 ]; + + Button->X = X1; + Button->Y = Y1; + Button->CALLDATA = (XtPointer)Layer; + + if ( X1 == 3 ) + { + X1 = 0; Y1 = Y1 + 1; + } + else + { + X1 = X1 + 1; + } + } + } + + Index = Index + 2; + } + + if ( X1 > 0 ) + { + X1 = 0; + Y1 = Y1 + 1; + } + + for ( Layer = 0; Layer < GRAAL_MAX_ACTIVE_NAME; Layer++ ) + { + for ( Visible = 0; Visible < 2; Visible++ ) + { + Button = &GraalViewLayerButton[ Index + Visible ]; + + Button->X = X1; + Button->Y = Y1; + + Button->FOREGROUND = "White"; + Button->BACKGROUND = "Black"; + + + if ( X1 == 3 ) + { + X1 = 0; Y1 = Y1 + 1; + } + else + { + X1 = X1 + 1; + } + } + + Index = Index + 2; + } + + if ( X1 > 0 ) Y1 = Y1 + 1; + + for ( Layer = 0; Layer < 5; Layer++ ) + { + GraalViewLayerButton[ Index ].Y = Y1;; + GraalViewLayerButton[ Index + 1 ].Y = Y1;; + + Index = Index + 2; + Y1 = Y1 + 1; + } + + GraalViewLayerPanel.ROW = Y1; + GraalViewLayerDefaultValues[ 3 ] = Y1 * 25; +} + +/*------------------------------------------------------------\ +| | +| Callback For Arrows | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackLeftArrow | +| | +\------------------------------------------------------------*/ + +void CallbackLeftArrow( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalZoomLeft(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackRightArrow | +| | +\------------------------------------------------------------*/ + +void CallbackRightArrow( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalZoomRight(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackUpArrow | +| | +\------------------------------------------------------------*/ + +void CallbackUpArrow( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalZoomUp(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackDownArrow | +| | +\------------------------------------------------------------*/ + +void CallbackDownArrow( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalZoomDown(); + + rdsend(); +} + + +/*------------------------------------------------------------\ +| | +| CallbackMoveSet | +| | +\------------------------------------------------------------*/ + +void CallbackMoveSet( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalViewMoveSetDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCloseArrows | +| | +\------------------------------------------------------------*/ + +void CallbackCloseArrows( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalExitPanel( &GraalViewArrowsPanel ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Zoom Callback | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackZoomRefresh | +| | +\------------------------------------------------------------*/ + +void CallbackZoomRefresh( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalZoomRefresh(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomPrevious | +| | +\------------------------------------------------------------*/ + +void CallbackZoomPrevious( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalZoomUndo(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomLess | +| | +\------------------------------------------------------------*/ + +void CallbackZoomLess( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalZoomLess(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomMore | +| | +\------------------------------------------------------------*/ + +void CallbackZoomMore( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalZoomMore(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomSet | +| | +\------------------------------------------------------------*/ + +void CallbackZoomSet( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalViewZoomSetDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCloseZoom | +| | +\------------------------------------------------------------*/ + +void CallbackCloseZoom( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalExitPanel( &GraalViewZoomPanel ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomIn | +| | +\------------------------------------------------------------*/ + +void CallbackZoomIn( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalChangeEditMode( GRAAL_ZOOM_IN, + GraalPromptZoomIn ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomCenter | +| | +\------------------------------------------------------------*/ + +void CallbackZoomCenter( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalChangeEditMode( GRAAL_ZOOM_CENTER, + GraalPromptZoomCenter ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomGoto | +| | +\------------------------------------------------------------*/ + +void CallbackZoomGoto( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalViewZoomGotoDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomPan | +| | +\------------------------------------------------------------*/ + +void CallbackZoomPan( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalChangeEditMode( GRAAL_ZOOM_PAN, + GraalPromptZoomPan ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomFit | +| | +\------------------------------------------------------------*/ + +void CallbackZoomFit( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalZoomFit(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Layer | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackLayerAllVisible | +| | +\------------------------------------------------------------*/ + +void CallbackLayerAllVisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalLayerAllVisible(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerAllInvisible | +| | +\------------------------------------------------------------*/ + +void CallbackLayerAllInvisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalLayerAllInvisible(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerVisible | +| | +\------------------------------------------------------------*/ + +void CallbackLayerVisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( GRAAL_RDS_ACTIVE_LAYER_TABLE[ (int)ClientData ] == 0 ) + { + GraalSetLayerVisible( ClientData ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackNameVisible | +| | +\------------------------------------------------------------*/ + +void CallbackNameVisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( GRAAL_RDS_ACTIVE_NAME_TABLE[ (int)ClientData ] == 0 ) + { + GraalSetNameVisible( ClientData ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerInvisible | +| | +\------------------------------------------------------------*/ + +void CallbackLayerInvisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( GRAAL_RDS_ACTIVE_LAYER_TABLE[ (int)ClientData ] == 1 ) + { + GraalSetLayerInvisible( ClientData ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackNameInvisible | +| | +\------------------------------------------------------------*/ + +void CallbackNameInvisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + if ( GRAAL_RDS_ACTIVE_NAME_TABLE[ (int)ClientData ] == 1 ) + { + GraalSetNameInvisible( ClientData ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerFillMode | +| | +\------------------------------------------------------------*/ + +void CallbackLayerFillMode( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GRAAL_FILL_MODE = ( GRAAL_FILL_MODE + 1 ) % 3; + + GraalChangeFillMode( GRAAL_FILL_MODE ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerInterface | +| | +\------------------------------------------------------------*/ + +void CallbackLayerInterface( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GRAAL_INSTANCE_INTERFACE = ! GRAAL_INSTANCE_INTERFACE; + GraalChangeInterface( GRAAL_INSTANCE_INTERFACE ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerIndex | +| | +\------------------------------------------------------------*/ + +void CallbackLayerIndex( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GRAAL_CONNECTOR_INDEX = ! GRAAL_CONNECTOR_INDEX; + GraalChangeIndex( GRAAL_CONNECTOR_INDEX ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerCursor | +| | +\------------------------------------------------------------*/ + +void CallbackLayerCursor( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GRAAL_XOR_CURSOR = ! GRAAL_XOR_CURSOR; + GraalChangeCursor( GRAAL_XOR_CURSOR ); + + GraalChangeCursorContext(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerForceDisplay | +| | +\------------------------------------------------------------*/ + +void CallbackLayerForceDisplay( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GRAAL_FORCE_DISPLAY = ! GRAAL_FORCE_DISPLAY; + GraalChangeForceDisplay( GRAAL_FORCE_DISPLAY ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerScale | +| | +\------------------------------------------------------------*/ + +void CallbackLayerScale( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + long NewScale; + long Factor; + + rdsbegin(); + + Factor = RDS_LAMBDA / RDS_PHYSICAL_GRID; + NewScale = GRAAL_SCALE + 1; + + while ( ( Factor % NewScale ) != 0 ) + { + NewScale = NewScale + 1; + + if ( NewScale > Factor ) + { + NewScale = 1; break; + } + } + + GraalLambdaGridX = ( (float)GraalLambdaGridX / (float)GRAAL_SCALE ) * (float)NewScale; + GraalLambdaGridY = ( (float)GraalLambdaGridY / (float)GRAAL_SCALE ) * (float)NewScale; + GraalLambdaGridDx = ( (float)GraalLambdaGridDx / (float)GRAAL_SCALE ) * (float)NewScale; + GraalLambdaGridDy = ( (float)GraalLambdaGridDy / (float)GRAAL_SCALE ) * (float)NewScale; + + GRAAL_SCALE = NewScale; + GraalChangeScale( GRAAL_SCALE ); + + GraalLoadParameters(); + GraalComputeLambdaGrid(); + GraalComputeAndDisplayMap(); + GraalZoomRefresh(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerBlackBoxString | +| | +\------------------------------------------------------------*/ + +void CallbackLayerBlackBoxString( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GRAAL_BLACK_BOX_STRING = ! GRAAL_BLACK_BOX_STRING; + GraalChangeBlackBoxString( GRAAL_BLACK_BOX_STRING ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerApply | +| | +\------------------------------------------------------------*/ + +void CallbackLayerApply( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalZoomRefresh(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCloseLayer | +| | +\------------------------------------------------------------*/ + +void CallbackCloseLayer( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalExitPanel( &GraalViewLayerPanel ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalChangeFillMode | +| | +\------------------------------------------------------------*/ + +void GraalChangeFillMode( FillMode ) + + char FillMode; +{ + int Index; + XmString Label; + + rdsbegin(); + + Index = 2 + ( ( RDS_ALL_LAYER + GRAAL_MAX_ACTIVE_NAME ) << 1 ); + Label = XmStringCreateSimple( GraalViewLayerFillModeName[ FillMode ] ); + + XtVaSetValues( GraalViewLayerButton[ Index ].BUTTON, + XmNlabelString, Label, + XmNresizable , False, + NULL ); + + XmStringFree( Label ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalChangeInterface | +| | +\------------------------------------------------------------*/ + +void GraalChangeInterface( Interface ) + + char Interface; +{ + int Index; + XmString Label; + + rdsbegin(); + + Index = 3 + ( ( RDS_ALL_LAYER + GRAAL_MAX_ACTIVE_NAME ) << 1 ); + Label = XmStringCreateSimple( GraalViewLayerInterfaceName[ Interface ] ); + + XtVaSetValues( GraalViewLayerButton[ Index ].BUTTON, + XmNlabelString, Label, + XmNresizable , False, + NULL ); + + XmStringFree( Label ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalChangeIndex | +| | +\------------------------------------------------------------*/ + +void GraalChangeIndex( Index ) + + char Index; +{ + int Pos; + XmString Label; + + rdsbegin(); + + Pos = 4 + ( ( RDS_ALL_LAYER + GRAAL_MAX_ACTIVE_NAME ) << 1 ); + Label = XmStringCreateSimple( GraalViewLayerConnectorIndex[ Index ] ); + + XtVaSetValues( GraalViewLayerButton[ Pos ].BUTTON, + XmNlabelString, Label, + XmNresizable , False, + NULL ); + + XmStringFree( Label ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalChangeCursor | +| | +\------------------------------------------------------------*/ + +void GraalChangeCursor( Type ) + + char Type; +{ + int Pos; + XmString Label; + + rdsbegin(); + + Pos = 5 + ( ( RDS_ALL_LAYER + GRAAL_MAX_ACTIVE_NAME ) << 1 ); + Label = XmStringCreateSimple( GraalViewLayerCursorType[ Type ] ); + + XtVaSetValues( GraalViewLayerButton[ Pos ].BUTTON, + XmNlabelString, Label, + XmNresizable , False, + NULL ); + + XmStringFree( Label ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalChangeForceDisplay | +| | +\------------------------------------------------------------*/ + +void GraalChangeForceDisplay( Index ) + + char Index; +{ + int Pos; + XmString Label; + + rdsbegin(); + + Pos = 6 + ( ( RDS_ALL_LAYER + GRAAL_MAX_ACTIVE_NAME ) << 1 ); + Label = XmStringCreateSimple( GraalViewLayerForceDisplay[ Index ] ); + + XtVaSetValues( GraalViewLayerButton[ Pos ].BUTTON, + XmNlabelString, Label, + XmNresizable , False, + NULL ); + + XmStringFree( Label ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalChangeScale | +| | +\------------------------------------------------------------*/ + +void GraalChangeScale( Scale ) + + long Scale; +{ + int Pos; + XmString Label; + char Buffer[ 64 ]; + + rdsbegin(); + + Pos = 7 + ( ( RDS_ALL_LAYER + GRAAL_MAX_ACTIVE_NAME ) << 1 ); + + sprintf( Buffer, "Scale %d", Scale ); + Label = XmStringCreateSimple( Buffer ); + + XtVaSetValues( GraalViewLayerButton[ Pos ].BUTTON, + XmNlabelString, Label, + XmNresizable , False, + NULL ); + + XmStringFree( Label ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalChangeBlackBoxString | +| | +\------------------------------------------------------------*/ + +void GraalChangeBlackBoxString( Index ) + + char Index; +{ + int Pos; + XmString Label; + + rdsbegin(); + + Pos = 8 + ( ( RDS_ALL_LAYER + GRAAL_MAX_ACTIVE_NAME ) << 1 ); + Label = XmStringCreateSimple( GraalViewLayerBlackBoxString[ Index ] ); + + XtVaSetValues( GraalViewLayerButton[ Pos ].BUTTON, + XmNlabelString, Label, + XmNresizable , False, + NULL ); + + XmStringFree( Label ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalSetLayerVisible | +| | +\------------------------------------------------------------*/ + +void GraalSetLayerVisible( Layer ) + + int Layer; +{ + int Index; + char *Background; + char *Foreground; + + rdsbegin(); + + Index = 2 + ( Layer << 1 ); + + if ( GRAAL_RDS_ACTIVE_LAYER_TABLE[ Layer ] != -1 ) + { + GRAAL_RDS_ACTIVE_LAYER_TABLE[ Layer ] = 1; + + XtVaSetValues( GraalViewLayerButton[ Index + 1 ].BUTTON, + XtVaTypedArg , + XmNbackground , + XmRString , + GRAAL_BLACK_COLOR , + strlen( GRAAL_BLACK_COLOR ) + 1 , + NULL + ); + + XtVaSetValues( GraalViewLayerButton[ Index + 1 ].BUTTON, + XtVaTypedArg , + XmNforeground , + XmRString , + GRAAL_BLACK_COLOR , + strlen( GRAAL_BLACK_COLOR ) + 1 , + NULL + ); + + Background = GraalViewLayerButton[ Index ].BACKGROUND; + Foreground = GraalViewLayerButton[ Index ].FOREGROUND; + + XtVaSetValues( GraalViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNbackground , + XmRString , + Background , + strlen( Background ) + 1, + NULL + ); + + XtVaSetValues( GraalViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNforeground , + XmRString , + Foreground , + strlen( Foreground ) + 1, + NULL + ); + + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalSetNameVisible | +| | +\------------------------------------------------------------*/ + +void GraalSetNameVisible( Name ) + + int Name; +{ + int Index; + char *Background; + char *Foreground; + + rdsbegin(); + + Index = 2 + ( ( RDS_ALL_LAYER + Name ) << 1 ); + + GRAAL_RDS_ACTIVE_NAME_TABLE[ Name ] = 1; + + XtVaSetValues( GraalViewLayerButton[ Index + 1 ].BUTTON, + XtVaTypedArg , + XmNbackground , + XmRString , + GRAAL_BLACK_COLOR , + strlen( GRAAL_BLACK_COLOR ) + 1 , + NULL + ); + + XtVaSetValues( GraalViewLayerButton[ Index + 1 ].BUTTON, + XtVaTypedArg , + XmNforeground , + XmRString , + GRAAL_BLACK_COLOR , + strlen( GRAAL_BLACK_COLOR ) + 1 , + NULL + ); + + Background = GraalViewLayerButton[ Index ].BACKGROUND; + Foreground = GraalViewLayerButton[ Index ].FOREGROUND; + + XtVaSetValues( GraalViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNbackground , + XmRString , + Background , + strlen( Background ) + 1, + NULL + ); + + XtVaSetValues( GraalViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNforeground , + XmRString , + Foreground , + strlen( Foreground ) + 1, + NULL + ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalSetLayerInvisible | +| | +\------------------------------------------------------------*/ + +void GraalSetLayerInvisible( Layer ) + + int Layer; +{ + int Index; + char *Background; + char *Foreground; + + rdsbegin(); + + Index = 3 + ( Layer << 1 ); + + if ( GRAAL_RDS_ACTIVE_LAYER_TABLE[ Layer ] != -1 ) + { + GRAAL_RDS_ACTIVE_LAYER_TABLE[ Layer ] = 0; + + XtVaSetValues( GraalViewLayerButton[ Index - 1 ].BUTTON, + XtVaTypedArg , + XmNbackground , + XmRString , + GRAAL_BLACK_COLOR , + strlen( GRAAL_BLACK_COLOR ) + 1 , + NULL + ); + + XtVaSetValues( GraalViewLayerButton[ Index - 1 ].BUTTON, + XtVaTypedArg , + XmNforeground , + XmRString , + GRAAL_BLACK_COLOR , + strlen( GRAAL_BLACK_COLOR ) + 1 , + NULL + ); + + Background = GraalViewLayerButton[ Index ].BACKGROUND; + Foreground = GraalViewLayerButton[ Index ].FOREGROUND; + + XtVaSetValues( GraalViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNbackground , + XmRString , + Background , + strlen( Background ) + 1 , + NULL + ); + + XtVaSetValues( GraalViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNforeground , + XmRString , + Foreground , + strlen( Foreground ) + 1 , + NULL + ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalSetNameInvisible | +| | +\------------------------------------------------------------*/ + +void GraalSetNameInvisible( Name ) + + int Name; +{ + int Index; + char *Background; + char *Foreground; + + rdsbegin(); + + Index = 3 + ( ( RDS_ALL_LAYER + Name ) << 1 ); + + GRAAL_RDS_ACTIVE_NAME_TABLE[ Name ] = 0; + + XtVaSetValues( GraalViewLayerButton[ Index - 1 ].BUTTON, + XtVaTypedArg , + XmNbackground , + XmRString , + GRAAL_BLACK_COLOR , + strlen( GRAAL_BLACK_COLOR ) + 1 , + NULL + ); + + XtVaSetValues( GraalViewLayerButton[ Index - 1 ].BUTTON, + XtVaTypedArg , + XmNforeground , + XmRString , + GRAAL_BLACK_COLOR , + strlen( GRAAL_BLACK_COLOR ) + 1 , + NULL + ); + + Background = GraalViewLayerButton[ Index ].BACKGROUND; + Foreground = GraalViewLayerButton[ Index ].FOREGROUND; + + XtVaSetValues( GraalViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNbackground , + XmRString , + Background , + strlen( Background ) + 1 , + NULL + ); + + XtVaSetValues( GraalViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNforeground , + XmRString , + Foreground , + strlen( Foreground ) + 1 , + NULL + ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalLayerAllVisible | +| | +\------------------------------------------------------------*/ + +void GraalLayerAllVisible() + +{ + int Layer; + + rdsbegin(); + + for ( Layer = 0; Layer < RDS_ALL_LAYER; Layer++ ) + { + GraalSetLayerVisible( Layer ); + } + + for ( Layer = 0; Layer < GRAAL_MAX_ACTIVE_NAME; Layer++ ) + { + GraalSetNameVisible( Layer ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalInitializeLayer | +| | +\------------------------------------------------------------*/ + +void GraalInitializeLayer() + +{ + int Index; + + rdsbegin(); + + for ( Index = 0; Index < RDS_ALL_LAYER; Index++ ) + { + if ( GRAAL_RDS_ACTIVE_LAYER_TABLE[ Index ] == 0 ) + { + GraalSetLayerInvisible( Index ); + } + else + if ( GRAAL_RDS_ACTIVE_LAYER_TABLE[ Index ] == 1 ) + { + GraalSetLayerVisible( Index ); + } + } + + for ( Index = 0; Index < GRAAL_MAX_ACTIVE_NAME; Index++ ) + { + if ( GRAAL_RDS_ACTIVE_NAME_TABLE[ Index ] == 0 ) + { + GraalSetNameInvisible( Index ); + } + else + { + GraalSetNameVisible( Index ); + } + } + + GraalChangeFillMode( GRAAL_FILL_MODE ); + GraalChangeInterface( GRAAL_INSTANCE_INTERFACE ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalLayerAllInvisible | +| | +\------------------------------------------------------------*/ + +void GraalLayerAllInvisible() + +{ + int Layer; + + rdsbegin(); + + for ( Layer = 0; Layer < RDS_ALL_LAYER; Layer++ ) + { + GraalSetLayerInvisible( Layer ); + } + + for ( Layer = 0; Layer < GRAAL_MAX_ACTIVE_NAME; Layer++ ) + { + GraalSetNameInvisible( Layer ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Grid | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackSetGridX | +| | +\------------------------------------------------------------*/ + +void CallbackSetGridX( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalViewGridXDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSetGridY | +| | +\------------------------------------------------------------*/ + +void CallbackSetGridY( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalEnterDialog( &GraalViewGridYDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackGridOnOff | +| | +\------------------------------------------------------------*/ + +void CallbackGridOnOff( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + XmString Label; + + rdsbegin(); + + GraalLambdaUserGrid = ! GraalLambdaUserGrid; + + if ( GraalLambdaUserGrid == GRAAL_FALSE ) + { + Label = XmStringCreateSimple( "Grid Off" ); + } + else + { + Label = XmStringCreateSimple( "Grid On" ); + } + + XtVaSetValues( MyWidget, XmNlabelString, Label, + XmNresizable , False, + NULL ); + XmStringFree( Label ); + + GraalZoomRefresh(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCloseGrid | +| | +\------------------------------------------------------------*/ + +void CallbackCloseGrid( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + rdsbegin(); + + GraalExitPanel( &GraalViewGridPanel ); + + rdsend(); +} diff --git a/alliance/src/graal/src/GMV_panel.h b/alliance/src/graal/src/GMV_panel.h new file mode 100644 index 00000000..88ea776b --- /dev/null +++ b/alliance/src/graal/src/GMV_panel.h @@ -0,0 +1,141 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Panel.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 25/02/93 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_VIEW_PANEL +# define GRAAL_VIEW_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define GRAAL_VIEW_ARROWS_X 990 +# define GRAAL_VIEW_ARROWS_Y 80 +# define GRAAL_VIEW_ZOOM_X 990 +# define GRAAL_VIEW_ZOOM_Y 230 +# define GRAAL_VIEW_LAYER_X 430 +# define GRAAL_VIEW_LAYER_Y 90 +# define GRAAL_VIEW_GRID_X 470 +# define GRAAL_VIEW_GRID_Y 330 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback View Panel | +| | +\------------------------------------------------------------*/ + + extern void CallbackLeftArrow(); + extern void CallbackRightArrow(); + extern void CallbackUpArrow(); + extern void CallbackDownArrow(); + extern void CallbackMoveSet(); + extern void CallbackCloseArrows(); + + extern void CallbackZoomRefresh(); + extern void CallbackZoomPrevious(); + extern void CallbackZoomLess(); + extern void CallbackZoomMore(); + extern void CallbackZoomSet(); + extern void CallbackZoomIn(); + extern void CallbackZoomFit(); + extern void CallbackZoomCenter(); + extern void CallbackZoomGoto(); + extern void CallbackZoomPan(); + extern void CallbackCloseZoom(); + + extern void CallbackLayerAllVisible(); + extern void CallbackLayerAllInvisible(); + extern void CallbackNameVisible(); + extern void CallbackNameInvisible(); + extern void CallbackLayerVisible(); + extern void CallbackLayerInvisible(); + extern void CallbackLayerFillMode(); + extern void CallbackLayerInterface(); + extern void CallbackLayerIndex(); + extern void CallbackLayerCursor(); + extern void CallbackLayerForceDisplay(); + extern void CallbackLayerScale(); + extern void CallbackLayerBlackBoxString(); + extern void CallbackLayerApply(); + extern void CallbackCloseLayer(); + + extern void GraalSetLayerVisible(); + extern void GraalSetLayerInvisible(); + extern void GraalSetNameVisible(); + extern void GraalSetNameInvisible(); + extern void GraalLayerAllVisible(); + extern void GraalLayerAllInvisible(); + extern void GraalChangeFillMode(); + extern void GraalChangeInterface(); + extern void GraalChangeIndex(); + extern void GraalChangeCursor(); + extern void GraalChangeForceDisplay(); + extern void GraalChangeScale(); + extern void GraalChangeBlackBoxString(); + + extern void CallbackSetGridX(); + extern void CallbackSetGridY(); + extern void CallbackGridOnOff(); + extern void CallbackCloseGrid(); + + extern void GraalInitializeLayer(); + +# endif diff --git a/alliance/src/graal/src/GMV_view.c b/alliance/src/graal/src/GMV_view.c new file mode 100644 index 00000000..0b90bb41 --- /dev/null +++ b/alliance/src/graal/src/GMV_view.c @@ -0,0 +1,674 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : View.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GRM.h" +# include "GSB.h" +# include "GTB.h" +# include "GMX.h" +# include "GMV.h" + +# include "GMV_view.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + graalzoom *GraalHeadZoom = (graalzoom *)NULL; + + int GraalPercentZoom = GRAAL_PERCENT_ZOOM; + int GraalPercentMoveX = GRAAL_PERCENT_MOVE; + int GraalPercentMoveY = GRAAL_PERCENT_MOVE; + +/*------------------------------------------------------------\ +| | +| Menu | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalAllocZoom | +| | +\------------------------------------------------------------*/ + +graalzoom *GraalAllocZoom () + +{ + return ( (graalzoom *) rdsalloc ( sizeof ( graalzoom ), 1)); +} + +/*------------------------------------------------------------\ +| | +| GraalFreeZoom | +| | +\------------------------------------------------------------*/ + +void GraalFreeZoom ( FreeZoom ) + + graalzoom *FreeZoom; + +{ + rdsfree( (char *)FreeZoom, sizeof(FreeZoom) ); +} + +/*------------------------------------------------------------\ +| | +| GraalAddZoom | +| | +\------------------------------------------------------------*/ + +void GraalAddZoom () + +{ + graalzoom *GraalZoom; + + rdsbegin(); + + GraalZoom = GraalAllocZoom (); + GraalZoom->X = GraalLambdaGridX; + GraalZoom->Y = GraalLambdaGridY; + GraalZoom->DX = GraalLambdaGridDx; + GraalZoom->DY = GraalLambdaGridDy; + GraalZoom->NEXT = GraalHeadZoom; + GraalHeadZoom = GraalZoom; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDelZoom | +| | +\------------------------------------------------------------*/ + +char GraalDelZoom() + +{ + graalzoom *GraalZoom; + + if ( GraalHeadZoom != (graalzoom *) NULL ) + { + rdsbegin(); + + GraalZoom = GraalHeadZoom; + GraalHeadZoom = GraalHeadZoom->NEXT; + GraalFreeZoom( GraalZoom ); + + rdsend(); + return( GRAAL_TRUE ); + } + + return( GRAAL_FALSE ); +} + +/*------------------------------------------------------------\ +| | +| GraalInitializeZoom | +| | +\------------------------------------------------------------*/ + +void GraalInitializeZoom() + +{ + rdsbegin(); + + while( GraalDelZoom() != GRAAL_FALSE ); + + if ( GraalComputeBound() == GRAAL_FALSE ) + { + GraalInitializeLambdaGrid(); + } + else + { + GraalLambdaGridX = ( GraalBoundXmin / GRAAL_RDS_LAMBDA ) - 1; + GraalLambdaGridY = ( GraalBoundYmin / GRAAL_RDS_LAMBDA ) - 1; + GraalLambdaGridDx = GraalBoundXmax / GRAAL_RDS_LAMBDA; + GraalLambdaGridDy = GraalBoundYmax / GRAAL_RDS_LAMBDA; + GraalLambdaGridDx = GraalLambdaGridDx - GraalLambdaGridX + 1; + GraalLambdaGridDy = GraalLambdaGridDy - GraalLambdaGridY + 1; + + GraalComputeLambdaGrid(); + } + + GraalComputeAndDisplayMap(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalZoomUndo | +| | +\------------------------------------------------------------*/ + +void GraalZoomUndo() + +{ + rdsbegin(); + + if ( GraalHeadZoom == (graalzoom *)NULL ) + { + GraalErrorMessage( GraalMainWindow, "No previous zoom !" ); + } + else + { + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + + GraalLambdaGridX = GraalHeadZoom->X; + GraalLambdaGridY = GraalHeadZoom->Y; + GraalLambdaGridDx = GraalHeadZoom->DX; + GraalLambdaGridDy = GraalHeadZoom->DY; + + GraalComputeLambdaGrid(); + GraalComputeAndDisplayMap(); + + GraalDisplayFigure( 0, 0, + GraalGraphicDx, GraalGraphicDy ); + + GraalRefreshGraphicWindow( 0, 0, + GraalGraphicDx, GraalGraphicDy); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_NORMAL_CURSOR ); + + GraalDelZoom(); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalZoomRight | +| | +\------------------------------------------------------------*/ + +void GraalZoomRight() + +{ + long Delta; + long Offset; + long GraalOldPixelGridX; + + rdsbegin(); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + + Delta = ( GraalPercentMoveX * GraalLambdaGridDx ) / 100; + + if ( Delta == 0 ) Delta = 1; + + GraalLambdaGridX = GraalLambdaGridX + Delta; + GraalOldPixelGridX = GraalPixelGridX; + GraalPixelGridX = (float)(GraalLambdaGridX) * GraalLambdaGridStep; + Offset = GraalPixelGridX - GraalOldPixelGridX; + + XCopyArea( GraalGraphicDisplay, + GraalGraphicPixmap, + GraalGraphicPixmap, + GraalBackgroundGC, + Offset, 0, + GraalGraphicDx - Offset, + GraalGraphicDy, + 0, 0 + ); + + GraalComputeAndDisplayMap(); + GraalDisplayFigure( GraalGraphicDx - Offset, 0, + GraalGraphicDx, GraalGraphicDy ); + GraalRefreshGraphicWindow( 0, 0, + GraalGraphicDx, GraalGraphicDy); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_NORMAL_CURSOR ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalZoomLeft | +| | +\------------------------------------------------------------*/ + +void GraalZoomLeft() + +{ + long Delta; + long Offset; + long GraalOldPixelGridX; + + rdsbegin(); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + + Delta = ( GraalPercentMoveX * GraalLambdaGridDx ) / 100; + + if ( Delta == 0 ) Delta = 1; + + GraalLambdaGridX = GraalLambdaGridX - Delta; + GraalOldPixelGridX = GraalPixelGridX; + GraalPixelGridX = (float)(GraalLambdaGridX) * GraalLambdaGridStep; + Offset = GraalOldPixelGridX - GraalPixelGridX; + + XCopyArea( GraalGraphicDisplay, + GraalGraphicPixmap, + GraalGraphicPixmap, + GraalBackgroundGC, + 0, 0, + GraalGraphicDx - Offset, + GraalGraphicDy, + Offset, 0 + ); + + GraalComputeAndDisplayMap(); + GraalDisplayFigure( 0, 0, Offset, GraalGraphicDy ); + GraalRefreshGraphicWindow( 0, 0, GraalGraphicDx, GraalGraphicDy); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_NORMAL_CURSOR ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalZoomDown | +| | +\------------------------------------------------------------*/ + +void GraalZoomDown() + +{ + long Delta; + long Offset; + long GraalOldPixelGridY; + + rdsbegin(); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + + Delta = ( GraalPercentMoveY * GraalLambdaGridDy ) / 100; + + if ( Delta == 0 ) Delta = 1; + + GraalLambdaGridY = GraalLambdaGridY - Delta; + GraalOldPixelGridY = GraalPixelGridY; + GraalPixelGridY = (float)(GraalLambdaGridY) * GraalLambdaGridStep; + Offset = GraalOldPixelGridY - GraalPixelGridY; + + XCopyArea( GraalGraphicDisplay, + GraalGraphicPixmap, + GraalGraphicPixmap, + GraalBackgroundGC, + 0, Offset, + GraalGraphicDx, + GraalGraphicDy - Offset, + 0, 0 + ); + + GraalComputeAndDisplayMap(); + GraalDisplayFigure( 0, 0, GraalGraphicDx, Offset ); + GraalRefreshGraphicWindow( 0, 0, GraalGraphicDx, GraalGraphicDy); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_NORMAL_CURSOR ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalZoomUp | +| | +\------------------------------------------------------------*/ + +void GraalZoomUp() + +{ + long Delta; + long Offset; + long GraalOldPixelGridY; + + rdsbegin(); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + + Delta = ( GraalPercentMoveY * GraalLambdaGridDy ) / 100; + + if ( Delta == 0 ) Delta = 1; + + GraalLambdaGridY = GraalLambdaGridY + Delta; + GraalOldPixelGridY = GraalPixelGridY; + GraalPixelGridY = (float)(GraalLambdaGridY) * GraalLambdaGridStep; + Offset = GraalPixelGridY - GraalOldPixelGridY; + + XCopyArea( GraalGraphicDisplay, + GraalGraphicPixmap, + GraalGraphicPixmap, + GraalBackgroundGC, + 0, 0, + GraalGraphicDx, + GraalGraphicDy - Offset, + 0, Offset + ); + + GraalComputeAndDisplayMap(); + GraalDisplayFigure( 0, GraalGraphicDy - Offset, + GraalGraphicDx, GraalGraphicDy ); + GraalRefreshGraphicWindow( 0, 0, GraalGraphicDx, GraalGraphicDy); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_NORMAL_CURSOR ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalZoomMore | +| | +\------------------------------------------------------------*/ + +void GraalZoomMore() + +{ + long DeltaX; + long DeltaY; + + rdsbegin(); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + + DeltaX = ( GraalPercentZoom * GraalLambdaGridDx ) / 100; + DeltaY = ( GraalPercentZoom * GraalLambdaGridDy ) / 100; + + if ( ( DeltaX >= 2 ) && + ( DeltaY >= 2 ) ) + { + GraalAddZoom(); + + GraalLambdaGridX = GraalLambdaGridX + (DeltaX >> 1); + GraalLambdaGridY = GraalLambdaGridY + (DeltaY >> 1); + GraalLambdaGridDx = GraalLambdaGridDx - DeltaX; + GraalLambdaGridDy = GraalLambdaGridDy - DeltaY; + + GraalComputeLambdaGrid(); + GraalComputeAndDisplayMap(); + GraalDisplayFigure( 0, 0, GraalGraphicDx, GraalGraphicDy ); + GraalRefreshGraphicWindow( 0, 0, GraalGraphicDx, GraalGraphicDy ); + } + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_NORMAL_CURSOR ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalZoomLess | +| | +\------------------------------------------------------------*/ + +void GraalZoomLess() + +{ + long DeltaX; + long DeltaY; + + rdsbegin(); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + + DeltaX = 100 * GraalLambdaGridDx / ( 100 - GraalPercentZoom ); + DeltaY = 100 * GraalLambdaGridDy / ( 100 - GraalPercentZoom ); + + GraalAddZoom(); + + GraalLambdaGridX = GraalLambdaGridX - ((DeltaX - GraalLambdaGridDx) >> 1); + GraalLambdaGridY = GraalLambdaGridY - ((DeltaY - GraalLambdaGridDy) >> 1); + GraalLambdaGridDx = DeltaX; + GraalLambdaGridDy = DeltaY; + + GraalComputeLambdaGrid(); + GraalComputeAndDisplayMap(); + GraalDisplayFigure( 0, 0, GraalGraphicDx, GraalGraphicDy ); + GraalRefreshGraphicWindow( 0, 0, GraalGraphicDx, GraalGraphicDy ); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_NORMAL_CURSOR ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalZoomFit | +| | +\------------------------------------------------------------*/ + +void GraalZoomFit() + +{ + rdsbegin(); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + + if ( GraalComputeBound() == GRAAL_FALSE ) + { + GraalErrorMessage( GraalMainWindow, "No element to display !" ); + } + else + { + GraalAddZoom(); + + GraalLambdaGridX = ( GraalBoundXmin / GRAAL_RDS_LAMBDA ) - 1; + GraalLambdaGridY = ( GraalBoundYmin / GRAAL_RDS_LAMBDA ) - 1; + GraalLambdaGridDx = GraalBoundXmax / GRAAL_RDS_LAMBDA; + GraalLambdaGridDy = GraalBoundYmax / GRAAL_RDS_LAMBDA; + GraalLambdaGridDx = GraalLambdaGridDx - GraalLambdaGridX + 1; + GraalLambdaGridDy = GraalLambdaGridDy - GraalLambdaGridY + 1; + + GraalComputeLambdaGrid(); + GraalComputeAndDisplayMap(); + GraalDisplayFigure( 0, 0, GraalGraphicDx, GraalGraphicDy ); + GraalRefreshGraphicWindow( 0, 0, GraalGraphicDx, GraalGraphicDy ); + } + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_NORMAL_CURSOR ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalZoomCenter | +| | +\------------------------------------------------------------*/ + +void GraalZoomCenter( LambdaX, LambdaY ) + + long LambdaX; + long LambdaY; +{ + rdsbegin(); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + + GraalLambdaGridX = LambdaX - ( GraalLambdaGridDx >> 1 ); + GraalLambdaGridY = LambdaY - ( GraalLambdaGridDy >> 1 ); + + GraalComputeLambdaGrid(); + GraalComputeAndDisplayMap(); + GraalDisplayFigure( 0, 0, GraalGraphicDx, GraalGraphicDy ); + GraalRefreshGraphicWindow( 0, 0, GraalGraphicDx, GraalGraphicDy ); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_NORMAL_CURSOR ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalZoomIn | +| | +\------------------------------------------------------------*/ + +void GraalZoomIn( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ) + + long LambdaX1; + long LambdaY1; + long LambdaX2; + long LambdaY2; +{ + long Swap; + + rdsbegin(); + + if ( ( LambdaX1 != LambdaX2 ) && + ( LambdaY1 != LambdaY2 ) ) + { + if ( LambdaX1 > LambdaX2 ) + { + Swap = LambdaX1; LambdaX1 = LambdaX2; LambdaX2 = Swap; + } + + if ( LambdaY1 > LambdaY2 ) + { + Swap = LambdaY1; LambdaY1 = LambdaY2; LambdaY2 = Swap; + } + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + + GraalAddZoom(); + + GraalLambdaGridX = LambdaX1; + GraalLambdaGridY = LambdaY1; + GraalLambdaGridDx = LambdaX2 - LambdaX1; + GraalLambdaGridDy = LambdaY2 - LambdaY1; + + GraalComputeLambdaGrid(); + GraalComputeAndDisplayMap(); + GraalDisplayFigure( 0, 0, GraalGraphicDx, GraalGraphicDy ); + GraalRefreshGraphicWindow( 0, 0, GraalGraphicDx, GraalGraphicDy ); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_NORMAL_CURSOR ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalZoomPan | +| | +\------------------------------------------------------------*/ + +void GraalZoomPan( LambdaX1, LambdaY1, LambdaX2, LambdaY2 ) + + long LambdaX1; + long LambdaY1; + long LambdaX2; + long LambdaY2; +{ + if ( ( LambdaX1 != LambdaX2 ) || + ( LambdaY1 != LambdaY2 ) ) + { + rdsbegin(); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + + GraalLambdaGridX = GraalLambdaGridX + ( LambdaX1 - LambdaX2 ); + GraalLambdaGridY = GraalLambdaGridY + ( LambdaY1 - LambdaY2 ); + + GraalComputeLambdaGrid(); + GraalComputeAndDisplayMap(); + GraalDisplayFigure( 0, 0, GraalGraphicDx, GraalGraphicDy ); + GraalRefreshGraphicWindow( 0, 0, GraalGraphicDx, GraalGraphicDy ); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_NORMAL_CURSOR ); + + rdsend(); + } +} + +/*------------------------------------------------------------\ +| | +| GraalZoomRefresh | +| | +\------------------------------------------------------------*/ + +void GraalZoomRefresh() + +{ + rdsbegin(); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + + GraalDisplayFigure( 0, 0, GraalGraphicDx, GraalGraphicDy ); + GraalRefreshGraphicWindow( 0, 0, GraalGraphicDx, GraalGraphicDy ); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_NORMAL_CURSOR ); + + rdsend(); +} diff --git a/alliance/src/graal/src/GMV_view.h b/alliance/src/graal/src/GMV_view.h new file mode 100644 index 00000000..7b892c17 --- /dev/null +++ b/alliance/src/graal/src/GMV_view.h @@ -0,0 +1,95 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : View.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 25/02/93 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_VIEW +# define GRAAL_VIEW + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define GRAAL_PERCENT_ZOOM 30 +# define GRAAL_PERCENT_ZOOM_MIN 5 +# define GRAAL_PERCENT_ZOOM_MAX 95 + +# define GRAAL_PERCENT_MOVE 30 +# define GRAAL_PERCENT_MOVE_MIN 5 +# define GRAAL_PERCENT_MOVE_MAX 95 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct graalzoom + { + struct graalzoom *NEXT; + + long X; + long Y; + long DX; + long DY; + + } graalzoom; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern int GraalPercentZoom; + extern int GraalPercentMove; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GMX.h b/alliance/src/graal/src/GMX.h new file mode 100644 index 00000000..70ccda7c --- /dev/null +++ b/alliance/src/graal/src/GMX.h @@ -0,0 +1,293 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : gmx101.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_GMX +# define GRAAL_GMX + +/*------------------------------------------------------------\ +| | +| Graphic Context | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Colors Define | +| | +\------------------------------------------------------------*/ + +# define GRAAL_BLACK_COLOR "Black" +# define GRAAL_WHITE_COLOR "White" +# define GRAAL_TEXT_COLOR "White" +# define GRAAL_ACCEPT_COLOR "magenta" +# define GRAAL_EQUI_COLOR "White" +# define GRAAL_DRUC_COLOR "Gray" +# define GRAAL_CURSOR_COLOR "Black" + +/*------------------------------------------------------------\ +| | +| Graal Message | +| | +\------------------------------------------------------------*/ + +# define GRAAL_MAX_MESSAGE 7 + +# define GRAAL_MESSAGE_X 0 +# define GRAAL_MESSAGE_Y 1 +# define GRAAL_MESSAGE_DX 2 +# define GRAAL_MESSAGE_DY 3 +# define GRAAL_MESSAGE_MODE 4 +# define GRAAL_MESSAGE_INFO 5 +# define GRAAL_MESSAGE_PROMPT 6 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Graal Widget | +| | +\------------------------------------------------------------*/ + + extern XtAppContext GraalApplication; + extern Widget GraalTopLevel; + extern Widget GraalMainWindow; + extern Widget GraalMainForm; + + extern Widget GraalMenuBar; + + extern Widget GraalGraphicFrame; + extern Widget GraalGraphicWindow; + extern Display *GraalGraphicDisplay; + + extern Widget GraalMessageMainPaned; + extern Widget GraalMessageMainForm; + extern Widget GraalMessageForm [ GRAAL_MAX_MESSAGE ]; + extern Widget GraalMessageText [ GRAAL_MAX_MESSAGE ]; + extern Widget GraalMessageLabel [ GRAAL_MAX_MESSAGE ]; + extern Widget GraalMessageFrame [ GRAAL_MAX_MESSAGE ]; + +/*------------------------------------------------------------\ +| | +| Graal Graphic Context | +| | +\------------------------------------------------------------*/ + + extern GC GraalLayerFillGC [ RDS_ALL_LAYER ]; + extern GC GraalLayerDrawGC [ RDS_ALL_LAYER ]; + extern GC GraalLayerAcceptGC [ RDS_ALL_LAYER ]; + extern GC GraalLayerEquiGC [ RDS_ALL_LAYER ]; + extern GC GraalLayerDrucGC [ RDS_ALL_LAYER ]; + extern GC GraalAcceptDrawGC; + extern GC GraalEquiDrawGC; + extern GC GraalDrucDrawGC; + extern GC GraalBackgroundGC; + extern GC GraalGridGC; + extern GC GraalXorGC; + extern GC GraalSmallTextGC; + extern GC GraalMediumTextGC; + extern GC GraalLargeTextGC; + + extern XFontStruct *GraalSmallTextFont; + extern XFontStruct *GraalLargeTextFont; + extern XFontStruct *GraalMediumTextFont; + +/*------------------------------------------------------------\ +| | +| Graal Graphic Pixmap | +| | +\------------------------------------------------------------*/ + + extern Pixmap GraalGraphicPixmap; + +/*------------------------------------------------------------\ +| | +| Graal Colormap | +| | +\------------------------------------------------------------*/ + + extern Colormap GraalColorMap; + +/*------------------------------------------------------------\ +| | +| Graal Graphic Size | +| | +\------------------------------------------------------------*/ + + extern Dimension GraalOldGraphicDx; + extern Dimension GraalOldGraphicDy; + extern Dimension GraalGraphicDx; + extern Dimension GraalGraphicDy; + +/*------------------------------------------------------------\ +| | +| Graal Lambda Grid | +| | +\------------------------------------------------------------*/ + + extern float GraalLambdaGridStep; + extern long GraalLambdaGridX; + extern long GraalLambdaGridY; + extern long GraalLambdaGridDx; + extern long GraalLambdaGridDy; + extern long GraalPixelGridX; + extern long GraalPixelGridY; + +/*------------------------------------------------------------\ +| | +| User Lambda Grid | +| | +\------------------------------------------------------------*/ + + extern long GraalLambdaUserGridDx; + extern long GraalLambdaUserGridDy; + extern char GraalLambdaUserGrid; + +/*------------------------------------------------------------\ +| | +| Graal Cursor | +| | +\------------------------------------------------------------*/ + + extern long GraalLambdaCursorX; + extern long GraalLambdaCursorY; + +/*------------------------------------------------------------\ +| | +| Graal Event | +| | +\------------------------------------------------------------*/ + + extern char GraalCountEventZoom; + extern char GraalCountEventEdit; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalInitializeRessources | +| | +\------------------------------------------------------------*/ + + extern void GraalInitializeRessources(); + +/*------------------------------------------------------------\ +| | +| Graal Change Title | +| | +\------------------------------------------------------------*/ + + extern void GraalChangeTopLevelTitle(); + +/*------------------------------------------------------------\ +| | +| Graal Edit Mode | +| | +\------------------------------------------------------------*/ + + extern void GraalChangeEditMode(); + extern void GraalContinueEditMode(); + +/*------------------------------------------------------------\ +| | +| GraalDisplayMessage | +| | +\------------------------------------------------------------*/ + + extern void GraalDisplayMessage(); + extern void GraalPromptEditMeasure(); + +/*------------------------------------------------------------\ +| | +| Graal Graphic Window | +| | +\------------------------------------------------------------*/ + + extern void GraalClearGraphicWindow(); + extern void GraalResizeGraphicWindow(); + extern void GraalRefreshGraphicWindow(); + +/*------------------------------------------------------------\ +| | +| Graal Lambda Grid | +| | +\------------------------------------------------------------*/ + + extern void GraalComputeLambdaGrid(); + extern void GraalResizeLambdaGrid(); + +/*------------------------------------------------------------\ +| | +| Graal Display Figure | +| | +\------------------------------------------------------------*/ + + extern void GraalDisplayFigure(); + extern void GraalDisplayRectangle(); + +/*------------------------------------------------------------\ +| | +| Graal Cursor | +| | +\------------------------------------------------------------*/ + + extern void GraalDisplayCursor(); + extern void GraalUndisplayCursor(); + +# endif diff --git a/alliance/src/graal/src/GMX_color.c b/alliance/src/graal/src/GMX_color.c new file mode 100644 index 00000000..261cc43f --- /dev/null +++ b/alliance/src/graal/src/GMX_color.c @@ -0,0 +1,755 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Colors.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rds.h" +# include "GSB.h" +# include "GMX.h" +# include "GMX_color.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + GC GraalLayerFillGC [ RDS_ALL_LAYER ]; + GC GraalLayerDrawGC [ RDS_ALL_LAYER ]; + GC GraalLayerAcceptGC [ RDS_ALL_LAYER ]; + GC GraalLayerEquiGC [ RDS_ALL_LAYER ]; + GC GraalLayerDrucGC [ RDS_ALL_LAYER ]; + GC GraalAcceptDrawGC; + GC GraalDrucDrawGC; + GC GraalEquiDrawGC; + GC GraalBackgroundGC; + GC GraalGridGC; + GC GraalSmallTextGC; + GC GraalMediumTextGC; + GC GraalLargeTextGC; + GC GraalXorGCInvert; + GC GraalXorGCXor; + GC GraalXorGC; + + XFontStruct *GraalLargeTextFont; + XFontStruct *GraalMediumTextFont; + XFontStruct *GraalSmallTextFont; + + Colormap GraalColorMap; + +/*------------------------------------------------------------\ +| | +| Layer Color Define | +| | +\------------------------------------------------------------*/ + + static char GraalLayerPatternDefine[ RDS_ALL_LAYER ] = + + { + 0, /* RDS_NWELL */ + 0, /* RDS_PWELL */ + 0, /* RDS_NIMP */ + 0, /* RDS_PIMP */ + 0, /* RDS_ACTIV */ + 1, /* RDS_NDIF */ + 1, /* RDS_PDIF */ + 1, /* RDS_NTIE */ + 1, /* RDS_PTIE */ + 3, /* RDS_POLY */ + 2, /* RDS_GATE */ + 3, /* RDS_VPOLY */ + 12, /* RDS_TPOLY */ + 2, /* RDS_POLY2 */ + 5, /* RDS_CONT */ + 3, /* RDS_TPOLY2 */ + 5, /* RDS_TCONT */ + 5, /* RDS_CONT2 */ + 4, /* RDS_ALU1 */ + 4, /* RDS_VALU1 */ + 12, /* RDS_TALU1 */ + 5, /* RDS_VIA1 */ + 5, /* RDS_TVIA1 */ + 6, /* RDS_ALU2 */ + 6, /* RDS_VALU2 */ + 12, /* RDS_TALU2 */ + 5, /* RDS_VIA2 */ + 5, /* RDS_TVIA2 */ + 8, /* RDS_ALU3 */ + 8, /* RDS_VALU3 */ + 12, /* RDS_TALU3 */ + 5, /* RDS_VIA3 */ + 5, /* RDS_TVIA3 */ + 9, /* RDS_ALU4 */ + 9, /* RDS_VALU4 */ + 14, /* RDS_TALU4 */ + 5, /* RDS_VIA4 */ + 5, /* RDS_TVIA4 */ + 10, /* RDS_ALU5 */ + 10, /* RDS_VALU5 */ + 12, /* RDS_TALU5 */ + 13, /* RDS_VIA5 */ + 5, /* RDS_TVIA5 */ + 11, /* RDS_ALU6 */ + 11, /* RDS_VALU6 */ + 12, /* RDS_TALU6 */ + 5, /* RDS_VIA6 */ + 5, /* RDS_TVIA6 */ + 8, /* RDS_ALU7 */ + 8, /* RDS_VALU7 */ + 12, /* RDS_TALU7 */ + 5, /* RDS_VIA7 */ + 5, /* RDS_TVIA7 */ + 9, /* RDS_ALU8 */ + 9, /* RDS_VALU8 */ + 12, /* RDS_TALU8 */ + 5, /* RDS_VIA8 */ + 5, /* RDS_TVIA8 */ + 10, /* RDS_ALU9 */ + 7, /* RDS_CPAS */ + 7, /* RDS_REF */ + 4, /* RDS_USER0 */ + 0, /* RDS_USER1 */ + 0, /* RDS_USER2 */ + 0, /* RDS_USER3 */ + 0, /* RDS_USER4 */ + 0, /* RDS_USER5 */ + 0, /* RDS_USER6 */ + 0, /* RDS_USER7 */ + 0, /* RDS_USER8 */ + 0, /* RDS_USER9 */ + 0 /* RDS_ABOX */ + }; + + + static char GraalPatternBits[ GRAAL_MAX_PATTERN ][ GRAAL_PATTERN_SQUARE ] = + + { /* FOR SUBST 0 */ + { + 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xf7, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xf7, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + } + , /* FOR DIF & TIE 1 */ + { + 0x77, 0x77, 0xbb, 0xbb, 0xdd, 0xdd, 0xee, 0xee, 0x77, 0x77, 0xbb, 0xbb, + 0xdd, 0xdd, 0xee, 0xee, 0x77, 0x77, 0xbb, 0xbb, 0xdd, 0xdd, 0xee, 0xee, + 0x77, 0x77, 0xbb, 0xbb, 0xdd, 0xdd, 0xee, 0xee + } + , /* FOR GATE 2 */ + { + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55 + } + , /* FOR POLY 3 */ + { + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa + } + , /* FOR ALU1 4 */ + { + 0x88, 0x88, 0x44, 0x44, 0x22, 0x22, 0x11, 0x11, 0x88, 0x88, 0x44, 0x44, + 0x22, 0x22, 0x11, 0x11, 0x88, 0x88, 0x44, 0x44, 0x22, 0x22, 0x11, 0x11, + 0x88, 0x88, 0x44, 0x44, 0x22, 0x22, 0x11, 0x11 + } + , /* FOR CONT 5 */ + { + 0x55, 0x55, 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, + 0x55, 0x55, 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, + 0x55, 0x55, 0xff, 0xff, 0x55, 0x55, 0xff, 0xff + } + , /* FOR ALU2 6 */ + { + 0x11, 0x11, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00, + 0x44, 0x44, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00, + 0x11, 0x11, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00 + } + , /* FOR REF 7 */ + { + 0xaa, 0xaa, 0x11, 0x11, 0xaa, 0xaa, 0x44, 0x44, 0xaa, 0xaa, 0x11, 0x11, + 0xaa, 0xaa, 0x44, 0x44, 0xaa, 0xaa, 0x11, 0x11, 0xaa, 0xaa, 0x44, 0x44, + 0xaa, 0xaa, 0x11, 0x11, 0xaa, 0xaa, 0x44, 0x44 + } + , /* FOR ALU3 8 */ + { + 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, + 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, + 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11 + } + , /* FOR ALU4 9 */ + { + 0x88, 0x88, 0x22, 0x22, 0x88, 0x88, 0x22, 0x22, 0x88, 0x88, 0x22, 0x22, + 0x88, 0x88, 0x22, 0x22, 0x88, 0x88, 0x22, 0x22, 0x88, 0x88, 0x22, 0x22, + 0x88, 0x88, 0x22, 0x22, 0x88, 0x88, 0x22, 0x22 + } + , /* FOR ALU5 10 */ + { + 0x22, 0x22, 0x88, 0x88, 0x22, 0x22, 0x88, 0x88, 0x22, 0x22, 0x88, 0x88, + 0x22, 0x22, 0x88, 0x88, 0x22, 0x22, 0x88, 0x88, 0x22, 0x22, 0x88, 0x88, + 0x22, 0x22, 0x88, 0x88, 0x22, 0x22, 0x88, 0x88 + } + , /* FOR ALU6 11 */ + { + 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, + 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, + 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44 + } + , /* FOR TPOLY, TALU1 12 */ + { + 0x00, 0x00, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00 + } + , /* FOR VIA 13 */ + { + 0xff, 0xff, 0xaa, 0xaa, 0xff, 0xff, 0xaa, 0xaa, 0xff, 0xff, 0xaa, 0xaa, + 0xff, 0xff, 0xaa, 0xaa, 0xff, 0xff, 0xaa, 0xaa, 0xff, 0xff, 0xaa, 0xaa, + 0xff, 0xff, 0xaa, 0xaa, 0xff, 0xff, 0xaa, 0xaa + } + , /* FOR TALUx 14 */ + { + 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00 + } + , /* FOR USER 15 */ + { + 0x44, 0x44, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00, + 0x11, 0x11, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00, + 0x44, 0x44, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00 + } + , + { + 0xee, 0xee, 0x77, 0x77, 0xbb, 0xbb, 0xdd, 0xdd, 0xee, 0xee, 0x77, 0x77, + 0xbb, 0xbb, 0xdd, 0xdd, 0xee, 0xee, 0x77, 0x77, 0xbb, 0xbb, 0xdd, 0xdd, + 0xee, 0xee, 0x77, 0x77, 0xbb, 0xbb, 0xdd, 0xdd + } + , + { + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa + } + , + { + 0xdd, 0xdd, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0xd5, 0xd5, 0xaa, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0xdd, 0xdd, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + 0xdd, 0xd5, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa + } + , + { + 0x77, 0x77, 0xaa, 0xaa, 0xd5, 0xd5, 0xaa, 0xaa, 0x77, 0x77, 0xaa, 0xaa, + 0xdd, 0x5d, 0xaa, 0xaa, 0x77, 0x77, 0xaa, 0xaa, 0xd5, 0xd5, 0xaa, 0xaa, + 0x77, 0x77, 0xaa, 0xaa, 0x5d, 0xdd, 0xaa, 0xaa + } + , + { + 0x55, 0x55, 0xbb, 0xbb, 0x55, 0x55, 0xfe, 0xfe, 0x55, 0x55, 0xbb, 0xbb, + 0x55, 0x55, 0xee, 0xef, 0x55, 0x55, 0xbb, 0xbb, 0x55, 0x55, 0xfe, 0xfe, + 0x55, 0x55, 0xbb, 0xbb, 0x55, 0x55, 0xef, 0xef + } + , + { + 0xff, 0xff, 0xaa, 0xaa, 0x77, 0x77, 0xaa, 0xaa, 0xff, 0xff, 0xaa, 0xaa, + 0x77, 0x7f, 0xaa, 0xaa, 0xff, 0xff, 0xaa, 0xaa, 0x77, 0x77, 0xaa, 0xaa, + 0xff, 0xff, 0xaa, 0xaa, 0x7f, 0x7f, 0xaa, 0xaa + } + , + { + 0xff, 0xff, 0xaa, 0xaa, 0xff, 0xff, 0xaa, 0xaa, 0xff, 0xff, 0xaa, 0xaa, + 0xff, 0xff, 0xaa, 0xaa, 0xff, 0xff, 0xaa, 0xaa, 0xff, 0xff, 0xaa, 0xaa, + 0xff, 0xff, 0xaa, 0xaa, 0xff, 0xff, 0xaa, 0xaa + } + , + { + 0x55, 0x55, 0xff, 0xff, 0xdd, 0xdd, 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, + 0x5d, 0xdd, 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0xdd, 0xdd, 0xff, 0xff, + 0x55, 0x55, 0xff, 0xff, 0x5d, 0x5d, 0xff, 0xff + } + , + { + 0xee, 0xee, 0xff, 0xff, 0xbb, 0xba, 0xff, 0xff, 0xee, 0xee, 0xff, 0xff, + 0xab, 0xbb, 0xff, 0xff, 0xee, 0xee, 0xff, 0xff, 0xbb, 0xba, 0xff, 0xff, + 0xee, 0xee, 0xff, 0xff, 0xbb, 0xab, 0xff, 0xff + } + , + { + 0xff, 0xff, 0xee, 0xee, 0xff, 0xff, 0xfb, 0xfb, 0xff, 0xff, 0xee, 0xee, + 0xff, 0xff, 0xbf, 0xbb, 0xff, 0xff, 0xee, 0xee, 0xff, 0xff, 0xfb, 0xfb, + 0xff, 0xff, 0xee, 0xee, 0xff, 0xff, 0xbf, 0xbf + } + , + { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbb, 0xbb, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xfb, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbb, 0xbb, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xfb + } + , + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x88, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08 + } + , + { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x77, 0x77, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xf7, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x77, 0x77, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xf7 + } + , + { + 0x10, 0x10, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00, 0x01, 0x11, 0x00, 0x00, + 0x44, 0x44, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00, + 0x01, 0x01, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00 + } + , + { + 0x00, 0x00, 0x11, 0x51, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00, 0x15, 0x15, + 0x00, 0x00, 0x44, 0x44, 0x00, 0x00, 0x51, 0x11, 0x00, 0x00, 0x44, 0x44, + 0x00, 0x00, 0x15, 0x15, 0x00, 0x00, 0x44, 0x44 + } + , + { + 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x8a, 0x88, 0x00, 0x00, 0xaa, 0xaa, + 0x00, 0x00, 0x88, 0x88, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x8a, 0x8a, + 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x88, 0x88 + } + , + { + 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, + 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, + 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00 + } + , + { + 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x88, 0x88, 0x55, 0x55, 0x00, 0x00, + 0x55, 0x55, 0x80, 0x80, 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x88, 0x88, + 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x88, 0x80 + } + , + { + 0x22, 0x22, 0x55, 0x55, 0x80, 0x80, 0x55, 0x55, 0x22, 0x22, 0x55, 0x55, + 0x88, 0x08, 0x55, 0x55, 0x22, 0x22, 0x55, 0x55, 0x80, 0x80, 0x55, 0x55, + 0x22, 0x22, 0x55, 0x55, 0x08, 0x08, 0x55, 0x55 + } + , + { + 0x88, 0x88, 0x55, 0x55, 0x22, 0xa2, 0x55, 0x55, 0x88, 0x88, 0x55, 0x55, + 0x2a, 0x2a, 0x55, 0x55, 0x88, 0x88, 0x55, 0x55, 0xa2, 0x22, 0x55, 0x55, + 0x88, 0x88, 0x55, 0x55, 0x2a, 0x2a, 0x55, 0x55 + } + , + { + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x54, 0x54, 0xaa, 0xaa, 0x55, 0x55, + 0xaa, 0xaa, 0x44, 0x44, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x44, 0x54, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x44, 0x44 + } + }; + + static Pixmap GraalPattern[ GRAAL_MAX_PATTERN ]; + + static char *GraalColorName[ 7 ] = + + { + GRAAL_BLACK_COLOR, + GRAAL_WHITE_COLOR, + GRAAL_TEXT_COLOR , + GRAAL_ACCEPT_COLOR, + GRAAL_EQUI_COLOR, + GRAAL_DRUC_COLOR, + GRAAL_CURSOR_COLOR + }; + + static int GraalColor[ GRAAL_MAX_COLOR ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalSwitchColormap | +| | +\------------------------------------------------------------*/ + +void GraalInitializeColorMap() +{ + Display *ADisplay; + Screen *AScreen; + + ADisplay = XtDisplay( GraalTopLevel ); + AScreen = XtScreen( GraalTopLevel ); + GraalColorMap = DefaultColormapOfScreen( AScreen ); + + if ( GRAAL_SWITCH_COLOR_MAP ) + { + GraalColorMap = XCopyColormapAndFree( ADisplay, GraalColorMap ); + XInstallColormap( ADisplay, GraalColorMap ); + XtVaSetValues( GraalTopLevel, XmNcolormap, GraalColorMap, NULL ); + } +} + +/*------------------------------------------------------------\ +| | +| GraalInitializeColors | +| | +\------------------------------------------------------------*/ + +void GraalInitializeColors() + +{ + XColor ForgetIt; + XColor GetIt; + Window Root; + int Counter; + char Error; + char *ColorName; + + rdsbegin(); + + if ( GRAAL_CURSOR_COLOR_NAME != (char *)NULL ) + { + GraalColorName[ 6 ] = GRAAL_CURSOR_COLOR_NAME; + } + + Error = False; + + for ( Counter = 0; Counter < GRAAL_MAX_COLOR; Counter++ ) + { + if ( Counter >= 7 ) + { + ColorName = GRAAL_RDS_LAYER_NAME_TABLE[ Counter - 7 ][ 1 ]; + } + else + { + ColorName = GraalColorName[ Counter ]; + } + + if ( ColorName != (char *)NULL ) + { + if ( ! XAllocNamedColor( GraalGraphicDisplay, + GraalColorMap, ColorName, + &GetIt, &ForgetIt ) ) + { + fprintf( stderr, "\nGmx: Unable to allocate color '%s' !\n", + ColorName ); + + Error = True; + } + + GraalColor[ Counter ] = GetIt.pixel; + } + else + { + GraalColor[ Counter ] = GraalColor[ 0 ]; + } + } + + if ( Error == True ) exit( 1 ); + + Root = RootWindowOfScreen ( XtScreen ( GraalGraphicWindow ) ); + + for ( Counter = 0; Counter < GRAAL_MAX_PATTERN; Counter++ ) + { + GraalPattern[ Counter ] = + + XCreateBitmapFromData( GraalGraphicDisplay, + Root, + GraalPatternBits[ Counter ], + GRAAL_PATTERN_WIDTH, + GRAAL_PATTERN_HEIGHT ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalChangeCursorContext | +| | +\------------------------------------------------------------*/ + +void GraalChangeCursorContext() +{ + XGCValues GraphicValue; + + if ( GRAAL_XOR_CURSOR == GRAAL_TRUE ) + { + GraalXorGC = GraalXorGCXor; + } + else + { + GraalXorGC = GraalXorGCInvert; + } +} + +/*------------------------------------------------------------\ +| | +| GraalInitializeGraphicContext | +| | +\------------------------------------------------------------*/ + +void GraalInitializeGraphicContext() + +{ + XGCValues GraphicValue; + int Counter; + Window Root; + char Pattern; + + rdsbegin(); + + GraalLargeTextFont = XLoadQueryFont( GraalGraphicDisplay, + GRAAL_LARGE_TEXT_FONT_NAME ); + + GraalMediumTextFont = XLoadQueryFont( GraalGraphicDisplay, + GRAAL_MEDIUM_TEXT_FONT_NAME ); + + GraalSmallTextFont = XLoadQueryFont( GraalGraphicDisplay, + GRAAL_SMALL_TEXT_FONT_NAME ); + + GraphicValue.foreground = GraalColor[ 0 ]; /* Black */ + GraphicValue.background = GraalColor[ 0 ]; + GraphicValue.plane_mask = AllPlanes; + + Root = RootWindowOfScreen ( XtScreen ( GraalGraphicWindow ) ), + + GraalBackgroundGC = XCreateGC ( GraalGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + GraphicValue.foreground = GraalColor[ 1 ]; /* White */ + + GraalGridGC = XCreateGC ( GraalGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + GraphicValue.foreground = GraalColor[ 3 ]; + + GraalAcceptDrawGC = XCreateGC ( GraalGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + GraphicValue.foreground = GraalColor[ 4 ]; + + GraalEquiDrawGC = XCreateGC ( GraalGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + GraphicValue.foreground = GraalColor[ 5 ]; + + GraalDrucDrawGC = XCreateGC ( GraalGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + GraphicValue.foreground = GraalColor[ 2 ]; /* Text */ + + GraalSmallTextGC = XCreateGC ( GraalGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + GraalMediumTextGC = XCreateGC ( GraalGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + GraalLargeTextGC = XCreateGC ( GraalGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + XSetFont( GraalGraphicDisplay, + GraalSmallTextGC, GraalSmallTextFont->fid ); + + XSetFont( GraalGraphicDisplay, + GraalMediumTextGC, GraalMediumTextFont->fid ); + + XSetFont( GraalGraphicDisplay, + GraalLargeTextGC, GraalLargeTextFont->fid ); + + GraphicValue.background = GraalColor[ 6 ]; /* Xor Color */ + GraphicValue.foreground = GraalColor[ 6 ]; /* Xor Color */ + GraphicValue.function = GXxor; + + GraalXorGCXor = XCreateGC ( GraalGraphicDisplay, + Root, + ( GCFunction | + GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + GraphicValue.function = GXinvert; + + GraalXorGCInvert = XCreateGC ( GraalGraphicDisplay, + Root, + ( GCFunction | + GCPlaneMask ), + &GraphicValue ); + + GraalChangeCursorContext(); + + GraphicValue.background = GraalColor[ 0 ]; /* Black */ + GraphicValue.foreground = GraalColor[ 1 ]; /* White */ + + for ( Counter = 0; Counter < RDS_ALL_LAYER; Counter++ ) + { + if ( GRAAL_RDS_LAYER_NAME_TABLE[ Counter ][ 0 ] != (char *)NULL ) + { + Pattern = GRAAL_RDS_LAYER_PATTERN_TABLE[ Counter ]; + + if ( ( Pattern < 0 ) || + ( Pattern >= GRAAL_MAX_PATTERN ) ) + { + Pattern = GraalLayerPatternDefine[ Counter ]; + } + + GraphicValue.stipple = GraalPattern[ Pattern ]; + GraphicValue.fill_style = FillStippled; + GraphicValue.foreground = GraalColor[ 3 ]; + + GraalLayerAcceptGC[ Counter ] = + + XCreateGC ( GraalGraphicDisplay, + Root, + ( GCStipple | + GCForeground | + GCBackground | + GCFillStyle | + GCPlaneMask ), + &GraphicValue ); + + GraphicValue.foreground = GraalColor[ 4 ]; + + GraalLayerEquiGC[ Counter ] = + + XCreateGC ( GraalGraphicDisplay, + Root, + ( GCStipple | + GCForeground | + GCBackground | + GCFillStyle | + GCPlaneMask ), + &GraphicValue ); + + GraphicValue.foreground = GraalColor[ 5 ]; + + GraalLayerDrucGC[ Counter ] = + + XCreateGC ( GraalGraphicDisplay, + Root, + ( GCStipple | + GCForeground | + GCBackground | + GCFillStyle | + GCPlaneMask ), + &GraphicValue ); + + GraphicValue.foreground = GraalColor[ Counter + 7 ]; + + GraalLayerFillGC[ Counter ] = + + XCreateGC ( GraalGraphicDisplay, + Root, + ( GCStipple | + GCForeground | + GCBackground | + GCFillStyle | + GCPlaneMask ), + &GraphicValue ); + + GraalLayerDrawGC[ Counter ] = + + XCreateGC ( GraalGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + } + } + + rdsend(); +} diff --git a/alliance/src/graal/src/GMX_color.h b/alliance/src/graal/src/GMX_color.h new file mode 100644 index 00000000..8ca1540b --- /dev/null +++ b/alliance/src/graal/src/GMX_color.h @@ -0,0 +1,92 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Color.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_COLOR +# define GRAAL_COLOR + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Pattern | +| | +\------------------------------------------------------------*/ + +# define GRAAL_PATTERN_WIDTH 16 +# define GRAAL_PATTERN_HEIGHT 16 +# define GRAAL_PATTERN_SQUARE 32 +# define GRAAL_MAX_PATTERN 38 + +# define GRAAL_MAX_COLOR ( RDS_ALL_LAYER + 7 ) + +# define GRAAL_LARGE_TEXT_FONT_NAME "9x15" +# define GRAAL_MEDIUM_TEXT_FONT_NAME "7x13" +# define GRAAL_SMALL_TEXT_FONT_NAME "5x8" + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalInitializeGraphicContext(); + extern void GraalInitializeColors(); + extern void GraalChangeCursorContext(); + extern void GraalInitializeColorMap(); + +# endif diff --git a/alliance/src/graal/src/GMX_cursor.c b/alliance/src/graal/src/GMX_cursor.c new file mode 100644 index 00000000..e683615b --- /dev/null +++ b/alliance/src/graal/src/GMX_cursor.c @@ -0,0 +1,534 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Cursor.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "GSB.h" +# include "GMX.h" +# include "GMX_view.h" +# include "GMX_grid.h" +# include "GMX_cursor.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Buffer | +| | +\------------------------------------------------------------*/ + + static char GraalCursorBuffer[ GRAAL_MAX_CURSOR_BUFFER ]; + +/*------------------------------------------------------------\ +| | +| Coordinates | +| | +\------------------------------------------------------------*/ + + Position GraalCursorX = 0; + Position GraalCursorY = 0; + Position GraalCursorSaveX = 0; + Position GraalCursorSaveY = 0; + char GraalCursorSaved = GRAAL_FALSE; + char GraalCursorInside = GRAAL_FALSE; + char GraalCursorType = GRAAL_INPUT_HALF_BOX; + + long GraalLambdaCursorX = 0; + long GraalLambdaCursorY = 0; + long GraalPixelCursorX = 0; + long GraalPixelCursorY = 0; + + long GraalLambdaCursorSaveX[ 2 ] = { 0, 0 }; + long GraalLambdaCursorSaveY[ 2 ] = { 0, 0 }; + char GraalCursorIndex = 0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalComputeCursor | +| | +\------------------------------------------------------------*/ + +void GraalComputeCursor( X, Y ) + + Position X; + Position Y; +{ + rdsbegin(); + + Y = GraalGraphicDy - Y; + + GraalLambdaCursorX = X + GraalPixelGridX; + GraalLambdaCursorY = Y + GraalPixelGridY; + + if ( GraalLambdaCursorX < 0 ) + { + GraalLambdaCursorX = ((float)(GraalLambdaCursorX) / GraalLambdaGridStep) - 0.5 ; + } + else + { + GraalLambdaCursorX = ((float)(GraalLambdaCursorX) / GraalLambdaGridStep) + 0.5 ; + } + + if ( GraalLambdaCursorY < 0 ) + { + GraalLambdaCursorY = ((float)(GraalLambdaCursorY) / GraalLambdaGridStep) - 0.5 ; + } + else + { + GraalLambdaCursorY = ((float)(GraalLambdaCursorY) / GraalLambdaGridStep) + 0.5 ; + } + + GraalPixelCursorX = ((float)(GraalLambdaCursorX) * GraalLambdaGridStep); + GraalPixelCursorY = ((float)(GraalLambdaCursorY) * GraalLambdaGridStep); + + GraalCursorX = GraalPixelCursorX - GraalPixelGridX; + GraalCursorY = GraalPixelCursorY - GraalPixelGridY; + GraalCursorY = GraalGraphicDy - GraalCursorY; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDisplayCoordinates | +| | +\------------------------------------------------------------*/ + +void GraalDisplayCoordinates() + +{ + rdsbegin(); + + sprintf( GraalCursorBuffer, "%.2f", (float)GraalLambdaCursorX / (float)GRAAL_SCALE ); + GraalDisplayMessage( GRAAL_MESSAGE_X, GraalCursorBuffer ); + + sprintf( GraalCursorBuffer, "%.2f", (float)GraalLambdaCursorY / (float)GRAAL_SCALE ); + GraalDisplayMessage( GRAAL_MESSAGE_Y, GraalCursorBuffer ); + + sprintf( GraalCursorBuffer, "%.2f", + (float)( GraalLambdaCursorX - GraalLambdaCursorSaveX[0] ) / (float)GRAAL_SCALE ); + GraalDisplayMessage( GRAAL_MESSAGE_DX, GraalCursorBuffer ); + + sprintf( GraalCursorBuffer, "%.2f", + (float)( GraalLambdaCursorY - GraalLambdaCursorSaveY[0] ) / (float)GRAAL_SCALE ); + GraalDisplayMessage( GRAAL_MESSAGE_DY, GraalCursorBuffer ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPointCursor | +| | +\------------------------------------------------------------*/ + +void GraalPointCursor() + +{ + rdsbegin(); + + GraalUndisplayCursor(); + + GraalLambdaCursorSaveX[ GraalCursorIndex ] = GraalLambdaCursorX; + GraalLambdaCursorSaveY[ GraalCursorIndex ] = GraalLambdaCursorY; + + GraalCursorIndex = GraalCursorIndex + 1; + + GraalDisplayCursor(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalResetCursor | +| | +\------------------------------------------------------------*/ + +void GraalResetCursor() + +{ + rdsbegin(); + + GraalUndisplayCursor(); + + GraalCursorIndex = GraalCursorIndex - 1; + + GraalDisplayCursor(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalChangeCursor | +| | +\------------------------------------------------------------*/ + +void GraalChangeCursorType( ArrayX, ArrayY, Index, Type ) + + long *ArrayX; + long *ArrayY; + char Index; + char Type; +{ + rdsbegin(); + + GraalUndisplayCursor(); + + GraalCursorType = Type; + GraalCursorIndex = Index; + + if ( Index != 0 ) + { + GraalLambdaCursorSaveX[ 0 ] = ArrayX[0]; + GraalLambdaCursorSaveY[ 0 ] = ArrayY[0]; + GraalLambdaCursorSaveX[ 1 ] = ArrayX[1]; + GraalLambdaCursorSaveY[ 1 ] = ArrayY[1]; + } + + GraalDisplayCursor(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDrawCursor | +| | +\------------------------------------------------------------*/ + +void GraalDrawCursor() + +{ + long X1; + long Y1; + long X2; + long Y2; + long DeltaX; + long DeltaY; + long Swap; + char DrawLine; + + rdsbegin(); + + XDrawLine( GraalGraphicDisplay, + XtWindow( GraalGraphicWindow ), + GraalXorGC, + GraalCursorSaveX - GRAAL_CURSOR_SIZE, + GraalCursorSaveY - GRAAL_CURSOR_SIZE, + GraalCursorSaveX + GRAAL_CURSOR_SIZE, + GraalCursorSaveY + GRAAL_CURSOR_SIZE ); + + XDrawLine( GraalGraphicDisplay, + XtWindow( GraalGraphicWindow ), + GraalXorGC, + GraalCursorSaveX - GRAAL_CURSOR_SIZE, + GraalCursorSaveY + GRAAL_CURSOR_SIZE, + GraalCursorSaveX + GRAAL_CURSOR_SIZE, + GraalCursorSaveY - GRAAL_CURSOR_SIZE ); + + if ( GraalCursorIndex > 0 ) + { + X1 = (float)(GraalLambdaCursorSaveX[0]) * GraalLambdaGridStep; + Y1 = (float)(GraalLambdaCursorSaveY[0]) * GraalLambdaGridStep; + X1 = X1 - GraalPixelGridX; + Y1 = Y1 - GraalPixelGridY; + Y1 = GraalGraphicDy - Y1; + + if ( GraalCursorIndex == 1 ) + { + X2 = GraalCursorSaveX; + Y2 = GraalCursorSaveY; + } + else + { + X2 = (float)(GraalLambdaCursorSaveX[1]) * GraalLambdaGridStep; + Y2 = (float)(GraalLambdaCursorSaveY[1]) * GraalLambdaGridStep; + X2 = X2 - GraalPixelGridX; + Y2 = Y2 - GraalPixelGridY; + Y2 = GraalGraphicDy - Y2; + } + + switch( GraalCursorType ) + { + case GRAAL_INPUT_POINT : + + break; + + case GRAAL_INPUT_LINE : + + XDrawLine( GraalGraphicDisplay, + XtWindow( GraalGraphicWindow ), + GraalXorGC, + X1, Y1, X2, Y2 ); + break; + + case GRAAL_INPUT_HALF_BOX : + + XDrawLine( GraalGraphicDisplay, + XtWindow( GraalGraphicWindow ), + GraalXorGC, + X1, Y1, X2, Y1 ); + + XDrawLine( GraalGraphicDisplay, + XtWindow( GraalGraphicWindow ), + GraalXorGC, + X2, Y1, X2, Y2 ); + break; + + case GRAAL_INPUT_ORTHO : + case GRAAL_INPUT_SORTHO : + case GRAAL_INPUT_LSTRING : + + DeltaX = X2 - X1; if ( DeltaX < 0 ) DeltaX = - DeltaX; + DeltaY = Y2 - Y1; if ( DeltaY < 0 ) DeltaY = - DeltaY; + + if ( DeltaX > DeltaY ) + { + Y2 = Y1; + + if ( X1 > X2 ) { Swap = X1; X1 = X2; X2 = Swap; } + + if ( X1 < 0 ) X1 = 0; + if ( X2 > GraalGraphicDx ) X2 = GraalGraphicDx; + + if ( ( X1 < X2 ) && + ( Y1 >= 0 ) && + ( Y1 <= GraalGraphicDy ) ) + { + XDrawLine( GraalGraphicDisplay, + XtWindow( GraalGraphicWindow ), + GraalXorGC, + X1, Y1, X2, Y2 ); + } + } + else + { + X2 = X1; + + if ( Y1 > Y2 ) { Swap = Y1; Y1 = Y2; Y2 = Swap; } + + if ( Y1 < 0 ) Y1 = 0; + if ( Y2 > GraalGraphicDy ) Y2 = GraalGraphicDy; + + if ( ( Y1 < Y2 ) && + ( X1 >= 0 ) && + ( X1 <= GraalGraphicDx ) ) + { + XDrawLine( GraalGraphicDisplay, + XtWindow( GraalGraphicWindow ), + GraalXorGC, + X1, Y1, X2, Y2 ); + } + } + + break; + + case GRAAL_INPUT_BOX : + + if ( X1 > X2 ) { Swap = X1; X1 = X2; X2 = Swap; } + if ( Y1 > Y2 ) { Swap = Y1; Y1 = Y2; Y2 = Swap; } + + DrawLine = 0; + + if ( X1 < 0 ) + { + X1 = 0; DrawLine |= GRAAL_WEST_MASK; + } + + if ( X2 > GraalGraphicDx ) + { + X2 = GraalGraphicDx; DrawLine |= GRAAL_EAST_MASK; + } + + if ( Y1 < 0 ) + { + Y1 = 0; DrawLine |= GRAAL_SOUTH_MASK; + } + + if ( Y2 > GraalGraphicDy ) + { + Y2 = GraalGraphicDy; DrawLine |= GRAAL_NORTH_MASK; + } + + if ( DrawLine == 0 ) + { + XDrawRectangle( GraalGraphicDisplay, + XtWindow( GraalGraphicWindow ), + GraalXorGC, + X1, Y1, + X2 - X1, Y2 - Y1 ); + } + else + { + if ( ( DrawLine & GRAAL_WEST_MASK ) == 0 ) + { + XDrawLine( GraalGraphicDisplay, + XtWindow( GraalGraphicWindow ), + GraalXorGC, + X1, Y2, + X1, Y1 ); + } + + if ( ( DrawLine & GRAAL_EAST_MASK ) == 0 ) + { + XDrawLine( GraalGraphicDisplay, + XtWindow( GraalGraphicWindow ), + GraalXorGC, + X2, Y2, + X2, Y1 ); + } + + if ( ( DrawLine & GRAAL_SOUTH_MASK ) == 0 ) + { + XDrawLine( GraalGraphicDisplay, + XtWindow( GraalGraphicWindow ), + GraalXorGC, + X1, Y1, + X2, Y1 ); + } + + if ( ( DrawLine & GRAAL_NORTH_MASK ) == 0 ) + { + XDrawLine( GraalGraphicDisplay, + XtWindow( GraalGraphicWindow ), + GraalXorGC, + X1, Y2, + X2, Y2 ); + } + } + + break; + + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalUndisplayCursor | +| | +\------------------------------------------------------------*/ + +void GraalUndisplayCursor() + +{ + rdsbegin(); + + if ( GraalCursorInside == GRAAL_TRUE ) + { + if ( GraalCursorSaved == GRAAL_TRUE ) + { + GraalDrawCursor(); + } + + GraalCursorSaved = GRAAL_FALSE; + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDisplayCursor | +| | +\------------------------------------------------------------*/ + +void GraalDisplayCursor() + +{ + rdsbegin(); + + if ( GraalCursorInside == GRAAL_TRUE ) + { + if ( GraalCursorSaved == GRAAL_TRUE ) + { + GraalDrawCursor(); + + GraalCursorSaved = GRAAL_FALSE; + } + + if ( ( GraalCursorY >= 0 ) && + ( GraalCursorX <= GraalGraphicDx ) ) + { + GraalCursorSaveX = GraalCursorX; + GraalCursorSaveY = GraalCursorY; + + GraalDrawCursor(); + + GraalCursorSaved = GRAAL_TRUE; + } + } + + rdsend(); +} diff --git a/alliance/src/graal/src/GMX_cursor.h b/alliance/src/graal/src/GMX_cursor.h new file mode 100644 index 00000000..1f8861b6 --- /dev/null +++ b/alliance/src/graal/src/GMX_cursor.h @@ -0,0 +1,95 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Cursor.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_CURSOR +# define GRAAL_CURSOR + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define GRAAL_MAX_CURSOR_BUFFER 128 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern Position GraalCursorX; + extern Position GraalCursorY; + extern Position GraalCursorSaveX; + extern Position GraalCursorSaveY; + extern char GraalCursorSaved; + extern char GraalCursorInside; + extern long GraalLambdaCursorX; + extern long GraalLambdaCursorY; + + extern long GraalPixelCursorX; + extern long GraalPixelCursorY; + + extern long GraalPixelCursorX1; + extern long GraalPixelCursorY1; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalComputeCursor(); + extern void GraalChangeCursorType(); + extern void GraalPointCursor(); + extern void GraalResetCursor(); + extern void GraalDisplayCoordinates(); + +# endif diff --git a/alliance/src/graal/src/GMX_dialog.c b/alliance/src/graal/src/GMX_dialog.c new file mode 100644 index 00000000..37dda450 --- /dev/null +++ b/alliance/src/graal/src/GMX_dialog.c @@ -0,0 +1,107 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Dialog.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "GSB.h" +# include "GTB.h" +# include "GMF.h" +# include "GME.h" +# include "GMC.h" +# include "GMV.h" +# include "GMT.h" +# include "GMS.h" +# include "GMH.h" +# include "GMX.h" + +# include "GMX_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalInitializeDialog | +| | +\------------------------------------------------------------*/ + +void GraalInitializeDialog() + +{ + rdsbegin(); + + GraalBuildFileDialog(); + GraalBuildEditDialog(); + GraalBuildViewDialog(); + GraalBuildCreateDialog(); + GraalBuildToolsDialog(); + + rdsend(); +} diff --git a/alliance/src/graal/src/GMX_dialog.h b/alliance/src/graal/src/GMX_dialog.h new file mode 100644 index 00000000..54d6582a --- /dev/null +++ b/alliance/src/graal/src/GMX_dialog.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : dialog.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_DIALOG +# define GRAAL_DIALOG + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalInitializeDialog(); + +# endif diff --git a/alliance/src/graal/src/GMX_event.c b/alliance/src/graal/src/GMX_event.c new file mode 100644 index 00000000..ace03ab7 --- /dev/null +++ b/alliance/src/graal/src/GMX_event.c @@ -0,0 +1,1091 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Event.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "GSB.h" +# include "GRM.h" +# include "GMX.h" +# include "GTB.h" +# include "GMV.h" +# include "GMS.h" +# include "GME.h" +# include "GMH.h" +# include "GMX_motif.h" +# include "GMX_grid.h" +# include "GMX_cursor.h" +# include "GMX_event.h" +# include "GMX_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Translation | +| | +\------------------------------------------------------------*/ + + static String GraalEventTranslation = + + ": CallbackEvent( 0 )\n\ + : CallbackEvent( 1 )\n\ + : CallbackEvent( 2 )\n\ + : CallbackEvent( 3 )\n\ + : CallbackEvent( 4 )\n\ + osfUp: CallbackEvent( 5 )\n\ + osfDown: CallbackEvent( 6 )\n\ + osfLeft: CallbackEvent( 7 )\n\ + osfRight: CallbackEvent( 8 )\n\ + Z: CallbackEvent( 9 )\n\ + M: CallbackEvent( 10 )\n\ + F: CallbackEvent( 11 )\n\ + R: CallbackEvent( 12 )\n\ + U: CallbackEvent( 13 )\n\ + I: CallbackEvent( 14 )\n\ + C: CallbackEvent( 15 )\n\ + P: CallbackEvent( 16 )\n\ + ShiftTab: CallbackEvent( 17 )\n\ + Tab: CallbackEvent( 18 )"; + +/*------------------------------------------------------------\ +| | +| Event Count | +| | +\------------------------------------------------------------*/ + + static char GraalMaxEventEditTable[] = + + { + 2, /* GRAAL_EDIT_MEASURE */ + 2, /* GRAAL_CREATE_SEGMENT */ + 2, /* GRAAL_CREATE_SEGMENT_WIRE */ + 1, /* GRAAL_CREATE_VIA */ + 2, /* GRAAL_CREATE_TRANSISTOR */ + 2, /* GRAAL_CREATE_TRANSISTOR_WIRE */ + 1, /* GRAAL_CREATE_CONNECTOR */ + 1, /* GRAAL_CREATE_INSTANCE */ + 1, /* GRAAL_CREATE_REFERENCE */ + 2, /* GRAAL_CREATE_ABUTMENTBOX */ + 1, /* GRAAL_SELECT_POINT_IDENTIFY */ + 1, /* GRAAL_SELECT_POINT_COPY */ + 1, /* GRAAL_SELECT_POINT_MOVE */ + 1, /* GRAAL_SELECT_POINT_DELETE */ + 1, /* GRAAL_SELECT_POINT_STRETCH */ + 1, /* GRAAL_SELECT_POINT_MODIFY */ + 2, /* GRAAL_SELECT_WINDOW_IDENTIFY */ + 2, /* GRAAL_SELECT_WINDOW_COPY */ + 2, /* GRAAL_SELECT_WINDOW_MOVE */ + 2, /* GRAAL_SELECT_WINDOW_DELETE */ + 2, /* GRAAL_SELECT_WINDOW_STRETCH */ + 2, /* GRAAL_SELECT_WINDOW_MODIFY */ + 2, /* GRAAL_EDIT_COPY_POINT */ + 2, /* GRAAL_EDIT_COPY_WINDOW */ + 2, /* GRAAL_EDIT_MOVE_POINT */ + 2, /* GRAAL_EDIT_MOVE_WINDOW */ + 2, /* GRAAL_EDIT_STRETCH_POINT */ + 2, /* GRAAL_EDIT_STRETCH_WINDOW */ + 1, /* GRAAL_TOOLS_EQUI */ + 2, /* GRAAL_TOOLS_FLATTEN */ + 2, /* GRAAL_TOOLS_UNFLATTEN */ + 2, /* GRAAL_TOOLS_PEEK */ + 2, /* GRAAL_TOOLS_DRUC */ + 2, /* GRAAL_TOOLS_REAL_FLATTEN */ + 1, /* GRAAL_TOOLS_HIERARCHY_DOWN */ + 1, /* GRAAL_TOOLS_HIERARCHY_SHOW */ + 2 /* GRAAL_CREATE_BIGVIA */ + }; + + static char GraalInputEventEditTable[] = + + { + GRAAL_INPUT_HALF_BOX, /* GRAAL_EDIT_MEASURE */ + GRAAL_INPUT_ORTHO, /* GRAAL_CREATE_SEGMENT */ + GRAAL_INPUT_LSTRING, /* GRAAL_CREATE_SEGMENT_WIRE */ + GRAAL_INPUT_POINT, /* GRAAL_CREATE_VIA */ + GRAAL_INPUT_ORTHO, /* GRAAL_CREATE_TRANSISTOR */ + GRAAL_INPUT_LSTRING, /* GRAAL_CREATE_TRANSISTOR_WIRE */ + GRAAL_INPUT_POINT, /* GRAAL_CREATE_CONNECTOR */ + GRAAL_INPUT_POINT, /* GRAAL_CREATE_INSTANCE */ + GRAAL_INPUT_POINT, /* GRAAL_CREATE_REFERENCE */ + GRAAL_INPUT_BOX, /* GRAAL_CREATE_ABUTMENTBOX */ + GRAAL_INPUT_POINT, /* GRAAL_SELECT_POINT_IDENTIFY */ + GRAAL_INPUT_POINT, /* GRAAL_SELECT_POINT_COPY */ + GRAAL_INPUT_POINT, /* GRAAL_SELECT_POINT_MOVE */ + GRAAL_INPUT_POINT, /* GRAAL_SELECT_POINT_DELETE */ + GRAAL_INPUT_POINT, /* GRAAL_SELECT_POINT_STRETCH */ + GRAAL_INPUT_POINT, /* GRAAL_SELECT_POINT_MODIFY */ + GRAAL_INPUT_BOX, /* GRAAL_SELECT_WINDOW_IDENTIFY */ + GRAAL_INPUT_BOX, /* GRAAL_SELECT_WINDOW_COPY */ + GRAAL_INPUT_BOX, /* GRAAL_SELECT_WINDOW_MOVE */ + GRAAL_INPUT_BOX, /* GRAAL_SELECT_WINDOW_DELETE */ + GRAAL_INPUT_BOX, /* GRAAL_SELECT_WINDOW_STRETCH */ + GRAAL_INPUT_BOX, /* GRAAL_SELECT_WINDOW_MODIFY */ + GRAAL_INPUT_LINE, /* GRAAL_EDIT_COPY_POINT */ + GRAAL_INPUT_LINE, /* GRAAL_EDIT_COPY_WINDOW */ + GRAAL_INPUT_LINE, /* GRAAL_EDIT_MOVE_POINT */ + GRAAL_INPUT_LINE, /* GRAAL_EDIT_MOVE_WINDOW */ + GRAAL_INPUT_ORTHO, /* GRAAL_EDIT_STRETCH_POINT */ + GRAAL_INPUT_ORTHO, /* GRAAL_EDIT_STRETCH_WINDOW */ + GRAAL_INPUT_POINT, /* GRAAL_TOOLS_EQUI */ + GRAAL_INPUT_BOX, /* GRAAL_TOOLS_FLATTEN */ + GRAAL_INPUT_BOX, /* GRAAL_TOOLS_UNFLATTEN */ + GRAAL_INPUT_BOX, /* GRAAL_TOOLS_PEEK */ + GRAAL_INPUT_BOX, /* GRAAL_TOOLS_DRUC */ + GRAAL_INPUT_BOX, /* GRAAL_TOOLS_REAL_FLATTEN */ + GRAAL_INPUT_POINT, /* GRAAL_TOOLS_HIERARCHY_DOWN */ + GRAAL_INPUT_POINT, /* GRAAL_TOOLS_HIERARCHY_SHOW */ + GRAAL_INPUT_BOX /* GRAAL_CREATE_BIGVIA */ + }; + + static char GraalMaxEventZoomTable[] = + + { + 1, /* GRAAL_ZOOM_CENTER */ + 2, /* GRAAL_ZOOM_IN */ + 2 /* GRAAL_ZOOM_PAN */ + }; + + static char GraalInputEventZoomTable[] = + + { + GRAAL_INPUT_POINT, /* GRAAL_ZOOM_CENTER */ + GRAAL_INPUT_BOX, /* GRAAL_ZOOM_IN */ + GRAAL_INPUT_LINE /* GRAAL_ZOOM_PAN */ + }; + +/*------------------------------------------------------------\ +| | +| Translation | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Expose Edit Zoom | +| | +\------------------------------------------------------------*/ + + static long GraalLambdaEventZoomX[ 2 ] = { 0, 0 }; + static long GraalLambdaEventZoomY[ 2 ] = { 0, 0 }; + static char GraalMaxEventZoom = 0; + char GraalCountEventZoom = 0; + + static long GraalLambdaEventEditX[ 2 ] = { 0, 0 }; + static long GraalLambdaEventEditY[ 2 ] = { 0, 0 }; + static char GraalMaxEventEdit = 2; + char GraalCountEventEdit = 0; + + static char GraalFirstExpose = GRAAL_TRUE; + +/*------------------------------------------------------------\ +| | +| Input | +| | +\------------------------------------------------------------*/ + + static char GraalInputMode = GRAAL_INPUT_HALF_BOX; + static char GraalSaveInputMode = GRAAL_INPUT_HALF_BOX; + static char GraalEditMode = GRAAL_EDIT_MEASURE; + static char GraalSaveEditMode = GRAAL_EDIT_MEASURE; + +/*------------------------------------------------------------\ +| | +| Edit Message | +| | +\------------------------------------------------------------*/ + + static void (*GraalPromptMessage)() = GraalPromptEditMeasure; + static void (*GraalSavePromptMessage)() = GraalPromptEditMeasure; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalChangeEditMode | +| | +\------------------------------------------------------------*/ + +void GraalChangeEditMode( EditMode , PromptMessage ) + + char EditMode; + void (*PromptMessage)(); +{ + rdsbegin(); + + if ( EditMode & GRAAL_ZOOM_MARK ) + { + EditMode = EditMode & ~GRAAL_ZOOM_MARK; + + GraalCountEventZoom = 0; + GraalMaxEventZoom = GraalMaxEventZoomTable[ EditMode ]; + + if ( ! ( GraalEditMode & GRAAL_ZOOM_MARK ) ) + { + GraalSaveEditMode = GraalEditMode; + GraalSaveInputMode = GraalInputMode; + GraalSavePromptMessage = GraalPromptMessage; + } + + GraalInputMode = GraalInputEventZoomTable[ EditMode ]; + GraalPromptMessage = PromptMessage; + GraalEditMode = EditMode | GRAAL_ZOOM_MARK; + + GraalChangeCursorType( NULL, NULL, 0, GraalInputMode ); + } + else + { + if ( GraalEditMode & GRAAL_ZOOM_MARK ) + { + GraalSaveEditMode = EditMode; + GraalSaveInputMode = GraalInputEventEditTable[ EditMode ]; + GraalSavePromptMessage = PromptMessage; + GraalCountEventEdit = 0; + GraalMaxEventEdit = GraalMaxEventEditTable[ EditMode ]; + } + else + { + if ( GraalEditMode != EditMode ) + { + GraalCountEventEdit = 0; + GraalMaxEventEdit = GraalMaxEventEditTable[ EditMode ]; + GraalEditMode = EditMode; + GraalInputMode = GraalInputEventEditTable[ EditMode ]; + GraalPromptMessage = PromptMessage; + + GraalChangeCursorType( NULL, NULL, 0, GraalInputMode ); + } + } + + GraalEditUnselectAll(); + } + + GraalPromptMessage(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalContinueEditMode | +| | +\------------------------------------------------------------*/ + +void GraalContinueEditMode( EditMode , PromptMessage, CountEvent ) + + char EditMode; + void (*PromptMessage)(); + char CountEvent; +{ + rdsbegin(); + + if ( GraalEditMode & GRAAL_ZOOM_MARK ) + { + GraalSaveEditMode = EditMode; + GraalSaveInputMode = GraalInputEventEditTable[ EditMode ]; + GraalSavePromptMessage = PromptMessage; + GraalCountEventEdit = CountEvent; + GraalMaxEventEdit = GraalMaxEventEditTable[ EditMode ]; + } + else + { + GraalCountEventEdit = CountEvent; + GraalMaxEventEdit = GraalMaxEventEditTable[ EditMode ]; + GraalEditMode = EditMode; + GraalInputMode = GraalInputEventEditTable[ EditMode ]; + GraalPromptMessage = PromptMessage; + + GraalChangeCursorType( GraalLambdaEventEditX, + GraalLambdaEventEditY, + GraalCountEventEdit, + GraalInputMode ); + + } + + GraalPromptMessage(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalTreatEventZoom | +| | +\------------------------------------------------------------*/ + +void GraalTreatEventZoom() + +{ + rdsbegin(); + + switch ( GraalEditMode ) + { + case GRAAL_ZOOM_CENTER : + + GraalZoomCenter( GraalLambdaEventZoomX[ 0 ], + GraalLambdaEventZoomY[ 0 ] ); + break; + + case GRAAL_ZOOM_IN : + + GraalZoomIn( GraalLambdaEventZoomX[ 0 ], + GraalLambdaEventZoomY[ 0 ], + GraalLambdaEventZoomX[ 1 ], + GraalLambdaEventZoomY[ 1 ] ); + break; + + case GRAAL_ZOOM_PAN : + + GraalZoomPan( GraalLambdaEventZoomX[ 0 ], + GraalLambdaEventZoomY[ 0 ], + GraalLambdaEventZoomX[ 1 ], + GraalLambdaEventZoomY[ 1 ] ); + break; + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalTreatEventEdit | +| | +\------------------------------------------------------------*/ + +void GraalTreatEventEdit() + +{ + long DeltaX; + long DeltaY; + long X1; + long X2; + long Y1; + long Y2; + + rdsbegin(); + + X1 = GraalLambdaEventEditX[0]; + X2 = GraalLambdaEventEditX[1]; + Y1 = GraalLambdaEventEditY[0]; + Y2 = GraalLambdaEventEditY[1]; + + if ( ( GraalInputMode == GRAAL_INPUT_LSTRING ) || + ( GraalInputMode == GRAAL_INPUT_ORTHO ) || + ( GraalInputMode == GRAAL_INPUT_SORTHO ) ) + { + DeltaX = X1 - X2; + DeltaY = Y1 - Y2; + + if ( DeltaX < 0 ) DeltaX = - DeltaX; + if ( DeltaY < 0 ) DeltaY = - DeltaY; + + if ( DeltaX > DeltaY ) + { + Y2 = Y1; + + GraalLambdaEventEditX[0] = X2; + GraalLambdaEventEditY[0] = Y2; + } + else + { + X2 = X1; + + GraalLambdaEventEditX[0] = X2; + GraalLambdaEventEditY[0] = Y2; + } + } + + if ( GraalInputMode == GRAAL_INPUT_LSTRING ) + { + GraalChangeCursorType( GraalLambdaEventEditX, + GraalLambdaEventEditY, + 1, GraalInputMode ); + + GraalCountEventEdit = 1; + } + else + { + GraalChangeCursorType( NULL, NULL, 0, + GraalInputMode ); + + GraalCountEventEdit = 0; + } + + switch ( GraalEditMode ) + { + case GRAAL_EDIT_MEASURE : + + break; + + case GRAAL_CREATE_SEGMENT : + case GRAAL_CREATE_SEGMENT_WIRE : + + GraalCreateSegmentMbk( X1, Y1, X2, Y2 ); + + break; + + case GRAAL_CREATE_VIA : + + GraalCreateViaMbk( X1, Y1 ); + + break; + + case GRAAL_CREATE_BIGVIA : + + GraalCreateBigViaMbk( X1, Y1, X2, Y2 ); + + break; + + case GRAAL_CREATE_TRANSISTOR : + case GRAAL_CREATE_TRANSISTOR_WIRE : + + GraalCreateTransistorMbk( X1, Y1, X2, Y2 ); + + break; + + case GRAAL_CREATE_CONNECTOR : + + GraalCreateConnectorMbk( X1, Y1 ); + + break; + + case GRAAL_CREATE_REFERENCE : + + GraalCreateReferenceMbk( X1, Y1 ); + + break; + + case GRAAL_CREATE_INSTANCE : + + GraalCreateInstanceMbk( X1, Y1 ); + + break; + + case GRAAL_CREATE_ABUTMENTBOX : + + GraalCreateAbutmentBoxMbk( X1, Y1, X2, Y2 ); + + break; + + case GRAAL_SELECT_POINT_IDENTIFY : + + GraalEditSelectPoint( X1, Y1 ); + GraalEditIdentify(); + + break; + + case GRAAL_SELECT_WINDOW_IDENTIFY : + + GraalEditSelectFence( X1, Y1, X2, Y2 ); + GraalEditIdentify(); + + break; + + case GRAAL_SELECT_POINT_COPY : + + GraalEditSelectPointCopy( X1, Y1 ); + + break; + + case GRAAL_SELECT_WINDOW_COPY : + + GraalEditSelectWindowCopy( X1, Y1, X2, Y2 ); + + break; + + case GRAAL_EDIT_COPY_POINT : + + GraalEditCopy( X1, Y1, X2, Y2, 0 ); + + break; + + case GRAAL_EDIT_COPY_WINDOW : + + GraalEditCopy( X1, Y1, X2, Y2, 1 ); + + break; + + case GRAAL_SELECT_POINT_MOVE : + + GraalEditSelectPointMove( X1, Y1 ); + + break; + + case GRAAL_SELECT_WINDOW_MOVE : + + GraalEditSelectWindowMove( X1, Y1, X2, Y2 ); + + break; + + case GRAAL_EDIT_MOVE_POINT : + + GraalEditMove( X1, Y1, X2, Y2, 0 ); + + break; + + case GRAAL_EDIT_MOVE_WINDOW : + + GraalEditMove( X1, Y1, X2, Y2, 1 ); + + break; + + case GRAAL_SELECT_POINT_DELETE : + + GraalEditSelectPointDelete( X1, Y1 ); + + break; + + case GRAAL_SELECT_WINDOW_DELETE : + + GraalEditSelectWindowDelete( X1, Y1, X2, Y2 ); + + break; + + case GRAAL_SELECT_POINT_STRETCH : + + GraalEditSelectPointStretch( X1, Y1 ); + + break; + + case GRAAL_SELECT_WINDOW_STRETCH : + + GraalEditSelectWindowStretch( X1, Y1, X2, Y2 ); + + break; + + case GRAAL_EDIT_STRETCH_POINT : + + GraalEditStretch( X1, Y1, X2, Y2, 0 ); + + break; + + case GRAAL_EDIT_STRETCH_WINDOW : + + GraalEditStretch( X1, Y1, X2, Y2, 1 ); + + break; + + case GRAAL_SELECT_POINT_MODIFY : + + GraalEditSelectPointModify( X1, Y1 ); + + break; + + case GRAAL_SELECT_WINDOW_MODIFY : + + GraalEditSelectWindowModify( X1, Y1, X2, Y2 ); + + break; + + case GRAAL_TOOLS_EQUI : + + GraalToolsSelectEqui( X1, Y1 ); + + break; + + case GRAAL_TOOLS_PEEK : + + GraalToolsPeek( X1, Y1, X2, Y2 ); + + break; + + case GRAAL_TOOLS_FLATTEN : + + GraalToolsSelectFlatten( X1, Y1, X2, Y2 ); + + break; + + case GRAAL_TOOLS_UNFLATTEN : + + GraalToolsSelectUnflatten( X1, Y1, X2, Y2 ); + + break; + + case GRAAL_TOOLS_DRUC : + + GraalToolsDruc( X1, Y1, X2, Y2 ); + + break; + + case GRAAL_TOOLS_REAL_FLATTEN : + + GraalToolsSelectRealFlatten( X1, Y1, X2, Y2 ); + + break; + + case GRAAL_TOOLS_HIERARCHY_DOWN : + + GraalToolsSelectHierarchyDown( X1, Y1 ); + + break; + + case GRAAL_TOOLS_HIERARCHY_SHOW : + + GraalEditSelectPoint( X1, Y1 ); + GraalToolsHierarchyShow( X1, Y1 ); + + break; + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEvent | +| | +\------------------------------------------------------------*/ + +void CallbackEvent ( MyWidget, Event, Args, Argc ) + + Widget MyWidget; + XButtonEvent *Event; + String *Args; + int *Argc; +{ + Display *EventDisplay; + char MouseEvent; + int FlagUp; + Position OldLambdaCursorX; + Position OldLambdaCursorY; + + rdsbegin(); + + EventDisplay = Event->display; + + MouseEvent = atoi( Args[ 0 ] ); + + if ( MouseEvent == GRAAL_LEAVE ) + { + GraalUndisplayCursor(); + GraalCursorInside = GRAAL_FALSE; + } + else + { + OldLambdaCursorX = GraalLambdaCursorX; + OldLambdaCursorY = GraalLambdaCursorY; + + GraalComputeCursor( Event->x, Event->y ); + + switch ( MouseEvent ) + { + case GRAAL_B1DN : + + if ( GraalEditMode & GRAAL_ZOOM_MARK ) + { + if ( GraalCountEventZoom < GraalMaxEventZoom ) + { + GraalLambdaEventZoomX[ GraalCountEventZoom ] = GraalLambdaCursorX; + GraalLambdaEventZoomY[ GraalCountEventZoom ] = GraalLambdaCursorY; + + GraalCountEventZoom = GraalCountEventZoom + 1; + + GraalPointCursor(); + + if ( GraalCountEventZoom == GraalMaxEventZoom ) + { + GraalChangeCursorType( NULL, NULL, 0, GraalInputMode ); + + GraalTreatEventZoom(); + + GraalInputMode = GraalSaveInputMode; + GraalEditMode = GraalSaveEditMode; + GraalPromptMessage = GraalSavePromptMessage; + GraalSaveEditMode = GRAAL_EDIT_MEASURE; + GraalSaveInputMode = GRAAL_INPUT_HALF_BOX; + GraalCountEventZoom = 0; + GraalMaxEventZoom = 0; + + GraalChangeCursorType( GraalLambdaEventEditX, + GraalLambdaEventEditY, + GraalCountEventEdit, + GraalInputMode ); + + GraalComputeCursor( Event->x, Event->y ); + GraalDisplayCursor(); + } + } + } + else + { + if ( GraalCountEventEdit < GraalMaxEventEdit ) + { + GraalLambdaEventEditX[ GraalCountEventEdit ] = GraalLambdaCursorX; + GraalLambdaEventEditY[ GraalCountEventEdit ] = GraalLambdaCursorY; + + GraalCountEventEdit = GraalCountEventEdit + 1; + + GraalPointCursor(); + + if ( GraalCountEventEdit == GraalMaxEventEdit ) + { + GraalTreatEventEdit(); + + GraalDisplayCursor(); + } + } + } + + GraalPromptMessage(); + + break; + + case GRAAL_B3DN : + + if ( GraalEditMode & GRAAL_ZOOM_MARK ) + { + if ( GraalCountEventZoom != 0 ) + { + GraalCountEventZoom = GraalCountEventZoom - 1; + + GraalResetCursor(); + } + else + { + GraalChangeCursorType( GraalLambdaEventEditX, + GraalLambdaEventEditY, + GraalCountEventEdit, + GraalSaveInputMode ); + + GraalInputMode = GraalSaveInputMode; + GraalEditMode = GraalSaveEditMode; + GraalPromptMessage = GraalSavePromptMessage; + GraalSaveEditMode = GRAAL_EDIT_MEASURE; + GraalSaveInputMode = GRAAL_INPUT_HALF_BOX; + GraalSavePromptMessage = GraalPromptEditMeasure; + GraalCountEventZoom = 0; + GraalMaxEventZoom = 0; + } + } + else + { + if ( GraalCountEventEdit != 0 ) + { + GraalCountEventEdit = GraalCountEventEdit - 1; + + GraalResetCursor(); + } + else + { + GraalEditUnselectAll(); + + GraalChangeCursorType( NULL, NULL, 0, + GRAAL_INPUT_HALF_BOX ); + + GraalInputMode = GRAAL_INPUT_HALF_BOX; + GraalEditMode = GRAAL_EDIT_MEASURE; + GraalPromptMessage = GraalPromptEditMeasure; + GraalCountEventEdit = 0; + GraalMaxEventEdit = 2; + } + } + + GraalPromptMessage(); + + break; + + case GRAAL_MOTION : + + break; + + case GRAAL_ENTER : + + GraalCursorInside = GRAAL_TRUE; + GraalDisplayCursor(); + + break; + + case GRAAL_KEY_UP : GraalZoomUp(); + + break; + + case GRAAL_KEY_DN : GraalZoomDown(); + + break; + + case GRAAL_KEY_LEFT : GraalZoomLeft(); + + break; + + case GRAAL_KEY_RIGHT : GraalZoomRight(); + + break; + + case GRAAL_KEY_MORE : GraalZoomMore(); + + break; + + case GRAAL_KEY_LESS : GraalZoomLess(); + + break; + + case GRAAL_KEY_FIT : GraalZoomFit(); + + break; + + case GRAAL_KEY_REFRESH : GraalZoomRefresh(); + + break; + + case GRAAL_KEY_UNZOOM : GraalZoomUndo(); + + break; + + case GRAAL_KEY_ZOOM_IN : + + GraalChangeEditMode( GRAAL_ZOOM_IN, GraalPromptZoomIn ); + + break; + + case GRAAL_KEY_CENTER : + + GraalChangeEditMode( GRAAL_ZOOM_CENTER, GraalPromptZoomCenter ); + + break; + + case GRAAL_KEY_PAN : + + GraalChangeEditMode( GRAAL_ZOOM_PAN, GraalPromptZoomPan ); + + break; + + case GRAAL_KEY_UP_LAYER : + case GRAAL_KEY_DN_LAYER : + + if ( ! ( GraalEditMode & GRAAL_ZOOM_MARK ) ) + { + FlagUp = ( MouseEvent == GRAAL_KEY_UP_LAYER ); + + switch ( GraalEditMode ) + { + case GRAAL_CREATE_SEGMENT : + case GRAAL_CREATE_SEGMENT_WIRE : GraalChangeSegmentLayer( FlagUp ); + break; + + case GRAAL_CREATE_VIA : GraalChangeViaType( FlagUp ); + break; + + case GRAAL_CREATE_BIGVIA : GraalChangeBigViaType( FlagUp ); + break; + + case GRAAL_CREATE_TRANSISTOR : + case GRAAL_CREATE_TRANSISTOR_WIRE : GraalChangeTransistorType( FlagUp ); + break; + + case GRAAL_CREATE_CONNECTOR : GraalChangeConnectorLayer( FlagUp ); + break; + + case GRAAL_CREATE_REFERENCE : GraalChangeReferenceType( FlagUp ); + break; + } + + GraalPromptMessage(); + } + + break; + } + + if ( MouseEvent >= GRAAL_KEY_UP ) + { + GraalComputeCursor( Event->x, Event->y ); + GraalDisplayCursor(); + } + + if ( ( OldLambdaCursorX != GraalLambdaCursorX ) || + ( OldLambdaCursorY != GraalLambdaCursorY ) ) + { + GraalDisplayCoordinates(); + GraalDisplayCursor(); + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackResize | +| | +\------------------------------------------------------------*/ + +void CallbackResize( MyWidget, ClientData, CallData ) + + Widget MyWidget; + XtPointer ClientData; + XmDrawingAreaCallbackStruct *CallData; +{ + if ( GraalFirstExpose == GRAAL_FALSE ) + { + rdsbegin(); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + GraalUndisplayCursor(); + + GraalResizeGraphicWindow(); + GraalRefreshGraphicWindow( 0, 0, + GraalGraphicDx, GraalGraphicDy ); + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_NORMAL_CURSOR ); + GraalDisplayCursor(); + + rdsend(); + } +} + +/*------------------------------------------------------------\ +| | +| CallbackExpose | +| | +\------------------------------------------------------------*/ + +void CallbackExpose( MyWidget, ClientData, CallData ) + + Widget MyWidget; + XtPointer ClientData; + XmDrawingAreaCallbackStruct *CallData; +{ + XExposeEvent *ExposeEvent; + + ExposeEvent = (XExposeEvent *)CallData->event; + + rdsbegin(); + + if ( GraalFirstExpose == GRAAL_TRUE ) + { + GraalFirstExpose = GRAAL_FALSE; + + GraalInitializeGraphicWindow(); + GraalUndisplayCursor(); + + GraalLoadConfig( GRAAL_FALSE ); + + if ( GraalFigureMbk != (phfig_list *)NULL ) + { + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_WATCH_CURSOR ); + + GraalAddFigure(); + GraalChangeTopLevelTitle( GraalFigureMbk->NAME ); + GraalInitializeZoom(); + GraalDisplayToolsMessage(); + GraalDisplayFigure( 0, 0, GraalGraphicDx, GraalGraphicDy ); + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_NORMAL_CURSOR ); + } + else + { + GraalChangeTopLevelTitle( (char *)NULL ); + } + + GraalRefreshGraphicWindow( 0, 0, GraalGraphicDx, GraalGraphicDy ); + GraalDisplayCursor(); + + GraalEnterPresentPanel(); + } + else + { + GraalUndisplayCursor(); + GraalRefreshGraphicWindow( ExposeEvent->x, ExposeEvent->y, + ExposeEvent->width, ExposeEvent->height ); + GraalDisplayCursor(); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalInitializeEvent | +| | +\------------------------------------------------------------*/ + +void GraalInitializeEvent() + +{ + XtActionsRec NewActions; + + rdsbegin(); + + XtVaSetValues( GraalGraphicWindow, + XmNtranslations, + XtParseTranslationTable( GraalEventTranslation ), + NULL + ); + + NewActions.string = "CallbackEvent"; + NewActions.proc = CallbackEvent; + + XtAppAddActions( GraalApplication, &NewActions, 1 ); + + XtAddCallback( GraalGraphicWindow, + XmNresizeCallback, + CallbackResize, NULL ); + + XtAddCallback( GraalGraphicWindow, + XmNexposeCallback, + CallbackExpose, NULL ); + + rdsend(); +} diff --git a/alliance/src/graal/src/GMX_event.h b/alliance/src/graal/src/GMX_event.h new file mode 100644 index 00000000..a51ce9ad --- /dev/null +++ b/alliance/src/graal/src/GMX_event.h @@ -0,0 +1,101 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Event.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_EVENT +# define GRAAL_EVENT + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define GRAAL_B1DN 0 +# define GRAAL_B3DN 1 +# define GRAAL_MOTION 2 +# define GRAAL_ENTER 3 +# define GRAAL_LEAVE 4 + +# define GRAAL_KEY_UP 5 +# define GRAAL_KEY_DN 6 +# define GRAAL_KEY_LEFT 7 +# define GRAAL_KEY_RIGHT 8 + +# define GRAAL_KEY_MORE 9 +# define GRAAL_KEY_LESS 10 + +# define GRAAL_KEY_FIT 11 +# define GRAAL_KEY_REFRESH 12 +# define GRAAL_KEY_UNZOOM 13 + +# define GRAAL_KEY_ZOOM_IN 14 +# define GRAAL_KEY_CENTER 15 +# define GRAAL_KEY_PAN 16 + +# define GRAAL_KEY_DN_LAYER 17 +# define GRAAL_KEY_UP_LAYER 18 + +# define GRAAL_MAX_EVENT_BUFFER 128 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalInitializeEvent(); + extern void GraalDisplayEditMeasure(); + +# endif diff --git a/alliance/src/graal/src/GMX_graphic.c b/alliance/src/graal/src/GMX_graphic.c new file mode 100644 index 00000000..d4726e3b --- /dev/null +++ b/alliance/src/graal/src/GMX_graphic.c @@ -0,0 +1,317 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Graphic.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "GSB.h" +# include "GTB.h" +# include "GMX.h" + +# include "GMX_graphic.h" +# include "GMX_view.h" +# include "GMX_grid.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + Widget GraalGraphicFrame; + Widget GraalGraphicWindow; + Display *GraalGraphicDisplay = (Display *)NULL; + + Dimension GraalGraphicDx = 0; + Dimension GraalGraphicDy = 0; + Dimension GraalOldGraphicDx = 0; + Dimension GraalOldGraphicDy = 0; + + Pixmap GraalGraphicPixmap = (Pixmap)NULL; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalInitializeGraphicWindow | +| | +\------------------------------------------------------------*/ + +void GraalInitializeGraphicWindow() + +{ + rdsbegin(); + + XtVaGetValues( GraalGraphicWindow, + XmNwidth, &GraalGraphicDx, + XmNheight, &GraalGraphicDy, + NULL + ); + + GraalOldGraphicDx = GraalGraphicDx; + GraalOldGraphicDy = GraalGraphicDy; + + GraalGraphicPixmap = + + XCreatePixmap ( GraalGraphicDisplay, + RootWindowOfScreen( XtScreen ( GraalGraphicWindow ) ), + GraalGraphicDx, + GraalGraphicDy, + DefaultDepthOfScreen ( XtScreen ( GraalGraphicWindow ) ) + ); + + GraalClearGraphicWindow( 0, 0, GraalGraphicDx, GraalGraphicDy ); + GraalInitializeLambdaGrid(); + + GraalSetMouseCursor( GraalGraphicWindow, GRAAL_NORMAL_CURSOR ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalClearGraphicWindow | +| | +\------------------------------------------------------------*/ + +void GraalClearGraphicWindow( GraphicX, GraphicY, GraphicDx, GraphicDy ) + + long GraphicX; + long GraphicY; + long GraphicDx; + long GraphicDy; +{ + XFillRectangle( GraalGraphicDisplay, + GraalGraphicPixmap, + GraalBackgroundGC, + GraphicX, GraphicY, + GraphicDx, + GraphicDy ); +} + +/*------------------------------------------------------------\ +| | +| GraalRefreshGraphicWindow | +| | +\------------------------------------------------------------*/ + +void GraalRefreshGraphicWindow( GraphicX, GraphicY, GraphicDx, GraphicDy ) + + Dimension GraphicX; + Dimension GraphicY; + Dimension GraphicDx; + Dimension GraphicDy; +{ + rdsbegin(); + + GraalUndisplayCursor(); + + XCopyArea( GraalGraphicDisplay, + GraalGraphicPixmap, + XtWindow ( GraalGraphicWindow ), + GraalBackgroundGC, + GraphicX, GraphicY, + GraphicDx, GraphicDy, + GraphicX, GraphicY + ); + + GraalDisplayLambdaGrid( GraphicX, GraphicY, + GraphicX + GraphicDx, + GraphicY + GraphicDy ); + GraalUndisplayCursor(); + + rdsend(); +} + + +/*------------------------------------------------------------\ +| | +| GraalResizeGraphicWindow | +| | +\------------------------------------------------------------*/ + +void GraalResizeGraphicWindow() + +{ + Pixmap OldPixmap; + Dimension SourceY; + Dimension TargetY; + Dimension TargetDx; + Dimension TargetDy; + + rdsbegin(); + + GraalOldGraphicDx = GraalGraphicDx; + GraalOldGraphicDy = GraalGraphicDy; + + XtVaGetValues( GraalGraphicWindow, + XmNwidth, &GraalGraphicDx, + XmNheight, &GraalGraphicDy, + NULL + ); + + if ( ( GraalOldGraphicDx != GraalGraphicDx ) || + ( GraalOldGraphicDy != GraalGraphicDy ) ) + { + OldPixmap = GraalGraphicPixmap; + + GraalGraphicPixmap = + + XCreatePixmap ( GraalGraphicDisplay, + RootWindowOfScreen( XtScreen ( GraalGraphicWindow ) ), + GraalGraphicDx, + GraalGraphicDy, + DefaultDepthOfScreen ( XtScreen ( GraalGraphicWindow ) ) + ); + + GraalClearGraphicWindow( 0, 0, GraalGraphicDx, GraalGraphicDy ); + + GraalResizeLambdaGrid(); + + if ( GraalOldGraphicDx < GraalGraphicDx ) + { + TargetDx = GraalOldGraphicDx; + + GraalDisplayFigure( TargetDx, 0, + GraalGraphicDx, GraalGraphicDy ); + } + else + { + TargetDx = GraalGraphicDx; + } + + if ( GraalOldGraphicDy < GraalGraphicDy ) + { + SourceY = 0; + TargetDy = GraalOldGraphicDy; + TargetY = GraalGraphicDy - GraalOldGraphicDy; + + GraalDisplayFigure( 0, TargetDy, + TargetDx, GraalGraphicDy ); + } + else + { + TargetDy = GraalGraphicDy; + TargetY = 0; + SourceY = GraalOldGraphicDy - GraalGraphicDy; + } + + XCopyArea( GraalGraphicDisplay, + OldPixmap, + GraalGraphicPixmap, + GraalBackgroundGC, + 0, SourceY, + TargetDx, TargetDy, + 0, TargetY + ); + + XFreePixmap( GraalGraphicDisplay, OldPixmap ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalInitializeGraphic | +| | +\------------------------------------------------------------*/ + +void GraalInitializeGraphic() + +{ + rdsbegin(); + + GraalGraphicFrame = XtVaCreateManagedWidget( "GraalGraphicFrame", + xmFrameWidgetClass, + GraalMainForm, + XmNshadowType , XmSHADOW_ETCHED_IN, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 1, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 191, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 1, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 199, + NULL ); + + GraalGraphicWindow = XtVaCreateManagedWidget( + "GraalGraphicWindow", + xmDrawingAreaWidgetClass, + GraalGraphicFrame, + XmNtopAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNbackground, 1, + XmNforeground, 0, + NULL + ); + + GraalGraphicDisplay = XtDisplay( GraalGraphicWindow ); + + rdsend(); +} diff --git a/alliance/src/graal/src/GMX_graphic.h b/alliance/src/graal/src/GMX_graphic.h new file mode 100644 index 00000000..8540a0f7 --- /dev/null +++ b/alliance/src/graal/src/GMX_graphic.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Graphic.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_GRAPHIC +# define GRAAL_GRAPHIC + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalInitializeGraphic(); + +# endif diff --git a/alliance/src/graal/src/GMX_grid.c b/alliance/src/graal/src/GMX_grid.c new file mode 100644 index 00000000..fffc4ca6 --- /dev/null +++ b/alliance/src/graal/src/GMX_grid.c @@ -0,0 +1,313 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Grid.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "GSB.h" +# include "GRM.h" +# include "GMX.h" + +# include "GMX_grid.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Lambda Grid | +| | +\------------------------------------------------------------*/ + + float GraalLambdaGridStep; + + long GraalLambdaGridX; + long GraalLambdaGridY; + long GraalLambdaGridDx; + long GraalLambdaGridDy; + + long GraalPixelGridX; + long GraalPixelGridY; + +/*------------------------------------------------------------\ +| | +| User Lambda Grid | +| | +\------------------------------------------------------------*/ + + long GraalLambdaUserGridDx; + long GraalLambdaUserGridDy; + char GraalLambdaUserGrid; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalInitializeLambdaGrid | +| | +\------------------------------------------------------------*/ + +void GraalInitializeLambdaGrid() + +{ + rdsbegin(); + + GraalLambdaGridX = GRAAL_DEFAULT_GRID_X; + GraalLambdaGridY = GRAAL_DEFAULT_GRID_Y; + GraalLambdaGridDx = GRAAL_DEFAULT_GRID_DX; + GraalLambdaGridDy = GRAAL_DEFAULT_GRID_DY; + GraalLambdaUserGridDx = 4; + GraalLambdaUserGridDy = 4; + GraalLambdaUserGrid = GRAAL_FALSE; + + GraalComputeLambdaGrid(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalComputeLambdaGrid | +| | +\------------------------------------------------------------*/ + +void GraalComputeLambdaGrid() + +{ + float StepX; + float StepY; + + rdsbegin(); + + StepX = (float)(GraalGraphicDx) / (float)(GraalLambdaGridDx); + StepY = (float)(GraalGraphicDy) / (float)(GraalLambdaGridDy); + + if ( StepX < StepY ) + { + GraalLambdaGridStep = StepX; + GraalLambdaGridDy = 1 + ( GraalGraphicDy / StepX ); + } + else + { + GraalLambdaGridStep = StepY; + GraalLambdaGridDx = 1 + ( GraalGraphicDx / StepY ); + } + + GraalPixelGridX = (float)(GraalLambdaGridX) * GraalLambdaGridStep; + GraalPixelGridY = (float)(GraalLambdaGridY) * GraalLambdaGridStep; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalResizeLambdaGrid | +| | +\------------------------------------------------------------*/ + +void GraalResizeLambdaGrid() + +{ + rdsbegin(); + + GraalLambdaGridDx = 1 + ( GraalGraphicDx / GraalLambdaGridStep ); + GraalLambdaGridDy = 1 + ( GraalGraphicDy / GraalLambdaGridStep ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDisplayLambdaGrid | +| | +\------------------------------------------------------------*/ + +char GraalDisplayLambdaGrid( GraphicX1, GraphicY1, GraphicX2, GraphicY2 ) + + Dimension GraphicX1; + Dimension GraphicY1; + Dimension GraphicX2; + Dimension GraphicY2; +{ + long X; + long Y; + long MaxGridX; + long MaxGridY; + long PixelX; + long PixelY; + long Xmin; + long Ymin; + char UserGrid; + char LambdaGrid; + float Check; + + rdsbegin(); + + if ( GraalLambdaGridStep < GRAAL_LOWER_GRID_STEP ) + { + LambdaGrid = 0; + } + else + { + LambdaGrid = 1; + } + + if ( GraalLambdaUserGrid == 1 ) + { + if ( GraalLambdaUserGridDx > GraalLambdaUserGridDy ) + { + Check = ( GRAAL_LOWER_GRID_STEP / GraalLambdaUserGridDx ); + } + else + { + Check = ( GRAAL_LOWER_GRID_STEP / GraalLambdaUserGridDy ); + } + + if ( GraalLambdaGridStep < Check ) UserGrid = 0; + else UserGrid = 1; + } + else + { + UserGrid = 0; + } + + if ( ( UserGrid == 0 ) && + ( LambdaGrid == 0 ) ) + { + rdsend(); + return( GRAAL_FALSE ); + } + + MaxGridX = GraalLambdaGridX + GraalLambdaGridDx; + MaxGridY = GraalLambdaGridY + GraalLambdaGridDy; + + if ( LambdaGrid ) + { + for ( X = GraalLambdaGridX; X < MaxGridX; X = X + 1 ) + { + PixelX = ((float)(X) * GraalLambdaGridStep); + PixelX = PixelX - GraalPixelGridX; + + if ( ( PixelX <= GraphicX2 ) && + ( PixelX >= GraphicX1 ) ) + + for ( Y = GraalLambdaGridY; Y < MaxGridY; Y = Y + 1 ) + { + PixelY = ((float)(Y) * GraalLambdaGridStep); + PixelY = PixelY - GraalPixelGridY; + PixelY = GraalGraphicDy - PixelY; + + if ( ( PixelY <= GraphicY2 ) && + ( PixelY >= GraphicY1 ) ) + { + XDrawPoint( GraalGraphicDisplay, + XtWindow( GraalGraphicWindow ), + GraalGridGC, + PixelX, PixelY ); + } + } + } + } + + if ( UserGrid ) + { + Xmin = ( GraalLambdaGridX / GraalLambdaUserGridDx ) * GraalLambdaUserGridDx; + Ymin = ( GraalLambdaGridY / GraalLambdaUserGridDy ) * GraalLambdaUserGridDy; + + for ( X = Xmin; X < MaxGridX ; X = X + GraalLambdaUserGridDx ) + { + PixelX = ((float)(X) * GraalLambdaGridStep); + PixelX = PixelX - GraalPixelGridX; + + if ( ( PixelX <= GraphicX2 ) && + ( PixelX >= GraphicX1 ) ) + + for ( Y = Ymin; Y < MaxGridY; Y = Y + GraalLambdaUserGridDy ) + { + PixelY = ((float)(Y) * GraalLambdaGridStep); + PixelY = PixelY - GraalPixelGridY; + PixelY = GraalGraphicDy - PixelY; + + if ( ( PixelY <= GraphicY2 ) && + ( PixelY >= GraphicY1 ) ) + { + XDrawLine( GraalGraphicDisplay, + XtWindow( GraalGraphicWindow ), + GraalGridGC, + PixelX - 2, PixelY, + PixelX + 2, PixelY ); + + XDrawLine( GraalGraphicDisplay, + XtWindow( GraalGraphicWindow ), + GraalGridGC, + PixelX, PixelY + 2, + PixelX, PixelY - 2 ); + } + } + } + } + + rdsend(); + return( GRAAL_TRUE ); +} diff --git a/alliance/src/graal/src/GMX_grid.h b/alliance/src/graal/src/GMX_grid.h new file mode 100644 index 00000000..3be2a3ac --- /dev/null +++ b/alliance/src/graal/src/GMX_grid.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Grid.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_GRID +# define GRAAL_GRID + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define GRAAL_DEFAULT_GRID_X 0 +# define GRAAL_DEFAULT_GRID_Y 0 +# define GRAAL_DEFAULT_GRID_DX 40 +# define GRAAL_DEFAULT_GRID_DY 40 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GMX_icon.c b/alliance/src/graal/src/GMX_icon.c new file mode 100644 index 00000000..741bab58 --- /dev/null +++ b/alliance/src/graal/src/GMX_icon.c @@ -0,0 +1,133 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Icon.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "GSB.h" +# include "GTB.h" +# include "GMX.h" + +# include "GMX_icon.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static char IconBits[] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x17, 0x00, 0x00, 0x00, + 0x78, 0x00, 0x18, 0x1c, 0x00, 0x00, 0x00, 0x40, 0x00, 0x0c, 0x18, 0x00, + 0x00, 0x00, 0x40, 0x00, 0x06, 0x10, 0x00, 0x00, 0x00, 0x40, 0x00, 0x02, + 0x10, 0x00, 0x00, 0x00, 0x40, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x40, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x02, 0x80, 0x33, 0x7c, + 0xf0, 0x41, 0x00, 0x02, 0x00, 0x4a, 0x86, 0x18, 0x42, 0x00, 0x02, 0x00, + 0x46, 0x82, 0x08, 0x42, 0x00, 0x02, 0x7f, 0x02, 0x80, 0x00, 0x42, 0x00, + 0x82, 0x13, 0x02, 0x80, 0x00, 0x42, 0x00, 0x82, 0x11, 0x02, 0xf8, 0xe0, + 0x43, 0x00, 0x82, 0x10, 0x02, 0x86, 0x18, 0x42, 0x00, 0x02, 0x10, 0x02, + 0x81, 0x04, 0x42, 0x00, 0x02, 0x10, 0x02, 0x81, 0x04, 0x42, 0x00, 0x06, + 0x10, 0x02, 0x81, 0x04, 0x42, 0x00, 0x0c, 0x18, 0x02, 0x81, 0x04, 0x42, + 0x00, 0x18, 0x0c, 0x02, 0x81, 0x04, 0x42, 0x00, 0xf0, 0x87, 0x0f, 0xfe, + 0xf9, 0xf7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x18, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, + 0x20, 0x00, 0x00, 0x00, 0x80, 0x01, 0x10, 0x40, 0x00, 0x06, 0x00, 0x00, + 0x02, 0x10, 0x40, 0x00, 0x01, 0x00, 0x00, 0x02, 0x10, 0x40, 0x00, 0x01, + 0x00, 0x00, 0x06, 0x20, 0x20, 0x80, 0x01, 0x00, 0x00, 0x04, 0x20, 0x20, + 0x80, 0x00, 0x00, 0x00, 0x0c, 0xc0, 0x18, 0xc0, 0x00, 0x00, 0x00, 0x78, + 0x00, 0x07, 0x78, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x0c, 0x00, 0x00, + 0x00, 0x80, 0x07, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xc0, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0c, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x06, 0x00, 0x00, 0x00, 0xfe, + 0xff, 0xff, 0xff, 0x01, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00 + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalInitializeIcon | +| | +\------------------------------------------------------------*/ + +void GraalInitializeIcon() + +{ + rdsbegin(); + + GraalSetIcon( GraalTopLevel, + IconBits, IconWidth, IconHeight ); + + rdsend(); +} diff --git a/alliance/src/graal/src/GMX_icon.h b/alliance/src/graal/src/GMX_icon.h new file mode 100644 index 00000000..22dd00f5 --- /dev/null +++ b/alliance/src/graal/src/GMX_icon.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Icon.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_ICON +# define GRAAL_ICON + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define IconWidth 50 +# define IconHeight 50 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalInitializeIcon(); + +# endif diff --git a/alliance/src/graal/src/GMX_menu.c b/alliance/src/graal/src/GMX_menu.c new file mode 100644 index 00000000..76240027 --- /dev/null +++ b/alliance/src/graal/src/GMX_menu.c @@ -0,0 +1,236 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Menu.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "GTB.h" +# include "GSB.h" +# include "GMF.h" +# include "GME.h" +# include "GMC.h" +# include "GMV.h" +# include "GMT.h" +# include "GMS.h" +# include "GMH.h" +# include "GMX.h" + +# include "GMX_menu.h" + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + Widget GraalMenuBar; + + GraalMenuItem GraalMainMenu[] = + + { + { + "File", + 'F', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + GraalFileMenu + } + , + { + "Edit", + 'E', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + GraalEditMenu + } + , + { + "Window", + 'W', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + GraalWindowMenu + } + , + { + "Create", + 'C', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + GraalCreateMenu + } + , + { + "View", + 'V', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + GraalViewMenu + } + , + { + "Tools", + 'T', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + GraalToolsMenu + } + , + { + "Setup", + 'S', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + GraalSetupMenu + } + , + { + "Help", + 'H', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + True, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + GraalHelpMenu + } + , + NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalInitializeMenu | +| | +\------------------------------------------------------------*/ + +void GraalInitializeMenu() + +{ + rdsbegin(); + + GraalMenuBar = XmCreateMenuBar( GraalMainWindow, + "GraalMenuBar", NULL, 0 ); + + GraalBuildMenus( GraalMenuBar, GraalMainMenu ); + + XtManageChild( GraalMenuBar ); + + rdsend(); +} + diff --git a/alliance/src/graal/src/GMX_menu.h b/alliance/src/graal/src/GMX_menu.h new file mode 100644 index 00000000..f91f6161 --- /dev/null +++ b/alliance/src/graal/src/GMX_menu.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Menu.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_MENU +# define GRAAL_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern GraalMenuItem GraalMainMenu[]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalInitializeMenu(); + +# endif diff --git a/alliance/src/graal/src/GMX_message.c b/alliance/src/graal/src/GMX_message.c new file mode 100644 index 00000000..533b9719 --- /dev/null +++ b/alliance/src/graal/src/GMX_message.c @@ -0,0 +1,290 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Message.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "GSB.h" +# include "GTB.h" +# include "GMX.h" +# include "GMX_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + Widget GraalMessageMainForm; + Widget GraalMessageText [ GRAAL_MAX_MESSAGE ]; + Widget GraalMessageLabel [ GRAAL_MAX_MESSAGE ]; + Widget GraalMessageFrame [ GRAAL_MAX_MESSAGE ]; + Widget GraalMessageForm [ GRAAL_MAX_MESSAGE ]; + + static char *GraalMessageLabelName [ GRAAL_MAX_MESSAGE ] = + + { + "X :", + "Y :", + "Dx :", + "Dy :", + NULL, + NULL, + NULL + }; + + static char *GraalMessageTextName [ GRAAL_MAX_MESSAGE ] = + + { + "0", + "0", + "0", + "0", + "Measure", + "Select point", + "Enter base point" + }; + + static char *GraalMessageFormName [ GRAAL_MAX_MESSAGE ] = + + { + "GraalMessageFormX", + "GraalMessageFormY", + "GraalMessageFormDx", + "GraalMessageFormDy", + "GraalMessageFormMode", + "GraalMessageFormInfo", + "GraalMessageFormPrompt" + }; + + static char *GraalMessageFrameName [ GRAAL_MAX_MESSAGE ] = + + { + "GraalMessageFrameX", + "GraalMessageFrameY", + "GraalMessageFrameDx", + "GraalMessageFrameDy", + "GraalMessageFrameMode", + "GraalMessageFrameInfo", + "GraalMessageFramePrompt" + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalDisplayMessage | +| | +\------------------------------------------------------------*/ + +void GraalDisplayMessage( Where, Text ) + + char Where; + char *Text; +{ + XmString TextString; + + rdsbegin(); + + TextString = XmStringCreateSimple( Text ); + + XtVaSetValues( GraalMessageText[ Where ], XmNlabelString, TextString, NULL ); + + XmStringFree( TextString ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPromptEditMeasure | +| | +\------------------------------------------------------------*/ + +void GraalPromptEditMeasure() + +{ + rdsbegin(); + + GraalDisplayMessage( GRAAL_MESSAGE_MODE , "Measure" ); + GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter base point" ); + GraalDisplayMessage( GRAAL_MESSAGE_INFO , "Select point" ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalInitializeMessage | +| | +\------------------------------------------------------------*/ + +void GraalInitializeMessage() + +{ + int Counter; + int Column; + int Left; + int Width; + + rdsbegin(); + + GraalMessageMainForm = + + XtVaCreateManagedWidget( "GraalMessageMainForm", + xmFormWidgetClass , + GraalMainForm , + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 193, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 199, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 0, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 200, + XmNfractionBase , 200, + NULL ); + + Column = 1; + Width = 17; + + for ( Counter = 0; Counter < GRAAL_MAX_MESSAGE; Counter++ ) + { + if ( Counter == 4 ) Width = 22; + if ( Counter == 5 ) Width = 68; + if ( Counter == 6 ) Width = 40; + + GraalMessageFrame[ Counter ] = + + XtVaCreateManagedWidget( GraalMessageFrameName[ Counter ], + xmFrameWidgetClass, + GraalMessageMainForm, + XmNshadowType , XmSHADOW_ETCHED_IN, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , Column, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , Column + Width, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + NULL + ); + + GraalMessageForm[ Counter ] = + + XtVaCreateManagedWidget( GraalMessageFormName[ Counter ], + xmFormWidgetClass , + GraalMessageFrame[ Counter ], + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNfractionBase , 18, + NULL + ); + + if ( GraalMessageLabelName[ Counter ] != (char *)NULL ) + { + GraalMessageLabel [ Counter ] = + + XtVaCreateManagedWidget( GraalMessageLabelName[ Counter ], + xmLabelWidgetClass, + GraalMessageForm [ Counter ], + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 6, + XmNbottomAttachment , XmATTACH_FORM, + XmNtopAttachment , XmATTACH_FORM, + XmNrecomputeSize , False, + NULL + ); + Left = 6; + } + else + { + Left = 0; + } + + GraalMessageText [ Counter ] = + + XtVaCreateManagedWidget( GraalMessageTextName[ Counter ], + xmLabelWidgetClass, + GraalMessageForm [ Counter ], + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , Left, + XmNrecomputeSize , False, + NULL + ); + + Column = Column + Width; + } + + rdsend(); +} diff --git a/alliance/src/graal/src/GMX_message.h b/alliance/src/graal/src/GMX_message.h new file mode 100644 index 00000000..7309b55f --- /dev/null +++ b/alliance/src/graal/src/GMX_message.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Message.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_MESSAGE +# define GRAAL_MESSAGE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalInitializeMessage(); + extern void GraalPromptEditMeasure(); + +# endif diff --git a/alliance/src/graal/src/GMX_motif.c b/alliance/src/graal/src/GMX_motif.c new file mode 100644 index 00000000..463331dc --- /dev/null +++ b/alliance/src/graal/src/GMX_motif.c @@ -0,0 +1,197 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Motif.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "GTB.h" +# include "GSB.h" +# include "GMX.h" +# include "GMS.h" + +# include "GMX_motif.h" +# include "GMX_graphic.h" +# include "GMX_event.h" +# include "GMX_message.h" +# include "GMX_menu.h" +# include "GMX_color.h" +# include "GMX_panel.h" +# include "GMX_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XtAppContext GraalApplication; + Widget GraalTopLevel; + Widget GraalMainWindow; + Widget GraalMainForm; + + static String GraalFallBacks [] = + + { + "*.GraalMainWindow.iconName : Graal", + "*GraalMenuBar*fontList : -*-helvetica-bold-r-*--14-*", + "*foreground : black", + "*background : gray", + "*fontList : -*-helvetica-medium-r-*--12-*", + "*pathMode : XmPATH_MODE_RELATIVE", + NULL + }; + + static char GraalTopLevelTitle[ 128 ] = "Graal : "; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalChangeTopLevelTitle | +| | +\------------------------------------------------------------*/ + +void GraalChangeTopLevelTitle( Title ) + + char *Title; +{ + rdsbegin(); + + if ( Title != (char *)NULL ) + { + strcpy( GraalTopLevelTitle + 8, Title ); + } + else + { + GraalTopLevelTitle[ 8 ] = '\0'; + } + + XtVaSetValues( GraalTopLevel, XmNtitle, GraalTopLevelTitle, NULL ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalInitializeRessources | +| | +\------------------------------------------------------------*/ + +void GraalInitializeRessources( argc, argv ) + + int *argc; + char *argv[]; +{ + Arg Args[ 2 ]; + + rdsbegin(); + + GraalTopLevel = XtVaAppInitialize( + &GraalApplication, + "graal.xrdb", + NULL, + 0, + argc, + argv, + GraalFallBacks, + NULL + ); + GraalLoadTopLevelConfig(); + + GraalInitializeColorMap(); + + GraalMainWindow = XtVaCreateManagedWidget( "GraalMainWindow", + xmMainWindowWidgetClass, + GraalTopLevel, + NULL); + + GraalMainForm = XtVaCreateManagedWidget( "GraalMainForm", + xmFormWidgetClass, + GraalMainWindow, + XmNfractionBase, + 200, + NULL ); + GraalInitializeMenu(); + GraalInitializeMessage(); + GraalInitializePanel(); + GraalInitializeGraphic(); + GraalInitializeEvent(); + GraalBuildPanelMap(); + GraalInitializeMapEvent(); + GraalInitializeColors(); + GraalInitializeGraphicContext(); + GraalInitializeDialog(); + GraalBuildPanelLibrary(); + GraalInitializeIcon(); + + XtSetArg( Args[0], XmNallowShellResize, True ); + XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING ); + + XtSetValues( GraalTopLevel, Args, 2 ); + + XtRealizeWidget( GraalTopLevel ); + + rdsend(); +} diff --git a/alliance/src/graal/src/GMX_motif.h b/alliance/src/graal/src/GMX_motif.h new file mode 100644 index 00000000..83fcd346 --- /dev/null +++ b/alliance/src/graal/src/GMX_motif.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Motif.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_MOTIF +# define GRAAL_MOTIF + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GMX_panel.c b/alliance/src/graal/src/GMX_panel.c new file mode 100644 index 00000000..a0f70733 --- /dev/null +++ b/alliance/src/graal/src/GMX_panel.c @@ -0,0 +1,143 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Panel.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "GSB.h" +# include "GTB.h" +# include "GMF.h" +# include "GME.h" +# include "GMC.h" +# include "GMV.h" +# include "GMT.h" +# include "GMS.h" +# include "GMH.h" +# include "GMX.h" + +# include "GMX_panel.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalInitializePanel | +| | +\------------------------------------------------------------*/ + +void GraalInitializePanel() + +{ + rdsbegin(); + + GraalBuildPanelLayer(); + GraalBuildPanelModify(); + GraalBuildPanelCreate(); + + GraalBuildPanel( GraalMainWindow, &GraalToolsGlobalPanel ); + GraalBuildPanel( GraalMainWindow, &GraalToolsMessagePanel ); + GraalBuildPanel( GraalMainWindow, &GraalToolsDrucPanel ); + GraalBuildPanel( GraalMainWindow, &GraalToolsHierarchyPanel ); + GraalBuildPanel( GraalMainWindow, &GraalToolsHierarchyShowPanel ); + + GraalBuildPanel( GraalMainWindow, &GraalViewArrowsPanel ); + GraalBuildPanel( GraalMainWindow, &GraalViewZoomPanel ); + GraalBuildPanel( GraalMainWindow, &GraalViewLayerPanel ); + GraalBuildPanel( GraalMainWindow, &GraalViewGridPanel ); + + GraalBuildPanel( GraalMainWindow, &GraalCreateSegmentPanel ); + GraalBuildPanel( GraalMainWindow, &GraalCreateViaPanel ); + GraalBuildPanel( GraalMainWindow, &GraalCreateBigViaPanel ); + GraalBuildPanel( GraalMainWindow, &GraalCreateTransistorPanel ); + GraalBuildPanel( GraalMainWindow, &GraalCreateConnectorPanel ); + GraalBuildPanel( GraalMainWindow, &GraalCreateReferencePanel ); + GraalBuildPanel( GraalMainWindow, &GraalCreateInstancePanel ); + + GraalBuildPanel( GraalMainWindow, &GraalEditGlobalPanel ); + GraalBuildPanel( GraalMainWindow, &GraalWindowGlobalPanel ); + GraalBuildPanel( GraalMainWindow, &GraalEditSelectPanel ); + GraalBuildPanel( GraalMainWindow, &GraalEditSearchPanel ); + GraalBuildPanel( GraalMainWindow, &GraalEditSearchViewPanel ); + GraalBuildPanel( GraalMainWindow, &GraalEditIdentifyPanel ); + + GraalBuildPanel( GraalMainWindow, &GraalModifySegmentPanel ); + GraalBuildPanel( GraalMainWindow, &GraalModifyConnectorPanel ); + GraalBuildPanel( GraalMainWindow, &GraalModifyTransistorPanel ); + GraalBuildPanel( GraalMainWindow, &GraalModifyReferencePanel ); + GraalBuildPanel( GraalMainWindow, &GraalModifyViaPanel ); + GraalBuildPanel( GraalMainWindow, &GraalModifyBigViaPanel ); + GraalBuildPanel( GraalMainWindow, &GraalModifyInstancePanel ); + + GraalBuildPanel( GraalMainWindow, &GraalSetupInformationsPanel ); + + GraalBuildPresentPanel(); + + rdsend(); +} diff --git a/alliance/src/graal/src/GMX_panel.h b/alliance/src/graal/src/GMX_panel.h new file mode 100644 index 00000000..cdd75da0 --- /dev/null +++ b/alliance/src/graal/src/GMX_panel.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Panel.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_PANEL +# define GRAAL_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalInitializeIcon(); + +# endif diff --git a/alliance/src/graal/src/GMX_view.c b/alliance/src/graal/src/GMX_view.c new file mode 100644 index 00000000..d29feaca --- /dev/null +++ b/alliance/src/graal/src/GMX_view.c @@ -0,0 +1,1026 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : View.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GSB.h" +# include "GRM.h" +# include "GMX.h" + +# include "GMX_view.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static long GraalGraphicX1; + static long GraalGraphicX2; + static long GraalGraphicY1; + static long GraalGraphicY2; + static XFontStruct *GraalTextFont; + static GC GraalTextGC; + static GC GraalDrawGC; + static GC GraalFillGC; + static graalview *GraalHeadView = (graalview *)NULL; + static graalview *GraalHeadViewString = (graalview *)NULL; + static char GraalInterrupt = 0; + static char GraalCheckInt = 0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Alloc Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalAllocView | +| | +\------------------------------------------------------------*/ + +graalview *GraalAllocView() +{ + return((graalview *)rdsalloc(sizeof(graalview), 1)); +} + +/*------------------------------------------------------------\ +| | +| Free Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalFreeView | +| | +\------------------------------------------------------------*/ + +void GraalFreeView( FreeView ) + + graalview *FreeView; +{ + rdsfree((char *)FreeView, sizeof(graalview)); +} + +/*------------------------------------------------------------\ +| | +| GraalAddViewLater | +| | +\------------------------------------------------------------*/ + +void GraalAddViewLater( Rectangle ) + + rdsrec_list *Rectangle; +{ + graalview *View; + + rdsbegin(); + + View = GraalAllocView(); + + View->RECTANGLE = Rectangle; + View->NEXT = GraalHeadView; + GraalHeadView = View; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalAddViewString | +| | +\------------------------------------------------------------*/ + +void GraalAddViewString( Rectangle ) + + rdsrec_list *Rectangle; +{ + graalview *View; + + rdsbegin(); + + View = GraalAllocView(); + + View->RECTANGLE = Rectangle; + View->NEXT = GraalHeadViewString; + GraalHeadViewString = View; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDelView | +| | +\------------------------------------------------------------*/ + +void GraalDelView() +{ + graalview *DelView; + graalview *View; + + rdsbegin(); + + View = GraalHeadView; + GraalHeadView = (graalview *)NULL; + + while( View != (graalview *)NULL ) + { + DelView = View; + View = View->NEXT; + + GraalFreeView( DelView ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDelViewString | +| | +\------------------------------------------------------------*/ + +void GraalDelViewString() +{ + graalview *DelView; + graalview *View; + + rdsbegin(); + + View = GraalHeadViewString; + GraalHeadViewString = (graalview *)NULL; + + while( View != (graalview *)NULL ) + { + DelView = View; + View = View->NEXT; + + GraalFreeView( DelView ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDisplayOneRectangle | +| | +\------------------------------------------------------------*/ + +void GraalDisplayOneRectangle( Rec ) + + rdsrec_list *Rec; +{ + long X1r; + long X2r; + long Y1r; + long Y2r; + long DeltaX; + long DeltaY; + long Xcr; + long Ycr; + char DrawLine; + char Tiny; + char Small; + char RdsLayer; + + rdsbegin(); + + RdsLayer = GetRdsLayer( Rec ); + + X1r = (float)( Rec->X ) * GraalLambdaGridStep; + Y1r = (float)( Rec->Y ) * GraalLambdaGridStep; + X2r = (float)( Rec->X + Rec->DX ) * GraalLambdaGridStep; + Y2r = (float)( Rec->Y + Rec->DY ) * GraalLambdaGridStep; + + X1r = ( X1r / GRAAL_RDS_LAMBDA ) - GraalPixelGridX; + X2r = ( X2r / GRAAL_RDS_LAMBDA ) - GraalPixelGridX; + Y1r = ( Y1r / GRAAL_RDS_LAMBDA ) - GraalPixelGridY; + Y2r = ( Y2r / GRAAL_RDS_LAMBDA ) - GraalPixelGridY; + + if ( ( X1r <= X2r ) && + ( Y1r <= Y2r ) ) + { + DrawLine = 0; + Tiny = 0; + Small = 0; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( ( DeltaX <= 1 ) || + ( DeltaY <= 1 ) ) Tiny = 1; + else + if ( GRAAL_FILL_MODE != GRAAL_FILL_MODE_FILL ) + { + if ( ( DeltaX <= 4 ) || + ( DeltaY <= 4 ) ) + { + if ( ( RdsLayer != RDS_NWELL ) && + ( RdsLayer != RDS_PWELL ) ) + { + Small = ! GRAAL_FORCE_DISPLAY; + } + } + } + + if ( Tiny ) + { + if ( ( DeltaX <= 1 ) && + ( DeltaY <= 1 ) ) + { + XDrawPoint( GraalGraphicDisplay, + GraalGraphicPixmap, + GraalDrawGC, + X1r, GraalGraphicDy - Y1r ); + } + else + if ( DeltaX <= 1 ) + { + Xcr = ( X1r + X2r ) >> 1; + + XDrawLine( GraalGraphicDisplay, + GraalGraphicPixmap, + GraalDrawGC, + Xcr, GraalGraphicDy - Y1r, + Xcr, GraalGraphicDy - Y2r ); + } + else + { + Ycr = ( Y1r + Y2r ) >> 1; + + XDrawLine( GraalGraphicDisplay, + GraalGraphicPixmap, + GraalDrawGC, + X1r, GraalGraphicDy - Ycr, + X2r, GraalGraphicDy - Ycr ); + } + } + else + { + if ( ! Small ) + { + if ( X1r < GraalGraphicX1 ) + { + X1r = GraalGraphicX1; DrawLine |= GRAAL_WEST_MASK; + } + + if ( X2r > GraalGraphicX2 ) + { + X2r = GraalGraphicX2; DrawLine |= GRAAL_EAST_MASK; + } + + if ( Y1r < GraalGraphicY1 ) + { + Y1r = GraalGraphicY1; DrawLine |= GRAAL_SOUTH_MASK; + } + + if ( Y2r > GraalGraphicY2 ) + { + Y2r = GraalGraphicY2; DrawLine |= GRAAL_NORTH_MASK; + } + } + + if ( ( X1r <= X2r ) && + ( Y1r <= Y2r ) ) + { + if ( ( X1r == X2r ) && + ( Y1r == Y2r ) ) + { + X2r++; + Y2r++; + } + + if ( DrawLine == 0 ) + { + XDrawRectangle( GraalGraphicDisplay, + GraalGraphicPixmap, + GraalDrawGC, + X1r, GraalGraphicDy - Y2r, + X2r - X1r, + Y2r - Y1r ); + } + else + { + if ( ( DrawLine & GRAAL_WEST_MASK ) == 0 ) + { + XDrawLine( GraalGraphicDisplay, + GraalGraphicPixmap, + GraalDrawGC, + X1r, GraalGraphicDy - Y2r, + X1r, GraalGraphicDy - Y1r ); + } + + if ( ( DrawLine & GRAAL_EAST_MASK ) == 0 ) + { + XDrawLine( GraalGraphicDisplay, + GraalGraphicPixmap, + GraalDrawGC, + X2r, GraalGraphicDy - Y2r, + X2r, GraalGraphicDy - Y1r ); + } + + if ( ( DrawLine & GRAAL_SOUTH_MASK ) == 0 ) + { + XDrawLine( GraalGraphicDisplay, + GraalGraphicPixmap, + GraalDrawGC, + X1r, GraalGraphicDy - Y1r, + X2r, GraalGraphicDy - Y1r ); + } + + if ( ( DrawLine & GRAAL_NORTH_MASK ) == 0 ) + { + XDrawLine( GraalGraphicDisplay, + GraalGraphicPixmap, + GraalDrawGC, + X1r, GraalGraphicDy - Y2r, + X2r, GraalGraphicDy - Y2r ); + } + } + + if ( ( ! Small ) && + ( RdsLayer != RDS_ABOX ) && + ( GRAAL_FILL_MODE != GRAAL_FILL_MODE_OUTLINE ) ) + { + if ( GRAAL_FILL_MODE == GRAAL_FILL_MODE_PATTERN ) + { + XSetFillStyle( GraalGraphicDisplay, + GraalFillGC, + FillStippled ); + } + else + { + XSetFillStyle( GraalGraphicDisplay, + GraalFillGC, + FillSolid ); + } + + XFillRectangle( GraalGraphicDisplay, + GraalGraphicPixmap, + GraalFillGC, + X1r, GraalGraphicDy - Y2r, + X2r - X1r, + Y2r - Y1r ); + } + } + } + + if ( ( DrawLine != 0 ) || + ( Rec->NAME == NULL ) ) + { + ClearGraalDrawText( Rec ); + } + } + else + { + ClearGraalDrawText( Rec ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDisplayOneString | +| | +\------------------------------------------------------------*/ + +void GraalDisplayOneString( Rec ) + + rdsrec_list *Rec; +{ + char *Name; + phcon_list *PhCon; + char Buffer[ 512 ]; + long X1r; + long X2r; + long Y1r; + long Y2r; + long WidthText; + long HeightText; + + rdsbegin(); + + X1r = (float)( Rec->X ) * GraalLambdaGridStep; + Y1r = (float)( Rec->Y ) * GraalLambdaGridStep; + X2r = (float)( Rec->X + Rec->DX ) * GraalLambdaGridStep; + Y2r = (float)( Rec->Y + Rec->DY ) * GraalLambdaGridStep; + + X1r = ( X1r / GRAAL_RDS_LAMBDA ) - GraalPixelGridX; + X2r = ( X2r / GRAAL_RDS_LAMBDA ) - GraalPixelGridX; + Y1r = ( Y1r / GRAAL_RDS_LAMBDA ) - GraalPixelGridY; + Y2r = ( Y2r / GRAAL_RDS_LAMBDA ) - GraalPixelGridY; + + if ( ( GRAAL_CONNECTOR_INDEX ) && + ( IsRdsFigRec( Rec ) ) && + ( IsRdsConnector( Rec ) ) ) + { + PhCon = (phcon_list *)GRAAL_MBK( Rec ); + sprintf( Buffer, "%s.%ld", PhCon->NAME, PhCon->INDEX ); + Name = namealloc( Buffer ); + } + else + { + Name = Rec->NAME; + } + + HeightText = GraalTextFont->ascent; + WidthText = XTextWidth( GraalTextFont, + Name, strlen( Name ) ); + + if ( GRAAL_BLACK_BOX_STRING ) + { + XDrawImageString( GraalGraphicDisplay, + GraalGraphicPixmap, + GraalTextGC, + (( X1r + X2r - WidthText ) >> 1), + GraalGraphicDy - (( Y1r + Y2r - HeightText ) >> 1), + Name, strlen( Name ) ); + } + else + { + XDrawString( GraalGraphicDisplay, + GraalGraphicPixmap, + GraalTextGC, + (( X1r + X2r - WidthText ) >> 1), + GraalGraphicDy - (( Y1r + Y2r - HeightText ) >> 1), + Name, strlen( Name ) ); + } + + ClearGraalDrawText( Rec ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalCheckInterrupt | +| | +\------------------------------------------------------------*/ + +char GraalCheckInterrupt() +{ + XEvent Event; + KeySym Key; + char Text[ 2 ]; + + rdsbegin(); + + if ( GraalCheckInt ) + { + if ( XCheckTypedEvent( GraalGraphicDisplay, KeyPress, &Event ) ) + { + XLookupString( &Event.xkey, Text, 1, &Key, 0 ); + + if ( Text[ 0 ] == '\003' ) + { + GraalInterrupt = 1; + + XBell( GraalGraphicDisplay, 0 ); + } + } + } + + GraalCheckInt = 0; + + rdsend(); + + return( GraalInterrupt ); +} + +/*------------------------------------------------------------\ +| | +| GraalInterruptDisplay | +| | +\------------------------------------------------------------*/ + +void GraalInterruptDisplay() +{ + rdsbegin(); + + GraalCheckInt = 1; + + signal( SIGALRM, GraalInterruptDisplay ); + alarm( 1 ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalFlushEventDisplay | +| | +\------------------------------------------------------------*/ + +void GraalFlushEventDisplay() +{ + XEvent Event; + + rdsbegin(); + + while ( XCheckTypedEvent( GraalGraphicDisplay, KeyPress, &Event ) ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDisplayFigure | +| | +\------------------------------------------------------------*/ + +void GraalDisplayFigure( GraphicX1, GraphicY1, GraphicX2, GraphicY2 ) + + long GraphicX1; + long GraphicY1; + long GraphicX2; + long GraphicY2; +{ + long Offset; + graalwin *ScanWin; + graalwinrec *ScanWinRec; + rdsrec_list *Rec; + rdsins_list *Instance; + char ScanRec; + char Layer; + char StaticLayer; + long X1; + long Y1; + long X2; + long Y2; + long X1r; + long Y1r; + long X; + long Y; + long Xmin; + long Xmax; + long Ymin; + long Ymax; + long LambdaMin; + char DrawText; + char DrawTextFig; + char DrawTextFigCon; + char DrawTextFigSeg; + char DrawTextFigRef; + char DrawTextIns; + char DrawTextInsCon; + char DrawTextInsSeg; + char DrawTextInsRef; + graalview *View; + + rdsbegin(); + + GraalTextGC = GraalSmallTextGC; + GraalTextFont = GraalSmallTextFont; + DrawTextFig = 0; + DrawTextFigCon = 0; + DrawTextFigSeg = 0; + DrawTextFigRef = 0; + DrawTextIns = 0; + DrawTextInsCon = 0; + DrawTextInsSeg = 0; + DrawTextInsRef = 0; + GraalGraphicX1 = GraphicX1; + GraalGraphicX2 = GraphicX2; + GraalGraphicY1 = GraphicY1; + GraalGraphicY2 = GraphicY2; + + if ( ( GraalLambdaGridStep > GRAAL_LOWER_FIGURE_STEP ) || + ( GRAAL_FORCE_DISPLAY ) ) + { + DrawTextFig = GRAAL_RDS_ACTIVE_NAME_TABLE[ GRAAL_FIGURE_NAME ]; + } + + if ( ( GraalLambdaGridStep > GRAAL_LOWER_INSTANCE_STEP ) || + ( GRAAL_FORCE_DISPLAY ) ) + { + DrawTextIns = GRAAL_RDS_ACTIVE_NAME_TABLE[ GRAAL_INSTANCE_NAME ]; + } + + if ( ( GraalLambdaGridStep > GRAAL_LOWER_CONNECTOR_STEP ) || + ( GRAAL_FORCE_DISPLAY ) ) + { + DrawTextInsCon = GRAAL_RDS_ACTIVE_NAME_TABLE[ GRAAL_INSTANCE_CONNECTOR_NAME ]; + DrawTextFigCon = GRAAL_RDS_ACTIVE_NAME_TABLE[ GRAAL_FIGURE_CONNECTOR_NAME ]; + } + + if ( ( GraalLambdaGridStep > GRAAL_LOWER_SEGMENT_STEP ) || + ( GRAAL_FORCE_DISPLAY ) ) + { + DrawTextFigSeg = GRAAL_RDS_ACTIVE_NAME_TABLE[ GRAAL_FIGURE_SEGMENT_NAME ]; + DrawTextInsSeg = GRAAL_RDS_ACTIVE_NAME_TABLE[ GRAAL_INSTANCE_SEGMENT_NAME ]; + } + + if ( ( GraalLambdaGridStep > GRAAL_LOWER_REFERENCE_STEP ) || + ( GRAAL_FORCE_DISPLAY ) ) + { + DrawTextFigRef = GRAAL_RDS_ACTIVE_NAME_TABLE[ GRAAL_FIGURE_REFERENCE_NAME ]; + DrawTextInsRef = GRAAL_RDS_ACTIVE_NAME_TABLE[ GRAAL_INSTANCE_REFERENCE_NAME ]; + } + + if ( GraalLambdaGridStep > GRAAL_LOWER_CONNECTOR_STEP ) + { + GraalTextGC = GraalMediumTextGC; + GraalTextFont = GraalMediumTextFont; + } + + if ( GraalLambdaGridStep > GRAAL_LOWER_REFERENCE_STEP ) + { + GraalTextGC = GraalLargeTextGC; + GraalTextFont = GraalLargeTextFont; + } + + GraalClearGraphicWindow( GraphicX1, + GraalGraphicDy - GraphicY2, + GraphicX2 - GraphicX1, + GraphicY2 - GraphicY1 ); + + if ( GraalFigureMbk == (phfig_list *)NULL ) return; + + LambdaMin = (float)(4.0 / ( GraalLambdaGridStep )); + + X1 = GraphicX1 + GraalPixelGridX; + X2 = GraphicX2 + GraalPixelGridX; + Y1 = GraphicY1 + GraalPixelGridY; + Y2 = GraphicY2 + GraalPixelGridY; + + X1 = ( X1 / GraalLambdaGridStep ); + Y1 = ( Y1 / GraalLambdaGridStep ); + X2 = ( X2 / GraalLambdaGridStep ); + Y2 = ( Y2 / GraalLambdaGridStep ); + + if ( X2 >= 0 ) { X2 = X2 + 1; } + if ( Y2 >= 0 ) { Y2 = Y2 + 1; } + if ( X1 <= 0 ) { X1 = X1 - 1; } + if ( Y1 <= 0 ) { Y1 = Y1 - 1; } + + X1 = X1 * GRAAL_RDS_LAMBDA; + X2 = X2 * GRAAL_RDS_LAMBDA; + Y1 = Y1 * GRAAL_RDS_LAMBDA; + Y2 = Y2 * GRAAL_RDS_LAMBDA; + + Xmin = ( X1 - GraalWindowXmin ) / GraalWindowSide; + Xmax = ( X2 - GraalWindowXmin ) / GraalWindowSide; + Ymin = ( Y1 - GraalWindowYmin ) / GraalWindowSide; + Ymax = ( Y2 - GraalWindowYmin ) / GraalWindowSide; + + if ( Xmin < 0 ) Xmin = 0; + if ( Ymin < 0 ) Ymin = 0; + if ( Xmin >= GraalWindowDx ) Xmin = GraalWindowDx - 1; + if ( Ymin >= GraalWindowDy ) Ymin = GraalWindowDy - 1; + + if ( Xmax < 0 ) Xmax = 0; + if ( Ymax < 0 ) Ymax = 0; + if ( Xmax >= GraalWindowDx ) Xmax = GraalWindowDx - 1; + if ( Ymax >= GraalWindowDy ) Ymax = GraalWindowDy - 1; + + GraalInterrupt = 0; + GraalCheckInt = 0; + + signal( SIGALRM, GraalInterruptDisplay ); + alarm( 1 ); + + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + if ( GraalCheckInterrupt() ) break; + + StaticLayer = RDS_STATIC_LAYER[ Layer ]; + + if ( GRAAL_RDS_ACTIVE_LAYER_TABLE[ StaticLayer ] != 1 ) continue; + + Y = Ymin; + + while ( Y <= Ymax ) + { + if ( GraalCheckInterrupt() ) break; + + X = Xmin; + + while ( X <= Xmax ) + { + if ( GraalCheckInterrupt() ) break; + + Offset = Y * GraalWindowDx + X; + + ScanWin = &GraalWindowTable[ Offset ]; + + if ( ScanWin->LAYERTAB != (graalwinrec **)NULL ) + { + for ( ScanWinRec = ScanWin->LAYERTAB[ Layer ]; + ScanWinRec != (graalwinrec *)NULL; + ScanWinRec = ScanWinRec->NEXT ) + { + for ( ScanRec = 0; ScanRec < GRAAL_MAX_REC ; ScanRec++ ) + { + Rec = ScanWinRec->RECTAB[ ScanRec ]; + + if ( ( Rec != (rdsrec_list *)NULL ) && + ( ! IsGraalDeleted( Rec ) ) && + ( ! IsGraalInvisible( Rec ) ) && + ( Rec->X <= X2 ) && + ( Rec->Y <= Y2 ) && + ( ( Rec->X + Rec->DX ) >= X1 ) && + ( ( Rec->Y + Rec->DY ) >= Y1 ) ) + { + + if ( ( ! GRAAL_INSTANCE_INTERFACE ) && + ( ! IsRdsFigRec( Rec ) ) && + ( ! IsRdsInstance( Rec ) ) ) continue; + + if ( ( Rec->DX < LambdaMin ) && + ( Rec->DY < LambdaMin ) ) + { + if ( ! GRAAL_FORCE_DISPLAY ) continue; + } + + if ( ! IsGraalOneWindow( Rec ) ) + { + X1r = ( Rec->X - GraalWindowXmin ) / GraalWindowSide; + Y1r = ( Rec->Y - GraalWindowYmin ) / GraalWindowSide; + + if ( X1r < 0 ) X1r = 0; + if ( Y1r < 0 ) Y1r = 0; + if ( X1r >= GraalWindowDx ) X1r = GraalWindowDx - 1; + if ( Y1r >= GraalWindowDy ) Y1r = GraalWindowDy - 1; + + if ( X1r < Xmin ) X1r = Xmin; + if ( Y1r < Ymin ) Y1r = Ymin; + + if ( ( X1r != X ) || ( Y1r != Y ) ) + { + if ( ! GRAAL_FORCE_DISPLAY ) continue; + } + } + + if ( ! IsRdsFigRec( Rec ) ) + { + Instance = (rdsins_list *)GRAAL_PREVIOUS( Rec ); + + if ( IsGraalDeleted( Instance->LAYERTAB[ RDS_ABOX ] ) ) continue; + + if ( IsRdsConnector( Rec ) ) + { + DrawText = DrawTextInsCon; + } + else + if ( ( IsRdsReference( Rec ) ) || + ( IsRdsVia( Rec ) ) ) + { + DrawText = DrawTextInsRef; + } + else + if ( IsRdsSegment( Rec ) ) + { + DrawText = DrawTextInsSeg; + } + else + { + DrawText = DrawTextIns; + } + } + else + { + if ( IsRdsConnector( Rec ) ) + { + DrawText = DrawTextFigCon; + } + else + if ( ( IsRdsReference( Rec ) ) || + ( IsRdsVia( Rec ) ) ) + { + DrawText = DrawTextFigRef; + } + else + if ( IsRdsSegment( Rec ) ) + { + DrawText = DrawTextFigSeg; + } + else + { + DrawText = DrawTextFig; + } + } + + if ( DrawText ) SetGraalDrawText( Rec ); + + if ( ( IsGraalAccepted( Rec ) != 0 ) || + ( IsGraalTreated( Rec ) != 0 ) || + ( IsGraalDruc( Rec ) != 0 ) ) + { + GraalAddViewLater( Rec ); + } + else + { + GraalDrawGC = GraalLayerDrawGC[ StaticLayer ]; + GraalFillGC = GraalLayerFillGC[ StaticLayer ]; + + GraalDisplayOneRectangle( Rec ); + + if ( IsGraalDrawText( Rec ) ) + { + GraalAddViewString( Rec ); + } + } + } + } + } + } + + X = X + 1; + } + + Y = Y + 1; + } + + for ( View = GraalHeadView; + View != (graalview *)NULL; + View = View->NEXT ) + { + Rec = View->RECTANGLE; + + if ( IsGraalAccepted( Rec ) != 0 ) + { + GraalDrawGC = GraalAcceptDrawGC; + GraalFillGC = GraalLayerAcceptGC[ StaticLayer ]; + } + else + if ( IsGraalTreated( Rec ) != 0 ) + { + GraalDrawGC = GraalEquiDrawGC; + GraalFillGC = GraalLayerEquiGC[ StaticLayer ]; + } + else + { + GraalDrawGC = GraalDrucDrawGC; + GraalFillGC = GraalLayerDrucGC[ StaticLayer ]; + } + + GraalDisplayOneRectangle( Rec ); + } + + GraalDelView(); + } + + for ( View = GraalHeadViewString; + View != (graalview *)NULL; + View = View->NEXT ) + { + Rec = View->RECTANGLE; + + GraalDisplayOneString( Rec ); + } + + GraalDelViewString(); + + alarm( 0 ); + GraalFlushEventDisplay(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDisplayRectangle | +| | +\------------------------------------------------------------*/ + +void GraalDisplayRectangle( Rectangle ) + + rdsrec_list *Rectangle; +{ + rdsrec_list *ScanRec; + long Xmin; + long Ymin; + long Xmax; + long Ymax; + + rdsbegin(); + + Xmin = Rectangle->X; + Ymin = Rectangle->Y; + Xmax = Xmin + Rectangle->DX; + Ymax = Ymin + Rectangle->DY; + + ScanRec = (rdsrec_list *)(Rectangle->USER); + + while ( ScanRec != Rectangle ) + { + if ( Xmin > ScanRec->X ) + { + Xmin = ScanRec->X; + } + + if ( Xmax < ( ScanRec->X + ScanRec->DX ) ) + { + Xmax = ScanRec->X + ScanRec->DX; + } + + if ( Ymin > ScanRec->Y ) + { + Ymin = ScanRec->Y; + } + + if ( Ymax < ( ScanRec->Y + ScanRec->DY ) ) + { + Ymax = ScanRec->Y + ScanRec->DY; + } + + ScanRec = (rdsrec_list *)(ScanRec->USER); + } + + Xmin = (float)( Xmin ) * GraalLambdaGridStep; + Ymin = (float)( Ymin ) * GraalLambdaGridStep; + Xmax = (float)( Xmax ) * GraalLambdaGridStep; + Ymax = (float)( Ymax ) * GraalLambdaGridStep; + + Xmin = ( Xmin / GRAAL_RDS_LAMBDA ) - GraalPixelGridX - 1; + Xmax = ( Xmax / GRAAL_RDS_LAMBDA ) - GraalPixelGridX + 1; + Ymin = ( Ymin / GRAAL_RDS_LAMBDA ) - GraalPixelGridY - 1; + Ymax = ( Ymax / GRAAL_RDS_LAMBDA ) - GraalPixelGridY + 1; + + if ( Xmin < 0 ) Xmin = 0; + if ( Ymin < 0 ) Ymin = 0; + + if ( Xmax > GraalGraphicDx ) Xmax = GraalGraphicDx; + if ( Ymax > GraalGraphicDy ) Ymax = GraalGraphicDy; + + if ( ( Xmax > 0 ) && + ( Ymax > 0 ) && + ( Xmin < GraalGraphicDx ) && + ( Ymin < GraalGraphicDy ) ) + { + GraalDisplayFigure( Xmin, Ymin , Xmax, Ymax ); + + GraalRefreshGraphicWindow( Xmin, GraalGraphicDy - Ymax, + Xmax - Xmin, Ymax - Ymin ); + } + + rdsend(); +} diff --git a/alliance/src/graal/src/GMX_view.h b/alliance/src/graal/src/GMX_view.h new file mode 100644 index 00000000..fe1733b6 --- /dev/null +++ b/alliance/src/graal/src/GMX_view.h @@ -0,0 +1,84 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : View.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_VIEW +# define GRAAL_VIEW + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Graal View | +| | +\------------------------------------------------------------*/ + + typedef struct graalview + + { + struct graalview *NEXT; + rdsrec_list *RECTANGLE; + + } graalview ; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GRM.h b/alliance/src/graal/src/GRM.h new file mode 100644 index 00000000..a744f5ed --- /dev/null +++ b/alliance/src/graal/src/GRM.h @@ -0,0 +1,610 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : GRM101.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_GRM +# define GRAAL_GRM + +# define GRAAL_SIZE (sizeof( graalrec )) + +# define GRAAL_MAX_REC 8 +# define GRAAL_ONE_WINDOW (long)0x00010000 +# define GRAAL_DELETED (long)0x00020000 +# define GRAAL_ACCEPTED (long)0x00040000 +# define GRAAL_TREATED (long)0x00080000 +# define GRAAL_FLATTEN (long)0x00100000 +# define GRAAL_PEEK (long)0x00200000 +# define GRAAL_DRUC (long)0x00400000 +# define GRAAL_INVISIBLE (long)0x00800000 +# define GRAAL_CUT (long)0x01000000 +# define GRAAL_SELECTED (long)0x02000000 +# define GRAAL_DRAW_TEXT (long)0x04000000 +# define GRAAL_SEARCH (long)0x08000000 + +/*------------------------------------------------------------\ +| | +| Macros | +| | +\------------------------------------------------------------*/ + +# define GRAAL_PREVIOUS( R ) \ + \ + (((graalrec *)((char *)(R)+sizeof(rdsrec_list)))->PREVIOUS) + +# define GRAAL_MBK( R ) \ + \ + (((graalrec *)((char *)(R)+sizeof(rdsrec_list)))->MBK ) + +# define GRAAL_WINDOW( R ) \ + \ + (((graalrec *)((char *)(R)+sizeof(rdsrec_list)))->WINDOW ) + +# define GRAAL_EQUI( R ) \ + \ + (((graalrec *)((char *)(R)+sizeof(rdsrec_list)))->EQUI ) + +/*------------------------------------------------------------\ +| | +| Macros | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Windows | +| | +\------------------------------------------------------------*/ + +# define IsGraalOneWindow( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS & GRAAL_ONE_WINDOW ) + +# define SetGraalOneWindow( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS |= GRAAL_ONE_WINDOW ) + +# define ClearGraalOneWindow( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS &= ~GRAAL_ONE_WINDOW ) + +/*------------------------------------------------------------\ +| | +| Search | +| | +\------------------------------------------------------------*/ + +# define IsGraalSearch( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS & GRAAL_SEARCH ) + +# define SetGraalSearch( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS |= GRAAL_SEARCH ) + +# define ClearGraalSearch( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS &= ~GRAAL_SEARCH ) + +/*------------------------------------------------------------\ +| | +| Deleted | +| | +\------------------------------------------------------------*/ + +# define IsGraalDeleted( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS & GRAAL_DELETED ) + +# define SetGraalDeleted( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS |= GRAAL_DELETED ) + +# define ClearGraalDeleted( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS &= ~GRAAL_DELETED ) + +/*------------------------------------------------------------\ +| | +| Accepted | +| | +\------------------------------------------------------------*/ + +# define IsGraalAccepted( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS & GRAAL_ACCEPTED ) + +# define SetGraalAccepted( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS |= GRAAL_ACCEPTED ) + +# define ClearGraalAccepted( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS &= ~GRAAL_ACCEPTED) + +/*------------------------------------------------------------\ +| | +| Selected | +| | +\------------------------------------------------------------*/ + +# define IsGraalSelected( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS & GRAAL_SELECTED ) + +# define SetGraalSelected( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS |= GRAAL_SELECTED ) + +# define ClearGraalSelected( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS &= ~GRAAL_SELECTED) + +/*------------------------------------------------------------\ +| | +| Treated | +| | +\------------------------------------------------------------*/ + +# define IsGraalTreated( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS & GRAAL_TREATED ) + +# define SetGraalTreated( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS |= GRAAL_TREATED ) + +# define ClearGraalTreated( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS &= ~GRAAL_TREATED ) + +/*------------------------------------------------------------\ +| | +| DrawText | +| | +\------------------------------------------------------------*/ + +# define IsGraalDrawText( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS & GRAAL_DRAW_TEXT ) + +# define SetGraalDrawText( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS |= GRAAL_DRAW_TEXT ) + +# define ClearGraalDrawText( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS &= ~GRAAL_DRAW_TEXT ) + +/*------------------------------------------------------------\ +| | +| Flatten | +| | +\------------------------------------------------------------*/ + +# define IsGraalFlatten( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS & GRAAL_FLATTEN ) + +# define SetGraalFlatten( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS |= GRAAL_FLATTEN ) + +# define ClearGraalFlatten( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS &= ~GRAAL_FLATTEN ) + +/*------------------------------------------------------------\ +| | +| Peek | +| | +\------------------------------------------------------------*/ + +# define IsGraalPeek( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS & GRAAL_PEEK ) + +# define SetGraalPeek( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS |= GRAAL_PEEK ) + +# define ClearGraalPeek( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS &= ~GRAAL_PEEK ) + +/*------------------------------------------------------------\ +| | +| Druc | +| | +\------------------------------------------------------------*/ + +# define IsGraalDruc( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS & GRAAL_DRUC ) + +# define SetGraalDruc( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS |= GRAAL_DRUC ) + +# define ClearGraalDruc( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS &= ~GRAAL_DRUC ) + +/*------------------------------------------------------------\ +| | +| Invisible | +| | +\------------------------------------------------------------*/ + +# define IsGraalInvisible( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS & GRAAL_INVISIBLE ) + +# define SetGraalInvisible( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS |= GRAAL_INVISIBLE ) + +# define ClearGraalInvisible( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS &= ~GRAAL_INVISIBLE ) + +/*------------------------------------------------------------\ +| | +| Cut | +| | +\------------------------------------------------------------*/ + +# define IsGraalCut( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS & GRAAL_CUT ) + +# define SetGraalCut( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS |= GRAAL_CUT ) + +# define ClearGraalCut( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS &= ~GRAAL_CUT ) + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Graal Windows | +| | +\------------------------------------------------------------*/ + + typedef struct graalwinrec + + { + struct graalwinrec *NEXT; + rdsrec_list *RECTAB[ GRAAL_MAX_REC ]; + + } graalwinrec; + + typedef struct graalwin + + { + struct graalwinrec **LAYERTAB; + + } graalwin; + + typedef struct graalrecwin + + { + struct graalrecwin *NEXT; + graalwin *WINDOW; + + } graalrecwin; + +/*------------------------------------------------------------\ +| | +| Graal Undo | +| | +\------------------------------------------------------------*/ + + typedef struct graalundorec + + { + struct graalundorec *NEXT; + rdsrec_list *RECTANGLE; + + } graalundorec; + + typedef struct graalundo + + { + struct graalundo *NEXT; + graalundorec *UNDO; + + } graalundo; + +/*------------------------------------------------------------\ +| | +| Graal Connector | +| | +\------------------------------------------------------------*/ + + typedef struct graalconrec + + { + struct graalconrec *NEXT; + rdsrec_list *RECTANGLE; + + } graalconrec; + +/*------------------------------------------------------------\ +| | +| Graal Select | +| | +\------------------------------------------------------------*/ + + typedef struct graalselect + + { + struct graalselect *NEXT; + rdsrec_list *RECTANGLE; + + } graalselect ; + +/*------------------------------------------------------------\ +| | +| Graal Search | +| | +\------------------------------------------------------------*/ + + typedef struct graalsearch + + { + struct graalsearch *NEXT; + rdsrec_list *RECTANGLE; + + } graalsearch; + +/*------------------------------------------------------------\ +| | +| Graal Peek | +| | +\------------------------------------------------------------*/ + + typedef struct graalpeek + + { + struct graalpeek *NEXT; + rdsrec_list *RECTANGLE; + + } graalpeek; + +/*------------------------------------------------------------\ +| | +| X Rectangle | +| | +\------------------------------------------------------------*/ + + typedef struct graalrec + + { + rdsrec_list **PREVIOUS; + void *MBK; + graalrecwin *WINDOW; + rdsrec_list *EQUI; + + } graalrec; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern long GraalBoundXmin; + extern long GraalBoundYmin; + extern long GraalBoundXmax; + extern long GraalBoundYmax; + extern char GraalRecomputeBound; + + extern long GraalWindowXmin; + extern long GraalWindowYmin; + extern long GraalWindowXmax; + extern long GraalWindowYmax; + extern long GraalWindowDx; + extern long GraalWindowDy; + extern long GraalWindowSide; + extern long GraalWindowSize; + extern graalwin *GraalWindowTable; + + extern rdsfig_list *GraalFigureRds; + extern rdsfig_list *GraalFigureDruc; + extern rdsrec_list *GraalRectangleDruc; + extern rdsrec_list *GraalCurrentDruc; + extern phfig_list *GraalFigureMbk; + + extern graalundo *GraalHeadRedo; + extern graalundo *GraalHeadUndo; + extern rdsrec_list *GraalHeadEqui; + extern graalselect *GraalHeadSelect; + extern graalsearch *GraalHeadSearch; + extern graalpeek *GraalHeadPeek; + extern graalconrec *GraalHeadConRec; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Translator MBK => RDS | +| | +\------------------------------------------------------------*/ + + extern rdsfig_list *Graaldrucrdsfig(); + extern char Graalsavephfig(); + extern phfig_list *Graalgetphfig(); + extern phfig_list *Graalrflattenphfig(); + extern phfig_list *Graalflattenphfig(); + extern rdsfig_list *Graalgetrdsfig(); + extern rdsfig_list *Graalrflattenrdsfig(); + extern rdsfig_list *GraalAddFigure(); + extern rdsins_list *GraalAddInstance(); + extern rdsins_list *GraalFlatInstance(); + extern rdsins_list *GraalUnflatInstance(); + extern char GraalRealFlatInstance(); + extern rdsrec_list *GraalAddSegment(); + extern rdsrec_list *GraalAddConnector(); + extern rdsrec_list *GraalAddReference(); + extern rdsrec_list *GraalAddVia(); + extern rdsrec_list *GraalAddAbox(); + extern void GraalDelFigure(); + extern void GraalDelInstance(); + extern void GraalDelRectangle(); + extern char GraalSaveFigure(); + +/*------------------------------------------------------------\ +| | +| Undo Acces Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalAddUndo(); + extern void GraalDelUndo(); + extern void GraalAddUndoRec(); + extern void GraalInitializeUndo(); + +/*------------------------------------------------------------\ +| | +| Flag Set & Clear Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalDeleteRectangle(); + extern void GraalUndeleteRectangle(); + extern void GraalSelectRectangle(); + extern void GraalUnselectRectangle(); + extern void GraalAcceptRectangle(); + extern void GraalRejectRectangle(); + +/*------------------------------------------------------------\ +| | +| Select Acces Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalAddSelect(); + extern void GraalDelSelect(); + extern void GraalPurgeSelect(); + +/*------------------------------------------------------------\ +| | +| Search Acces Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalAddSearch(); + extern void GraalDelSearch(); + +/*------------------------------------------------------------\ +| | +| Peek Acces Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalPeekInstance(); + extern void GraalAddPeek(); + extern void GraalDelPeek(); + +/*------------------------------------------------------------\ +| | +| Equi Extract Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalExtractEqui(); + extern void GraalDelEqui(); + +/*------------------------------------------------------------\ +| | +| Druc Acces Functions | +| | +\------------------------------------------------------------*/ + + extern rdsrec_list *GraalAddDruc(); + extern void GraalDelDruc(); + extern void GraalDelDrucFigure(); + +/*------------------------------------------------------------\ +| | +| Bound Compute | +| | +\------------------------------------------------------------*/ + + extern char GraalComputeBound(); + +/*------------------------------------------------------------\ +| | +| Window Acces Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalInitializeWindowTable(); + +/*------------------------------------------------------------\ +| | +| Error Message Functions | +| | +\------------------------------------------------------------*/ + + extern char *GraalGetErrorMessage(); + extern void GraalExitErrorMessage(); + +/*------------------------------------------------------------\ +| | +| Informations Functions | +| | +\------------------------------------------------------------*/ + + extern char *GraalGetInformations(); + +# endif diff --git a/alliance/src/graal/src/GRM_connector.c b/alliance/src/graal/src/GRM_connector.c new file mode 100644 index 00000000..b9543b18 --- /dev/null +++ b/alliance/src/graal/src/GRM_connector.c @@ -0,0 +1,197 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Connector.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GRM.h" +# include "GSB.h" +# include "GRM_connector.h" + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + graalconrec *GraalHeadConRec = (graalconrec *)NULL; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Alloc Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalAllocConRec | +| | +\------------------------------------------------------------*/ + +graalconrec *GraalAllocConRec() +{ + return((graalconrec *)rdsalloc(sizeof(graalconrec), 1)); +} + +/*------------------------------------------------------------\ +| | +| Free Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalFreeConRec | +| | +\------------------------------------------------------------*/ + +void GraalFreeConRec( FreeConRec ) + + graalconrec *FreeConRec; +{ + rdsfree((char *)FreeConRec, sizeof(graalconrec)); +} + +/*------------------------------------------------------------\ +| | +| GraalDelAllConRec | +| | +\------------------------------------------------------------*/ + +void GraalDelAllConRec() + +{ + graalconrec *ConRec; + graalconrec *DelConRec; + + rdsbegin(); + + ConRec = GraalHeadConRec; + + while ( ConRec != (graalconrec *)NULL ) + { + DelConRec = ConRec; + ConRec = ConRec->NEXT; + + GraalFreeConRec( DelConRec ); + } + + GraalHeadConRec = (graalconrec *)NULL; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDelConRec | +| | +\------------------------------------------------------------*/ + +void GraalDelConRec( Rectangle ) + + rdsrec_list *Rectangle; +{ + rdsrec_list *ScanRec; + graalconrec *ConRec; + graalconrec **Previous; + + rdsbegin(); + + Previous = &GraalHeadConRec; + + for ( ConRec = GraalHeadConRec; + ConRec != (graalconrec *)NULL; + ConRec = ConRec->NEXT ) + { + ScanRec = Rectangle; + + do + { + if ( ConRec->RECTANGLE == ScanRec ) + { + *Previous = ConRec->NEXT; + + GraalFreeConRec( ConRec ); + + return; + } + + ScanRec = (rdsrec_list *)ScanRec->USER; + } + while ( ScanRec != Rectangle ); + + Previous = &ConRec->NEXT; + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalAddConRec | +| | +\------------------------------------------------------------*/ + +void GraalAddConRec( Rectangle ) + + rdsrec_list *Rectangle; +{ + graalconrec *ConRec; + + rdsbegin(); + + ConRec = GraalAllocConRec(); + + ConRec->NEXT = GraalHeadConRec; + ConRec->RECTANGLE = Rectangle; + GraalHeadConRec = ConRec; + + rdsend(); +} diff --git a/alliance/src/graal/src/GRM_connector.h b/alliance/src/graal/src/GRM_connector.h new file mode 100644 index 00000000..f58b296d --- /dev/null +++ b/alliance/src/graal/src/GRM_connector.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Connector.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRM_CONNECTOR +# define GRM_CONNECTOR + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalDelConRec(); + extern void GraalDelAllConRec(); + extern void GraalAddConRec(); + +# endif diff --git a/alliance/src/graal/src/GRM_druc.c b/alliance/src/graal/src/GRM_druc.c new file mode 100644 index 00000000..e9bbf120 --- /dev/null +++ b/alliance/src/graal/src/GRM_druc.c @@ -0,0 +1,199 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Druc.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "vrd.h" +# include "GRM.h" +# include "GSB.h" +# include "GRM_window.h" +# include "GRM_druc.h" + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + rdsfig_list *GraalFigureDruc = (rdsfig_list *)0; + rdsrec_list *GraalRectangleDruc = (rdsrec_list *)0; + rdsrec_list *GraalCurrentDruc = (rdsrec_list *)0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalAddDruc | +| | +\------------------------------------------------------------*/ + +rdsrec_list *GraalAddDruc( DrucRec ) + + rdsrec_list *DrucRec; +{ + rdsrec_list *ScanDrucRec; + rdsrec_list *ScanRec; + rdsrec_list *First; + rdsrec_list *Link; + + rdsbegin(); + + First = (rdsrec_list *)NULL; + + if ( ! IsGraalDruc( DrucRec ) ) + { + ScanDrucRec = DrucRec; + + do + { + ScanRec = + + addrdsfigrec( GraalFigureRds, ScanDrucRec->NAME, + GetRdsLayer( ScanDrucRec ), + ScanDrucRec->X, ScanDrucRec->Y, + ScanDrucRec->DX, ScanDrucRec->DY ); + + SetGraalDruc( ScanRec ); + SetGraalDruc( ScanDrucRec ); + + if ( ScanRec->NEXT != (rdsrec_list *)NULL ) + { + GRAAL_PREVIOUS( ScanRec->NEXT ) = &ScanRec->NEXT; + } + + GRAAL_PREVIOUS( ScanRec ) = + + &GraalFigureRds->LAYERTAB[ GetRdsLayer( ScanRec ) ]; + + GraalInsertRectangle( ScanRec ); + + if ( First == (rdsrec_list *)NULL ) + { + First = ScanRec; + Link = ScanRec; + } + else + { + Link->USER = (void *)ScanRec; + Link = ScanRec; + } + + ScanDrucRec = MACRO_NEXT_EQUI( ScanDrucRec ); + } + while ( ScanDrucRec != DrucRec ); + + Link->USER = (void *)First; + } + + rdsend(); + return( First ); +} + +/*------------------------------------------------------------\ +| | +| GraalDelDruc | +| | +\------------------------------------------------------------*/ + +void GraalDelDruc( Rectangle ) + + rdsrec_list *Rectangle; +{ + rdsrec_list *ScanRec; + rdsrec_list *DelRec; + + rdsbegin(); + + ScanRec = Rectangle; + + do + { + DelRec = ScanRec; + ScanRec = (rdsrec_list *)(ScanRec->USER); + + *(GRAAL_PREVIOUS( DelRec )) = DelRec->NEXT; + + if ( DelRec->NEXT != (rdsrec_list *)NULL ) + { + GRAAL_PREVIOUS( DelRec->NEXT ) = GRAAL_PREVIOUS( DelRec ); + } + + GraalEraseRectangle( DelRec ); + + freerdsrec( DelRec, GRAAL_SIZE ); + } + while ( ScanRec != Rectangle ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDelDrucFigure | +| | +\------------------------------------------------------------*/ + +void GraalDelDrucFigure() +{ + if ( GraalFigureDruc != (rdsfig_list *)0 ) + { + GraalCurrentDruc = (rdsrec_list *)0; + + delrdsfig( GraalFigureDruc->NAME ); + GraalFigureDruc = (rdsfig_list *)0; + + if ( GraalRectangleDruc != (rdsrec_list *)0 ) + { + GraalDelDruc( GraalRectangleDruc ); + GraalRectangleDruc = (rdsrec_list *)0; + } + } +} diff --git a/alliance/src/graal/src/GRM_druc.h b/alliance/src/graal/src/GRM_druc.h new file mode 100644 index 00000000..ba53699e --- /dev/null +++ b/alliance/src/graal/src/GRM_druc.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Druc.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRM_DRUC +# define GRM_DRUC + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GRM_equi.c b/alliance/src/graal/src/GRM_equi.c new file mode 100644 index 00000000..3a2f1753 --- /dev/null +++ b/alliance/src/graal/src/GRM_equi.c @@ -0,0 +1,554 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Equi.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GRM.h" +# include "GSB.h" +# include "GRM_equi.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + rdsrec_list *GraalHeadEqui = (rdsrec_list *)NULL; + + static char GraalReferenceBuffer[ GRAAL_REFERENCE_BUFFER_SIZE ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalCutCx | +| | +\------------------------------------------------------------*/ + +rdsrec_list *GraalCutCx( Rec, X1, Y1, X2, Y2 ) + + rdsrec_list *Rec; + long X1; + long Y1; + long X2; + long Y2; +{ + void *Pointer; + phseg_list *Segment; + rdsrec_list *Diff; + rdsrec_list *Save; + rdsrec_list *ScanRec; + graalrecwin *RecWin; + graalrecwin *ScanRecWin; + graalrecwin StaticRecWin; + graalwin *ScanWin; + graalwinrec *ScanWinRec; + long *Table; + long *LineTable; + long Xvia; + long Yvia; + char Index; + char Mask; + char MbkLayer; + char DiffLayer; + char GateLayer; + char CXType; + + rdsbegin(); + + Pointer = GRAAL_MBK( Rec ); + Xvia = ((phvia_list *)Pointer)->XVIA; + Yvia = ((phvia_list *)Pointer)->YVIA; + CXType = ((phvia_list *)Pointer)->TYPE; + + MbkLayer = GRAAL_CUT_C_X_LIST[ CXType ]; + GateLayer = GET_LYNX_TRANSISTOR_GATE_LAYER( MbkLayer ); + DiffLayer = GET_LYNX_TRANSISTOR_DIFF_LAYER( MbkLayer ); + + if ( GetRdsLayer( Rec ) != DiffLayer ) + { + rdsend(); + return( Rec ); + } + + Table = GRAAL_CUT_C_X_ARRAY[ MbkLayer ]; + Mask = 0; + Save = Rec; + + if ( IsGraalOneWindow ( Rec ) ) + { + StaticRecWin.NEXT = (graalrecwin *)NULL; + StaticRecWin.WINDOW = (graalwin *)GRAAL_WINDOW( Rec ); + RecWin = &StaticRecWin; + } + else + { + RecWin = GRAAL_WINDOW( Rec ); + } + + for ( ScanRecWin = RecWin ; + ScanRecWin != (graalrecwin *) NULL ; + ScanRecWin = ScanRecWin->NEXT ) + { + ScanWin = ScanRecWin->WINDOW; + + for ( ScanWinRec = ScanWin->LAYERTAB[ GateLayer ]; + ScanWinRec != (graalwinrec *)NULL; + ScanWinRec = ScanWinRec->NEXT ) + { + for ( Index = 0; Index < GRAAL_MAX_REC; Index++ ) + { + ScanRec = ScanWinRec->RECTAB[ Index ]; + + if ( ( ScanRec != (rdsrec_list *)NULL ) && + ( ! IsGraalDeleted( ScanRec ) ) && + ( IsRdsFigRec( ScanRec ) ) && + ( IsRdsSegment( ScanRec ) ) ) + { + Segment = (phseg_list *)GRAAL_MBK( ScanRec ); + + if ( Segment->LAYER == MbkLayer ) + { + if ( ( Segment->TYPE == UP ) || + ( Segment->TYPE == DOWN ) ) + { + if ( Segment->X1 == Xvia ) + { + if ( Segment->Y1 == Yvia ) Mask |= GRAAL_NORTH_MASK; + else + if ( Segment->Y2 == Yvia ) Mask |= GRAAL_SOUTH_MASK; + } + } + else + { + if ( Segment->Y1 == Yvia ) + { + if ( Segment->X1 == Xvia ) Mask |= GRAAL_EAST_MASK; + else + if ( Segment->X2 == Xvia ) Mask |= GRAAL_WEST_MASK; + } + } + } + } + } + } + } + + if ( Mask != 0 ) + { + Diff = (rdsrec_list *)NULL; + + LineTable = &Table[ Mask << 4 ]; + + for ( Index = 0; Index < 16; Index = Index + 4 ) + { + if ( LineTable[ Index ] == -1 ) break; + + Diff = addrdsfigrec( GraalFigureRds, + NULL, DiffLayer, + Rec->X + LineTable[ Index + 0 ], + Rec->Y + LineTable[ Index + 1 ], + LineTable[ Index + 2 ], + LineTable[ Index + 3 ] ); + + GRAAL_PREVIOUS( Diff ) = + + &(GraalFigureRds->LAYERTAB[ DiffLayer ]); + + if ( Diff->NEXT != (rdsrec_list *)NULL ) + { + GRAAL_PREVIOUS( Diff->NEXT ) = &Diff->NEXT; + } + + GRAAL_MBK( Diff ) = GRAAL_MBK( Rec ); + + Diff->USER = Rec->USER; + Rec->USER = (void *)Diff; + + SetGraalCut( Diff ); + GraalInsertRectangle( Diff ); + + if ( ( ( Diff->X ) <= X2 ) && + ( ( Diff->Y ) <= Y2 ) && + ( ( Diff->X + Diff->DX ) >= X1 ) && + ( ( Diff->Y + Diff->DY ) >= Y1 ) ) + + { + Save = Diff; + } + } + + if ( Save != Rec ) SetGraalInvisible( Rec ); + } + + rdsend(); + return( Save ); +} + +/*------------------------------------------------------------\ +| | +| GraalExtractEqui | +| | +\------------------------------------------------------------*/ + +void GraalExtractEqui( Rec ) + + rdsrec_list *Rec; +{ + rdsrec_list *LastRec; + rdsrec_list *ScanRec; + rdsrec_list *ScanInsRec; + rdsins_list *ScanIns; + graalrecwin *RecWin; + graalrecwin *ScanRecWin; + graalrecwin StaticRecWin; + graalwin *ScanWin; + graalwinrec *ScanWinRec; + char *RefName; + char *ScanRecName; + char *ScanInsRecName; + void *Pointer; + int Index; + int LayerIns; + int LayerRec; + int Layer; + int Counter; + long X1; + long X2; + long Y1; + long Y2; + + rdsbegin(); + + if ( GraalHeadEqui != (rdsrec_list *)NULL ) + { + GraalDelEqui(); + } + + StaticRecWin.NEXT = (graalrecwin *)NULL; + + GraalHeadEqui = Rec; + SetGraalTreated( Rec ); + + ScanRec = (rdsrec_list *)Rec->USER; + LastRec = Rec; + + while ( ScanRec != Rec ) + { + SetGraalTreated( ScanRec ); + + GRAAL_EQUI( LastRec ) = ScanRec; + LastRec = ScanRec; + ScanRec = (rdsrec_list *)ScanRec->USER; + } + + Rec = GraalHeadEqui; + + do + { + X1 = Rec->X; + Y1 = Rec->Y; + X2 = Rec->DX + X1; + Y2 = Rec->DY + Y1; + + if ( IsGraalOneWindow ( Rec ) ) + { + StaticRecWin.WINDOW = (graalwin *)GRAAL_WINDOW( Rec ); + RecWin = &StaticRecWin; + } + else + { + RecWin = GRAAL_WINDOW( Rec ); + } + + LayerRec = GetRdsLayer ( Rec ); + + for ( ScanRecWin = RecWin ; + ScanRecWin != (graalrecwin *) NULL ; + ScanRecWin = ScanRecWin->NEXT ) + { + ScanWin = ScanRecWin->WINDOW; + + Index = 0; + + while ( ( Layer = GET_LYNX_GRAPH_LAYER ( LayerRec, Index ) ) != RDS_LYNX_GRAPH_EMPTY ) + { + for ( ScanWinRec = ScanWin->LAYERTAB[ Layer ]; + ScanWinRec != (graalwinrec *)NULL; + ScanWinRec = ScanWinRec->NEXT ) + { + for ( Counter = 0; Counter < GRAAL_MAX_REC; Counter++ ) + { + ScanRec = ScanWinRec->RECTAB[ Counter ]; + + if ( ( ScanRec != (rdsrec_list *)NULL ) && + ( ! IsGraalDeleted( ScanRec ) ) && + ( ! IsGraalTreated( ScanRec ) ) && + ( ! IsGraalInvisible( ScanRec ) ) && + ( ( ScanRec->X ) <= X2 ) && + ( ( ScanRec->Y ) <= Y2 ) && + ( ( ScanRec->X + ScanRec->DX ) >= X1 ) && + ( ( ScanRec->Y + ScanRec->DY ) >= Y1 ) ) + { + if ( IsRdsFigRec( ScanRec ) ) + { + if ( ( IsRdsVia( ScanRec ) ) && + ( IsRdsFigRec( ScanRec ) ) && + ( ! IsGraalInvisible( ScanRec ) ) && + ( ! IsGraalCut( ScanRec ) ) ) + { + Pointer = GRAAL_MBK( ScanRec ); + + if ( GRAAL_CUT_C_X_LIST[ ((phvia_list *)Pointer)->TYPE ] < MBK_MAX_LAYER ) + { + ScanRec = GraalCutCx( ScanRec, X1, Y1, X2, Y2 ); + } + } + + SetGraalTreated( ScanRec ); + + GRAAL_EQUI( LastRec ) = ScanRec; + LastRec = ScanRec; + } + else + if ( ( IsRdsConInter( ScanRec ) ) || + ( IsRdsRefCon( ScanRec ) ) ) + { + SetGraalTreated( ScanRec ); + + if ( ( IsRdsRefCon( ScanRec ) ) && + ( ScanRec->NAME != (char *)NULL ) ) + { + strcpy( GraalReferenceBuffer, ScanRec->NAME ); + + RefName = strrchr( GraalReferenceBuffer, '_' ); + + if ( RefName != (char *)NULL ) + { + *RefName = '\0'; + } + + ScanRecName = namealloc( GraalReferenceBuffer ); + } + else + { + ScanRecName = ScanRec->NAME; + } + + GRAAL_EQUI( LastRec ) = ScanRec; + LastRec = ScanRec; + + ScanIns = (rdsins_list *)GRAAL_PREVIOUS( ScanRec ); + + if ( ! IsGraalDeleted( ScanIns->LAYERTAB[ RDS_ABOX ] ) ) + { + for ( LayerIns = 0 ; LayerIns < RDS_MAX_LAYER ; LayerIns ++ ) + { + for ( ScanInsRec = ScanIns->LAYERTAB[ LayerIns ]; + ScanInsRec != (rdsrec_list *)NULL; + ScanInsRec = ScanInsRec->NEXT ) + { + if ( ! IsGraalTreated( ScanInsRec ) ) + { + if ( ( IsRdsRefCon( ScanInsRec ) ) && + ( ScanInsRec->NAME != (char *)NULL ) ) + { + strcpy( GraalReferenceBuffer, ScanInsRec->NAME ); + + RefName = strrchr( GraalReferenceBuffer, '_' ); + + if ( RefName != (char *)NULL ) + { + *RefName = '\0'; + } + + ScanInsRecName = namealloc( GraalReferenceBuffer ); + } + else + { + ScanInsRecName = ScanInsRec->NAME; + } + + if ( ( ( IsRdsConInter( ScanInsRec ) ) || + ( IsRdsRefCon( ScanInsRec ) ) ) && + ( ScanRecName == ScanInsRecName ) ) + { + SetGraalTreated( ScanInsRec ); + + GRAAL_EQUI( LastRec ) = ScanInsRec; + LastRec = ScanInsRec; + } + } + } + } + } + } + } + } + } + + Index = Index + 1; + } + } + + Rec = GRAAL_EQUI( Rec ); + } + while ( Rec != (rdsrec_list *)NULL ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDelEqui | +| | +\------------------------------------------------------------*/ + +void GraalDelEqui() + +{ + rdsrec_list *Rec; + rdsrec_list *ScanRec; + rdsrec_list *DelEqui; + rdsrec_list *DelRec; + rdsrec_list *FirstRec; + void **Previous; + + rdsbegin(); + + Rec = GraalHeadEqui; + + while ( Rec != (rdsrec_list *)NULL ) + { + ClearGraalTreated( Rec ); + + DelEqui = Rec; + Rec = GRAAL_EQUI( Rec ); + + GRAAL_EQUI( DelEqui ) = (rdsrec_list *)NULL; + + if ( IsGraalCut( DelEqui ) ) + { + ScanRec = DelEqui; + Previous = &ScanRec->USER; + FirstRec = ScanRec; + ScanRec = (rdsrec_list *)(ScanRec->USER); + + do + { + if ( ( IsGraalCut( ScanRec ) ) && + ( GRAAL_EQUI( ScanRec ) == (rdsrec_list *)NULL ) ) + { + *Previous = ScanRec->USER; + DelRec = ScanRec; + ScanRec = (rdsrec_list *)(ScanRec->USER); + + *(GRAAL_PREVIOUS( DelRec )) = DelRec->NEXT; + + if ( DelRec->NEXT != (rdsrec_list *)NULL ) + { + GRAAL_PREVIOUS( DelRec->NEXT ) = GRAAL_PREVIOUS( DelRec ); + } + + GraalEraseRectangle( DelRec ); + + freerdsrec( DelRec, GRAAL_SIZE ); + } + else + { + ClearGraalInvisible( ScanRec ); + + Previous = &(ScanRec->USER); + ScanRec = (rdsrec_list *)(ScanRec->USER); + } + } + while ( ScanRec != FirstRec ); + + if ( ( IsGraalCut( ScanRec ) ) && + ( GRAAL_EQUI( ScanRec ) == (rdsrec_list *)NULL ) ) + { + *Previous = ScanRec->USER; + DelRec = ScanRec; + ScanRec = (rdsrec_list *)(ScanRec->USER); + + *(GRAAL_PREVIOUS( DelRec )) = DelRec->NEXT; + + if ( DelRec->NEXT != (rdsrec_list *)NULL ) + { + GRAAL_PREVIOUS( DelRec->NEXT ) = GRAAL_PREVIOUS( DelRec ); + } + + GraalEraseRectangle( DelRec ); + + freerdsrec( DelRec, GRAAL_SIZE ); + } + else + { + ClearGraalInvisible( ScanRec ); + } + } + } + + GraalHeadEqui = (rdsrec_list *)NULL; + + rdsend(); +} diff --git a/alliance/src/graal/src/GRM_equi.h b/alliance/src/graal/src/GRM_equi.h new file mode 100644 index 00000000..bc49fefd --- /dev/null +++ b/alliance/src/graal/src/GRM_equi.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Equi.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRM_EQUI +# define GRM_EQUI + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define GRAAL_REFERENCE_BUFFER_SIZE 256 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GRM_error.c b/alliance/src/graal/src/GRM_error.c new file mode 100644 index 00000000..2bfa95c2 --- /dev/null +++ b/alliance/src/graal/src/GRM_error.c @@ -0,0 +1,401 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Error.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "rtl.h" +# include "GSB.h" +# include "GRM.h" +# include "GRM_error.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static FILE *GraalStreamErr; + static FILE *GraalStreamOut; + static FILE *GraalStreamAll; + + static char GraalErrFileName[ 40 ]; + static char GraalOutFileName[ 40 ]; + static char GraalAllFileName[ 40 ]; + + static char GraalNormalMode = 1; + +/*------------------------------------------------------------\ +| | +| Graal Error Message | +| | +\------------------------------------------------------------*/ + + static char *GraalErrorBuffer = (char *)NULL; + +/*------------------------------------------------------------\ +| | +| Graal Informations | +| | +\------------------------------------------------------------*/ + + static char GraalInformationsBuffer[ GRAAL_INFORMATIONS_BUFFER_SIZE ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Graal Error Message Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalExitCloseStream | +| | +\------------------------------------------------------------*/ + +void GraalExitCloseStream() +{ + rdsbegin(); + + if ( GraalStreamErr != (FILE *)0 ) + { + fclose( GraalStreamErr ); + unlink( GraalErrFileName ); + } + + if ( GraalStreamAll != (FILE *)0 ) + { + fclose( GraalStreamAll ); + unlink( GraalAllFileName ); + } + + if ( ( GraalNormalMode ) && + ( GraalStreamOut != (FILE *)0 ) ) + { + fclose( GraalStreamOut ); + unlink( GraalOutFileName ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalExitFatalError | +| | +\------------------------------------------------------------*/ + +void GraalExitFatalError() +{ + rdsbegin(); + + GraalExitCloseStream(); + + if ( GraalHeadUndo != (graalundo *)NULL ) + { + GraalFigureMbk->NAME = namealloc( "graal_dump" ); + GraalSaveFigure(); + } + + exit( 2 ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalExitErrorMessage | +| | +\------------------------------------------------------------*/ + +void GraalExitErrorMessage( Error ) + + int Error; +{ + rdsbegin(); + + GraalExitCloseStream(); + + if ( GraalHeadUndo != (graalundo *)NULL ) + { + CallbackFileSaveAs( NULL, NULL, NULL ); + } + + exit( Error ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalInitializeErrorMessage | +| | +\------------------------------------------------------------*/ + +void GraalInitializeErrorMessage( Debug ) + + char Debug; +{ + rdsbegin(); + + GraalNormalMode = ! Debug; + + if ( GraalNormalMode ) + { + sprintf( GraalOutFileName, "/tmp/%s_out_%d", GRAAL_TOOL_NAME, getpid() ); + } + + sprintf( GraalErrFileName, "/tmp/%s_err_%d", GRAAL_TOOL_NAME, getpid() ); + sprintf( GraalAllFileName, "/tmp/%s_all_%d", GRAAL_TOOL_NAME, getpid() ); + + GraalStreamErr = freopen( GraalErrFileName, "w+", stderr); + GraalStreamAll = fopen ( GraalAllFileName, "w+" ); + + if ( GraalNormalMode ) + { + GraalStreamOut = freopen( GraalOutFileName, "w+", stdout); + } + else + { + GraalStreamOut = GraalStreamErr; + } + + if ( ( GraalStreamAll == (FILE *)NULL ) || + ( GraalStreamOut == (FILE *)NULL ) || + ( GraalStreamErr == (FILE *)NULL ) ) + { + fprintf( stdout, "Grm: Unable to open trace window !\n"); + exit( 1 ); + } + + if ( GraalNormalMode ) + { + unlink( GraalOutFileName ); + } + + unlink( GraalErrFileName ); + + signal( SIGINT, GraalExitErrorMessage ); + + if ( ! Debug ) + { + signal( SIGSEGV, GraalExitFatalError ); + signal( SIGUSR1, GraalExitFatalError ); + signal( SIGUSR2, GraalExitFatalError ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalFlushErrorMessage | +| | +\------------------------------------------------------------*/ + +void GraalFlushErrorMessage() +{ + int Data; + + rdsbegin(); + + fflush( GraalStreamErr ); + fseek( GraalStreamErr, 0L, 0 ); + + while( ( Data = fgetc( GraalStreamErr ) ) != EOF ) + { + fputc( Data, GraalStreamAll ); + } + + fclose( GraalStreamErr ); + + GraalStreamErr = freopen( GraalErrFileName, "w+", stderr ); + + if ( GraalNormalMode ) + { + fflush( GraalStreamOut ); + fseek( GraalStreamOut, 0L, 0 ); + + while( ( Data = fgetc( GraalStreamOut ) ) != EOF ) + { + fputc( Data, GraalStreamAll ); + } + + fclose( GraalStreamOut ); + + GraalStreamOut = freopen( GraalOutFileName, "w+", stdout ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalGetErrorMessage | +| | +\------------------------------------------------------------*/ + +char *GraalGetErrorMessage() + +{ + char *Message; + long Length; + long Index; + int Data; + + rdsbegin(); + + GraalFlushErrorMessage(); + + fflush( GraalStreamAll ); + + Length = ftell( GraalStreamAll ); + + if ( GraalErrorBuffer != (char *)NULL ) + { + rdsfreeblock( GraalErrorBuffer ); + } + + GraalErrorBuffer = rdsallocblock( Length + 1 ); + Index = 0; + + while ( ( ( Data = fgetc( GraalStreamAll ) ) != EOF ) && + ( Index < Length ) ) + { + GraalErrorBuffer[ Index++ ] = (char)Data; + } + + rewind( GraalStreamAll ); + + GraalErrorBuffer[ Index ] = '\0'; + + if ( Index == 0 ) + { + Message = (char *)NULL; + } + else + { + Message = GraalErrorBuffer; + } + + rdsend(); + return( Message ); +} + +/*------------------------------------------------------------\ +| | +| GraalGetInformations | +| | +\------------------------------------------------------------*/ + +char *GraalGetInformations() + +{ + char *Scan; + + rdsbegin(); + + GraalComputeBound(); + + Scan = GraalInformationsBuffer; + + if ( GraalFigureMbk != (phfig_list *)NULL ) + { + sprintf( Scan, " FIGURE : %s\n\n XAB1 : %d\n YAB1 : %d\n XAB2 : %d\n YAB2 : %d\n\n", + GraalFigureMbk->NAME, + GraalFigureMbk->XAB1 / GRAAL_SCALE_X, + GraalFigureMbk->YAB1 / GRAAL_SCALE_X, + GraalFigureMbk->XAB2 / GRAAL_SCALE_X, + GraalFigureMbk->YAB2 / GRAAL_SCALE_X ); + } + else + { + sprintf( Scan, " FIGURE : No current figure !\n\n" ); + } + + Scan = Scan + strlen( Scan ); + + sprintf( Scan, " BOUNDING BOX : \n\n XMIN : %d\n YMIN : %d\n XMAX : %d\n YMAX : %d\n\n", + GraalBoundXmin / GRAAL_RDS_LAMBDA, GraalBoundYmin / GRAAL_RDS_LAMBDA, + GraalBoundXmax / GRAAL_RDS_LAMBDA, GraalBoundYmax / GRAAL_RDS_LAMBDA ); + + Scan = Scan + strlen( Scan ); + + sprintf( Scan, " WINDOWS : \n\n XMIN : %d\n YMIN : %d\n XMAX : %d\n YMAX : %d\n DX : %d\n DY : %d\n SIDE : %d\n\n", + GraalWindowXmin / GRAAL_RDS_LAMBDA, GraalWindowYmin / GRAAL_RDS_LAMBDA, + GraalWindowXmax / GRAAL_RDS_LAMBDA, GraalWindowYmax / GRAAL_RDS_LAMBDA, + GraalWindowDx , GraalWindowDy, + GraalWindowSide / GRAAL_RDS_LAMBDA ); + + Scan = Scan + strlen( Scan ); + + sprintf( Scan, " RDS TECHNOLOGY : %s\n\n", RDS_TECHNO_NAME ); + + Scan = Scan + strlen( Scan ); + + sprintf( Scan, " GRAAL TECHNOLOGY : %s\n\n", GRAAL_TECHNO_NAME ); + + rdsend(); + return( GraalInformationsBuffer ); +} diff --git a/alliance/src/graal/src/GRM_error.h b/alliance/src/graal/src/GRM_error.h new file mode 100644 index 00000000..3f40f8f6 --- /dev/null +++ b/alliance/src/graal/src/GRM_error.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Error.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRM_ERROR +# define GRM_ERROR + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define GRAAL_INFORMATIONS_BUFFER_SIZE 1024 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalFlushErrorMessage(); + +# endif diff --git a/alliance/src/graal/src/GRM_mbkrds.c b/alliance/src/graal/src/GRM_mbkrds.c new file mode 100644 index 00000000..e459162c --- /dev/null +++ b/alliance/src/graal/src/GRM_mbkrds.c @@ -0,0 +1,1219 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : MbkRds.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include "mut.h" +# include "mph.h" +# include "mpu.h" +# include "rds.h" +# include "rpr.h" +# include "rwi.h" +# include "rut.h" +# include "rtl.h" +# include "rfm.h" +# include "GSB.h" +# include "GRM.h" +# include "vrd.h" +# include "GRM_error.h" +# include "GRM_window.h" +# include "GRM_mbkrds.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| For Set Long Jump | +| | +\------------------------------------------------------------*/ + + static jmp_buf GraalJumpBuffer; + +/*------------------------------------------------------------\ +| | +| Graal Figure | +| | +\------------------------------------------------------------*/ + + rdsfig_list *GraalFigureRds = (rdsfig_list *)NULL; + graalconrec *GraalHeadConnector = (graalconrec *)NULL; + phfig_list *GraalFigureMbk = (phfig_list *)NULL; + +/*------------------------------------------------------------\ +| | +| Graal Exit Handler Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalExitHandler | +| | +\------------------------------------------------------------*/ + +void GraalExitHandler() +{ + GraalFlushErrorMessage(); + + longjmp( GraalJumpBuffer, 1); +} + +/*------------------------------------------------------------\ +| | +| GraalActiveExitHandler | +| | +\------------------------------------------------------------*/ + +void GraalActiveExitHandler() +{ + MBK_EXIT_FUNCTION = GraalExitHandler; +} + +/*------------------------------------------------------------\ +| | +| GraalResetExitHandler | +| | +\------------------------------------------------------------*/ + +void GraalResetExitHandler() +{ + MBK_EXIT_FUNCTION = NULL; +} + +/*------------------------------------------------------------\ +| | +| Graal Add Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Graal Add Figure | +| | +\------------------------------------------------------------*/ + +rdsfig_list *GraalAddFigure() + +{ + void *Pointer; + void *Previous; + rdsrec_list *Abox; + + rdsbegin(); + + GraalFigureRds = addrdsfig( GraalFigureMbk->NAME, GRAAL_SIZE ); + + Abox = aboxmbkrds( GraalFigureMbk, GraalFigureRds ); + + if ( Abox != (rdsrec_list *)NULL ) + { + GraalCheckWindow( Abox->X , Abox->Y, + Abox->X + Abox->DX, Abox->Y + Abox->DY ); + + delrdsfigrec( GraalFigureRds, Abox ); + } + + GraalAddAbox(); + + Previous = (void *)(&(GraalFigureMbk->PHSEG)); + + for ( Pointer = (void *)(GraalFigureMbk->PHSEG); + Pointer != (void *)NULL; + Pointer = (void *)(((phseg_list *)Pointer)->NEXT)) + { + ((phseg_list *)Pointer)->USER = Previous; + Previous = (void *)(&((phseg_list *)Pointer)->NEXT); + + GraalAddSegment( (phseg_list *)Pointer ); + } + + Previous = (void *)(&(GraalFigureMbk->PHCON)); + + for ( Pointer = (void *)(GraalFigureMbk->PHCON); + Pointer != (void *)NULL; + Pointer = (void *)(((phcon_list *)Pointer)->NEXT)) + { + ((phcon_list *)Pointer)->USER = Previous; + Previous = (void *)(&((phcon_list *)Pointer)->NEXT); + + GraalAddConnector( (phcon_list *)Pointer ); + } + + Previous = (void *)(&(GraalFigureMbk->PHREF)); + + for ( Pointer = (void *)(GraalFigureMbk->PHREF); + Pointer != (void *)NULL; + Pointer = (void *)(((phref_list *)Pointer)->NEXT)) + { + ((phref_list *)Pointer)->USER = Previous; + Previous = (void *)(&((phref_list *)Pointer)->NEXT); + + GraalAddReference( (phref_list *)Pointer ); + } + + Previous = (void *)(&(GraalFigureMbk->PHVIA)); + + for ( Pointer = (void *)(GraalFigureMbk->PHVIA); + Pointer != (void *)NULL; + Pointer = (void *)(((phvia_list *)Pointer)->NEXT)) + { + ((phvia_list *)Pointer)->USER = Previous; + Previous = (void *)(&((phvia_list *)Pointer)->NEXT); + + GraalAddVia( (phvia_list *)Pointer ); + } + + Previous = (void *)(&(GraalFigureMbk->PHINS)); + + for ( Pointer = (void *)(GraalFigureMbk->PHINS); + Pointer != (void *)NULL; + Pointer = (void *)(((phins_list *)Pointer)->NEXT)) + { + ((phins_list *)Pointer)->USER = Previous; + Previous = (void *)(&((phins_list *)Pointer)->NEXT); + + GraalAddInstance( (phins_list *)Pointer ); + } + + rdsend(); + return( GraalFigureRds ); +} + +/*------------------------------------------------------------\ +| | +| Graal Add Instance | +| | +\------------------------------------------------------------*/ + +rdsins_list *GraalAddInstance( InstanceMbk ) + + phins_list *InstanceMbk; +{ + rdsins_list *InstanceRds; + rdsrec_list *Rectangle; + char Layer; + + rdsbegin(); + + delphfig( InstanceMbk->FIGNAME ); + + if ( Graalgetphfig( InstanceMbk->FIGNAME, 'P' ) == (phfig_list *)NULL ) + { + rdsend(); + return( (rdsins_list *)NULL ); + } + + InstanceRds = insmbkrds( GraalFigureRds, InstanceMbk, 'P', 1 ); + InstanceRds->USER = (void *)(&GraalFigureRds->INSTANCE); + + if ( InstanceRds->NEXT != (rdsins_list *)NULL ) + { + InstanceRds->NEXT->USER = (void *)(&InstanceRds->NEXT); + } + + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + for ( Rectangle = InstanceRds->LAYERTAB[ Layer ]; + Rectangle != (rdsrec_list *)NULL; + Rectangle = Rectangle->NEXT ) + { + GRAAL_MBK( Rectangle ) = (void *)InstanceMbk; + GRAAL_PREVIOUS( Rectangle ) = (rdsrec_list **)InstanceRds; + + GraalInsertRectangle( Rectangle ); + } + } + + rdsend(); + return( InstanceRds ); +} + +/*------------------------------------------------------------\ +| | +| Graal Flat Instance | +| | +\------------------------------------------------------------*/ + +rdsins_list *GraalFlatInstance( InstanceRds ) + + rdsins_list *InstanceRds; +{ + phfig_list *ModelMbk; + phins_list *InstanceMbk; + rdsrec_list *ScanRec; + rdsrec_list *DelRec; + char Layer; + + rdsbegin(); + + ModelMbk = Graalgetphfig( InstanceRds->FIGNAME, 'A' ); + + if ( ModelMbk == (phfig_list *)NULL ) + { + rdsend(); + return( (rdsins_list *)NULL ); + } + + ModelMbk = Graalrflattenphfig( ModelMbk, YES, NO ); + + if ( ModelMbk == (phfig_list *)NULL ) + { + rdsend(); + return( (rdsins_list *)NULL ); + } + + for ( Layer = 0; Layer < RDS_ABOX; Layer++ ) + { + ScanRec = InstanceRds->LAYERTAB[ Layer ]; + + InstanceRds->LAYERTAB[ Layer ] = (rdsrec_list *)NULL; + + while( ScanRec != (rdsrec_list *)NULL ) + { + DelRec = ScanRec; + ScanRec = ScanRec->NEXT; + + GraalEraseRectangle( DelRec ); + + freerdsrec( DelRec, GRAAL_SIZE ); + } + } + + ScanRec = InstanceRds->LAYERTAB[ RDS_ABOX ]; + + SetGraalFlatten( ScanRec ); + + InstanceMbk = (phins_list *)GRAAL_MBK( ScanRec ); + + inssegmbkrds( InstanceMbk, ModelMbk, InstanceRds, 1 ); + insconmbkrds( InstanceMbk, ModelMbk, InstanceRds ); + insrefmbkrds( InstanceMbk, ModelMbk, InstanceRds ); + insviambkrds( InstanceMbk, ModelMbk, InstanceRds, 1 ); + + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + for ( ScanRec = InstanceRds->LAYERTAB[ Layer ]; + ScanRec != (rdsrec_list *)NULL; + ScanRec = ScanRec->NEXT ) + { + GRAAL_MBK( ScanRec ) = (void *)InstanceMbk; + GRAAL_PREVIOUS( ScanRec ) = (rdsrec_list **)InstanceRds; + + GraalInsertRectangle( ScanRec ); + } + } + + delphfig( ModelMbk->NAME ); + + rdsend(); + return( InstanceRds ); +} + +/*------------------------------------------------------------\ +| | +| Graal Unflat Instance | +| | +\------------------------------------------------------------*/ + +rdsins_list *GraalUnflatInstance( InstanceRds ) + + rdsins_list *InstanceRds; +{ + phfig_list *ModelMbk; + phins_list *InstanceMbk; + rdsrec_list *Rectangle; + rdsrec_list *ScanRec; + rdsrec_list *DelRec; + char Layer; + + rdsbegin(); + + delphfig( InstanceRds->FIGNAME ); + + ModelMbk = Graalgetphfig( InstanceRds->FIGNAME, 'P' ); + + if ( ModelMbk == (phfig_list *)NULL ) + { + rdsend(); + return( (rdsins_list *)NULL ); + } + + for ( Layer = 0; Layer < RDS_ABOX; Layer++ ) + { + ScanRec = InstanceRds->LAYERTAB[ Layer ]; + + InstanceRds->LAYERTAB[ Layer ] = (rdsrec_list *)NULL; + + while( ScanRec != (rdsrec_list *)NULL ) + { + DelRec = ScanRec; + ScanRec = ScanRec->NEXT; + + GraalEraseRectangle( DelRec ); + + freerdsrec( DelRec, GRAAL_SIZE ); + } + } + + ScanRec = InstanceRds->LAYERTAB[ RDS_ABOX ]; + + ClearGraalFlatten( ScanRec ); + + InstanceMbk = (phins_list *)GRAAL_MBK( ScanRec ); + + inssegmbkrds( InstanceMbk, ModelMbk, InstanceRds, 1 ); + insconmbkrds( InstanceMbk, ModelMbk, InstanceRds ); + insrefmbkrds( InstanceMbk, ModelMbk, InstanceRds ); + insviambkrds( InstanceMbk, ModelMbk, InstanceRds, 1 ); + + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + for ( ScanRec = InstanceRds->LAYERTAB[ Layer ]; + ScanRec != (rdsrec_list *)NULL; + ScanRec = ScanRec->NEXT ) + { + GRAAL_MBK( ScanRec ) = (void *)InstanceMbk; + GRAAL_PREVIOUS( ScanRec ) = (rdsrec_list **)InstanceRds; + + GraalInsertRectangle( ScanRec ); + } + } + + delphfig( ModelMbk->NAME ); + + rdsend(); + return( InstanceRds ); +} + +/*------------------------------------------------------------\ +| | +| Graal Add Segment | +| | +\------------------------------------------------------------*/ + +rdsrec_list *GraalAddSegment( SegmentMbk ) + + phseg_list *SegmentMbk; +{ + rdsrec_list *ScanRec; + rdsrec_list *ScanPrev; + rdsrec_list *FirstRec; + rdsrec_list **Previous; + + rdsbegin(); + + ScanRec = FirstRec = segmbkrds( GraalFigureRds, SegmentMbk, 1 ); + + if ( FirstRec == (rdsrec_list *)NULL ) + { + rdsend(); + return( FirstRec ); + } + + do + { + GRAAL_MBK( ScanRec ) = (void *)SegmentMbk; + + if ( ScanRec != FirstRec ) ScanRec->NAME = (char *)0; + + GraalInsertRectangle( ScanRec ); + + if ( GRAAL_PREVIOUS( ScanRec ) == (rdsrec_list **)NULL ) + { + Previous = &(GraalFigureRds->LAYERTAB[ GetRdsLayer( ScanRec ) ]); + + for ( ScanPrev = *Previous; + ScanPrev != ScanRec; + ScanPrev = ScanPrev->NEXT ) + { + if ( GRAAL_PREVIOUS( ScanPrev ) == (rdsrec_list **)NULL ) + { + GRAAL_PREVIOUS( ScanPrev ) = Previous; + } + + Previous = &ScanPrev->NEXT; + } + + GRAAL_PREVIOUS( ScanRec ) = Previous; + + ScanPrev = ScanPrev->NEXT; + + if ( ( ScanPrev != (rdsrec_list *)NULL ) && + ( GRAAL_PREVIOUS( ScanPrev ) != (rdsrec_list **)NULL ) ) + { + GRAAL_PREVIOUS( ScanPrev ) = &ScanRec->NEXT; + } + } + + ScanRec = (rdsrec_list *)ScanRec->USER; + } + while ( ScanRec != FirstRec ); + + rdsend(); + return( FirstRec ); +} + +/*------------------------------------------------------------\ +| | +| Graal Add Connector | +| | +\------------------------------------------------------------*/ + +rdsrec_list *GraalAddConnector( ConnectorMbk ) + + phcon_list *ConnectorMbk; +{ + rdsrec_list *Rectangle; + + rdsbegin(); + + Rectangle = conmbkrds( GraalFigureRds, ConnectorMbk ); + + if ( Rectangle == (rdsrec_list *)NULL ) + { + rdsend(); + return( Rectangle ); + } + + GraalAddConRec( Rectangle ); + + GRAAL_MBK( Rectangle ) = (void *)ConnectorMbk; + + GraalInsertRectangle( Rectangle ); + + GRAAL_PREVIOUS( Rectangle ) = + + &(GraalFigureRds->LAYERTAB[ GetRdsLayer( Rectangle ) ]); + + if ( Rectangle->NEXT != (rdsrec_list *)NULL ) + { + GRAAL_PREVIOUS( Rectangle->NEXT ) = &Rectangle->NEXT; + } + + rdsend(); + return( Rectangle ); +} + +/*------------------------------------------------------------\ +| | +| Graal Add Via | +| | +\------------------------------------------------------------*/ + +rdsrec_list *GraalAddVia( ViaMbk ) + + phvia_list *ViaMbk; +{ + rdsrec_list *ScanRec; + rdsrec_list *ScanPrev; + rdsrec_list *FirstRec; + rdsrec_list **Previous; + + rdsbegin(); + + ScanRec = FirstRec = viambkrds( GraalFigureRds, ViaMbk, 1 ); + + if ( FirstRec == (rdsrec_list *)NULL ) + { + rdsend(); + return( FirstRec ); + } + + do + { + GRAAL_MBK( ScanRec ) = (void *)ViaMbk; + + GraalInsertRectangle( ScanRec ); + + if ( GRAAL_PREVIOUS( ScanRec ) == (rdsrec_list **)NULL ) + { + Previous = &(GraalFigureRds->LAYERTAB[ GetRdsLayer( ScanRec ) ]); + + for ( ScanPrev = *Previous; + ScanPrev != ScanRec; + ScanPrev = ScanPrev->NEXT ) + { + if ( GRAAL_PREVIOUS( ScanPrev ) == (rdsrec_list **)NULL ) + { + GRAAL_PREVIOUS( ScanPrev ) = Previous; + } + + Previous = &ScanPrev->NEXT; + } + + GRAAL_PREVIOUS( ScanRec ) = Previous; + + ScanPrev = ScanPrev->NEXT; + + if ( ( ScanPrev != (rdsrec_list *)NULL ) && + ( GRAAL_PREVIOUS( ScanPrev ) != (rdsrec_list **)NULL ) ) + { + GRAAL_PREVIOUS( ScanPrev ) = &ScanRec->NEXT; + } + } + + ScanRec = (rdsrec_list *)ScanRec->USER; + } + while ( ScanRec != FirstRec ); + + rdsend(); + return( FirstRec ); +} + +/*------------------------------------------------------------\ +| | +| Graal Add Reference | +| | +\------------------------------------------------------------*/ + +rdsrec_list *GraalAddReference( ReferenceMbk ) + + phref_list *ReferenceMbk; +{ + rdsrec_list *ScanRec; + rdsrec_list *ScanPrev; + rdsrec_list *FirstRec; + rdsrec_list **Previous; + + rdsbegin(); + + ScanRec = FirstRec = refmbkrds( GraalFigureRds, ReferenceMbk ); + + if ( FirstRec == (rdsrec_list *)NULL ) + { + rdsend(); + return( FirstRec ); + } + + do + { + GRAAL_MBK( ScanRec ) = (void *)ReferenceMbk; + + GraalInsertRectangle( ScanRec ); + + if ( GRAAL_PREVIOUS( ScanRec ) == (rdsrec_list **)NULL ) + { + Previous = &(GraalFigureRds->LAYERTAB[ GetRdsLayer( ScanRec ) ]); + + for ( ScanPrev = *Previous; + ScanPrev != ScanRec; + ScanPrev = ScanPrev->NEXT ) + { + if ( GRAAL_PREVIOUS( ScanPrev ) == (rdsrec_list **)NULL ) + { + GRAAL_PREVIOUS( ScanPrev ) = Previous; + } + + Previous = &ScanPrev->NEXT; + } + + GRAAL_PREVIOUS( ScanRec ) = Previous; + + ScanPrev = ScanPrev->NEXT; + + if ( ( ScanPrev != (rdsrec_list *)NULL ) && + ( GRAAL_PREVIOUS( ScanPrev ) != (rdsrec_list **)NULL ) ) + { + GRAAL_PREVIOUS( ScanPrev ) = &ScanRec->NEXT; + } + } + + ScanRec = (rdsrec_list *)ScanRec->USER; + } + while ( ScanRec != FirstRec ); + + rdsend(); + return( FirstRec ); +} + +/*------------------------------------------------------------\ +| | +| Graal Add Abox | +| | +\------------------------------------------------------------*/ + +rdsrec_list *GraalAddAbox() + +{ + rdsrec_list *Rectangle; + + rdsbegin(); + + Rectangle = aboxmbkrds( GraalFigureMbk, GraalFigureRds ); + + if ( Rectangle != (rdsrec_list *)NULL ) + { + GRAAL_PREVIOUS( Rectangle ) = + + &(GraalFigureRds->LAYERTAB[ RDS_ABOX ]); + + if ( Rectangle->NEXT != (rdsrec_list *)NULL ) + { + GRAAL_PREVIOUS( Rectangle->NEXT ) = &Rectangle->NEXT; + } + + GRAAL_MBK( Rectangle ) = (void *)GraalFigureMbk; + + GraalInsertRectangle( Rectangle ); + } + + rdsend(); + return( Rectangle ); +} + +/*------------------------------------------------------------\ +| | +| Graal Delete Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Graal Del Figure | +| | +\------------------------------------------------------------*/ + +void GraalDelFigure() + +{ + char Layer; + rdsrec_list *DelRec; + rdsrec_list *ScanRec; + rdsins_list *ScanIns; + rdsins_list *DelIns; + + rdsbegin(); + + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + ScanRec = GraalFigureRds->LAYERTAB[ Layer ]; + + while ( ScanRec != (rdsrec_list *)NULL ) + { + DelRec = ScanRec; + ScanRec = ScanRec->NEXT; + + GraalEraseRecWin( DelRec ); + + freerdsrec( DelRec, GRAAL_SIZE ); + } + + GraalFigureRds->LAYERTAB[ Layer ] = (rdsrec_list *)NULL; + } + + ScanIns = GraalFigureRds->INSTANCE; + + while ( ScanIns != (rdsins_list *)NULL ) + { + DelIns = ScanIns; + ScanIns = ScanIns->NEXT; + + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + ScanRec = GraalFigureRds->LAYERTAB[ Layer ]; + + while ( ScanRec != (rdsrec_list *)NULL ) + { + DelRec = ScanRec; + ScanRec = ScanRec->NEXT; + + GraalEraseRecWin( DelRec ); + + freerdsrec( DelRec, GRAAL_SIZE ); + } + } + + freerdsins( DelIns ); + } + + GraalFigureRds->INSTANCE = (rdsins_list *)NULL; + + while ( HEAD_RDSFIG != (rdsfig_list *)0 ) + { + delrdsfig( HEAD_RDSFIG->NAME ); + } + + while ( HEAD_PHFIG != (phfig_list *)0 ) + { + delphfig( HEAD_PHFIG->NAME ); + } + + GraalDelAllConRec(); + + GraalFigureRds = (rdsfig_list *)NULL; + GraalFigureMbk = (phfig_list *)NULL; + + GraalEraseWindow(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Graal Del Instance | +| | +\------------------------------------------------------------*/ + +void GraalDelInstance( InstanceRds ) + + rdsins_list *InstanceRds; +{ + phins_list *InstanceMbk; + rdsrec_list *ScanRec; + rdsrec_list *DelRec; + char Layer; + + rdsbegin(); + + *(rdsins_list **)(InstanceRds->USER) = InstanceRds->NEXT; + + if ( InstanceRds->NEXT != (rdsins_list *)NULL ) + { + InstanceRds->NEXT->USER = InstanceRds->USER; + } + + InstanceMbk = (phins_list *)GRAAL_MBK( InstanceRds->LAYERTAB[ RDS_ABOX ] ); + + *(phins_list **)(InstanceMbk->USER) = InstanceMbk->NEXT; + + if ( InstanceMbk->NEXT != (phins_list *)NULL ) + { + InstanceMbk->NEXT->USER = InstanceMbk->USER; + } + + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + ScanRec = InstanceRds->LAYERTAB[ Layer ]; + + while( ScanRec != (rdsrec_list *)NULL ) + { + DelRec = ScanRec; + ScanRec = ScanRec->NEXT; + + GraalEraseRectangle( DelRec ); + + freerdsrec( DelRec, GRAAL_SIZE ); + } + } + + freerdsins( InstanceRds ); + mbkfree( InstanceMbk ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Graal Del Rectangle | +| | +\------------------------------------------------------------*/ + +void GraalDelRectangle( Rectangle ) + + rdsrec_list *Rectangle; +{ + rdsrec_list *ScanRec; + rdsrec_list *DelRec; + void *Pointer; + + rdsbegin(); + + Pointer = GRAAL_MBK( Rectangle ); + + if ( IsRdsSegment( Rectangle ) ) + { + *((phseg_list **)(((phseg_list *)Pointer)->USER)) = ((phseg_list *)Pointer)->NEXT; + + if ( ((phseg_list *)Pointer)->NEXT != (phseg_list *)NULL ) + { + ((phseg_list *)Pointer)->NEXT->USER = ((phseg_list *)Pointer)->USER; + } + + mbkfree( Pointer ); + } + else + if ( IsRdsVia( Rectangle ) ) + { + *(phvia_list **)(((phvia_list *)Pointer)->USER) = ((phvia_list *)Pointer)->NEXT; + + if (((phvia_list *)Pointer)->NEXT != (phvia_list *)NULL ) + { + ((phvia_list *)Pointer)->NEXT->USER = ((phvia_list *)Pointer)->USER; + } + + mbkfree( Pointer ); + } + else + if ( IsRdsConnector( Rectangle ) ) + { + *(phcon_list **)(((phcon_list *)Pointer)->USER) = ((phcon_list *)Pointer)->NEXT; + + if (((phcon_list *)Pointer)->NEXT != (phcon_list *)NULL ) + { + ((phcon_list *)Pointer)->NEXT->USER = ((phcon_list *)Pointer)->USER; + } + + GraalDelConRec( Rectangle ); + + mbkfree( Pointer ); + } + else + if ( IsRdsReference( Rectangle ) ) + { + *(phref_list **)(((phref_list *)Pointer)->USER) = ((phref_list *)Pointer)->NEXT; + + if (((phref_list *)Pointer)->NEXT != (phref_list *)NULL ) + { + ((phref_list *)Pointer)->NEXT->USER = ((phref_list *)Pointer)->USER; + } + + mbkfree( Pointer ); + } +/*\ + else + if ( IsRdsFigure( Rectangle ) ) + { + if ( GraalFigureRds->LAYERTAB[ RDS_ABOX ] == Rectangle ) + { + GraalFigureMbk->XAB1 = 0; + GraalFigureMbk->YAB1 = 0; + GraalFigureMbk->XAB2 = 0; + GraalFigureMbk->YAB2 = 0; + } + } +\*/ + + ScanRec = Rectangle; + + do + { + DelRec = ScanRec; + ScanRec = (rdsrec_list *)(ScanRec->USER); + + *(GRAAL_PREVIOUS( DelRec )) = DelRec->NEXT; + + if ( DelRec->NEXT != (rdsrec_list *)NULL ) + { + GRAAL_PREVIOUS( DelRec->NEXT ) = GRAAL_PREVIOUS( DelRec ); + } + + GraalEraseRectangle( DelRec ); + + freerdsrec( DelRec, GRAAL_SIZE ); + } + while ( ScanRec != Rectangle ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Graal Save Figure | +| | +\------------------------------------------------------------*/ + +char GraalSaveFigure() + +{ + rdsbegin(); + + GraalDelUndo( &GraalHeadRedo ); + GraalDelUndo( &GraalHeadUndo ); + + rdsend(); + return( Graalsavephfig( GraalFigureMbk ) ); +} + +/*------------------------------------------------------------\ +| | +| Graalgetphfig | +| | +\------------------------------------------------------------*/ + +phfig_list *Graalgetphfig( FigureName, Mode ) + + char *FigureName; + char Mode; +{ + phfig_list *FigureMbk; + + rdsbegin(); + + GraalActiveExitHandler(); + + if ( setjmp( GraalJumpBuffer ) == 0 ) + { + FigureMbk = getphfig( FigureName, Mode ); + + GraalResetExitHandler(); + + if ( ( FigureMbk->XAB1 == FigureMbk->XAB2 ) && + ( FigureMbk->YAB1 == FigureMbk->YAB2 ) ) + { + FigureMbk->XAB1 = 0; + FigureMbk->XAB2 = 0; + FigureMbk->YAB1 = 0; + FigureMbk->YAB2 = 0; + } + + rdsend(); + return( FigureMbk ); + } + + GraalResetExitHandler(); + + delphfig( FigureName ); + + rdsend(); + return( (phfig_list *)NULL ); +} + +/*------------------------------------------------------------\ +| | +| Graalrflattenphfig | +| | +\------------------------------------------------------------*/ + +phfig_list *Graalrflattenphfig( FigureMbk, Concat, Catal ) + + phfig_list *FigureMbk; + char Concat; + char Catal; +{ + rdsbegin(); + + GraalActiveExitHandler(); + + if ( setjmp( GraalJumpBuffer ) == 0 ) + { + rflattenphfig( FigureMbk, Concat, Catal ); + + GraalResetExitHandler(); + + rdsend(); + return( FigureMbk ); + } + + GraalResetExitHandler(); + + rdsend(); + return( (phfig_list *)NULL ); +} + +/*------------------------------------------------------------\ +| | +| Graalflattenphfig | +| | +\------------------------------------------------------------*/ + +phfig_list *Graalflattenphfig( FigureMbk, Name, Concat ) + + phfig_list *FigureMbk; + char *Name; + char Concat; +{ + rdsbegin(); + + GraalActiveExitHandler(); + + if ( setjmp( GraalJumpBuffer ) == 0 ) + { + flattenphfig( FigureMbk, Name, Concat ); + + GraalResetExitHandler(); + + rdsend(); + return( FigureMbk ); + } + + GraalResetExitHandler(); + + rdsend(); + return( (phfig_list *)NULL ); +} + +/*------------------------------------------------------------\ +| | +| Graalsavephfig | +| | +\------------------------------------------------------------*/ + +char Graalsavephfig( FigureMbk ) + + phfig_list *FigureMbk; +{ + rdsbegin(); + + GraalActiveExitHandler(); + + if ( setjmp( GraalJumpBuffer ) == 0 ) + { + savephfig( FigureMbk ); + + GraalResetExitHandler(); + + rdsend(); + return( GRAAL_TRUE ); + } + + GraalResetExitHandler(); + + rdsend(); + return( GRAAL_FALSE ); +} + +/*------------------------------------------------------------\ +| | +| Graaldrucrdsfig | +| | +\------------------------------------------------------------*/ + +rdsfig_list *Graaldrucrdsfig( Figure ) + + rdsfig_list *Figure; +{ + rdsfig_list *FigureError; + + rdsbegin(); + + GraalActiveExitHandler(); + + if ( setjmp( GraalJumpBuffer ) == 0 ) + { + FigureError = drucrdsfig( Figure, + RDS_TECHNO_NAME, + "_druc_err_" ); + GraalResetExitHandler(); + + rdsend(); + return( FigureError ); + } + + GraalResetExitHandler(); + + delrdsfig( Figure->NAME ); + + rdsend(); + return( (rdsfig_list *)NULL ); +} + +/*------------------------------------------------------------\ +| | +| Graalgetrdsfig | +| | +\------------------------------------------------------------*/ + +rdsfig_list *Graalgetrdsfig( FigureName, Mode ) + + char *FigureName; + char Mode; +{ + rdsfig_list *FigureRds; + + rdsbegin(); + + FigureName = namealloc( FigureName ); + GraalActiveExitHandler(); + + if ( setjmp( GraalJumpBuffer ) == 0 ) + { + FigureRds = getrdsfig( FigureName, Mode, GRAAL_SIZE ); + + GraalResetExitHandler(); + + rdsend(); + return( FigureRds ); + } + + GraalResetExitHandler(); + + delrdsfig( FigureName ); + + rdsend(); + return( (rdsfig_list *)NULL ); +} + +/*------------------------------------------------------------\ +| | +| Graalrflattenrdsfig | +| | +\------------------------------------------------------------*/ + +rdsfig_list *Graalrflattenrdsfig( Figure, Concat, Catal ) + + rdsfig_list *Figure; + char Concat; + char Catal; +{ + rdsbegin(); + + GraalActiveExitHandler(); + + if ( setjmp( GraalJumpBuffer ) == 0 ) + { + rflattenrdsfig( Figure, Concat, Catal ); + + GraalResetExitHandler(); + + rdsend(); + return( Figure ); + } + + GraalResetExitHandler(); + + rdsend(); + return( (rdsfig_list *)0 ); +} diff --git a/alliance/src/graal/src/GRM_mbkrds.h b/alliance/src/graal/src/GRM_mbkrds.h new file mode 100644 index 00000000..b434f495 --- /dev/null +++ b/alliance/src/graal/src/GRM_mbkrds.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : MbkRds.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRM_MBKRDS +# define GRM_MBKRDS + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GRM_peek.c b/alliance/src/graal/src/GRM_peek.c new file mode 100644 index 00000000..66a588b4 --- /dev/null +++ b/alliance/src/graal/src/GRM_peek.c @@ -0,0 +1,534 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| File : Peek.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GRM.h" +# include "GSB.h" +# include "GRM_peek.h" + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + graalpeek *GraalHeadPeek = (graalpeek *)0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Alloc Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalAllocPeek | +| | +\------------------------------------------------------------*/ + +graalpeek *GraalAllocPeek() +{ + return((graalpeek *)rdsalloc(sizeof(graalpeek), 1)); +} + +/*------------------------------------------------------------\ +| | +| Free Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalFreePeek | +| | +\------------------------------------------------------------*/ + +void GraalFreePeek( FreePeek ) + + graalpeek *FreePeek; +{ + rdsfree((char *)FreePeek, sizeof(graalpeek)); +} + +/*------------------------------------------------------------\ +| | +| GraalAddPeek | +| | +\------------------------------------------------------------*/ + +void GraalAddPeek( Rectangle ) + + rdsrec_list *Rectangle; +{ + graalpeek *Peek; + + rdsbegin(); + + Peek = GraalAllocPeek(); + + Peek->RECTANGLE = Rectangle; + Peek->NEXT = GraalHeadPeek; + GraalHeadPeek = Peek; + + SetGraalPeek( Rectangle ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDelPeek | +| | +\------------------------------------------------------------*/ + +void GraalDelPeek() + +{ + graalpeek *Peek; + rdsins_list *Instance; + rdsrec_list *ScanRec; + rdsrec_list *DelRec; + rdsrec_list **Previous; + char Layer; + + rdsbegin(); + + while ( GraalHeadPeek != (graalpeek *)0 ) + { + Peek = GraalHeadPeek; + ScanRec = Peek->RECTANGLE; + + ClearGraalPeek( ScanRec ); + + Instance = (rdsins_list *)GRAAL_PREVIOUS( ScanRec ); + + for ( Layer = 0; Layer < RDS_ABOX; Layer++ ) + { + Previous = &Instance->LAYERTAB[ Layer ]; + ScanRec = *Previous; + + while( ScanRec != (rdsrec_list *)0 ) + { + DelRec = ScanRec; + ScanRec = ScanRec->NEXT; + + if ( IsGraalPeek( DelRec ) ) + { + *Previous = ScanRec; + + GraalEraseRectangle( DelRec ); + + freerdsrec( DelRec, GRAAL_SIZE ); + } + else + { + Previous = &DelRec->NEXT; + } + } + } + + GraalHeadPeek = GraalHeadPeek->NEXT; + + GraalFreePeek( Peek ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Graal Peek Instance | +| | +\------------------------------------------------------------*/ + +void GraalPeekInstance( Rectangle, LambdaX1, LambdaY1, LambdaX2, LambdaY2 ) + + rdsrec_list *Rectangle; + long LambdaX1; + long LambdaY1; + long LambdaX2; + long LambdaY2; +{ + phfig_list *ModelMbk; + phfig_list *FigureMbk; + + phins_list *InstanceMbk; + phins_list *SourceMbk; + phins_list **PreviousMbk; + + rdsfig_list *FigureRds; + rdsins_list *TargetRds; + rdsrec_list *ScanRec; + rdsrec_list *DelRec; + void *Pointer; + void *Delete; + long X1; + long Y1; + long X2; + long Y2; + long Xab1; + long Yab1; + long Xab2; + long Yab2; + long XabMin; + long YabMin; + long XabMax; + long YabMax; + long Swap; + char Layer; + + rdsbegin(); + + XabMin = LambdaX1 - GRAAL_PEEK_BOUND; + YabMin = LambdaY1 - GRAAL_PEEK_BOUND; + XabMax = LambdaX2 + GRAAL_PEEK_BOUND; + YabMax = LambdaY2 + GRAAL_PEEK_BOUND; + + FigureRds = addrdsfig( "_ludo_", GRAAL_SIZE ); + FigureMbk = addphfig( "_ludo_" ); + SourceMbk = (phins_list *)GRAAL_MBK( Rectangle ); + TargetRds = (rdsins_list *)GRAAL_PREVIOUS( Rectangle ); + + InstanceMbk = addphins( FigureMbk, + SourceMbk->FIGNAME, SourceMbk->INSNAME, + SourceMbk->TRANSF, + SourceMbk->XINS, SourceMbk->YINS ); + do + { + Pointer = (void *) + + Graalflattenphfig( FigureMbk, FigureMbk->PHINS->INSNAME, YES ); + + if ( Pointer == (void *)0 ) break; + + Pointer = (void *)FigureMbk->PHSEG; + FigureMbk->PHSEG = (phseg_list *)0; + + while( Pointer != (void *)0 ) + { + Delete = Pointer; + Pointer = ((phseg_list *)Pointer)->NEXT; + + segmbkrds( FigureRds, (phseg_list *)Delete, 1 ); + mbkfree( Delete ); + } + + Pointer = (void *)FigureMbk->PHREF; + FigureMbk->PHREF = (phref_list *)0; + + while( Pointer != (void *)0 ) + { + Delete = Pointer; + Pointer = ((phref_list *)Pointer)->NEXT; + + refmbkrds( FigureRds, (phref_list *)Delete ); + mbkfree( Delete ); + } + + Pointer = (void *)FigureMbk->PHVIA; + FigureMbk->PHVIA = (phvia_list *)0; + + while( Pointer != (void *)0 ) + { + Delete = Pointer; + Pointer = ((phvia_list *)Pointer)->NEXT; + + viambkrds( FigureRds, (phvia_list *)Delete, 1 ); + mbkfree( Delete ); + } + + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + ScanRec = FigureRds->LAYERTAB[ Layer ]; + + while ( ScanRec != (rdsrec_list *)0 ) + { + DelRec = ScanRec; + ScanRec = ScanRec->NEXT; + + X1 = DelRec->X; + Y1 = DelRec->Y; + X2 = DelRec->DX + X1; + Y2 = DelRec->DY + Y1; + + if ( ( X1 < LambdaX2 ) && + ( Y1 < LambdaY2 ) && + ( X2 > LambdaX1 ) && + ( Y2 > LambdaY1 ) ) + { + SetGraalPeek( DelRec ); + ClearRdsFigRec( DelRec ); + + DelRec->NEXT = TargetRds->LAYERTAB[ Layer ]; + TargetRds->LAYERTAB[ Layer ] = DelRec; + + GRAAL_MBK( DelRec ) = (void *)SourceMbk; + GRAAL_PREVIOUS( DelRec ) = (rdsrec_list **)TargetRds; + + if ( X1 < LambdaX1 ) { X1 = LambdaX1; } + if ( Y1 < LambdaY1 ) { Y1 = LambdaY1; } + if ( X2 > LambdaX2 ) { X2 = LambdaX2; } + if ( Y2 > LambdaY2 ) { Y2 = LambdaY2; } + + DelRec->X = X1; + DelRec->Y = Y1; + DelRec->DX = X2 - X1; + DelRec->DY = Y2 - Y1; + + GraalInsertRectangle( DelRec ); + } + else + { + freerdsrec( DelRec, GRAAL_SIZE ); + } + } + + FigureRds->LAYERTAB[ Layer ] = (rdsrec_list *)0; + } + + InstanceMbk = FigureMbk->PHINS; + PreviousMbk = &FigureMbk->PHINS; + + while( InstanceMbk != (phins_list *)0 ) + { + ModelMbk = Graalgetphfig( InstanceMbk->FIGNAME, 'P' ); + + if ( ModelMbk != (phfig_list *)0 ) + { + xyflat + ( &Xab1 , &Yab1, + ModelMbk->XAB1 , ModelMbk->YAB1, + InstanceMbk->XINS , InstanceMbk->YINS, + ModelMbk->XAB1 , ModelMbk->YAB1, + ModelMbk->XAB2 , ModelMbk->YAB2, + InstanceMbk->TRANSF + ); + + xyflat + ( &Xab2 , &Yab2, + ModelMbk->XAB2 , ModelMbk->YAB2, + InstanceMbk->XINS , InstanceMbk->YINS, + ModelMbk->XAB1 , ModelMbk->YAB1, + ModelMbk->XAB2 , ModelMbk->YAB2, + InstanceMbk->TRANSF + ); + + Xab1 = RfmRoundLow( Xab1 * GRAAL_RDS_LAMBDA / GRAAL_SCALE_X ); + Yab1 = RfmRoundLow( Yab1 * GRAAL_RDS_LAMBDA / GRAAL_SCALE_X ); + Xab2 = RfmRoundHigh( Xab2 * GRAAL_RDS_LAMBDA / GRAAL_SCALE_X ); + Yab2 = RfmRoundHigh( Yab2 * GRAAL_RDS_LAMBDA / GRAAL_SCALE_X ); + + if ( Xab1 > Xab2 ) { Swap = Xab1; Xab1 = Xab2; Xab2 = Swap; } + if ( Yab1 > Yab2 ) { Swap = Yab1; Yab1 = Yab2; Yab2 = Swap; } + + if ( ( Xab1 < XabMax ) && + ( Yab1 < YabMax ) && + ( Xab2 > XabMin ) && + ( Yab2 > YabMin ) ) + { + PreviousMbk = &InstanceMbk->NEXT; + InstanceMbk = InstanceMbk->NEXT; + + continue; + } + } + + *PreviousMbk = InstanceMbk->NEXT; + Delete = (void *)InstanceMbk; + InstanceMbk = InstanceMbk->NEXT; + + mbkfree( Delete ); + } + } + while( FigureMbk->PHINS != (phins_list *)0 ); + + delphfig( "_ludo_" ); + delrdsfig( "_ludo_" ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Graal Real Flat Instance | +| | +\------------------------------------------------------------*/ + +char GraalRealFlatInstance( Rectangle ) + + rdsrec_list *Rectangle; +{ + phfig_list *FigureMbk; + phins_list *InstanceMbk; + phins_list *SourceMbk; + + void *Pointer; + void *Previous; + void *SavePointer; + + rdsbegin(); + + FigureMbk = addphfig( "_ludo_" ); + SourceMbk = (phins_list *)GRAAL_MBK( Rectangle ); + + InstanceMbk = addphins( FigureMbk, + SourceMbk->FIGNAME, SourceMbk->INSNAME, + SourceMbk->TRANSF, + SourceMbk->XINS, SourceMbk->YINS ); + Pointer = (void *) + + Graalflattenphfig( FigureMbk, FigureMbk->PHINS->INSNAME, YES ); + + if ( Pointer == (void *)0 ) + { + delphfig( "_ludo_" ); + + rdsend(); + return( GRAAL_FALSE ); + } + + SavePointer = (void *)(GraalFigureMbk->PHSEG); + GraalFigureMbk->PHSEG = FigureMbk->PHSEG; + Previous = (void *)(&(GraalFigureMbk->PHSEG)); + + for ( Pointer = (void *)(FigureMbk->PHSEG); + Pointer != (void *)0; + Pointer = (void *)(((phseg_list *)Pointer)->NEXT)) + { + ((phseg_list *)Pointer)->USER = Previous; + Previous = (void *)(&((phseg_list *)Pointer)->NEXT); + + GraalAddSegment( (phseg_list *)Pointer ); + } + + if ( SavePointer != (void *)0 ) + { + *(phseg_list **)Previous = (phseg_list *)SavePointer; + ((phseg_list *)SavePointer)->USER = Previous; + } + + FigureMbk->PHSEG = (phseg_list *)0; + + SavePointer = (void *)(GraalFigureMbk->PHREF); + GraalFigureMbk->PHREF = FigureMbk->PHREF; + Previous = (void *)(&(GraalFigureMbk->PHREF)); + + for ( Pointer = (void *)(FigureMbk->PHREF); + Pointer != (void *)0; + Pointer = (void *)(((phref_list *)Pointer)->NEXT)) + { + ((phref_list *)Pointer)->USER = Previous; + Previous = (void *)(&((phref_list *)Pointer)->NEXT); + + GraalAddReference( (phref_list *)Pointer ); + } + + if ( SavePointer != (void *)0 ) + { + *(phref_list **)Previous = (phref_list *)SavePointer; + ((phref_list *)SavePointer)->USER = Previous; + } + + FigureMbk->PHREF = (phref_list *)0; + + SavePointer = (void *)(GraalFigureMbk->PHVIA); + GraalFigureMbk->PHVIA = FigureMbk->PHVIA; + Previous = (void *)(&(GraalFigureMbk->PHVIA)); + + for ( Pointer = (void *)(GraalFigureMbk->PHVIA); + Pointer != (void *)0; + Pointer = (void *)(((phvia_list *)Pointer)->NEXT)) + { + ((phvia_list *)Pointer)->USER = Previous; + Previous = (void *)(&((phvia_list *)Pointer)->NEXT); + + GraalAddVia( (phvia_list *)Pointer ); + } + + if ( SavePointer != (void *)0 ) + { + *(phvia_list **)Previous = (phvia_list *)SavePointer; + ((phvia_list *)SavePointer)->USER = Previous; + } + + FigureMbk->PHVIA = (phvia_list *)0; + + SavePointer = (void *)(GraalFigureMbk->PHINS); + GraalFigureMbk->PHINS = FigureMbk->PHINS; + Previous = (void *)(&(GraalFigureMbk->PHINS)); + + for ( Pointer = (void *)(FigureMbk->PHINS); + Pointer != (void *)0; + Pointer = (void *)(((phins_list *)Pointer)->NEXT)) + { + ((phins_list *)Pointer)->USER = Previous; + Previous = (void *)(&((phins_list *)Pointer)->NEXT); + + GraalAddInstance( (phins_list *)Pointer ); + } + + if ( SavePointer != (void *)0 ) + { + *(phins_list **)Previous = (phins_list *)SavePointer; + ((phins_list *)SavePointer)->USER = Previous; + } + + FigureMbk->PHINS = (phins_list *)0; + + delphfig( "_ludo_" ); + + GraalDelUndo( &GraalHeadRedo ); + GraalDelUndo( &GraalHeadUndo ); + + GraalDelInstance( (rdsins_list *)GRAAL_PREVIOUS( Rectangle ) ); + + rdsend(); + return( GRAAL_TRUE ); +} diff --git a/alliance/src/graal/src/GRM_peek.h b/alliance/src/graal/src/GRM_peek.h new file mode 100644 index 00000000..a1c663fb --- /dev/null +++ b/alliance/src/graal/src/GRM_peek.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Peek.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRM_PEEK +# define GRM_PEEK + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GRM_search.c b/alliance/src/graal/src/GRM_search.c new file mode 100644 index 00000000..1796f2bd --- /dev/null +++ b/alliance/src/graal/src/GRM_search.c @@ -0,0 +1,207 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| File : Search.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GRM.h" +# include "GSB.h" +# include "GRM_search.h" + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + graalsearch *GraalHeadSearch = (graalsearch *)NULL; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Alloc Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalAllocSearch | +| | +\------------------------------------------------------------*/ + +graalsearch *GraalAllocSearch() +{ + return((graalsearch *)rdsalloc(sizeof(graalsearch), 1)); +} + +/*------------------------------------------------------------\ +| | +| Free Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalFreeSearch | +| | +\------------------------------------------------------------*/ + +void GraalFreeSearch( FreeSearch ) + + graalsearch *FreeSearch; +{ + rdsfree((char *)FreeSearch, sizeof(graalsearch)); +} + +/*------------------------------------------------------------\ +| | +| GraalSetSearchRectangle | +| | +\------------------------------------------------------------*/ + +void GraalSetSearchRectangle( Rectangle ) + + rdsrec_list *Rectangle; +{ + rdsrec_list *ScanRec; + + rdsbegin(); + + ScanRec = Rectangle; + + do + { + SetGraalSearch( ScanRec ); + + ScanRec = (rdsrec_list *)ScanRec->USER; + } + while( Rectangle != ScanRec ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalClearSearchRectangle | +| | +\------------------------------------------------------------*/ + +void GraalClearSearchRectangle( Rectangle ) + + rdsrec_list *Rectangle; +{ + rdsrec_list *ScanRec; + + rdsbegin(); + + ScanRec = Rectangle; + + do + { + ClearGraalSearch( ScanRec ); + + ScanRec = (rdsrec_list *)ScanRec->USER; + } + while( Rectangle != ScanRec ); + + rdsend(); +} + + +/*------------------------------------------------------------\ +| | +| GraalAddSearch | +| | +\------------------------------------------------------------*/ + +void GraalAddSearch( Rectangle ) + + rdsrec_list *Rectangle; +{ + graalsearch *Search; + + rdsbegin(); + + if ( ! IsGraalSearch( Rectangle ) ) + { + Search = GraalAllocSearch(); + + Search->RECTANGLE = Rectangle; + Search->NEXT = GraalHeadSearch; + GraalHeadSearch = Search; + + GraalSetSearchRectangle( Rectangle ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDelSearch | +| | +\------------------------------------------------------------*/ + +void GraalDelSearch() + +{ + graalsearch *Search; + + rdsbegin(); + + while ( GraalHeadSearch != (graalsearch *)NULL ) + { + Search = GraalHeadSearch; + GraalHeadSearch = GraalHeadSearch->NEXT; + + GraalClearSearchRectangle( Search->RECTANGLE ); + + GraalFreeSearch( Search ); + } + + rdsend(); +} diff --git a/alliance/src/graal/src/GRM_search.h b/alliance/src/graal/src/GRM_search.h new file mode 100644 index 00000000..2c0b83df --- /dev/null +++ b/alliance/src/graal/src/GRM_search.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Search.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRM_SEARCH +# define GRM_SEARCH + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GRM_select.c b/alliance/src/graal/src/GRM_select.c new file mode 100644 index 00000000..b4260973 --- /dev/null +++ b/alliance/src/graal/src/GRM_select.c @@ -0,0 +1,354 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Select.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GRM.h" +# include "GSB.h" +# include "GRM_window.h" +# include "GRM_select.h" + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + graalselect *GraalHeadSelect = (graalselect *)NULL; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Alloc Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalAllocSelect | +| | +\------------------------------------------------------------*/ + +graalselect *GraalAllocSelect() +{ + return((graalselect *)rdsalloc(sizeof(graalselect), 1)); +} + +/*------------------------------------------------------------\ +| | +| Free Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalFreeSelect | +| | +\------------------------------------------------------------*/ + +void GraalFreeSelect( FreeSelect ) + + graalselect *FreeSelect; +{ + rdsfree((char *)FreeSelect, sizeof(graalselect)); +} + +/*------------------------------------------------------------\ +| | +| GraalAcceptRectangle | +| | +\------------------------------------------------------------*/ + +void GraalAcceptRectangle( Rectangle ) + + rdsrec_list *Rectangle; +{ + rdsrec_list *ScanRec; + + rdsbegin(); + + ScanRec = Rectangle; + + do + { + SetGraalAccepted( ScanRec ); + + ScanRec = (rdsrec_list *)ScanRec->USER; + } + while( Rectangle != ScanRec ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalRejectRectangle | +| | +\------------------------------------------------------------*/ + +void GraalRejectRectangle( Rectangle ) + + rdsrec_list *Rectangle; +{ + rdsrec_list *ScanRec; + + rdsbegin(); + + ScanRec = Rectangle; + + do + { + ClearGraalAccepted( ScanRec ); + + ScanRec = (rdsrec_list *)ScanRec->USER; + } + while( Rectangle != ScanRec ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalSelectRectangle | +| | +\------------------------------------------------------------*/ + +void GraalSelectRectangle( Rectangle ) + + rdsrec_list *Rectangle; +{ + rdsrec_list *ScanRec; + + rdsbegin(); + + ScanRec = Rectangle; + + do + { + SetGraalSelected( ScanRec ); + + ScanRec = (rdsrec_list *)ScanRec->USER; + } + while( Rectangle != ScanRec ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalUnselectRectangle | +| | +\------------------------------------------------------------*/ + +void GraalUnselectRectangle( Rectangle ) + + rdsrec_list *Rectangle; +{ + rdsrec_list *ScanRec; + + rdsbegin(); + + ScanRec = Rectangle; + + do + { + ClearGraalSelected( ScanRec ); + + ScanRec = (rdsrec_list *)ScanRec->USER; + } + while( Rectangle != ScanRec ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDeleteRectangle | +| | +\------------------------------------------------------------*/ + +void GraalDeleteRectangle( Rectangle ) + + rdsrec_list *Rectangle; +{ + rdsrec_list *ScanRec; + + rdsbegin(); + + ScanRec = Rectangle; + + do + { + SetGraalDeleted( ScanRec ); + + ScanRec = (rdsrec_list *)ScanRec->USER; + } + while( Rectangle != ScanRec ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalUndeleteRectangle | +| | +\------------------------------------------------------------*/ + +void GraalUndeleteRectangle( Rectangle ) + + rdsrec_list *Rectangle; +{ + rdsrec_list *ScanRec; + + rdsbegin(); + + ScanRec = Rectangle; + + do + { + ClearGraalDeleted( ScanRec ); + + ScanRec = (rdsrec_list *)ScanRec->USER; + } + while( Rectangle != ScanRec ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalAddSelect | +| | +\------------------------------------------------------------*/ + +void GraalAddSelect( Rectangle ) + + rdsrec_list *Rectangle; +{ + graalselect *Select; + + rdsbegin(); + + Select = GraalAllocSelect(); + + Select->RECTANGLE = Rectangle; + Select->NEXT = GraalHeadSelect; + GraalHeadSelect = Select; + + GraalSelectRectangle( Rectangle ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDelSelect | +| | +\------------------------------------------------------------*/ + +void GraalDelSelect() +{ + graalselect *DelSelect; + graalselect *Select; + + rdsbegin(); + + Select = GraalHeadSelect; + GraalHeadSelect = (graalselect *)NULL; + + while( Select != (graalselect *)NULL ) + { + GraalRejectRectangle( Select->RECTANGLE ); + + DelSelect = Select; + Select = Select->NEXT; + + GraalFreeSelect( DelSelect ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalPurgeSelect | +| | +\------------------------------------------------------------*/ + +void GraalPurgeSelect() +{ + graalselect *DelSelect; + graalselect *Select; + graalselect **Previous; + + rdsbegin(); + + Previous = &GraalHeadSelect; + Select = GraalHeadSelect; + + while( Select != (graalselect *)NULL ) + { + if ( ! IsGraalAccepted( Select->RECTANGLE ) ) + { + DelSelect = Select; + Select = Select->NEXT; + *Previous = Select; + + GraalFreeSelect( DelSelect ); + } + else + { + Previous = &Select->NEXT; + Select = Select->NEXT; + } + } + + rdsend(); +} diff --git a/alliance/src/graal/src/GRM_select.h b/alliance/src/graal/src/GRM_select.h new file mode 100644 index 00000000..f4e5ac82 --- /dev/null +++ b/alliance/src/graal/src/GRM_select.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Select.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRM_SELECT +# define GRM_SELECT + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GRM_undo.c b/alliance/src/graal/src/GRM_undo.c new file mode 100644 index 00000000..a3738ff2 --- /dev/null +++ b/alliance/src/graal/src/GRM_undo.c @@ -0,0 +1,306 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Undo.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GRM.h" +# include "GSB.h" +# include "GRM_window.h" +# include "GRM_undo.h" + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + graalundo *GraalHeadUndo = (graalundo *)NULL; + graalundo *GraalHeadRedo = (graalundo *)NULL; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Alloc Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalAllocUndo | +| | +\------------------------------------------------------------*/ + +graalundo *GraalAllocUndo() +{ + return((graalundo *)rdsalloc(sizeof(graalundo), 1)); +} + +/*------------------------------------------------------------\ +| | +| GraalAllocUndoRec | +| | +\------------------------------------------------------------*/ + +graalundorec *GraalAllocUndoRec() +{ + return((graalundorec *)rdsalloc(sizeof(graalundorec), 1)); +} + +/*------------------------------------------------------------\ +| | +| Free Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalFreeUndo | +| | +\------------------------------------------------------------*/ + +void GraalFreeUndo( FreeUndo ) + + graalundo *FreeUndo; +{ + rdsfree((char *)FreeUndo, sizeof(graalundo)); +} + +/*------------------------------------------------------------\ +| | +| GraalFreeUndoRec | +| | +\------------------------------------------------------------*/ + +void GraalFreeUndoRec( FreeUndoRec ) + + graalundorec *FreeUndoRec; +{ + rdsfree((char *)FreeUndoRec, sizeof(graalundorec)); +} + +/*------------------------------------------------------------\ +| | +| GraalAddUndoRec | +| | +\------------------------------------------------------------*/ + +void GraalAddUndoRec( Rectangle ) + + rdsrec_list *Rectangle; +{ + graalundorec *UndoRec; + + rdsbegin(); + + UndoRec = GraalAllocUndoRec(); + UndoRec->RECTANGLE = Rectangle; + UndoRec->NEXT = GraalHeadUndo->UNDO; + GraalHeadUndo->UNDO = UndoRec; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalAddUndo | +| | +\------------------------------------------------------------*/ + +void GraalAddUndo() + +{ + graalundo *NewUndo; + + rdsbegin(); + + GraalDelUndo( &GraalHeadRedo ); + + NewUndo = GraalAllocUndo(); + NewUndo->NEXT = GraalHeadUndo; + GraalHeadUndo = NewUndo; + + GraalRecomputeBound = GRAAL_TRUE; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEraseUndo | +| | +\------------------------------------------------------------*/ + +void GraalEraseUndo( HeadUndo ) + + graalundo **HeadUndo; +{ + graalundo *ScanUndo; + graalundo *DelUndo; + graalundorec *ScanUndoRec; + graalundorec *DelUndoRec; + + rdsbegin(); + + ScanUndo = *HeadUndo; + *HeadUndo = (graalundo *)NULL; + + while ( ScanUndo != (graalundo *)NULL ) + { + ScanUndoRec = ScanUndo->UNDO; + + while( ScanUndoRec != (graalundorec *)NULL ) + { + DelUndoRec = ScanUndoRec; + ScanUndoRec = ScanUndoRec->NEXT; + + GraalFreeUndoRec( DelUndoRec ); + } + + DelUndo = ScanUndo; + ScanUndo = ScanUndo->NEXT; + + GraalFreeUndo( DelUndo ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalInitializeUndo | +| | +\------------------------------------------------------------*/ + +void GraalInitializeUndo() + +{ + rdsbegin(); + + GraalEraseUndo( &GraalHeadUndo ); + GraalEraseUndo( &GraalHeadRedo ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalDelUndo | +| | +\------------------------------------------------------------*/ + +void GraalDelUndo( HeadUndo ) + + graalundo **HeadUndo; +{ + graalundo *ScanUndo; + graalundo *DelUndo; + graalundorec *ScanUndoRec; + graalundorec *DelUndoRec; + rdsrec_list *ScanRec; + graalundorec *HeadDelete; + graalundorec *Delete; + + rdsbegin(); + + HeadDelete = (graalundorec *)NULL; + ScanUndo = *HeadUndo; + *HeadUndo = (graalundo *)NULL; + + while ( ScanUndo != (graalundo *)NULL ) + { + ScanUndoRec = ScanUndo->UNDO; + + while( ScanUndoRec != (graalundorec *)NULL ) + { + ScanRec = ScanUndoRec->RECTANGLE; + + if ( IsGraalDeleted( ScanRec ) ) + { + GraalUndeleteRectangle( ScanRec ); + + Delete = ScanUndoRec; + ScanUndoRec = ScanUndoRec->NEXT; + Delete->NEXT = HeadDelete; + HeadDelete = Delete; + } + else + { + DelUndoRec = ScanUndoRec; + ScanUndoRec = ScanUndoRec->NEXT; + + GraalFreeUndoRec( DelUndoRec ); + } + } + + DelUndo = ScanUndo; + ScanUndo = ScanUndo->NEXT; + + GraalFreeUndo( DelUndo ); + } + + while( HeadDelete != (graalundorec *)NULL ) + { + Delete = HeadDelete; + HeadDelete = HeadDelete->NEXT; + + if ( IsRdsInstance( Delete->RECTANGLE ) ) + { + GraalDelInstance( GRAAL_PREVIOUS( Delete->RECTANGLE ) ); + } + else + { + GraalDelRectangle( Delete->RECTANGLE ); + } + + GraalFreeUndoRec( Delete ); + } + + rdsend(); +} diff --git a/alliance/src/graal/src/GRM_undo.h b/alliance/src/graal/src/GRM_undo.h new file mode 100644 index 00000000..e390d12a --- /dev/null +++ b/alliance/src/graal/src/GRM_undo.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Undo.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRM_UNDO +# define GRM_UNDO + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GRM_window.c b/alliance/src/graal/src/GRM_window.c new file mode 100644 index 00000000..c5c45830 --- /dev/null +++ b/alliance/src/graal/src/GRM_window.c @@ -0,0 +1,1004 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Window.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rfm.h" +# include "GSB.h" +# include "GRM.h" +# include "GRM_window.h" + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + long GraalWindowXmin = 0; + long GraalWindowYmin = 0; + long GraalWindowXmax = 0; + long GraalWindowYmax = 0; + long GraalWindowDx = 0; + long GraalWindowDy = 0; + long GraalWindowSide = 0; + long GraalWindowSize = 0; + graalwin *GraalWindowTable = (graalwin *)NULL; + + long GraalBoundXmin = 0; + long GraalBoundYmin = 0; + long GraalBoundXmax = 0; + long GraalBoundYmax = 0; + + char GraalRecomputeBound = GRAAL_TRUE; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Alloc Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalAllocWinLayer | +| | +\------------------------------------------------------------*/ + +graalwin *GraalAllocWinLayer( GraalWin ) + + graalwin *GraalWin; +{ + if ( GraalWin->LAYERTAB == (graalwinrec **)NULL ) + { + GraalWin->LAYERTAB = + + (graalwinrec **)rdsallocblock( sizeof(graalwinrec *) * RDS_MAX_LAYER ); + } +} + +/*------------------------------------------------------------\ +| | +| GraalAllocWinRec | +| | +\------------------------------------------------------------*/ + +graalwinrec *GraalAllocWinRec() +{ + return((graalwinrec *)rdsalloc(sizeof(graalwinrec), 1)); +} + +/*------------------------------------------------------------\ +| | +| GraalAllocRecWin | +| | +\------------------------------------------------------------*/ + +graalrecwin *GraalAllocRecWin() +{ + return((graalrecwin *)rdsalloc(sizeof(graalrecwin), 1)); +} + +/*------------------------------------------------------------\ +| | +| Free Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalFreeWinLayer | +| | +\------------------------------------------------------------*/ + +void GraalFreeWinLayer( FreeWin ) + + graalwin *FreeWin; +{ + if ( FreeWin->LAYERTAB != (graalwinrec **)NULL ) + { + rdsfreeblock( (char *)FreeWin->LAYERTAB ); + FreeWin->LAYERTAB = (graalwinrec **)NULL; + } +} + +/*------------------------------------------------------------\ +| | +| GraalFreeWinRec | +| | +\------------------------------------------------------------*/ + +void GraalFreeWinRec( FreeWinRec ) + + graalwinrec *FreeWinRec; +{ + rdsfree((char *)FreeWinRec, sizeof(graalwinrec)); +} + +/*------------------------------------------------------------\ +| | +| GraalFreeRecWin | +| | +\------------------------------------------------------------*/ + +void GraalFreeRecWin( FreeRecWin ) + + graalrecwin *FreeRecWin; +{ + rdsfree((char *)FreeRecWin, sizeof(graalrecwin)); +} + +/*------------------------------------------------------------\ +| | +| Init Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Graalgetenv | +| | +\------------------------------------------------------------*/ + +long Graalgetenv( Name ) + + char *Name; +{ + char *String; + + String = mbkgetenv( Name ); + + if ( String == (char *)NULL ) + { + return( 0 ); + } + + return( atoi( String ) ); +} + +/*------------------------------------------------------------\ +| | +| GraalInitializeWindow | +| | +\------------------------------------------------------------*/ + +void GraalInitializeWindow() +{ + rdsbegin(); + + if ( GraalWindowTable == (graalwin *)NULL ) + { + GraalWindowDx = Graalgetenv( GRAAL_WINDOW_DX ); + GraalWindowDy = Graalgetenv( GRAAL_WINDOW_DY ); + GraalWindowXmin = Graalgetenv( GRAAL_WINDOW_XMIN ); + GraalWindowYmin = Graalgetenv( GRAAL_WINDOW_YMIN ); + GraalWindowSide = Graalgetenv( GRAAL_WINDOW_SIDE ); + + if ( ( GraalWindowDx <= 0 ) || + ( GraalWindowDy <= 0 ) || + ( GraalWindowSide <= 0 ) ) + { + GraalWindowDx = GRAAL_DEFAULT_WINDOW_DX; + GraalWindowDy = GRAAL_DEFAULT_WINDOW_DY; + GraalWindowSize = GRAAL_DEFAULT_WINDOW_DX * GRAAL_DEFAULT_WINDOW_DY; + GraalWindowXmin = GRAAL_DEFAULT_WINDOW_XMIN * GRAAL_RDS_LAMBDA; + GraalWindowYmin = GRAAL_DEFAULT_WINDOW_YMIN * GRAAL_RDS_LAMBDA; + GraalWindowXmax = GRAAL_DEFAULT_WINDOW_XMAX * GRAAL_RDS_LAMBDA; + GraalWindowYmax = GRAAL_DEFAULT_WINDOW_YMAX * GRAAL_RDS_LAMBDA; + GraalWindowSide = GRAAL_DEFAULT_WINDOW_SIDE * GRAAL_RDS_LAMBDA; + } + else + { + GraalWindowSize = GraalWindowDx * GraalWindowDy; + GraalWindowSide = GraalWindowSide * GRAAL_RDS_LAMBDA; + GraalWindowXmin = GraalWindowXmin * GRAAL_RDS_LAMBDA; + GraalWindowYmin = GraalWindowYmin * GRAAL_RDS_LAMBDA; + GraalWindowXmax = GraalWindowXmin + ( GraalWindowDx * GraalWindowSide ); + GraalWindowYmax = GraalWindowYmin + ( GraalWindowDy * GraalWindowSide ); + } + + GraalWindowTable = + + (graalwin *)rdsallocblock( sizeof(graalwin) * GraalWindowSize ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Purge Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalEraseWindow | +| | +\------------------------------------------------------------*/ + +void GraalEraseWindow() + +{ + long Offset; + graalwin *ScanWin; + graalwinrec *ScanWinRec; + graalwinrec *DelWinRec; + char Layer; + + rdsbegin(); + + for ( Offset = 0; Offset < GraalWindowSize; Offset++ ) + { + ScanWin = &GraalWindowTable[ Offset ]; + + if ( ScanWin->LAYERTAB != (graalwinrec **)NULL ) + { + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + ScanWinRec = ScanWin->LAYERTAB[ Layer ]; + + while ( ScanWinRec != (graalwinrec *)NULL ) + { + DelWinRec = ScanWinRec; + ScanWinRec = ScanWinRec->NEXT; + + GraalFreeWinRec( DelWinRec ); + } + } + + GraalFreeWinLayer( ScanWin ); + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalInsertRectangle | +| | +\------------------------------------------------------------*/ + +void GraalInsertRectangle( Rectangle ) + + rdsrec_list *Rectangle; +{ + graalwin *LinkWin; + graalrecwin *RecWin; + graalwinrec *WinRec; + char Layer; + char Index; + long Offset; + + long X1; + long X2; + long Y1; + long Y2; + long FirstX; + + rdsbegin(); + + Y1 = ( Rectangle->Y - 1 - GraalWindowYmin ) / GraalWindowSide; + Y2 = ( Rectangle->Y + Rectangle->DY - GraalWindowYmin ) / GraalWindowSide; + X1 = ( Rectangle->X - 1 - GraalWindowXmin ) / GraalWindowSide; + X2 = ( Rectangle->X + Rectangle->DX - GraalWindowXmin ) / GraalWindowSide; + + if ( X1 < 0 ) X1 = 0; + if ( X2 < 0 ) X2 = 0; + if ( X1 >= GraalWindowDx ) X1 = GraalWindowDx - 1; + if ( X2 >= GraalWindowDx ) X2 = GraalWindowDx - 1; + + if ( Y1 < 0 ) Y1 = 0; + if ( Y2 < 0 ) Y2 = 0; + if ( Y1 >= GraalWindowDy ) Y1 = GraalWindowDy - 1; + if ( Y2 >= GraalWindowDy ) Y2 = GraalWindowDy - 1; + + FirstX = X1; + + while ( Y1 <= Y2 ) + { + X1 = FirstX; + + while ( X1 <= X2 ) + { + Offset = Y1 * GraalWindowDx + X1; + + LinkWin = &GraalWindowTable[ Offset ]; + + if ( LinkWin->LAYERTAB == (graalwinrec **)NULL ) + { + GraalAllocWinLayer( LinkWin ); + } + + if ( GRAAL_WINDOW( Rectangle ) == (graalrecwin *)NULL ) + { + GRAAL_WINDOW( Rectangle ) = (graalrecwin *)LinkWin; + + SetGraalOneWindow( Rectangle ); + } + else + { + if ( IsGraalOneWindow( Rectangle ) ) + { + ClearGraalOneWindow( Rectangle ); + + RecWin = GraalAllocRecWin(); + RecWin->WINDOW = (graalwin *)GRAAL_WINDOW( Rectangle ); + GRAAL_WINDOW( Rectangle ) = RecWin; + } + + RecWin = GraalAllocRecWin(); + RecWin->WINDOW = LinkWin; + RecWin->NEXT = GRAAL_WINDOW( Rectangle ); + GRAAL_WINDOW( Rectangle ) = RecWin; + } + + Layer = GetRdsLayer( Rectangle ); + + WinRec = LinkWin->LAYERTAB[ Layer ]; + + if ( WinRec == (graalwinrec *)NULL ) + { + WinRec = GraalAllocWinRec(); + LinkWin->LAYERTAB[ Layer ] = WinRec; + WinRec->RECTAB[ 0 ] = Rectangle; + } + else + { + for ( Index = 0; Index < GRAAL_MAX_REC; Index++ ) + { + if ( WinRec->RECTAB[ Index ] == (rdsrec_list *)NULL ) break; + } + + if ( Index == GRAAL_MAX_REC ) + { + WinRec = GraalAllocWinRec(); + WinRec->NEXT = LinkWin->LAYERTAB[ Layer ]; + LinkWin->LAYERTAB[ Layer ] = WinRec; + WinRec->RECTAB[ 0 ] = Rectangle; + } + else + { + WinRec->RECTAB[ Index ] = Rectangle; + } + } + + X1 = X1 + 1; + } + + Y1 = Y1 + 1; + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEraseRectangle | +| | +\------------------------------------------------------------*/ + +void GraalEraseRectangle( Rectangle ) + + rdsrec_list *Rectangle; +{ + graalrecwin StaticRecWin; + graalrecwin *ScanRecWin; + graalrecwin *DelRecWin; + graalwinrec *ScanWinRec; + graalwinrec *FirstWinRec; + graalwin *ScanWin; + + char Layer; + char Index; + char Found; + + rdsbegin(); + + if ( IsGraalOneWindow( Rectangle ) ) + { + StaticRecWin.NEXT = (graalrecwin *)NULL; + StaticRecWin.WINDOW = (graalwin *)GRAAL_WINDOW( Rectangle ); + ScanRecWin = &StaticRecWin; + } + else + { + ScanRecWin = GRAAL_WINDOW( Rectangle ); + } + + Layer = GetRdsLayer( Rectangle ); + + while ( ScanRecWin != (graalrecwin *)NULL ) + { + DelRecWin = ScanRecWin; + ScanRecWin = ScanRecWin->NEXT; + + ScanWin = DelRecWin->WINDOW; + Found = GRAAL_MAX_REC; + + FirstWinRec = ScanWin->LAYERTAB[ Layer ]; + + for ( ScanWinRec = FirstWinRec; + ScanWinRec != (graalwinrec *)NULL; + ScanWinRec = ScanWinRec->NEXT ) + { + for ( Index = 0; Index < GRAAL_MAX_REC; Index++ ) + { + if ( ScanWinRec->RECTAB[ Index ] == Rectangle ) + { + Found = Index; break; + } + } + + if ( Found != GRAAL_MAX_REC ) break; + } + + if ( ScanWinRec == FirstWinRec ) + { + ScanWinRec->RECTAB[ Found ] = (rdsrec_list *)NULL; + } + else + { + for ( Index = 0; Index < GRAAL_MAX_REC; Index++ ) + { + if ( FirstWinRec->RECTAB[ Index ] != (rdsrec_list *)NULL ) break; + } + + ScanWinRec->RECTAB[ Found ] = FirstWinRec->RECTAB[ Index ]; + FirstWinRec->RECTAB[ Index ] = (rdsrec_list *)NULL; + } + + for ( Index = 0; Index < GRAAL_MAX_REC; Index++ ) + { + if ( FirstWinRec->RECTAB[ Index ] != (rdsrec_list *)NULL ) break; + } + + if ( Index == GRAAL_MAX_REC ) + { + ScanWin->LAYERTAB[ Layer ] = FirstWinRec->NEXT; + + GraalFreeWinRec( FirstWinRec ); + } + + if ( DelRecWin != &StaticRecWin ) + { + GraalFreeRecWin( DelRecWin ); + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEraseRecWin | +| | +\------------------------------------------------------------*/ + +void GraalEraseRecWin( Rectangle ) + + rdsrec_list *Rectangle; +{ + graalrecwin *ScanRecWin; + graalrecwin *DelRecWin; + + rdsbegin(); + + if ( ! IsGraalOneWindow( Rectangle ) ) + { + ScanRecWin = GRAAL_WINDOW( Rectangle ); + + do + { + DelRecWin = ScanRecWin; + ScanRecWin = ScanRecWin->NEXT; + + GraalFreeRecWin( DelRecWin ); + } + while ( ScanRecWin != (graalrecwin *)NULL ); + } + + GRAAL_WINDOW( Rectangle ) = (graalrecwin *)NULL; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalViewWindow | +| | +\------------------------------------------------------------*/ + +# ifdef DEBUG + +void GraalViewWindow() +{ + graalwin *ScanWin; + graalwinrec *ScanWinRec; + rdsrec_list *Rectangle; + long X; + long Y; + long Xmin; + long Ymin; + long Xmax; + long Ymax; + long Counter; + long MaskCounter; + char Layer; + char ScanRec; + + rdsbegin(); + + fprintf( stdout, "\n\t--> Window\n" ); + fprintf( stdout, "\n\tXMIN : %d" , GraalWindowXmin ); + fprintf( stdout, "\n\tXMAX : %d" , GraalWindowXmax ); + fprintf( stdout, "\n\tYMIN : %d" , GraalWindowYmin ); + fprintf( stdout, "\n\tYMAX : %d" , GraalWindowYmax ); + fprintf( stdout, "\n\tDX : %d" , GraalWindowDx ); + fprintf( stdout, "\n\tDY : %d" , GraalWindowDy ); + fprintf( stdout, "\n\tSIDE : %d" , GraalWindowSide ); + fprintf( stdout, "\n\tSIZE : %d\n", GraalWindowSize ); + + fprintf( stdout, "\n\t--> Dump all windows\n" ); + + Ymin = GraalWindowYmin; + Ymax = Ymin + GraalWindowSide; + Y = 0; + + MaskCounter = 0; + + while ( Y < GraalWindowDy ) + { + Xmin = GraalWindowXmin; + Xmax = Xmin + GraalWindowSide ; + X = 0; + + ScanWin = GraalWindowTable[ Y * GraalWindowDx ]; + + while ( X < GraalWindowDx ) + { + if ( ScanWin != (graalwin *)NULL ) + { + fprintf( stdout, "\n\t--> Window[ %d, %d ]\n", X, Y ); + + fprintf( stdout, "\n\tXMIN : %d" , Xmin ); + fprintf( stdout, "\n\tYMIN : %d" , Ymin ); + fprintf( stdout, "\n\tXMAX : %d" , Xmax ); + fprintf( stdout, "\n\tYMAX : %d\n", Ymax ); + + Counter = 0; + + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + for ( ScanWinRec = ScanWin->LAYERTAB[ Layer ]; + ScanWinRec != (graalwinrec *)NULL; + ScanWinRec = ScanWinRec->NEXT ) + { + for ( ScanRec = 0; ScanRec < GRAAL_MAX_REC ; ScanRec++ ) + { + Rectangle = ScanWinRec->RECTAB[ ScanRec ]; + + if ( Rectangle != (rdsrec_list *)NULL ) + { + if ( ( Rectangle->X > Xmax ) || + ( Rectangle->Y > Ymax ) || + ( Rectangle->X + Rectangle->DX < Xmin ) || + ( Rectangle->Y + Rectangle->DY < Ymin ) ) + { + viewrdsrec( Rectangle ); + } + else + { + Counter = Counter + 1; + } + } + } + } + } + + MaskCounter = MaskCounter + Counter; + + fprintf( stdout, "\n\t<-- Total rectangles %d", Counter ); + } + + Xmin = Xmax; + Xmax = Xmax + GraalWindowSide; + X = X + 1; + + ScanWin = GraalWindowTable[ Y * GraalWindowDx + X ]; + } + + Ymin = Ymax; + Ymax = Ymax + GraalWindowSide; + Y = Y + 1; + } + + fprintf( stdout, "\n<-- Total Rectangles %d\n", MaskCounter ); + + rdsend(); +} + +# endif + +/*------------------------------------------------------------\ +| | +| GraalComputeBound | +| | +\------------------------------------------------------------*/ + +char GraalComputeBound() + +{ + graalwin *ScanWin; + graalwinrec *ScanWinRec; + rdsrec_list *Rec; + long Offset; + long X; + long Y; + char Layer; + char FirstBound; + char ScanRec; + + if ( GraalFigureMbk == (phfig_list *)NULL ) + { + return( GRAAL_FALSE ); + } + + if ( GraalRecomputeBound == GRAAL_FALSE ) + { + return( GRAAL_TRUE ); + } + + rdsbegin(); + + GraalBoundXmin = 0; + GraalBoundXmax = 0; + GraalBoundYmin = 0; + GraalBoundYmax = 0; + + Y = 0; + + FirstBound = 1; + + while ( ( Y < GraalWindowDy ) && + ( FirstBound == 1 ) ) + { + Offset = Y * GraalWindowDx; + X = 0; + + while ( X < GraalWindowDx ) + { + ScanWin = &GraalWindowTable[ Offset ]; + + if ( ScanWin->LAYERTAB != (graalwinrec **)NULL ) + { + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + for ( ScanWinRec = ScanWin->LAYERTAB[ Layer ]; + ScanWinRec != (graalwinrec *)NULL; + ScanWinRec = ScanWinRec->NEXT ) + { + for ( ScanRec = 0; ScanRec < GRAAL_MAX_REC ; ScanRec++ ) + { + Rec = ScanWinRec->RECTAB[ ScanRec ]; + + if ( ( Rec != (rdsrec_list *)NULL ) && + ( ! IsGraalDeleted( Rec ) ) ) + { + if ( FirstBound == 1 ) + { + FirstBound = 0; + GraalBoundYmin = Rec->Y; + } + else + if ( Rec->Y < GraalBoundYmin ) + { + GraalBoundYmin = Rec->Y; + } + } + } + } + } + } + + X = X + 1; + Offset = Offset + 1; + } + + Y = Y + 1; + } + + if ( FirstBound == 1 ) + { + rdsend(); + return( GRAAL_FALSE ); + } + + FirstBound = 1; + + Y = GraalWindowDy - 1; + + while ( ( Y >= 0 ) && + ( FirstBound == 1 ) ) + { + Offset = Y * GraalWindowDx; + X = 0; + + while ( X < GraalWindowDx ) + { + ScanWin = &GraalWindowTable[ Offset ]; + + if ( ScanWin->LAYERTAB != (graalwinrec **)NULL ) + { + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + for ( ScanWinRec = ScanWin->LAYERTAB[ Layer ]; + ScanWinRec != (graalwinrec *)NULL; + ScanWinRec = ScanWinRec->NEXT ) + { + for ( ScanRec = 0; ScanRec < GRAAL_MAX_REC ; ScanRec++ ) + { + Rec = ScanWinRec->RECTAB[ ScanRec ]; + + if ( ( Rec != (rdsrec_list *)NULL ) && + ( ! IsGraalDeleted( Rec ) ) ) + { + if ( FirstBound == 1 ) + { + FirstBound = 0; + GraalBoundYmax = Rec->Y + Rec->DY; + } + else + if ( ( Rec->Y + Rec->DY ) > GraalBoundYmax ) + { + GraalBoundYmax = Rec->Y + Rec->DY; + } + } + } + } + } + } + + X = X + 1; + Offset = Offset + 1; + } + + Y = Y - 1; + } + + FirstBound = 1; + + X = GraalWindowDx - 1; + + while ( ( X >= 0 ) && + ( FirstBound == 1 ) ) + { + Offset = X; + Y = 0; + + while ( Y < GraalWindowDy ) + { + ScanWin = &GraalWindowTable[ Offset ]; + + if ( ScanWin->LAYERTAB != (graalwinrec **)NULL ) + { + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + for ( ScanWinRec = ScanWin->LAYERTAB[ Layer ]; + ScanWinRec != (graalwinrec *)NULL; + ScanWinRec = ScanWinRec->NEXT ) + { + for ( ScanRec = 0; ScanRec < GRAAL_MAX_REC ; ScanRec++ ) + { + Rec = ScanWinRec->RECTAB[ ScanRec ]; + + if ( ( Rec != (rdsrec_list *)NULL ) && + ( ! IsGraalDeleted( Rec ) ) ) + { + if ( FirstBound == 1 ) + { + FirstBound = 0; + GraalBoundXmax = Rec->X + Rec->DX; + } + else + if ( ( Rec->X + Rec->DX ) > GraalBoundXmax ) + { + GraalBoundXmax = Rec->X + Rec->DX; + } + } + } + } + } + } + + Y = Y + 1; + Offset = Offset + GraalWindowDx; + } + + X = X - 1; + } + + X = 0; + + FirstBound = 1; + + while ( ( X < GraalWindowDx ) && + ( FirstBound == 1 ) ) + { + Offset = X; + Y = 0; + + while ( Y < GraalWindowDy ) + { + ScanWin = &GraalWindowTable[ Offset ]; + + if ( ScanWin->LAYERTAB != (graalwinrec **)NULL ) + { + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + for ( ScanWinRec = ScanWin->LAYERTAB[ Layer ]; + ScanWinRec != (graalwinrec *)NULL; + ScanWinRec = ScanWinRec->NEXT ) + { + for ( ScanRec = 0; ScanRec < GRAAL_MAX_REC ; ScanRec++ ) + { + Rec = ScanWinRec->RECTAB[ ScanRec ]; + + if ( ( Rec != (rdsrec_list *)NULL ) && + ( ! IsGraalDeleted( Rec ) ) ) + { + if ( FirstBound == 1 ) + { + FirstBound = 0; + GraalBoundXmin = Rec->X; + } + else + if ( Rec->X < GraalBoundXmin ) + { + GraalBoundXmin = Rec->X; + } + } + } + } + } + } + + Y = Y + 1; + Offset = Offset + GraalWindowDx; + } + + X = X + 1; + } + + GraalRecomputeBound = GRAAL_FALSE; + + rdsend(); + return( GRAAL_TRUE ); +} + +/*------------------------------------------------------------\ +| | +| GraalCheckWindow | +| | +\------------------------------------------------------------*/ + +void GraalCheckWindow( CheckXmin, CheckYmin, CheckXmax, CheckYmax ) + + long CheckXmin; + long CheckYmin; + long CheckXmax; + long CheckYmax; +{ + long Border; + long SideX; + long SideY; + char Compute; + + rdsbegin(); + + Compute = 0; + Border = GRAAL_WINDOW_BORDER * GRAAL_RDS_LAMBDA; + + if ( ( CheckXmin - Border ) < GraalWindowXmin ) + { + GraalWindowXmin = CheckXmin - Border; + Compute = 1; + } + + if ( ( CheckYmin - Border ) < GraalWindowYmin ) + { + GraalWindowYmin = CheckYmin - Border; + Compute = 1; + } + + if ( ( CheckXmax + Border ) > GraalWindowXmax ) + { + GraalWindowXmax = CheckXmax + Border; + Compute = 1; + } + + if ( ( CheckYmax + Border ) > GraalWindowYmax ) + { + GraalWindowYmax = CheckYmax + Border; + Compute = 1; + } + + if ( Compute ) + { + GraalEraseWindow(); + rdsfreeblock( GraalWindowTable ); + + GraalWindowDx = GRAAL_DEFAULT_WINDOW_DX; + GraalWindowDy = GRAAL_DEFAULT_WINDOW_DY; + + SideX = 1 + ( GraalWindowXmax - GraalWindowXmin ) / GraalWindowDx; + SideY = 1 + ( GraalWindowYmax - GraalWindowYmin ) / GraalWindowDy; + + if ( SideX < SideY ) + { + GraalWindowSide = SideY; + } + else + { + GraalWindowSide = SideX; + } + + GraalWindowDx = 1 + ( GraalWindowXmax - GraalWindowXmin ) / GraalWindowSide; + GraalWindowDy = 1 + ( GraalWindowYmax - GraalWindowYmin ) / GraalWindowSide; + + GraalWindowXmax = GraalWindowXmin + ( GraalWindowDx * GraalWindowSide ); + GraalWindowYmax = GraalWindowYmin + ( GraalWindowDy * GraalWindowSide ); + GraalWindowSize = GraalWindowDx * GraalWindowDy; + + GraalWindowTable = + + (graalwin *)rdsallocblock( sizeof(graalwin) * GraalWindowSize ); + } + + rdsend(); +} diff --git a/alliance/src/graal/src/GRM_window.h b/alliance/src/graal/src/GRM_window.h new file mode 100644 index 00000000..18480e95 --- /dev/null +++ b/alliance/src/graal/src/GRM_window.h @@ -0,0 +1,91 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Window.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRM_WINDOW +# define GRM_WINDOW + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define GRAAL_DEFAULT_WINDOW_XMIN -4000 +# define GRAAL_DEFAULT_WINDOW_YMIN -4000 +# define GRAAL_DEFAULT_WINDOW_XMAX 16000 +# define GRAAL_DEFAULT_WINDOW_YMAX 16000 +# define GRAAL_DEFAULT_WINDOW_DX 100 +# define GRAAL_DEFAULT_WINDOW_DY 100 +# define GRAAL_DEFAULT_WINDOW_SIDE 200 + +# define GRAAL_WINDOW_BORDER 4000 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalInitializeWindow(); + extern void GraalCheckWindow(); + extern void GraalEraseWindow(); + + extern void GraalInsertRectangle(); + extern void GraalEraseRectangle(); + extern void GraalEraseRecWin(); + + extern void GraalViewWindow(); + +# endif diff --git a/alliance/src/graal/src/GSB.h b/alliance/src/graal/src/GSB.h new file mode 100644 index 00000000..3c441c19 --- /dev/null +++ b/alliance/src/graal/src/GSB.h @@ -0,0 +1,223 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : GSB101.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_GSB +# define GRAAL_GSB + +# define GRAAL_TRUE 1 +# define GRAAL_FALSE 0 + +# define GRAAL_ERROR 1 +# define GRAAL_OK 0 + +# define GRAAL_NORTH 0 +# define GRAAL_SOUTH 1 +# define GRAAL_EAST 2 +# define GRAAL_WEST 3 + +# define GRAAL_NORTH_MASK 1 +# define GRAAL_SOUTH_MASK 2 +# define GRAAL_WEST_MASK 4 +# define GRAAL_EAST_MASK 8 + +# define GRAAL_DEFAULT_FIGURE_NAME "NONAME" + +/*------------------------------------------------------------\ +| | +| Edit Mode | +| | +\------------------------------------------------------------*/ + +# define GRAAL_EDIT_MEASURE (char)0x00 +# define GRAAL_CREATE_SEGMENT (char)0x01 +# define GRAAL_CREATE_SEGMENT_WIRE (char)0x02 +# define GRAAL_CREATE_VIA (char)0x03 +# define GRAAL_CREATE_TRANSISTOR (char)0x04 +# define GRAAL_CREATE_TRANSISTOR_WIRE (char)0x05 +# define GRAAL_CREATE_CONNECTOR (char)0x06 +# define GRAAL_CREATE_INSTANCE (char)0x07 +# define GRAAL_CREATE_REFERENCE (char)0x08 +# define GRAAL_CREATE_ABUTMENTBOX (char)0x09 +# define GRAAL_SELECT_POINT_IDENTIFY (char)0x0A +# define GRAAL_SELECT_POINT_COPY (char)0x0B +# define GRAAL_SELECT_POINT_MOVE (char)0x0C +# define GRAAL_SELECT_POINT_DELETE (char)0x0D +# define GRAAL_SELECT_POINT_STRETCH (char)0x0E +# define GRAAL_SELECT_POINT_MODIFY (char)0x0F +# define GRAAL_SELECT_WINDOW_COPY (char)0x10 +# define GRAAL_SELECT_WINDOW_MOVE (char)0x11 +# define GRAAL_SELECT_WINDOW_DELETE (char)0x12 +# define GRAAL_SELECT_WINDOW_STRETCH (char)0x13 +# define GRAAL_SELECT_WINDOW_MODIFY (char)0x14 +# define GRAAL_SELECT_WINDOW_IDENTIFY (char)0x15 +# define GRAAL_EDIT_COPY_POINT (char)0x16 +# define GRAAL_EDIT_COPY_WINDOW (char)0x17 +# define GRAAL_EDIT_MOVE_POINT (char)0x18 +# define GRAAL_EDIT_MOVE_WINDOW (char)0x19 +# define GRAAL_EDIT_STRETCH_POINT (char)0x1A +# define GRAAL_EDIT_STRETCH_WINDOW (char)0x1B +# define GRAAL_TOOLS_EQUI (char)0x1C +# define GRAAL_TOOLS_FLATTEN (char)0x1D +# define GRAAL_TOOLS_UNFLATTEN (char)0x1E +# define GRAAL_TOOLS_PEEK (char)0x1F +# define GRAAL_TOOLS_DRUC (char)0x20 +# define GRAAL_TOOLS_REAL_FLATTEN (char)0x21 +# define GRAAL_TOOLS_HIERARCHY_DOWN (char)0x22 +# define GRAAL_TOOLS_HIERARCHY_SHOW (char)0x23 +# define GRAAL_CREATE_BIGVIA (char)0x24 + + +# define GRAAL_ZOOM_CENTER (char)0x80 +# define GRAAL_ZOOM_IN (char)0x81 +# define GRAAL_ZOOM_PAN (char)0x82 + +# define GRAAL_ZOOM_MARK (char)0x80 + +/*------------------------------------------------------------\ +| | +| Input Mode | +| | +\------------------------------------------------------------*/ + +# define GRAAL_INPUT_POINT 0 +# define GRAAL_INPUT_ORTHO 1 +# define GRAAL_INPUT_LINE 2 +# define GRAAL_INPUT_LSTRING 3 +# define GRAAL_INPUT_BOX 4 +# define GRAAL_INPUT_SORTHO 5 +# define GRAAL_INPUT_HALF_BOX 6 + +/*------------------------------------------------------------\ +| | +| Active Name | +| | +\------------------------------------------------------------*/ + +# define GRAAL_FIGURE_NAME 0 +# define GRAAL_INSTANCE_NAME 1 +# define GRAAL_FIGURE_CONNECTOR_NAME 2 +# define GRAAL_INSTANCE_CONNECTOR_NAME 3 +# define GRAAL_FIGURE_SEGMENT_NAME 4 +# define GRAAL_INSTANCE_SEGMENT_NAME 5 +# define GRAAL_FIGURE_REFERENCE_NAME 6 +# define GRAAL_INSTANCE_REFERENCE_NAME 7 + +# define GRAAL_MAX_ACTIVE_NAME 8 + +/*------------------------------------------------------------\ +| | +| Fill Mode | +| | +\------------------------------------------------------------*/ + +# define GRAAL_FILL_MODE_OUTLINE 0 +# define GRAAL_FILL_MODE_FILL 1 +# define GRAAL_FILL_MODE_PATTERN 2 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char *GRAAL_SEGMENT_NAME_TABLE[ MBK_MAX_LAYER ][ 3 ]; + extern char *GRAAL_TRANSISTOR_NAME_TABLE[ MBK_MAX_LAYER ][ 3 ]; + extern char *GRAAL_CONNECTOR_NAME_TABLE[ MBK_MAX_LAYER ][ 3 ]; + extern long GRAAL_SEGMENT_VALUE_TABLE[ MBK_MAX_LAYER ][ 2 ]; + extern char *GRAAL_VIA_NAME_TABLE[ MBK_MAX_VIA ][ 3 ]; + extern char *GRAAL_BIGVIA_NAME_TABLE[ MBK_MAX_VIA ][ 3 ]; + extern long GRAAL_BIGVIA_VALUE_TABLE[ MBK_MAX_LAYER ][ 1 ]; + extern char *GRAAL_REFERENCE_NAME_TABLE[ MBK_MAX_REFERENCE ][ 3 ]; + extern char *GRAAL_ORIENT_NAME_TABLE[ MBK_MAX_ORIENT ][ 3 ]; + extern char *GRAAL_SYMMETRY_NAME_TABLE[ MBK_MAX_SYMMETRY ][ 3 ]; + extern char *GRAAL_RDS_LAYER_NAME_TABLE[ RDS_ALL_LAYER ][ 3 ]; + extern int GRAAL_RDS_LAYER_PATTERN_TABLE[ RDS_ALL_LAYER ]; + extern long GRAAL_PEEK_BOUND; + extern char *GRAAL_CURSOR_COLOR_NAME; + extern long GRAAL_CURSOR_SIZE; + extern float GRAAL_LOWER_GRID_STEP; + extern float GRAAL_LOWER_FIGURE_STEP; + extern float GRAAL_LOWER_INSTANCE_STEP; + extern float GRAAL_LOWER_REFERENCE_STEP; + extern float GRAAL_LOWER_SEGMENT_STEP; + extern float GRAAL_LOWER_CONNECTOR_STEP; + extern long GRAAL_RDS_LAMBDA; + extern long GRAAL_SCALE_X; + extern long GRAAL_SCALE; + extern char GRAAL_XOR_CURSOR; + + extern char GRAAL_INSTANCE_INTERFACE; + extern char GRAAL_FILL_MODE; + extern char GRAAL_CONNECTOR_INDEX; + extern char GRAAL_FORCE_DISPLAY; + extern char GRAAL_BLACK_BOX_STRING; + extern char GRAAL_SWITCH_COLOR_MAP; + + extern char GRAAL_RDS_ACTIVE_LAYER_TABLE[ RDS_ALL_LAYER ]; + extern char GRAAL_RDS_ACTIVE_NAME_TABLE[ GRAAL_MAX_ACTIVE_NAME ]; + extern long *GRAAL_CUT_C_X_ARRAY [ MBK_MAX_LAYER ]; + extern char GRAAL_CUT_C_X_LIST[ MBK_MAX_VIA ]; + + extern char *GRAAL_TECHNO_NAME; + extern char *GRAAL_GMS_FILE_NAME; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern char *GraalPostTreatString(); + extern void GraalLoadParameters(); + extern void GraalViewParameters(); + extern void GraalInitializeCutCxTable(); + extern void Graalenv(); + +# endif diff --git a/alliance/src/graal/src/GSB_error.c b/alliance/src/graal/src/GSB_error.c new file mode 100644 index 00000000..0ebe954d --- /dev/null +++ b/alliance/src/graal/src/GSB_error.c @@ -0,0 +1,185 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Gsb Errors | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rwi.h" +# include "rut.h" +# include "rpr.h" +# include "GSB.h" +# include "GSB_error.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +void GsbError( ErrorType, Message, Data ) + + char ErrorType; + char *Message; + long Data; +{ + fflush(stdout); + + fprintf( stderr, "Gsb %s: ", GRAAL_TECHNO_NAME ); + + switch ( ErrorType ) + { + case DEFINE_MISSING : + + fprintf( stderr, "Some defines missing\n"); + break; + + case TABLE_MISSING : + + fprintf( stderr, "Some tables missing\n"); + break; + + case LINE_EXPECTED : + + fprintf( stderr, "%s expected line %lu\n", + Message, Data ); + break; + + case UNKNOWN_DEFINE : + + fprintf( stderr, "Unknown define %s line %lu\n", + Message, Data ); + break; + + case NOT_DEFINED : + + fprintf( stderr, "%s not defined line %lu\n", + Message, Data ); + break; + + case TOO_SMAL : + + fprintf( stderr, "%s too smal line %lu\n", + Message, Data ); + break; + + case MISSING_VALUE : + + fprintf( stderr, "Missing value at line %lu\n", + Data ); + break; + + case MISSING_NAME : + + fprintf( stderr, "Missing name of %s line %lu\n", + Message, Data ); + break; + + case UNEXPECTED_LINE : + + fprintf( stderr, "%s unexpected line %lu\n", + Message, Data ); + break; + + case UNEXPECTED_EOF : + + fprintf( stderr, "Unexpected end of file, missing definitions\n"); + break; + + case TOO_MANY_WORDS : + + fprintf( stderr, "Too many words %s unexpected line %lu\n", + Message, Data ); + break; + + case MISSING_TABLE : + + fprintf( stderr, "Missing value in %s table line %lu\n", + Message, Data ); + break; + + case OPEN_FILE : + + fprintf( stderr, "Parameters file can't be opened\n" ); + break; + + case UNKNOWN_TABLE : + + fprintf( stderr, "Unknown table %s line %lu\n", + Message , Data ); + break; + + case SYNTAX_ERROR : + + fprintf( stderr, "Syntax Error %s at line %lu\n", + Message , Data ); + break; + + case ILLEGAL_FLOAT : + + fprintf( stderr, "Illegal floating point number %s line %lu\n", + Message , Data ); + break; + } + + fflush( stderr ); + + exit( 1 ); +} diff --git a/alliance/src/graal/src/GSB_error.h b/alliance/src/graal/src/GSB_error.h new file mode 100644 index 00000000..db0cfe4a --- /dev/null +++ b/alliance/src/graal/src/GSB_error.h @@ -0,0 +1,88 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Gsb Errors | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef GSB_ERROR +# define GSB_ERROR + +/*------------------------------------------------------------\ +| | +| Rpr Error Constants | +| | +\------------------------------------------------------------*/ + +# define DEFINE_MISSING 0 +# define TABLE_MISSING 1 +# define LINE_EXPECTED 2 +# define UNKNOWN_DEFINE 3 +# define NOT_DEFINED 4 +# define TOO_SMAL 5 +# define MISSING_VALUE 6 +# define MISSING_NAME 7 +# define UNEXPECTED_LINE 8 +# define UNEXPECTED_EOF 9 +# define TOO_MANY_WORDS 10 +# define MISSING_TABLE 11 +# define OPEN_FILE 12 +# define UNKNOWN_TABLE 13 +# define SYNTAX_ERROR 14 +# define ILLEGAL_FLOAT 15 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GSB_parse.c b/alliance/src/graal/src/GSB_parse.c new file mode 100644 index 00000000..82dc74b0 --- /dev/null +++ b/alliance/src/graal/src/GSB_parse.c @@ -0,0 +1,1885 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : GsbParse.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rwi.h" +# include "rut.h" +# include "rpr.h" +# include "GSB.h" +# include "GSB_error.h" +# include "GSB_parse.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Global Variables | +| | +\------------------------------------------------------------*/ + + char *GRAAL_TECHNO_NAME = (char *)NULL; + + long GRAAL_RDS_LAMBDA = 0; + long GRAAL_SCALE_X = 0; + long GRAAL_SCALE = 1; + +/*------------------------------------------------------------\ +| | +| Private Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Table variables | +| | +\------------------------------------------------------------*/ + + char *GRAAL_VIA_NAME_TABLE[ MBK_MAX_VIA ][ 3 ]; + char *GRAAL_BIGVIA_NAME_TABLE[ MBK_MAX_VIA ][ 3 ]; + char *GRAAL_SYMMETRY_NAME_TABLE[ MBK_MAX_SYMMETRY ][ 3 ]; + char *GRAAL_ORIENT_NAME_TABLE[ MBK_MAX_ORIENT ][ 3 ]; + char *GRAAL_REFERENCE_NAME_TABLE[ MBK_MAX_REFERENCE ][ 3 ]; + char *GRAAL_SEGMENT_NAME_TABLE[ MBK_MAX_LAYER ][ 3 ]; + char *GRAAL_TRANSISTOR_NAME_TABLE[ MBK_MAX_LAYER ][ 3 ]; + char *GRAAL_CONNECTOR_NAME_TABLE[ MBK_MAX_LAYER ][ 3 ]; + char *GRAAL_RDS_LAYER_NAME_TABLE[ RDS_ALL_LAYER ][ 3 ]; + char *GRAAL_CURSOR_COLOR_NAME; + int GRAAL_RDS_LAYER_PATTERN_TABLE[ RDS_ALL_LAYER ]; + + long GRAAL_SEGMENT_VALUE_TABLE[ MBK_MAX_LAYER ][ 2 ]; + long GRAAL_BIGVIA_VALUE_TABLE[ MBK_MAX_LAYER ][ 1 ]; + long GRAAL_PEEK_BOUND; + long GRAAL_CURSOR_SIZE; + + float GRAAL_LOWER_GRID_STEP; + float GRAAL_LOWER_FIGURE_STEP; + float GRAAL_LOWER_INSTANCE_STEP; + float GRAAL_LOWER_CONNECTOR_STEP; + float GRAAL_LOWER_SEGMENT_STEP; + float GRAAL_LOWER_REFERENCE_STEP; + +/*------------------------------------------------------------\ +| | +| Keywords variables | +| | +\------------------------------------------------------------*/ + + static char KeywordDefined = 0; + + static char *DefineKeyword; + static char *TableKeyword; + static char *EndTableKeyword; + static char *EndRecordKeyword; + static char *PeekBoundKeyword; + static char *LowerGridStepKeyword; + static char *LowerFigureStepKeyword; + static char *LowerInstanceStepKeyword; + static char *LowerSegmentStepKeyword; + static char *LowerReferenceStepKeyword; + static char *LowerConnectorStepKeyword; + static char *SegmentNameKeyword; + static char *TransistorNameKeyword; + static char *ConnectorNameKeyword; + static char *SegmentValueKeyword; + static char *ViaNameKeyword; + static char *BigViaNameKeyword; + static char *BigViaValueKeyword; + static char *SymmetryNameKeyword; + static char *OrientNameKeyword; + static char *ReferenceNameKeyword; + static char *RdsLayerNameKeyword; + static char *CursorColorNameKeyword; + static char *CursorSizeKeyword; + + + static keyword KeywordDefine[ GSB_MAX_KEYWORD ] = + + + { + { "alu1", ALU1 }, + { "alu2", ALU2 }, + { "alu3", ALU3 }, + { "alu4", ALU4 }, + { "alu5", ALU5 }, + { "alu6", ALU6 }, + { "alu7", ALU7 }, + { "alu8", ALU8 }, + { "alu9", ALU9 }, + { "c_x_n", C_X_N }, + { "c_x_p", C_X_P }, + { "calu1", CALU1 }, + { "calu2", CALU2 }, + { "calu3", CALU3 }, + { "calu4", CALU4 }, + { "calu5", CALU5 }, + { "calu6", CALU6 }, + { "calu7", CALU7 }, + { "calu8", CALU8 }, + { "calu9", CALU9 }, + { "cont_body_n", CONT_BODY_N }, + { "cont_body_p", CONT_BODY_P }, + { "cont_dif_n", CONT_DIF_N }, + { "cont_dif_p", CONT_DIF_P }, + { "cont_poly", CONT_POLY }, + { "cont_poly2", CONT_POLY2 }, + { "cont_turn1", CONT_TURN1 }, + { "cont_turn2", CONT_TURN2 }, + { "cont_turn3", CONT_TURN3 }, + { "cont_turn4", CONT_TURN4 }, + { "cont_turn5", CONT_TURN5 }, + { "cont_turn6", CONT_TURN6 }, + { "cont_turn7", CONT_TURN7 }, + { "cont_turn8", CONT_TURN8 }, + { "cont_turn9", CONT_TURN9 }, + { "cont_via", CONT_VIA }, + { "cont_via2", CONT_VIA2 }, + { "cont_via3", CONT_VIA3 }, + { "cont_via4", CONT_VIA4 }, + { "cont_via5", CONT_VIA5 }, + { "cont_via6", CONT_VIA6 }, + { "cont_via7", CONT_VIA7 }, + { "cont_via8", CONT_VIA8 }, + { "east", GRAAL_EAST }, + { "ndif", NDIF }, + { "north", GRAAL_NORTH }, + { "nosym", NOSYM }, + { "ntie", NTIE }, + { "ntrans", NTRANS }, + { "nwell", NWELL }, + { "pdif", PDIF }, + { "poly", POLY }, + { "poly2", POLY2 }, + { "ptie", PTIE }, + { "ptrans", PTRANS }, + { "pwell", PWELL }, + { "rds_abox", RDS_LAYER_ABOX }, + { "rds_activ", RDS_LAYER_ACTIV }, + { "rds_alu1", RDS_LAYER_ALU1 }, + { "rds_alu2", RDS_LAYER_ALU2 }, + { "rds_alu3", RDS_LAYER_ALU3 }, + { "rds_alu4", RDS_LAYER_ALU4 }, + { "rds_alu5", RDS_LAYER_ALU5 }, + { "rds_alu6", RDS_LAYER_ALU6 }, + { "rds_alu7", RDS_LAYER_ALU7 }, + { "rds_alu8", RDS_LAYER_ALU8 }, + { "rds_alu9", RDS_LAYER_ALU9 }, + { "rds_cont", RDS_LAYER_CONT }, + { "rds_cont2", RDS_LAYER_CONT2 }, + { "rds_cpas", RDS_LAYER_CPAS }, + { "rds_gate", RDS_LAYER_GATE }, + { "rds_ndif", RDS_LAYER_NDIF }, + { "rds_nimp", RDS_LAYER_NIMP }, + { "rds_ntie", RDS_LAYER_NTIE }, + { "rds_nwell", RDS_LAYER_NWELL }, + { "rds_pdif", RDS_LAYER_PDIF }, + { "rds_pimp", RDS_LAYER_PIMP }, + { "rds_poly", RDS_LAYER_POLY }, + { "rds_poly2", RDS_LAYER_POLY2 }, + { "rds_ptie", RDS_LAYER_PTIE }, + { "rds_pwell", RDS_LAYER_PWELL }, + { "rds_ref", RDS_LAYER_REF }, + { "rds_talu1", RDS_LAYER_TALU1 }, + { "rds_talu2", RDS_LAYER_TALU2 }, + { "rds_talu3", RDS_LAYER_TALU3 }, + { "rds_talu4", RDS_LAYER_TALU4 }, + { "rds_talu5", RDS_LAYER_TALU5 }, + { "rds_talu6", RDS_LAYER_TALU6 }, + { "rds_talu7", RDS_LAYER_TALU7 }, + { "rds_talu8", RDS_LAYER_TALU8 }, + { "rds_tcont", RDS_LAYER_TCONT }, + { "rds_tpoly", RDS_LAYER_TPOLY }, + { "rds_tpoly2", RDS_LAYER_TPOLY2 }, + { "rds_tvia1", RDS_LAYER_TVIA1 }, + { "rds_tvia2", RDS_LAYER_TVIA2 }, + { "rds_tvia3", RDS_LAYER_TVIA3 }, + { "rds_tvia4", RDS_LAYER_TVIA4 }, + { "rds_tvia5", RDS_LAYER_TVIA5 }, + { "rds_tvia6", RDS_LAYER_TVIA6 }, + { "rds_tvia7", RDS_LAYER_TVIA7 }, + { "rds_tvia8", RDS_LAYER_TVIA8 }, + { "rds_user0", RDS_LAYER_USER0 }, + { "rds_user1", RDS_LAYER_USER1 }, + { "rds_user2", RDS_LAYER_USER2 }, + { "rds_user3", RDS_LAYER_USER3 }, + { "rds_user4", RDS_LAYER_USER4 }, + { "rds_user5", RDS_LAYER_USER5 }, + { "rds_user6", RDS_LAYER_USER6 }, + { "rds_user7", RDS_LAYER_USER7 }, + { "rds_user8", RDS_LAYER_USER8 }, + { "rds_user9", RDS_LAYER_USER9 }, + { "rds_valu1", RDS_LAYER_VALU1 }, + { "rds_valu2", RDS_LAYER_VALU2 }, + { "rds_valu3", RDS_LAYER_VALU3 }, + { "rds_valu4", RDS_LAYER_VALU4 }, + { "rds_valu5", RDS_LAYER_VALU5 }, + { "rds_valu6", RDS_LAYER_VALU6 }, + { "rds_valu7", RDS_LAYER_VALU7 }, + { "rds_valu8", RDS_LAYER_VALU8 }, + { "rds_via1", RDS_LAYER_VIA1 }, + { "rds_via2", RDS_LAYER_VIA2 }, + { "rds_via3", RDS_LAYER_VIA3 }, + { "rds_via4", RDS_LAYER_VIA4 }, + { "rds_via5", RDS_LAYER_VIA5 }, + { "rds_via6", RDS_LAYER_VIA6 }, + { "rds_via7", RDS_LAYER_VIA7 }, + { "rds_via8", RDS_LAYER_VIA8 }, + { "rds_vpoly", RDS_LAYER_VPOLY }, + { "ref_con", MBK_REF_CON }, + { "ref_ref", MBK_REF_REF }, + { "rot_m", ROT_M }, + { "rot_p", ROT_P }, + { "south", GRAAL_SOUTH }, + { "sy_rm", SY_RM }, + { "sy_rp", SY_RP }, + { "sym_x", SYM_X }, + { "sym_y", SYM_Y }, + { "symxy", SYMXY }, + { "talu1", TALU1 }, + { "talu2", TALU2 }, + { "talu3", TALU3 }, + { "talu4", TALU4 }, + { "talu5", TALU5 }, + { "talu6", TALU6 }, + { "talu7", TALU7 }, + { "talu8", TALU8 }, + { "tpoly", TPOLY }, + { "tpoly2", TPOLY2 }, + { "west", GRAAL_WEST } + }; + +/*------------------------------------------------------------\ +| | +| File variables | +| | +\------------------------------------------------------------*/ + + static FILE *GsbFile; + static char GsbBuffer[ GSB_MAX_BUFFER ]; + static long GsbCurrentLine; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Gsb File Get String | +| | +\------------------------------------------------------------*/ + +char *GsbFileGetString( String, Size ) + + char *String; + int Size; +{ + register char *RegisterString; + register Register; + + rdsbegin(); + + RegisterString = String; + + while (--Size > 0 && (Register = getc( GsbFile )) != EOF ) + { + if ((*RegisterString++ = Register) == '\\') + { + if ((Register = getc( GsbFile )) == '\n') + { + *(RegisterString - 1) = ' '; + } + else + { + ungetc( Register, GsbFile ); + } + } + else + { + if ( Register == '\n') break; + } + } + + *RegisterString = '\0'; + + rdsend(); + return ( ( Register == EOF ) && + ( RegisterString == String ) ) ? (char *)NULL : String; +} + +/*------------------------------------------------------------\ +| | +| Gsb File Get Line | +| | +\------------------------------------------------------------*/ + +void GsbGetLine( Buffer ) + + char *Buffer; +{ + char *Check; + char *String; + char OneComment; + + rdsbegin(); + + do + { + OneComment = 0; + + Check = GsbFileGetString( Buffer, GSB_MAX_BUFFER ); + + if ( Check != (char *)NULL ) + { + GsbCurrentLine++; + } + else + { + GsbError( UNEXPECTED_EOF, (char *)NULL, GsbCurrentLine ); + } + + if ( String = strchr( Buffer, GSB_COMMENT_CHAR )) + { + if ( String == Buffer ) + { + OneComment = 1; + } + else + { + *(String - 1) = '\0'; + } + } + + while (*Buffer != '\0' && strchr( GSB_SEPARATORS_STRING, *Buffer)) + { + Buffer = Buffer + 1;; + } + + if (*Buffer == '\0') OneComment = 1; + + } + while ( OneComment == 1); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Gsb Check Keyword | +| | +\------------------------------------------------------------*/ + +char GsbCheckKeyword( Word ) + + char *Word; +{ + if ( ( Word == DefineKeyword ) || + ( Word == TableKeyword ) ) + { + return 1; + } + else + { + return 0; + } +} + +/*------------------------------------------------------------\ +| | +| Gsb Get First word | +| | +\------------------------------------------------------------*/ + +char *GsbGetFirstWord( Buffer, IsKeyword, Hash ) + + char *Buffer; + char IsKeyword; + char Hash; +{ + char *String; + char *Text; + int Index; + + rdsbegin(); + + if ( String = (char *)strtok( Buffer, GSB_SEPARATORS_STRING )) + { + if ( Hash ) + { + String = namealloc( String ); + } + else + { + Text = malloc( strlen( String ) + 1 ); + strcpy( Text, String ); + String = Text; + + for ( Index = 0; Text[ Index ]; Index++ ) + { + if ( Text[ Index ] == '_' ) Text[ Index ] = ' '; + } + } + + if ( ( IsKeyword ) && GsbCheckKeyword( String ) ) + { + GsbError( UNEXPECTED_LINE, String, GsbCurrentLine ); + } + } + + rdsend(); + return( String ); +} + +/*------------------------------------------------------------\ +| | +| Gsb Get Next word | +| | +\------------------------------------------------------------*/ + +char *GsbGetNextWord( IsKeyword, Hash ) + + char IsKeyword; + char Hash; +{ + char *String; + char *Text; + int Index; + + rdsbegin(); + + if ( String = (char *)strtok( (char *)NULL, GSB_SEPARATORS_STRING )) + { + if ( Hash ) + { + String = namealloc( String ); + } + else + { + Text = malloc( strlen( String ) + 1 ); + strcpy( Text, String ); + String = Text; + + for ( Index = 0; Text[ Index ]; Index++ ) + { + if ( Text[ Index ] == '_' ) Text[ Index ] = ' '; + } + } + + if ( ( IsKeyword ) && GsbCheckKeyword( String ) ) + { + GsbError( UNEXPECTED_LINE, String, GsbCurrentLine ); + } + } + + rdsend(); + return( String ); +} + +/*------------------------------------------------------------\ +| | +| Gsb Keyword Compare | +| | +\------------------------------------------------------------*/ + +int GsbKeywordCompare( FirstKey, SecondKey ) + + keyword *FirstKey; + keyword *SecondKey; +{ + return strcmp( FirstKey->NAME, SecondKey->NAME ); +} + +/*------------------------------------------------------------\ +| | +| Gsb Get String Value | +| | +\------------------------------------------------------------*/ + +long GsbGetStringValue( String ) + + char *String; +{ + long Value; + keyword *Keyword; + keyword Entry; + + rdsbegin(); + + if ( sscanf( String, "%ld", &Value) ) + { + rdsend(); + return ( Value ); + } + + Entry.NAME = String; + + Keyword = (keyword *)bsearch( (char *)(&Entry), + (char *)KeywordDefine, + GSB_MAX_KEYWORD, sizeof( keyword ), + GsbKeywordCompare ); + + if ( Keyword == (keyword *)NULL ) + { + GsbError( UNEXPECTED_LINE, String, GsbCurrentLine ); + } + + rdsend(); + return( Keyword->VALUE ); +} + +/*------------------------------------------------------------\ +| | +| Gsb Get String Float | +| | +\------------------------------------------------------------*/ + +float GsbGetStringFloat( String ) + + char *String; +{ + float Value; + + rdsbegin(); + + if ( ! sscanf( String, "%g", &Value) ) + { + GsbError( ILLEGAL_FLOAT, String, GsbCurrentLine ); + } + + rdsend(); + return ( Value ); +} + +/*------------------------------------------------------------\ +| | +| Gsb Get Number | +| | +\------------------------------------------------------------*/ + +long GsbGetNumber( String ) + + char *String; +{ + long Value; + + rdsbegin(); + + if ( ! sscanf( String, "%d", &Value )) + { + GsbError( UNEXPECTED_LINE, "number", GsbCurrentLine ); + } + + rdsend(); + return Value; +} + +/*------------------------------------------------------------\ +| | +| Gsb Read Segment Name | +| | +\------------------------------------------------------------*/ + +void GsbReadSegmentName() + +{ + char Layer; + char Field; + char LayerCount; + char EndTable; + char *FirstWord; + + rdsbegin(); + + EndTable = 0; + LayerCount = 0; + + while ( ( EndTable != 1 ) && + ( LayerCount <= MBK_MAX_LAYER ) ) + { + GsbGetLine( GsbBuffer ); + + FirstWord = GsbGetFirstWord( GsbBuffer, 1, 1 ); + + if ( FirstWord == EndTableKeyword ) + { + EndTable = 1; + } + else + if ( LayerCount < MBK_MAX_LAYER ) + { + Layer = GsbGetStringValue( FirstWord ); + + for ( Field = 0; Field < 3; Field++ ) + { + FirstWord = GsbGetNextWord( 0, 0 ); + + if ( FirstWord == EndRecordKeyword ) + { + GsbError( MISSING_VALUE, (char *)NULL, GsbCurrentLine ); + } + else + if ( GET_SEGMENT_LAYER( Layer, 0 ) != RDS_SEGMENT_EMPTY ) + + { + GRAAL_SEGMENT_NAME_TABLE [ Layer ][ Field ] = FirstWord; + } + } + + FirstWord = GsbGetNextWord( 0, 1 ); + + if ( FirstWord != EndRecordKeyword ) + { + GsbError( TOO_MANY_WORDS, FirstWord, GsbCurrentLine ); + } + } + + LayerCount = LayerCount + 1; + } + + if ( EndTable == 0 ) + { + GsbError( LINE_EXPECTED, EndTableKeyword, GsbCurrentLine); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Gsb Read Transistor Name | +| | +\------------------------------------------------------------*/ + +void GsbReadTransistorName() + +{ + char Layer; + char Field; + char LayerCount; + char EndTable; + char *FirstWord; + + rdsbegin(); + + EndTable = 0; + LayerCount = 0; + + while ( ( EndTable != 1 ) && + ( LayerCount <= MBK_MAX_LAYER ) ) + { + GsbGetLine( GsbBuffer ); + + FirstWord = GsbGetFirstWord( GsbBuffer, 1, 1 ); + + if ( FirstWord == EndTableKeyword ) + { + EndTable = 1; + } + else + if ( LayerCount < MBK_MAX_LAYER ) + { + Layer = GsbGetStringValue( FirstWord ); + + for ( Field = 0; Field < 3; Field++ ) + { + FirstWord = GsbGetNextWord( 0, 0 ); + + if ( FirstWord == EndRecordKeyword ) + { + GsbError( MISSING_VALUE, (char *)NULL, GsbCurrentLine ); + } + else + if ( GET_SEGMENT_LAYER( Layer, 0 ) != RDS_SEGMENT_EMPTY ) + { + GRAAL_TRANSISTOR_NAME_TABLE [ Layer ][ Field ] = FirstWord; + } + } + + FirstWord = GsbGetNextWord( 0, 1 ); + + if ( FirstWord != EndRecordKeyword ) + { + GsbError( TOO_MANY_WORDS, FirstWord, GsbCurrentLine ); + } + } + + LayerCount = LayerCount + 1; + } + + if ( EndTable == 0 ) + { + GsbError( LINE_EXPECTED, EndTableKeyword, GsbCurrentLine); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Gsb Read Connector Name | +| | +\------------------------------------------------------------*/ + +void GsbReadConnectorName() + +{ + char Layer; + char Field; + char LayerCount; + char EndTable; + char *FirstWord; + + rdsbegin(); + + EndTable = 0; + LayerCount = 0; + + while ( ( EndTable != 1 ) && + ( LayerCount <= MBK_MAX_LAYER ) ) + { + GsbGetLine( GsbBuffer ); + + FirstWord = GsbGetFirstWord( GsbBuffer, 1, 1 ); + + if ( FirstWord == EndTableKeyword ) + { + EndTable = 1; + } + else + if ( LayerCount < MBK_MAX_LAYER ) + { + Layer = GsbGetStringValue( FirstWord ); + + for ( Field = 0; Field < 3; Field++ ) + { + FirstWord = GsbGetNextWord( 0, 0 ); + + if ( FirstWord == EndRecordKeyword ) + { + GsbError( MISSING_VALUE, (char *)NULL, GsbCurrentLine ); + } + else + if ( GET_SEGMENT_LAYER( Layer, 0 ) != RDS_SEGMENT_EMPTY ) + { + GRAAL_CONNECTOR_NAME_TABLE [ Layer ][ Field ] = FirstWord; + } + } + + FirstWord = GsbGetNextWord( 0, 1 ); + + if ( FirstWord != EndRecordKeyword ) + { + GsbError( TOO_MANY_WORDS, FirstWord, GsbCurrentLine ); + } + } + + LayerCount = LayerCount + 1; + } + + if ( EndTable == 0 ) + { + GsbError( LINE_EXPECTED, EndTableKeyword, GsbCurrentLine); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Gsb Read Segment Value | +| | +\------------------------------------------------------------*/ + +void GsbReadSegmentValue() + +{ + char Layer; + char Field; + char LayerCount; + char EndTable; + char *FirstWord; + + rdsbegin(); + + EndTable = 0; + LayerCount = 0; + + while ( ( EndTable != 1 ) && + ( LayerCount <= MBK_MAX_LAYER ) ) + { + GsbGetLine( GsbBuffer ); + + FirstWord = GsbGetFirstWord( GsbBuffer, 1, 1 ); + + if ( FirstWord == EndTableKeyword ) + { + EndTable = 1; + } + else + if ( LayerCount < MBK_MAX_LAYER ) + { + Layer = GsbGetStringValue( FirstWord ); + + for ( Field = 0; Field < 2; Field++ ) + { + FirstWord = GsbGetNextWord( 0, 0 ); + + if ( FirstWord == EndRecordKeyword ) + { + GsbError( MISSING_VALUE, (char *)NULL, GsbCurrentLine ); + } + else + if ( GET_SEGMENT_LAYER( Layer, 0 ) != RDS_SEGMENT_EMPTY ) + { + GRAAL_SEGMENT_VALUE_TABLE [ Layer ][ Field ] = GsbGetStringValue( FirstWord ); + } + } + + FirstWord = GsbGetNextWord( 0, 1 ); + + if ( FirstWord != EndRecordKeyword ) + { + GsbError( TOO_MANY_WORDS, FirstWord, GsbCurrentLine ); + } + } + + LayerCount = LayerCount + 1; + } + + if ( EndTable == 0 ) + { + GsbError( LINE_EXPECTED, EndTableKeyword, GsbCurrentLine); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Gsb Read BigVia Value | +| | +\------------------------------------------------------------*/ + +void GsbReadBigViaValue() + +{ + char Layer; + char Field; + char LayerCount; + char EndTable; + char *FirstWord; + + rdsbegin(); + + EndTable = 0; + LayerCount = 0; + + while ( ( EndTable != 1 ) && + ( LayerCount <= MBK_MAX_VIA ) ) + { + GsbGetLine( GsbBuffer ); + + FirstWord = GsbGetFirstWord( GsbBuffer, 1, 1 ); + + if ( FirstWord == EndTableKeyword ) + { + EndTable = 1; + } + else + if ( LayerCount < MBK_MAX_VIA ) + { + Layer = GsbGetStringValue( FirstWord ); + + FirstWord = GsbGetNextWord( 0, 0 ); + + if ( FirstWord == EndRecordKeyword ) + { + GsbError( MISSING_VALUE, (char *)NULL, GsbCurrentLine ); + } + else + if ( ( GET_BIGVIA_HOLE_LAYER( Layer, 0 ) != RDS_BIGVIA_HOLE_EMPTY ) || + ( GET_TURNVIA_LAYER( Layer, 0 ) != RDS_TURNVIA_EMPTY ) ) + { + GRAAL_BIGVIA_VALUE_TABLE [ Layer ][ 0 ] = GsbGetStringValue( FirstWord ); + } + + FirstWord = GsbGetNextWord( 0, 1 ); + + if ( FirstWord != EndRecordKeyword ) + { + GsbError( TOO_MANY_WORDS, FirstWord, GsbCurrentLine ); + } + } + + LayerCount = LayerCount + 1; + } + + if ( EndTable == 0 ) + { + GsbError( LINE_EXPECTED, EndTableKeyword, GsbCurrentLine); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Gsb Read Reference Name | +| | +\------------------------------------------------------------*/ + +void GsbReadReferenceName() + +{ + char Layer; + char Field; + char LayerCount; + char EndTable; + char *FirstWord; + + rdsbegin(); + + EndTable = 0; + LayerCount = 0; + + while ( ( EndTable != 1 ) && + ( LayerCount <= MBK_MAX_REFERENCE ) ) + { + GsbGetLine( GsbBuffer ); + + FirstWord = GsbGetFirstWord( GsbBuffer, 1, 1 ); + + if ( FirstWord == EndTableKeyword ) + { + EndTable = 1; + } + else + if ( LayerCount < MBK_MAX_REFERENCE ) + { + Layer = GsbGetStringValue( FirstWord ); + + for ( Field = 0; Field < 3; Field++ ) + { + FirstWord = GsbGetNextWord( 0, 0 ); + + if ( FirstWord == EndRecordKeyword ) + { + GsbError( MISSING_VALUE, (char *)NULL, GsbCurrentLine ); + } + else + if ( GET_REFERENCE_LAYER( Layer, 0 ) != RDS_REFERENCE_EMPTY ) + { + GRAAL_REFERENCE_NAME_TABLE [ Layer ][ Field ] = FirstWord; + } + } + + FirstWord = GsbGetNextWord( 0, 1 ); + + if ( FirstWord != EndRecordKeyword ) + { + GsbError( TOO_MANY_WORDS, FirstWord, GsbCurrentLine ); + } + } + + LayerCount = LayerCount + 1; + } + + if ( EndTable == 0 ) + { + GsbError( LINE_EXPECTED, EndTableKeyword, GsbCurrentLine); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Gsb Read Orient Name | +| | +\------------------------------------------------------------*/ + +void GsbReadOrientName() + +{ + char Layer; + char Field; + char LayerCount; + char EndTable; + char *FirstWord; + + rdsbegin(); + + EndTable = 0; + LayerCount = 0; + + while ( ( EndTable != 1 ) && + ( LayerCount <= MBK_MAX_ORIENT ) ) + { + GsbGetLine( GsbBuffer ); + + FirstWord = GsbGetFirstWord( GsbBuffer, 1, 1 ); + + if ( FirstWord == EndTableKeyword ) + { + EndTable = 1; + } + else + if ( LayerCount < MBK_MAX_ORIENT ) + { + Layer = GsbGetStringValue( FirstWord ); + + for ( Field = 0; Field < 3; Field++ ) + { + FirstWord = GsbGetNextWord( 0, 0 ); + + if ( FirstWord == EndRecordKeyword ) + { + GsbError( MISSING_VALUE, (char *)NULL, GsbCurrentLine ); + } + else + { + GRAAL_ORIENT_NAME_TABLE [ Layer ][ Field ] = FirstWord; + } + } + + FirstWord = GsbGetNextWord( 0, 1 ); + + if ( FirstWord != EndRecordKeyword ) + { + GsbError( TOO_MANY_WORDS, FirstWord, GsbCurrentLine ); + } + } + + LayerCount = LayerCount + 1; + } + + if ( EndTable == 0 ) + { + GsbError( LINE_EXPECTED, EndTableKeyword, GsbCurrentLine); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Gsb Read Symmetry Name | +| | +\------------------------------------------------------------*/ + +void GsbReadSymmetryName() + +{ + char Layer; + char Field; + char LayerCount; + char EndTable; + char *FirstWord; + + rdsbegin(); + + EndTable = 0; + LayerCount = 0; + + while ( ( EndTable != 1 ) && + ( LayerCount <= MBK_MAX_SYMMETRY ) ) + { + GsbGetLine( GsbBuffer ); + + FirstWord = GsbGetFirstWord( GsbBuffer, 1, 1 ); + + if ( FirstWord == EndTableKeyword ) + { + EndTable = 1; + } + else + if ( LayerCount < MBK_MAX_SYMMETRY ) + { + Layer = GsbGetStringValue( FirstWord ); + + for ( Field = 0; Field < 3; Field++ ) + { + FirstWord = GsbGetNextWord( 0, 0 ); + + if ( FirstWord == EndRecordKeyword ) + { + GsbError( MISSING_VALUE, (char *)NULL, GsbCurrentLine ); + } + else + { + GRAAL_SYMMETRY_NAME_TABLE [ Layer ][ Field ] = FirstWord; + } + } + + FirstWord = GsbGetNextWord( 0, 1 ); + + if ( FirstWord != EndRecordKeyword ) + { + GsbError( TOO_MANY_WORDS, FirstWord, GsbCurrentLine ); + } + } + + LayerCount = LayerCount + 1; + } + + if ( EndTable == 0 ) + { + GsbError( LINE_EXPECTED, EndTableKeyword, GsbCurrentLine); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Gsb Read Big Via Name | +| | +\------------------------------------------------------------*/ + +void GsbReadBigViaName() + +{ + char Layer; + char LayerCount; + char EndTable; + char Field; + char *FirstWord; + + rdsbegin(); + + EndTable = 0; + LayerCount = 0; + + while ( ( EndTable != 1 ) && + ( LayerCount <= MBK_MAX_VIA ) ) + { + GsbGetLine( GsbBuffer ); + + FirstWord = GsbGetFirstWord( GsbBuffer, 1, 1 ); + + if ( FirstWord == EndTableKeyword ) + { + EndTable = 1; + } + else + if ( LayerCount < MBK_MAX_VIA ) + { + Layer = GsbGetStringValue( FirstWord ); + + for ( Field = 0; Field < 3; Field++ ) + { + FirstWord = GsbGetNextWord( 1, 0 ); + + if ( FirstWord == EndRecordKeyword ) + { + GsbError( MISSING_VALUE, (char *)NULL, GsbCurrentLine ); + } + else + if ( ( GET_BIGVIA_HOLE_LAYER( Layer, 0 ) != RDS_BIGVIA_HOLE_EMPTY ) || + ( GET_TURNVIA_LAYER( Layer, 0 ) != RDS_TURNVIA_EMPTY ) ) + { + GRAAL_BIGVIA_NAME_TABLE [ Layer ][ Field ] = FirstWord; + } + } + + FirstWord = GsbGetNextWord( 0, 1 ); + + if ( FirstWord != EndRecordKeyword ) + { + GsbError( TOO_MANY_WORDS, FirstWord, GsbCurrentLine ); + } + } + + LayerCount = LayerCount + 1; + } + + if ( EndTable == 0 ) + { + GsbError( LINE_EXPECTED, EndTableKeyword, GsbCurrentLine); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Gsb Read Via Name | +| | +\------------------------------------------------------------*/ + +void GsbReadViaName() + +{ + char Layer; + char LayerCount; + char EndTable; + char Field; + char *FirstWord; + + rdsbegin(); + + EndTable = 0; + LayerCount = 0; + + while ( ( EndTable != 1 ) && + ( LayerCount <= MBK_MAX_VIA ) ) + { + GsbGetLine( GsbBuffer ); + + FirstWord = GsbGetFirstWord( GsbBuffer, 1, 1 ); + + if ( FirstWord == EndTableKeyword ) + { + EndTable = 1; + } + else + if ( LayerCount < MBK_MAX_VIA ) + { + Layer = GsbGetStringValue( FirstWord ); + + for ( Field = 0; Field < 3; Field++ ) + { + FirstWord = GsbGetNextWord( 1, 0 ); + + if ( FirstWord == EndRecordKeyword ) + { + GsbError( MISSING_VALUE, (char *)NULL, GsbCurrentLine ); + } + else + if ( GET_VIA_LAYER( Layer, 0 ) != RDS_VIA_EMPTY ) + { + GRAAL_VIA_NAME_TABLE [ Layer ][ Field ] = FirstWord; + } + } + + FirstWord = GsbGetNextWord( 0, 1 ); + + if ( FirstWord != EndRecordKeyword ) + { + GsbError( TOO_MANY_WORDS, FirstWord, GsbCurrentLine ); + } + } + + LayerCount = LayerCount + 1; + } + + if ( EndTable == 0 ) + { + GsbError( LINE_EXPECTED, EndTableKeyword, GsbCurrentLine); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Gsb Read Rds Layer Name | +| | +\------------------------------------------------------------*/ + +void GsbReadRdsLayerName() + +{ + char Layer; + char Pattern; + char LayerCount; + char EndTable; + char Field; + char *FirstWord; + + rdsbegin(); + + EndTable = 0; + LayerCount = 0; + + while ( ( EndTable != 1 ) && + ( LayerCount <= RDS_ALL_LAYER ) ) + { + GsbGetLine( GsbBuffer ); + + FirstWord = GsbGetFirstWord( GsbBuffer, 1, 1 ); + + if ( FirstWord == EndTableKeyword ) + { + EndTable = 1; + } + else + if ( LayerCount < RDS_ALL_LAYER ) + { + Layer = GsbGetStringValue( FirstWord ); + + for ( Field = 0; Field < 3; Field++ ) + { + FirstWord = GsbGetNextWord( 1, 0 ); + + if ( FirstWord == EndRecordKeyword ) + { + GsbError( MISSING_VALUE, (char *)NULL, GsbCurrentLine ); + } + else + if ( RDS_DYNAMIC_LAYER[ Layer ] != RDS_LAYER_UNUSED ) + { + GRAAL_RDS_LAYER_NAME_TABLE [ Layer ][ Field ] = FirstWord; + } + } + + FirstWord = GsbGetNextWord( 0, 1 ); + + if ( FirstWord != EndRecordKeyword ) + { + Pattern = GsbGetStringValue( FirstWord ); + + if ( RDS_DYNAMIC_LAYER[ Layer ] != RDS_LAYER_UNUSED ) + { + GRAAL_RDS_LAYER_PATTERN_TABLE[ Layer ] = (int)Pattern; + } + + FirstWord = GsbGetNextWord( 0, 1 ); + if ( FirstWord != EndRecordKeyword ) + { + GsbError( TOO_MANY_WORDS, FirstWord, GsbCurrentLine ); + } + } + } + + LayerCount = LayerCount + 1; + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Gsb Read Parameters | +| | +\------------------------------------------------------------*/ + +void GsbReadParam() + +{ + char *FirstWord; + char *SecondWord; + long Continue; + + rdsbegin(); + + Continue = 0; + + while ( Continue != GSB_ALL_DEFINED_MASK ) + { + GsbGetLine( GsbBuffer ); + + FirstWord = GsbGetFirstWord( GsbBuffer, 0, 1); + + if ( FirstWord == DefineKeyword ) + { + FirstWord = GsbGetNextWord( 1, 1 ); + + if (! FirstWord ) + { + GsbError( MISSING_NAME, DefineKeyword, GsbCurrentLine ); + } + + SecondWord = GsbGetNextWord( 1, 0 ); + + if (! SecondWord ) + { + GsbError( MISSING_VALUE, SecondWord, GsbCurrentLine ); + } + + if ( FirstWord == PeekBoundKeyword ) + { + GRAAL_PEEK_BOUND = GsbGetStringValue( SecondWord ) * GRAAL_RDS_LAMBDA; + + Continue |= GSB_PEEK_BOUND_MASK; + } + else + if ( FirstWord == LowerGridStepKeyword ) + { + GRAAL_LOWER_GRID_STEP = GsbGetStringFloat( SecondWord ); + + Continue |= GSB_LOWER_GRID_STEP_MASK; + } + else + if ( FirstWord == LowerFigureStepKeyword ) + { + GRAAL_LOWER_FIGURE_STEP = GsbGetStringFloat( SecondWord ) / GRAAL_SCALE; + + Continue |= GSB_LOWER_FIGURE_STEP_MASK; + } + else + if ( FirstWord == LowerInstanceStepKeyword ) + { + GRAAL_LOWER_INSTANCE_STEP = GsbGetStringFloat( SecondWord ) / GRAAL_SCALE; + + Continue |= GSB_LOWER_INSTANCE_STEP_MASK; + } + else + if ( FirstWord == LowerSegmentStepKeyword ) + { + GRAAL_LOWER_SEGMENT_STEP = GsbGetStringFloat( SecondWord ) / GRAAL_SCALE; + + Continue |= GSB_LOWER_SEGMENT_STEP_MASK; + } + else + if ( FirstWord == LowerConnectorStepKeyword ) + { + GRAAL_LOWER_CONNECTOR_STEP = GsbGetStringFloat( SecondWord ) / GRAAL_SCALE; + + Continue |= GSB_LOWER_CONNECTOR_STEP_MASK; + } + else + if ( FirstWord == LowerReferenceStepKeyword ) + { + GRAAL_LOWER_REFERENCE_STEP = GsbGetStringFloat( SecondWord ) / GRAAL_SCALE; + + Continue |= GSB_LOWER_REFERENCE_STEP_MASK; + } + else + if ( FirstWord == CursorColorNameKeyword ) + { + GRAAL_CURSOR_COLOR_NAME = namealloc( SecondWord ); + + Continue |= GSB_CURSOR_COLOR_NAME_MASK; + } + else + if ( FirstWord == CursorSizeKeyword ) + { + GRAAL_CURSOR_SIZE = GsbGetStringValue( SecondWord ); + + Continue |= GSB_CURSOR_SIZE_MASK; + } + else + { + GsbError( UNKNOWN_DEFINE, FirstWord, GsbCurrentLine ); + } + } + else + if ( FirstWord == TableKeyword ) + { + if (!( FirstWord = GsbGetNextWord(1, 1))) + { + GsbError( MISSING_NAME, TableKeyword ); + } + + if ( FirstWord == ConnectorNameKeyword ) + { + GsbReadConnectorName(); + + Continue |= GSB_CONNECTOR_NAME_MASK; + } + else + if ( FirstWord == SegmentNameKeyword ) + { + GsbReadSegmentName(); + + Continue |= GSB_SEGMENT_NAME_MASK; + } + else + if ( FirstWord == SegmentValueKeyword ) + { + GsbReadSegmentValue(); + + Continue |= GSB_SEGMENT_VALUE_MASK; + } + else + if ( FirstWord == BigViaValueKeyword ) + { + GsbReadBigViaValue(); + + Continue |= GSB_BIGVIA_VALUE_MASK; + } + else + if ( FirstWord == TransistorNameKeyword ) + { + GsbReadTransistorName(); + + Continue |= GSB_TRANSISTOR_NAME_MASK; + } + else + if ( FirstWord == ViaNameKeyword ) + { + GsbReadViaName(); + + Continue |= GSB_VIA_NAME_MASK; + } + else + if ( FirstWord == BigViaNameKeyword ) + { + GsbReadBigViaName(); + + Continue |= GSB_BIGVIA_NAME_MASK; + } + else + if ( FirstWord == ReferenceNameKeyword ) + { + GsbReadReferenceName(); + + Continue |= GSB_REFERENCE_NAME_MASK; + } + else + if ( FirstWord == OrientNameKeyword ) + { + GsbReadOrientName(); + + Continue |= GSB_ORIENT_NAME_MASK; + } + else + if ( FirstWord == SymmetryNameKeyword ) + { + GsbReadSymmetryName(); + + Continue |= GSB_SYMMETRY_NAME_MASK; + } + else + if ( FirstWord == RdsLayerNameKeyword ) + { + GsbReadRdsLayerName(); + + Continue |= GSB_RDS_LAYER_NAME_MASK; + } + else + { + GsbError( UNKNOWN_TABLE, FirstWord, GsbCurrentLine ); + } + } + else + { + GsbError( SYNTAX_ERROR, FirstWord, GsbCurrentLine ); + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Gsb Load Parameters | +| | +\------------------------------------------------------------*/ + +void GraalLoadParameters() + +{ + char Layer; + char Buffer[ 512 ]; + char *String; + + rdsbegin(); + + GRAAL_TECHNO_NAME = mbkgetenv( "GRAAL_TECHNO_NAME" ); + + if ( GRAAL_TECHNO_NAME == (char *)NULL ) + { + String = mbkgetenv( "ALLIANCE_TOP" ); + if ( String == (char *)NULL ) String = ALLIANCE_TOP; + + sprintf( Buffer, "%s/%s", String, GRAAL_DEFAULT_TECHNO_NAME ); + GRAAL_TECHNO_NAME = mbkstrdup( Buffer ); + } + + GRAAL_RDS_LAMBDA = RDS_LAMBDA / GRAAL_SCALE; + GRAAL_SCALE_X = SCALE_X / GRAAL_SCALE; + + if ( ! KeywordDefined ) + { + DefineKeyword = namealloc( DEFINE_KEYWORD ); + TableKeyword = namealloc( TABLE_KEYWORD ); + EndTableKeyword = namealloc( END_TABLE_KEYWORD ); + EndRecordKeyword = namealloc( END_RECORD_KEYWORD ); + PeekBoundKeyword = namealloc( PEEK_BOUND_KEYWORD ); + LowerGridStepKeyword = namealloc( LOWER_GRID_STEP_KEYWORD ); + LowerFigureStepKeyword = namealloc( LOWER_FIGURE_STEP_KEYWORD ); + LowerInstanceStepKeyword = namealloc( LOWER_INSTANCE_STEP_KEYWORD ); + LowerReferenceStepKeyword = namealloc( LOWER_REFERENCE_STEP_KEYWORD ); + LowerSegmentStepKeyword = namealloc( LOWER_SEGMENT_STEP_KEYWORD ); + LowerConnectorStepKeyword = namealloc( LOWER_CONNECTOR_STEP_KEYWORD ); + CursorColorNameKeyword = namealloc( CURSOR_COLOR_NAME_KEYWORD ); + CursorSizeKeyword = namealloc( CURSOR_SIZE_KEYWORD ); + SegmentNameKeyword = namealloc( SEGMENT_NAME_KEYWORD ); + TransistorNameKeyword = namealloc( TRANSISTOR_NAME_KEYWORD ); + ConnectorNameKeyword = namealloc( CONNECTOR_NAME_KEYWORD ); + SegmentValueKeyword = namealloc( SEGMENT_VALUE_KEYWORD ); + ViaNameKeyword = namealloc( VIA_NAME_KEYWORD ); + BigViaNameKeyword = namealloc( BIGVIA_NAME_KEYWORD ); + BigViaValueKeyword = namealloc( BIGVIA_VALUE_KEYWORD ); + ReferenceNameKeyword = namealloc( REFERENCE_NAME_KEYWORD ); + OrientNameKeyword = namealloc( ORIENT_NAME_KEYWORD ); + SymmetryNameKeyword = namealloc( SYMMETRY_NAME_KEYWORD ); + RdsLayerNameKeyword = namealloc( RDS_LAYER_NAME_KEYWORD ); + + KeywordDefined = 1; + } + + for ( Layer = 0; Layer < MBK_MAX_LAYER; Layer++ ) + { + GRAAL_CONNECTOR_NAME_TABLE[ Layer ][0] = (char *)NULL;; + GRAAL_CONNECTOR_NAME_TABLE[ Layer ][1] = (char *)NULL; + GRAAL_CONNECTOR_NAME_TABLE[ Layer ][2] = (char *)NULL; + + GRAAL_SEGMENT_NAME_TABLE[ Layer ][0] = (char *)NULL;; + GRAAL_SEGMENT_NAME_TABLE[ Layer ][1] = (char *)NULL; + GRAAL_SEGMENT_NAME_TABLE[ Layer ][2] = (char *)NULL; + + GRAAL_TRANSISTOR_NAME_TABLE[ Layer ][0] = (char *)NULL;; + GRAAL_TRANSISTOR_NAME_TABLE[ Layer ][1] = (char *)NULL; + GRAAL_TRANSISTOR_NAME_TABLE[ Layer ][2] = (char *)NULL; + + GRAAL_SEGMENT_VALUE_TABLE[ Layer ][0] = 0; + GRAAL_SEGMENT_VALUE_TABLE[ Layer ][1] = 0; + } + + for ( Layer = 0; Layer < MBK_MAX_VIA; Layer++ ) + { + GRAAL_VIA_NAME_TABLE[ Layer ][0] = (char *)NULL;; + GRAAL_VIA_NAME_TABLE[ Layer ][1] = (char *)NULL; + GRAAL_VIA_NAME_TABLE[ Layer ][2] = (char *)NULL; + + GRAAL_BIGVIA_NAME_TABLE[ Layer ][0] = (char *)NULL;; + GRAAL_BIGVIA_NAME_TABLE[ Layer ][1] = (char *)NULL; + GRAAL_BIGVIA_NAME_TABLE[ Layer ][2] = (char *)NULL; + + GRAAL_BIGVIA_VALUE_TABLE[ Layer ][0] = 0; + } + + for ( Layer = 0; Layer < MBK_MAX_REFERENCE; Layer++ ) + { + GRAAL_REFERENCE_NAME_TABLE[ Layer ][0] = (char *)NULL;; + GRAAL_REFERENCE_NAME_TABLE[ Layer ][1] = (char *)NULL; + GRAAL_REFERENCE_NAME_TABLE[ Layer ][2] = (char *)NULL; + } + + for ( Layer = 0; Layer < RDS_ALL_LAYER; Layer++ ) + { + GRAAL_RDS_LAYER_NAME_TABLE[ Layer ][0] = (char *)NULL;; + GRAAL_RDS_LAYER_NAME_TABLE[ Layer ][1] = (char *)NULL; + GRAAL_RDS_LAYER_NAME_TABLE[ Layer ][2] = (char *)NULL; + GRAAL_RDS_LAYER_PATTERN_TABLE[ Layer ] = -1; + } + + for ( Layer = 0; Layer < MBK_MAX_SYMMETRY; Layer++ ) + { + GRAAL_SYMMETRY_NAME_TABLE[ Layer ][0] = (char *)NULL;; + GRAAL_SYMMETRY_NAME_TABLE[ Layer ][1] = (char *)NULL; + GRAAL_SYMMETRY_NAME_TABLE[ Layer ][2] = (char *)NULL; + } + + for ( Layer = 0; Layer < MBK_MAX_ORIENT; Layer++ ) + { + GRAAL_ORIENT_NAME_TABLE[ Layer ][0] = (char *)NULL;; + GRAAL_ORIENT_NAME_TABLE[ Layer ][1] = (char *)NULL; + GRAAL_ORIENT_NAME_TABLE[ Layer ][2] = (char *)NULL; + } + + GRAAL_PEEK_BOUND = 0; + GRAAL_LOWER_GRID_STEP = 0.0; + GRAAL_LOWER_FIGURE_STEP = 0.0; + GRAAL_LOWER_INSTANCE_STEP = 0.0; + GRAAL_LOWER_CONNECTOR_STEP = 0.0; + GRAAL_LOWER_SEGMENT_STEP = 0.0; + GRAAL_LOWER_REFERENCE_STEP = 0.0; + GRAAL_CURSOR_COLOR_NAME = (char *)NULL; + GRAAL_CURSOR_SIZE = 5; + + if ( !( GsbFile = fopen( GRAAL_TECHNO_NAME, "r"))) + + GsbError( OPEN_FILE, NULL, 0); + + GsbReadParam(); + + fclose( GsbFile ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Gsb View Parameters | +| | +\------------------------------------------------------------*/ + +# ifdef DEBUG + +void GraalViewParameters() + +{ + char Layer; + + rdsbegin(); + + fprintf( stdout, "\nPEEK_BOUND DEFINE %d\n", + GRAAL_PEEK_BOUND / GRAAL_RDS_LAMBDA ); + + fprintf( stdout, "\nSEGMENT TABLE\n" ); + + for ( Layer = 0; Layer < MBK_MAX_LAYER; Layer++ ) + { + fprintf( stdout, "\nLayer:%d %s %s %s %d %d", + Layer, + GRAAL_SEGMENT_NAME_TABLE[ Layer ][0], + GRAAL_SEGMENT_NAME_TABLE[ Layer ][1], + GRAAL_SEGMENT_NAME_TABLE[ Layer ][2], + GRAAL_SEGMENT_VALUE_TABLE[ Layer ][0], + GRAAL_SEGMENT_VALUE_TABLE[ Layer ][1] ); + } + + fprintf( stdout, "\n\nEND\n" ); + + fprintf( stdout, "\nTRANSISTOR TABLE\n" ); + + for ( Layer = 0; Layer < MBK_MAX_LAYER; Layer++ ) + { + fprintf( stdout, "\nLayer:%d %s %s %s", + Layer, + GRAAL_TRANSISTOR_NAME_TABLE[ Layer ][0], + GRAAL_TRANSISTOR_NAME_TABLE[ Layer ][1], + GRAAL_TRANSISTOR_NAME_TABLE[ Layer ][2] ); + } + + fprintf( stdout, "\n\nEND\n" ); + + fprintf( stdout, "\nCONNECTOR TABLE\n" ); + + for ( Layer = 0; Layer < MBK_MAX_LAYER; Layer++ ) + { + fprintf( stdout, "\nLayer:%d %s %s %s", + Layer, + GRAAL_CONNECTOR_NAME_TABLE[ Layer ][0], + GRAAL_CONNECTOR_NAME_TABLE[ Layer ][1], + GRAAL_CONNECTOR_NAME_TABLE[ Layer ][2] ); + } + + fprintf( stdout, "\n\nEND\n" ); + + fprintf( stdout, "\nVIA TABLE\n" ); + + for ( Layer = 0; Layer < MBK_MAX_VIA; Layer++ ) + { + fprintf( stdout, "\nVia:%d %s %s %s", + Layer, + GRAAL_VIA_NAME_TABLE[ Layer ][0], + GRAAL_VIA_NAME_TABLE[ Layer ][1], + GRAAL_VIA_NAME_TABLE[ Layer ][2] ); + } + + fprintf( stdout, "\n\nEND\n" ); + + fprintf( stdout, "\nBIGVIA TABLE\n" ); + + for ( Layer = 0; Layer < MBK_MAX_VIA; Layer++ ) + { + fprintf( stdout, "\nVia:%d %s %s %s", + Layer, + GRAAL_BIGVIA_NAME_TABLE[ Layer ][0], + GRAAL_BIGVIA_NAME_TABLE[ Layer ][1], + GRAAL_BIGVIA_NAME_TABLE[ Layer ][2] ); + } + + fprintf( stdout, "\n\nEND\n" ); + + fprintf( stdout, "\nREFERENCE TABLE\n" ); + + for ( Layer = 0; Layer < MBK_MAX_REFERENCE; Layer++ ) + { + fprintf( stdout, "\nReference:%d %s %s %s", + Layer, + GRAAL_REFERENCE_NAME_TABLE[ Layer ][0], + GRAAL_REFERENCE_NAME_TABLE[ Layer ][1], + GRAAL_REFERENCE_NAME_TABLE[ Layer ][2] ); + } + + fprintf( stdout, "\nORIENT TABLE\n" ); + + for ( Layer = 0; Layer < MBK_MAX_ORIENT; Layer++ ) + { + fprintf( stdout, "\nSymmetry:%d %s %s %s", + Layer, + GRAAL_ORIENT_NAME_TABLE[ Layer ][0], + GRAAL_ORIENT_NAME_TABLE[ Layer ][1], + GRAAL_ORIENT_NAME_TABLE[ Layer ][2] ); + } + + fprintf( stdout, "\nSYMMETRY TABLE\n" ); + + for ( Layer = 0; Layer < MBK_MAX_SYMMETRY; Layer++ ) + { + fprintf( stdout, "\nReference:%d %s %s %s", + Layer, + GRAAL_SYMMETRY_NAME_TABLE[ Layer ][0], + GRAAL_SYMMETRY_NAME_TABLE[ Layer ][1], + GRAAL_SYMMETRY_NAME_TABLE[ Layer ][2] ); + } + + fprintf( stdout, "\n\nEND\n" ); + + fprintf( stdout, "\nRDS_LAYER TABLE\n" ); + + for ( Layer = 0; Layer < RDS_ALL_LAYER; Layer++ ) + { + fprintf( stdout, "\nLayer:%d %s %s %s", + Layer, + GRAAL_RDS_LAYER_NAME_TABLE[ Layer ][0], + GRAAL_RDS_LAYER_NAME_TABLE[ Layer ][1], + GRAAL_RDS_LAYER_NAME_TABLE[ Layer ][2] ); + } + + fprintf( stdout, "\n\nEND\n" ); + + rdsend(); +} + +# endif diff --git a/alliance/src/graal/src/GSB_parse.h b/alliance/src/graal/src/GSB_parse.h new file mode 100644 index 00000000..d8360a65 --- /dev/null +++ b/alliance/src/graal/src/GSB_parse.h @@ -0,0 +1,136 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GSB | +| | +| File : Gsbparse.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef GSB_PARSE +# define GSB_PARSE + +# define GSB_MAX_BUFFER 255 +# define GSB_MAX_KEYWORD 149 + +# define GSB_SEPARATORS_STRING " \t\n" +# define GSB_COMMENT_CHAR '#' + +/*------------------------------------------------------------\ +| | +| Keyword Constants | +| | +\------------------------------------------------------------*/ + +# define DEFINE_KEYWORD "DEFINE" +# define TABLE_KEYWORD "TABLE" +# define END_TABLE_KEYWORD "END" +# define END_RECORD_KEYWORD NULL + +# define PEEK_BOUND_KEYWORD "GRAAL_PEEK_BOUND" +# define LOWER_GRID_STEP_KEYWORD "GRAAL_LOWER_GRID_STEP" +# define LOWER_FIGURE_STEP_KEYWORD "GRAAL_LOWER_FIGURE_STEP" +# define LOWER_INSTANCE_STEP_KEYWORD "GRAAL_LOWER_INSTANCE_STEP" +# define LOWER_CONNECTOR_STEP_KEYWORD "GRAAL_LOWER_CONNECTOR_STEP" +# define LOWER_SEGMENT_STEP_KEYWORD "GRAAL_LOWER_SEGMENT_STEP" +# define LOWER_REFERENCE_STEP_KEYWORD "GRAAL_LOWER_REFERENCE_STEP" + + +# define SEGMENT_NAME_KEYWORD "GRAAL_SEGMENT_NAME" +# define TRANSISTOR_NAME_KEYWORD "GRAAL_TRANSISTOR_NAME" +# define CONNECTOR_NAME_KEYWORD "GRAAL_CONNECTOR_NAME" +# define SEGMENT_VALUE_KEYWORD "GRAAL_SEGMENT_VALUE" +# define VIA_NAME_KEYWORD "GRAAL_VIA_NAME" +# define BIGVIA_NAME_KEYWORD "GRAAL_BIGVIA_NAME" +# define BIGVIA_VALUE_KEYWORD "GRAAL_BIGVIA_VALUE" +# define REFERENCE_NAME_KEYWORD "GRAAL_REFERENCE_NAME" +# define SYMMETRY_NAME_KEYWORD "GRAAL_SYMMETRY_NAME" +# define ORIENT_NAME_KEYWORD "GRAAL_ORIENT_NAME" +# define RDS_LAYER_NAME_KEYWORD "GRAAL_RDS_LAYER_NAME" +# define CURSOR_COLOR_NAME_KEYWORD "GRAAL_CURSOR_COLOR_NAME" +# define CURSOR_SIZE_KEYWORD "GRAAL_CURSOR_SIZE" + +# define GSB_SEGMENT_NAME_MASK 0x00001 +# define GSB_SEGMENT_VALUE_MASK 0x00002 +# define GSB_TRANSISTOR_NAME_MASK 0x00004 +# define GSB_CONNECTOR_NAME_MASK 0x00008 +# define GSB_VIA_NAME_MASK 0x00010 +# define GSB_REFERENCE_NAME_MASK 0x00020 +# define GSB_SYMMETRY_NAME_MASK 0x00040 +# define GSB_ORIENT_NAME_MASK 0x00080 +# define GSB_RDS_LAYER_NAME_MASK 0x00100 +# define GSB_PEEK_BOUND_MASK 0x00200 +# define GSB_LOWER_GRID_STEP_MASK 0x00400 +# define GSB_LOWER_FIGURE_STEP_MASK 0x00800 +# define GSB_LOWER_INSTANCE_STEP_MASK 0x01000 +# define GSB_LOWER_REFERENCE_STEP_MASK 0x02000 +# define GSB_LOWER_SEGMENT_STEP_MASK 0x04000 +# define GSB_LOWER_CONNECTOR_STEP_MASK 0x08000 +# define GSB_CURSOR_COLOR_NAME_MASK 0x10000 +# define GSB_CURSOR_SIZE_MASK 0x20000 +# define GSB_BIGVIA_NAME_MASK 0x40000 +# define GSB_BIGVIA_VALUE_MASK 0x80000 + +# define GSB_ALL_DEFINED_MASK 0xFFFFF + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct keyword + { + char *NAME; + char VALUE; + + } keyword; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GSB_share.c b/alliance/src/graal/src/GSB_share.c new file mode 100644 index 00000000..d77e832c --- /dev/null +++ b/alliance/src/graal/src/GSB_share.c @@ -0,0 +1,434 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Share.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rwi.h" +# include "rut.h" +# include "rpr.h" +# include "GSB.h" +# include "GSB_share.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + char GRAAL_RDS_ACTIVE_LAYER_TABLE[ RDS_ALL_LAYER ] = + + { + 1, /* RDS_NWELL */ + 1, /* RDS_PWELL */ + 1, /* RDS_NIMP */ + 1, /* RDS_PIMP */ + 1, /* RDS_ACTIV */ + 1, /* RDS_NDIF */ + 1, /* RDS_PDIF */ + 1, /* RDS_NTIE */ + 1, /* RDS_PTIE */ + 1, /* RDS_POLY */ + 1, /* RDS_VPOLY */ + 1, /* RDS_GATE */ + 1, /* RDS_TPOLY */ + 1, /* RDS_POLY2 */ + 1, /* RDS_CONT */ + 1, /* RDS_TCONT */ + 1, /* RDS_CONT2 */ + 1, /* RDS_ALU1 */ + 1, /* RDS_VALU1 */ + 1, /* RDS_TALU1 */ + 1, /* RDS_VIA1 */ + 1, /* RDS_TVIA1 */ + 1, /* RDS_ALU2 */ + 1, /* RDS_VALU2 */ + 1, /* RDS_TALU2 */ + 1, /* RDS_VIA2 */ + 1, /* RDS_TVIA2 */ + 1, /* RDS_ALU3 */ + 1, /* RDS_VALU3 */ + 1, /* RDS_TALU3 */ + 1, /* RDS_VIA3 */ + 1, /* RDS_TVIA3 */ + 1, /* RDS_ALU4 */ + 1, /* RDS_CPAS */ + 1, /* RDS_REF */ + 1, /* RDS_USER0 */ + 1, /* RDS_USER1 */ + 1, /* RDS_USER2 */ + 1 /* RDS_ABOX */ + }; + + char GRAAL_RDS_ACTIVE_NAME_TABLE[ GRAAL_MAX_ACTIVE_NAME ] = + + { + 1, /* FIGURE NAME */ + 1, /* INSTANCE NAME */ + 1, /* FIGURE CONNECTOR NAME */ + 1, /* INSTANCE CONNECTOR NAME */ + 1, /* FIGURE SEGMENT NAME */ + 1, /* INSTANCE SEGMENT NAME */ + 1, /* FIGURE REFERENCE NAME */ + 1 /* INSTANCE REFERENCE NAME */ + }; + +/*------------------------------------------------------------\ +| | +| Fill Mode and Instance Interface | +| | +\------------------------------------------------------------*/ + + char GRAAL_FILL_MODE = GRAAL_FILL_MODE_PATTERN; + char GRAAL_INSTANCE_INTERFACE = GRAAL_TRUE; + char GRAAL_CONNECTOR_INDEX = GRAAL_FALSE; + char GRAAL_FORCE_DISPLAY = GRAAL_FALSE; + char GRAAL_BLACK_BOX_STRING = GRAAL_FALSE; + char GRAAL_SWITCH_COLOR_MAP = GRAAL_FALSE; + +/*------------------------------------------------------------\ +| | +| Cursor Type | +| | +\------------------------------------------------------------*/ + + char GRAAL_XOR_CURSOR = GRAAL_FALSE; + +/*------------------------------------------------------------\ +| | +| File Name | +| | +\------------------------------------------------------------*/ + + char *GRAAL_GMS_FILE_NAME = (char *)NULL; + +/*------------------------------------------------------------\ +| | +| Cut Transistor Table | +| | +\------------------------------------------------------------*/ + + static long GRAAL_CUT_C_X_PARAM[ 5 ]; + + /* 0 -> Constant 0 */ + /* 1 -> Nothing to do */ + /* 2 -> D */ + /* 3 -> ( D + d ) / 2 */ + /* 4 -> ( D - d ) / 2 */ + + static long GRAAL_CUT_C_X_TABLE [ 16 ] [ 4 ] [ 4 ] = + + { + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy */ + /* O */ + { { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 } }, /* */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy | */ + /* O */ + { { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 } }, /* */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy */ + /* O */ + { { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 } }, /* | */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy | */ + /* O */ + { { 0, 0, 4, 2 }, { 3, 0, 4, 2 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 } }, /* | */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy */ + /* --O */ + { { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 } }, /* */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy | */ + /* --O */ + { { 0, 0, 2, 4 }, { 0, 3, 4, 4 }, { 3, 4, 4, 3 }, { 1, 1, 1, 1 } }, /* */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy */ + /* --O */ + { { 0, 0, 4, 4 }, { 3, 0, 4, 2 }, { 0, 3, 3, 4 }, { 1, 1, 1, 1 } }, /* | */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy | */ + /* --O */ + { { 0, 0, 4, 4 }, { 3, 0, 4, 2 }, { 0, 3, 4, 4 }, { 1, 1, 1, 1 } }, /* | */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy */ + /* O-- */ + { { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 } }, /* */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy | */ + /* O-- */ + { { 0, 0, 4, 2 }, { 4, 0, 3, 4 }, { 3, 3, 4, 4 }, { 1, 1, 1, 1 } }, /* */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy */ + /* O-- */ + { { 0, 0, 4, 2 }, { 3, 0, 4, 4 }, { 4, 3, 3, 4 }, { 1, 1, 1, 1 } }, /* | */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy | */ + /* O-- */ + { { 0, 0, 4, 2 }, { 3, 0, 4, 4 }, { 3, 3, 4, 4 }, { 1, 1, 1, 1 } }, /* | */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy */ + /* --O-- */ + { { 0, 0, 2, 4 }, { 0, 3, 2, 4 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 } }, /* */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy | */ + /* --O-- */ + { { 0, 0, 2, 4 }, { 0, 3, 4, 4 }, { 3, 3, 4, 4 }, { 1, 1, 1, 1 } }, /* */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy */ + /* --O-- */ + { { 0, 0, 4, 4 }, { 3, 0, 4, 4 }, { 0, 3, 2, 4 }, { 1, 1, 1, 1 } }, /* | */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy | */ + /* --O-- */ + { { 0, 0, 4, 4 }, { 3, 0, 4, 4 }, { 0, 3, 4, 4 }, { 3, 3, 4, 4 } }, /* | */ + + }; + + long *GRAAL_CUT_C_X_ARRAY[ MBK_MAX_LAYER ]; + char GRAAL_CUT_C_X_LIST[ MBK_MAX_VIA ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalPostTreatString | +| | +\------------------------------------------------------------*/ + +char *GraalPostTreatString( Text ) + + char *Text; +{ + char OnlySpace; + int Counter; + + rdsbegin(); + + if ( Text != (char *)NULL ) + { + OnlySpace = 1; + + for ( Counter = 0; Text[ Counter ]; Counter++ ) + { + if ( Text[ Counter ] != ' ' ) OnlySpace = 0; + } + + if ( OnlySpace ) Text = (char *)NULL; + } + + rdsend(); + return( Text ); +} + +/*------------------------------------------------------------\ +| | +| GraalInitializeCutCxTable | +| | +\------------------------------------------------------------*/ + +void GraalInitializeCutCxTable() + +{ + int Index; + long DeltaGate; + long DeltaDiff; + int Layer; + int GateLayer; + int DiffLayer; + long *Table; + int MbkLayer; + int TransType; + int CXType; + + rdsbegin(); + + for ( MbkLayer = 0; MbkLayer < MBK_MAX_LAYER; MbkLayer++ ) + { + TransType = GET_LYNX_TRANSISTOR_TYPE( MbkLayer ); + CXType = GET_LYNX_TRANSISTOR_CX( MbkLayer ); + + if ( ( TransType == RDS_LYNX_TRANSISTOR_EMPTY ) || + ( CXType == RDS_LYNX_TRANSISTOR_EMPTY ) ) + { + GRAAL_CUT_C_X_ARRAY[ MbkLayer ] = (long *)NULL; + } + else + { + Table = (long *)rdsalloc( sizeof( GRAAL_CUT_C_X_TABLE ), RDS_ALLOC_BLOCK ); + memcpy( Table, GRAAL_CUT_C_X_TABLE, sizeof( GRAAL_CUT_C_X_TABLE ) ); + + GRAAL_CUT_C_X_ARRAY[ MbkLayer ] = Table; + + DeltaGate = -1; + DeltaDiff = -1; + Index = 0; + GateLayer = GET_LYNX_TRANSISTOR_GATE_LAYER( MbkLayer ); + DiffLayer = GET_LYNX_TRANSISTOR_DIFF_LAYER( MbkLayer ); + Layer = GET_VIA_LAYER( CXType, Index ); + + while ( Layer != RDS_VIA_EMPTY ) + { + if ( Layer == GateLayer ) + { + DeltaGate = GET_VIA_SIZE( CXType, Index ); + } + else + if ( Layer == DiffLayer ) + { + DeltaDiff = GET_VIA_SIZE( CXType, Index ); + } + + Index = Index + 1; + + Layer = GET_VIA_LAYER( CXType, Index ); + } + + if ( ( DeltaGate == -1 ) || + ( DeltaDiff == -1 ) ) + { + for ( Index = 0; Index < 256; Index++ ) + { + Table[ Index ] = -1; + } + } + else + { + /* 0 -> Constant 0 */ + /* 1 -> Nothing to do */ + /* 2 -> D */ + /* 3 -> ( D + d ) / 2 */ + /* 4 -> ( D - d ) / 2 */ + + GRAAL_CUT_C_X_PARAM[ 0 ] = 0; + GRAAL_CUT_C_X_PARAM[ 1 ] = -1; + GRAAL_CUT_C_X_PARAM[ 2 ] = DeltaDiff; + GRAAL_CUT_C_X_PARAM[ 3 ] = ( DeltaDiff + DeltaGate ) >> 1; + GRAAL_CUT_C_X_PARAM[ 4 ] = ( DeltaDiff - DeltaGate ) >> 1; + + for ( Index = 0; Index < 256; Index++ ) + { + Table[ Index ] = GRAAL_CUT_C_X_PARAM[ Table[ Index ] ]; + } + } + } + } + + for ( Index = 0; Index < MBK_MAX_VIA; Index++ ) + { + for ( MbkLayer = 0; MbkLayer < MBK_MAX_LAYER; MbkLayer++ ) + { + if ( GET_LYNX_TRANSISTOR_CX( MbkLayer ) == Index ) break; + } + + GRAAL_CUT_C_X_LIST[ Index ] = MbkLayer; + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Graalenv | +| | +\------------------------------------------------------------*/ + +void Graalenv() +{ + char *Env; + FILE *File; + char *Buffer; + + Env = mbkgetenv( "HOME" ); + + if ( Env == (char *)NULL ) + { + GRAAL_GMS_FILE_NAME = GMS_FILE_NAME; + } + else + { + GRAAL_GMS_FILE_NAME = + + (char *)rdsallocblock( strlen( Env ) + strlen( GMS_FILE_NAME ) + 2 ); + + strcpy( GRAAL_GMS_FILE_NAME, Env ); + strcat( GRAAL_GMS_FILE_NAME, "/" ); + strcat( GRAAL_GMS_FILE_NAME, GMS_FILE_NAME ); + } + + Buffer = rdsallocblock( strlen( WORK_LIB ) + 32 ); + sprintf( Buffer, "%s/_ludo_%ld", WORK_LIB, getpid() ); + + File = fopen( Buffer, "w" ); + + if ( File == (FILE *)0 ) + { + fprintf( stdout, "Gsb: fatal error, invalid MBK_WORK_LIB '%s'\n", WORK_LIB ); + exit( 3 ); + } + else + { + unlink( Buffer ); + fclose( File ); + } + + rdsfreeblock( Buffer ); +} diff --git a/alliance/src/graal/src/GSB_share.h b/alliance/src/graal/src/GSB_share.h new file mode 100644 index 00000000..279682a7 --- /dev/null +++ b/alliance/src/graal/src/GSB_share.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Share.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef GSB_SHARE +# define GSB_SHARE + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GTB.h b/alliance/src/graal/src/GTB.h new file mode 100644 index 00000000..ee2f5f7f --- /dev/null +++ b/alliance/src/graal/src/GTB.h @@ -0,0 +1,213 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : gtb101.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_GTB +# define GRAAL_GTB + +/*------------------------------------------------------------\ +| | +| MouseCursors | +| | +\------------------------------------------------------------*/ + +# define GRAAL_NORMAL_CURSOR 0 +# define GRAAL_WATCH_CURSOR 1 +# define GRAAL_PIRATE_CURSOR 2 +# define GRAAL_CROSS_CURSOR 3 +# define GRAAL_NO_CURSOR 4 + +# define GRAAL_MAX_CURSOR 5 + +/*------------------------------------------------------------\ +| | +| DialogBoxType | +| | +\------------------------------------------------------------*/ + +# define GRAAL_DIALOG_MESSAGE 0 +# define GRAAL_DIALOG_ERROR 1 +# define GRAAL_DIALOG_INFO 2 +# define GRAAL_DIALOG_QUESTION 3 +# define GRAAL_DIALOG_WARNING 4 +# define GRAAL_DIALOG_WORKING 5 +# define GRAAL_DIALOG_FILE 6 +# define GRAAL_DIALOG_PROMPT 7 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalDialogBox | +| | +\------------------------------------------------------------*/ + + typedef struct GraalDialogItem + + { + char *LABEL; + char TYPE; + Widget WIDGET; + void (*CALLBACK_OK)(); + XtPointer CALLDATA_OK; + void (*CALLBACK_CANCEL)(); + XtPointer CALLDATA_CANCEL; + + } GraalDialogItem; + + +/*------------------------------------------------------------\ +| | +| GraalMenuItem | +| | +\------------------------------------------------------------*/ + + typedef struct GraalMenuItem + + { + char *LABEL; + char MNEMONIC; + char *SHORT_KEY; + char *SHORT_KEY_TEXT; + WidgetClass *CLASS; + Boolean SEPARATOR; + Boolean TITLE; + Boolean HELP; + void (*CALLBACK)(); + XtPointer CALLDATA; + Widget BUTTON; + Widget MENU; + struct GraalMenuItem *NEXT; + + } GraalMenuItem; + +/*------------------------------------------------------------\ +| | +| GraalPanelButtonItem | +| | +\------------------------------------------------------------*/ + + typedef struct GraalPanelButtonItem + + { + char *LABEL; + char *TEXT; + char *BITMAP; + int WIDTH; + int HEIGHT; + char *FOREGROUND; + char *BACKGROUND; + unsigned char X; + unsigned char Y; + unsigned char DX; + unsigned char DY; + void (*CALLBACK)(); + XtPointer CALLDATA; + Widget BUTTON; + + } GraalPanelButtonItem; + +/*------------------------------------------------------------\ +| | +| GraalPanelItem | +| | +\------------------------------------------------------------*/ + + typedef struct GraalPanelItem + + { + char *TITLE; + char COMPUTE; + char MANAGED; + int X; + int Y; + int WIDTH; + int HEIGHT; + unsigned char COLUMN; + unsigned char ROW; + Widget PANEL; + Widget PANEL_FORM; + Widget FRAME; + Widget FORM; + unsigned char LIST_NUMBER; + GraalPanelButtonItem *LIST; + + } GraalPanelItem; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void GraalDestroyDialogCallback(); + extern void GraalExitDialogCallback(); + + extern void GraalSetMouseCursor(); + extern Pixmap GraalCreatePixmap(); + extern void GraalSetIcon(); + extern void GraalBuildMenus(); + extern void GraalBuildPanel(); + extern void GraalEnterPanel(); + extern void GraalExitPanel(); + extern void GraalBuildDialog(); + extern void GraalEnterDialog(); + extern void GraalReEnterDialog(); + extern void GraalExitDialog(); + extern void GraalWarningMessage(); + extern void GraalErrorMessage(); + +# endif diff --git a/alliance/src/graal/src/GTB_cursor.c b/alliance/src/graal/src/GTB_cursor.c new file mode 100644 index 00000000..cfd207a4 --- /dev/null +++ b/alliance/src/graal/src/GTB_cursor.c @@ -0,0 +1,172 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : cursor.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include "rds.h" +# include "GTB.h" +# include "GTB_cursor.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static GraalMouseCursor GraalMouseCursorArray [ GRAAL_MAX_CURSOR ] = + + { + { XC_left_ptr , True }, + { XC_watch , True }, + { XC_pirate , True }, + { XC_cross_reverse , True }, + { 0 , True } + }; + + static char GraalCursorMaskOr [ 8 ] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + static char GraalCursorMaskAnd [ 8 ] = + + { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalSetMouseCursor | +| | +\------------------------------------------------------------*/ + +void GraalSetMouseCursor( MainWidget, CursorType ) + + Widget MainWidget; + char CursorType; +{ + Display *DisplayId; + Window MainWindow; + XColor White; + XColor Black; + XColor ForgetIt; + Colormap ColorMap; + Pixmap MaskOr; + Pixmap MaskAnd; + Cursor Type; + Cursor NewCursor; + + rdsbegin(); + + DisplayId = XtDisplay( MainWidget ); + MainWindow = XtWindow( MainWidget ); + + Type = GraalMouseCursorArray[ CursorType ].CURSOR; + + if ( GraalMouseCursorArray[ CursorType ].MAKE == True ) + { + if ( Type != 0 ) + { + NewCursor = XCreateFontCursor( DisplayId, Type ); + } + else + { + ColorMap = DefaultColormapOfScreen ( XtScreen( MainWidget ) ); + + XAllocNamedColor( DisplayId, ColorMap, "black", &Black, &ForgetIt ); + XAllocNamedColor( DisplayId, ColorMap, "white", &White, &ForgetIt ); + + MaskOr = + + XCreatePixmapFromBitmapData( DisplayId, + MainWindow, + GraalCursorMaskOr, + 8, 8, + Black.pixel, + White.pixel, 1 ); + + MaskAnd = + + XCreatePixmapFromBitmapData( DisplayId, + MainWindow, + GraalCursorMaskAnd, + 8, 8, + Black.pixel, + White.pixel, 1 ); + + NewCursor = XCreatePixmapCursor( DisplayId, + MaskAnd, MaskOr, + &Black, &White, 0, 0 ); + } + + GraalMouseCursorArray[ CursorType ].CURSOR = NewCursor; + GraalMouseCursorArray[ CursorType ].MAKE = False; + + Type = NewCursor; + } + + XDefineCursor( DisplayId, MainWindow, Type ); + + XmUpdateDisplay( MainWidget ); + + rdsend(); +} diff --git a/alliance/src/graal/src/GTB_cursor.h b/alliance/src/graal/src/GTB_cursor.h new file mode 100644 index 00000000..3d378a39 --- /dev/null +++ b/alliance/src/graal/src/GTB_cursor.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : cursor.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_MTB_CURSOR +# define GRAAL_MTB_CURSOR + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct GraalMouseCursor + { + Cursor CURSOR; + Boolean MAKE; + + } GraalMouseCursor; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GTB_dialog.c b/alliance/src/graal/src/GTB_dialog.c new file mode 100644 index 00000000..feb59904 --- /dev/null +++ b/alliance/src/graal/src/GTB_dialog.c @@ -0,0 +1,461 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : dialog.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "rds.h" +# include "GTB.h" +# include "GTB_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static GraalLockLoop = 0; + + static GraalDialogItem GraalWarningDialog = + + { + "Warning", + GRAAL_DIALOG_WARNING, + (Widget)NULL, + (void *)NULL, + (XtPointer)NULL, + (void *)NULL, + (XtPointer)NULL + }; + + static GraalDialogItem GraalErrorDialog = + + { + "Error", + GRAAL_DIALOG_ERROR, + (Widget)NULL, + (void *)NULL, + (XtPointer)NULL, + (void *)NULL, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalDestroyDialogCallback | +| | +\------------------------------------------------------------*/ + +void GraalDestroyDialogCallback( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + GraalLockLoop = 0; + GraalExitErrorMessage( 1 ); +} + +/*------------------------------------------------------------\ +| | +| GraalExitDialogCallback | +| | +\------------------------------------------------------------*/ + +void GraalExitDialogCallback() + +{ + rdsbegin(); + + GraalExitDialog(); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalBuildDialog | +| | +\------------------------------------------------------------*/ + +void GraalBuildDialog( Father, Dialog ) + + Widget Father; + GraalDialogItem *Dialog; +{ + Arg Args[3]; + XmString Label; + + rdsbegin(); + + Label = XmStringCreateLtoR( Dialog->LABEL, + XmSTRING_DEFAULT_CHARSET ); + + if ( Dialog->TYPE < GRAAL_DIALOG_FILE ) + { + XtSetArg( Args[0], XmNmessageString , Label); + } + else + { + XtSetArg( Args[0], XmNselectionLabelString, Label); + } + + XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING ); + XtSetArg( Args[2], XmNtitle, " " ); + + switch ( Dialog->TYPE ) + { + case GRAAL_DIALOG_MESSAGE : + + Dialog->WIDGET = + + XmCreateMessageDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case GRAAL_DIALOG_ERROR : + + Dialog->WIDGET = + + XmCreateErrorDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case GRAAL_DIALOG_INFO : + + Dialog->WIDGET = + + XmCreateInformationDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case GRAAL_DIALOG_QUESTION : + + Dialog->WIDGET = + + XmCreateQuestionDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case GRAAL_DIALOG_WARNING : + + Dialog->WIDGET = + + XmCreateWarningDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case GRAAL_DIALOG_WORKING : + + Dialog->WIDGET = + + XmCreateWorkingDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case GRAAL_DIALOG_FILE : + + Dialog->WIDGET = + + XmCreateFileSelectionDialog( Father, Dialog->LABEL, Args, 3); + + XtUnmanageChild( XmFileSelectionBoxGetChild( Dialog->WIDGET, + XmDIALOG_FILTER_LABEL ) ); + + XtUnmanageChild( XmFileSelectionBoxGetChild( Dialog->WIDGET, + XmDIALOG_FILTER_TEXT ) ); + + break; + + case GRAAL_DIALOG_PROMPT : + + Dialog->WIDGET = + + XmCreatePromptDialog( Father, Dialog->LABEL, Args, 3); + + XtUnmanageChild( XmSelectionBoxGetChild( Dialog->WIDGET, + XmDIALOG_HELP_BUTTON ) ); + } + + XmStringFree( Label ); + + XtAddCallback (Dialog->WIDGET, XmNdestroyCallback, + GraalDestroyDialogCallback, NULL ); + + if ( Dialog->TYPE < GRAAL_DIALOG_FILE ) + { + XtUnmanageChild( XmMessageBoxGetChild( Dialog->WIDGET, + XmDIALOG_HELP_BUTTON ) ); + } + + if ( ( Dialog->CALLBACK_OK == NULL ) && + ( Dialog->CALLBACK_CANCEL == NULL ) ) + { + XtAddCallback( Dialog->WIDGET, XmNokCallback, + GraalExitDialogCallback, NULL ); + } + else + { + if ( Dialog->CALLBACK_OK == NULL ) + { + XtUnmanageChild( XmMessageBoxGetChild( Dialog->WIDGET, + XmDIALOG_OK_BUTTON ) ); + } + else + { + XtAddCallback( Dialog->WIDGET, XmNokCallback, + Dialog->CALLBACK_OK, + Dialog->CALLDATA_OK ); + } + } + + if ( Dialog->CALLBACK_CANCEL == NULL ) + { + XtUnmanageChild( XmMessageBoxGetChild( Dialog->WIDGET, + XmDIALOG_CANCEL_BUTTON ) ); + } + else + { + XtAddCallback( Dialog->WIDGET, XmNcancelCallback, + Dialog->CALLBACK_CANCEL, + Dialog->CALLDATA_CANCEL ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalLimitedLoop | +| | +\------------------------------------------------------------*/ + +void GraalLimitedLoop( MyWidget ) + + Widget MyWidget; +{ + Widget DialogShell, WShell; + XEvent Event; + XAnyEvent *AnyEvent; + XtAppContext Context; + + rdsbegin(); + + Context = XtWidgetToApplicationContext( MyWidget ); + + GraalLockLoop = 1; + + for ( WShell = MyWidget; + ! XtIsShell( WShell ); + WShell = XtParent( WShell ) ); + + while( GraalLockLoop == 1 ) + { + XtAppNextEvent( Context, &Event ); + + AnyEvent = (XAnyEvent *)( &Event ); + + for ( DialogShell = XtWindowToWidget( AnyEvent->display, AnyEvent->window ); + ((DialogShell != NULL ) && (!XtIsShell( DialogShell ))); + DialogShell = XtParent(DialogShell)); + + switch ( AnyEvent->type ) + { + case ButtonPress : + case ButtonRelease : + + if ( WShell == DialogShell ) + { + XtDispatchEvent( &Event ); + } + + break; + + case KeyPress : + case KeyRelease : + + if ( WShell != DialogShell ) + { + AnyEvent->window = XtWindow( WShell ); + } + + default : + + XtDispatchEvent( &Event ); + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEnterDialog | +| | +\------------------------------------------------------------*/ + +void GraalEnterDialog( Dialog ) + + GraalDialogItem *Dialog; +{ + rdsbegin(); + + XtManageChild ( Dialog->WIDGET ); + + GraalLimitedLoop( Dialog->WIDGET ); + + XtUnmanageChild( Dialog->WIDGET ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalReEnterDialog | +| | +\------------------------------------------------------------*/ + +void GraalReEnterDialog() +{ + GraalLockLoop = 1; +} + +/*------------------------------------------------------------\ +| | +| GraalExitDialog | +| | +\------------------------------------------------------------*/ + +void GraalExitDialog() + +{ + GraalLockLoop = 0; +} + +/*------------------------------------------------------------\ +| | +| GraalWarningMessage | +| | +\------------------------------------------------------------*/ + +void GraalWarningMessage( Father, Subject ) + + Widget Father; + char *Subject; +{ + XmString Label; + + rdsbegin(); + + if ( GraalWarningDialog.WIDGET == (Widget)NULL ) + { + GraalBuildDialog( Father, &GraalWarningDialog ); + } + + Label = XmStringCreateLtoR( Subject, + XmSTRING_DEFAULT_CHARSET ); + + XtVaSetValues( GraalWarningDialog.WIDGET, + XmNmessageString, + Label, NULL ); + + XmStringFree( Label ); + + GraalEnterDialog( &GraalWarningDialog ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalErrorMessage | +| | +\------------------------------------------------------------*/ + +void GraalErrorMessage( Father, Subject ) + + Widget Father; + char *Subject; +{ + XmString Label; + + rdsbegin(); + + if ( GraalErrorDialog.WIDGET == (Widget)NULL ) + { + GraalBuildDialog( Father, &GraalErrorDialog ); + } + + Label = XmStringCreateLtoR( Subject, + XmSTRING_DEFAULT_CHARSET ); + + XtVaSetValues( GraalErrorDialog.WIDGET, + XmNmessageString, + Label, NULL ); + + XmStringFree( Label ); + + GraalEnterDialog( &GraalErrorDialog ); + + rdsend(); +} diff --git a/alliance/src/graal/src/GTB_dialog.h b/alliance/src/graal/src/GTB_dialog.h new file mode 100644 index 00000000..a09806cc --- /dev/null +++ b/alliance/src/graal/src/GTB_dialog.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : dialog.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_MTB_DIALOG +# define GRAAL_MTB_DIALOG + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GTB_icon.c b/alliance/src/graal/src/GTB_icon.c new file mode 100644 index 00000000..79034e50 --- /dev/null +++ b/alliance/src/graal/src/GTB_icon.c @@ -0,0 +1,102 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : icon.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include "rds.h" +# include "GTB.h" +# include "GTB_icon.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalSetIcon | +| | +\------------------------------------------------------------*/ + +void GraalSetIcon( ShellWidget, IconBits, IconWidth, IconHeight ) + + Widget ShellWidget; + char *IconBits; + int IconWidth; + int IconHeight; +{ + Pixmap IconPixmap; + + rdsbegin(); + + IconPixmap = XCreatePixmapFromBitmapData( XtDisplay( ShellWidget ), + RootWindowOfScreen( XtScreen( ShellWidget ) ), + IconBits, IconWidth, IconHeight, + WhitePixelOfScreen( XtScreen( ShellWidget ) ), + BlackPixelOfScreen( XtScreen( ShellWidget ) ), + DefaultDepthOfScreen( XtScreen( ShellWidget ) ) ); + XtVaSetValues( ShellWidget, + XmNiconPixmap, IconPixmap, + XmNiconic, False, + NULL ); + + rdsend(); +} + diff --git a/alliance/src/graal/src/GTB_icon.h b/alliance/src/graal/src/GTB_icon.h new file mode 100644 index 00000000..1e92af4e --- /dev/null +++ b/alliance/src/graal/src/GTB_icon.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : icon.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_MTB_ICON +# define GRAAL_MTB_ICON + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GTB_menu.c b/alliance/src/graal/src/GTB_menu.c new file mode 100644 index 00000000..0caf8a84 --- /dev/null +++ b/alliance/src/graal/src/GTB_menu.c @@ -0,0 +1,193 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : menu.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "rds.h" +# include "GTB.h" +# include "GTB_menu.h" + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static char MenuBuffer [ MENU_BUFFER_SIZE ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalBuildMenus | +| | +\------------------------------------------------------------*/ + +void GraalBuildMenus( Father, Menu ) + + Widget Father; + GraalMenuItem *Menu; +{ + + Widget Button; + Widget SubMenu; + XmString Text; + Arg Args[ 2 ]; + int Counter; + + rdsbegin(); + + for ( Counter = 0; + Menu[ Counter ].LABEL != NULL; + Counter++ ) + { + if ( Menu[ Counter ].SEPARATOR == True ) + { + XtCreateManagedWidget( "Separator", + xmSeparatorWidgetClass, Father, + NULL , + 0 ); + } + + Button = XtVaCreateManagedWidget( Menu[ Counter ].LABEL, + *Menu[ Counter ].CLASS, Father, + XmNmnemonic, + Menu[ Counter ].MNEMONIC, + NULL ); + Menu[ Counter ].BUTTON = Button; + + if ( Menu[ Counter ].SHORT_KEY != NULL ) + { + XtVaSetValues( Button, + XmNaccelerator, + Menu[ Counter ].SHORT_KEY, + NULL ); + } + + if ( Menu[ Counter ].SHORT_KEY != NULL ) + { + Text = XmStringCreateSimple( Menu[ Counter ].SHORT_KEY_TEXT ); + + XtVaSetValues( Button, + XmNacceleratorText, + Text, + NULL ); + + XmStringFree( Text ); + } + + if ( Menu[ Counter ].CALLBACK != NULL ) + { + XtAddCallback( Button, + XmNactivateCallback, + Menu[ Counter ].CALLBACK, + Menu[ Counter ].CALLDATA ); + } + + if ( Menu[ Counter ].HELP == True ) + { + XtSetArg( Args[ 0 ], XmNmenuHelpWidget, Button ); + + XtSetValues( Father, Args, 1 ); + } + + if ( Menu[ Counter ].NEXT != NULL) + { + strcpy( MenuBuffer, Menu[ Counter ].LABEL ); + strcat( MenuBuffer, " Menu" ); + + SubMenu = XmCreatePulldownMenu( Father, + MenuBuffer, + Args, 0 ); + + Menu[ Counter ].MENU = SubMenu; + + if ( Menu[ Counter ].TITLE == True ) + { + Text = XmStringCreateLtoR( MenuBuffer, XmSTRING_DEFAULT_CHARSET ); + + XtVaCreateManagedWidget( "MenuTitle", + xmLabelWidgetClass, + SubMenu, + XmNlabelString, Text, + NULL ); + + XmStringFree( Text ); + + XtCreateManagedWidget( "Separator", + xmSeparatorWidgetClass, + SubMenu, + NULL, + 0 ); + } + + XtSetArg( Args[ 0 ], XmNsubMenuId, SubMenu ); + XtSetValues( Button, Args, 1 ); + + GraalBuildMenus( SubMenu, Menu[ Counter ].NEXT ); + } + else Menu[ Counter ].MENU = (Widget)NULL; + } + + rdsend(); +} + diff --git a/alliance/src/graal/src/GTB_menu.h b/alliance/src/graal/src/GTB_menu.h new file mode 100644 index 00000000..0981a551 --- /dev/null +++ b/alliance/src/graal/src/GTB_menu.h @@ -0,0 +1,67 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : menu.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_MTB_MENU +# define GRAAL_MTB_MENU + +# define MENU_BUFFER_SIZE 80 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GTB_panel.c b/alliance/src/graal/src/GTB_panel.c new file mode 100644 index 00000000..1db09172 --- /dev/null +++ b/alliance/src/graal/src/GTB_panel.c @@ -0,0 +1,357 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : panel.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include "rds.h" +# include "GTB.h" + +# include "GTB_panel.h" +# include "GTB_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalBuildPanel | +| | +\------------------------------------------------------------*/ + +void GraalBuildPanel( Father, Panel ) + + Widget Father; + GraalPanelItem *Panel; +{ + Arg Args[13]; + GraalPanelButtonItem *Button; + char *Label; + int Counter; + int Fraction; + int X1; + int Y1; + int X2; + int Y2; + Pixmap ButtonPixmap; + + rdsbegin(); + + Fraction = Panel->ROW * Panel->COLUMN; + + XtSetArg( Args[0], XmNshadowType , XmSHADOW_ETCHED_IN ); + XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING ); + XtSetArg( Args[2], XmNtitle , Panel->TITLE ); + + Panel->PANEL = XmCreateFormDialog( Father, Panel->TITLE, Args, 3); + + XtAddCallback( Panel->PANEL, XmNdestroyCallback, + GraalDestroyDialogCallback, NULL ); + + Panel->PANEL_FORM = XtVaCreateManagedWidget( "", + xmFormWidgetClass, + Panel->PANEL, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , 100, + NULL + ); + + Panel->FRAME = XtVaCreateManagedWidget( "", + xmFrameWidgetClass, + Panel->PANEL_FORM, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + NULL + ); + + Panel->FORM = XtVaCreateManagedWidget( "", + xmFormWidgetClass, + Panel->FRAME, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , Fraction, + NULL + ); + Button = Panel->LIST; + + for ( Counter = 0; Counter < Panel->LIST_NUMBER; Counter++ ) + { + if ( Button[ Counter ].LABEL == (char *)NULL ) continue; + + X1 = Button[ Counter ].X * Panel->ROW; + Y1 = Button[ Counter ].Y * Panel->COLUMN; + X2 = X1 + Button[ Counter ].DX * Panel->ROW; + Y2 = Y1 + Button[ Counter ].DY * Panel->COLUMN; + + Label = Button[ Counter ].LABEL; + + if ( ( Button[ Counter ].TEXT != (char *)NULL ) && + ( Button[ Counter ].BITMAP != (char *)NULL ) ) + { + XtSetArg( Args[0] , XmNtopAttachment , XmATTACH_POSITION ); + XtSetArg( Args[1] , XmNtopPosition , Y1 ); + XtSetArg( Args[2] , XmNbottomAttachment , XmATTACH_POSITION ); + XtSetArg( Args[3] , XmNbottomPosition , Y2 ); + XtSetArg( Args[4] , XmNrightAttachment , XmATTACH_POSITION ); + XtSetArg( Args[5] , XmNrightPosition , X2 ); + XtSetArg( Args[6] , XmNleftAttachment , XmATTACH_POSITION ); + XtSetArg( Args[7] , XmNleftPosition , X1 ); + XtSetArg( Args[8] , XmNscrollBarDisplayPolicy, XmSTATIC ); + XtSetArg( Args[9] , XmNscrollHorizontal , True ); + XtSetArg( Args[10] , XmNscrollVertical , True ); + XtSetArg( Args[11] , XmNlistSizePolicy , XmCONSTANT ); + XtSetArg( Args[12] , XmNselectionPolicy , XmMULTIPLE_SELECT ); + + Button[ Counter ].BUTTON = + + XmCreateScrolledList( Panel->FORM, Button[ Counter ].TEXT, Args, 13 ); + + XtManageChild ( Button[ Counter ].BUTTON ); + } + else + if ( Button[ Counter ].TEXT != (char *)NULL ) + { + XtSetArg( Args[0] , XmNrows , 10 ); + XtSetArg( Args[1] , XmNeditable , False ); + XtSetArg( Args[2] , XmNeditMode , XmMULTI_LINE_EDIT ); + XtSetArg( Args[3] , XmNcursorPositionVisible, False ); + XtSetArg( Args[4] , XmNtopAttachment , XmATTACH_POSITION ); + XtSetArg( Args[5] , XmNtopPosition , Y1 ); + XtSetArg( Args[6] , XmNleftAttachment , XmATTACH_POSITION ); + XtSetArg( Args[7] , XmNleftPosition , X1 ); + XtSetArg( Args[8] , XmNbottomAttachment , XmATTACH_POSITION ); + XtSetArg( Args[9] , XmNbottomPosition , Y2 ); + XtSetArg( Args[10], XmNrightAttachment , XmATTACH_POSITION ); + XtSetArg( Args[11], XmNrightPosition , X2 ); + + Button[ Counter ].BUTTON = + + XmCreateScrolledText( Panel->FORM, Button[ Counter ].TEXT, Args, 12); + + XtManageChild ( Button[ Counter ].BUTTON ); + } + else + if ( Button[ Counter ].BITMAP != (char *)NULL ) + { + ButtonPixmap = GraalCreatePixmap( Father, + Button[ Counter ].BITMAP, + Button[ Counter ].WIDTH, + Button[ Counter ].HEIGHT ); + Button[ Counter ].BUTTON = + + XtVaCreateManagedWidget( Label, + xmPushButtonWidgetClass, + Panel->FORM, + XmNlabelType , XmPIXMAP, + XmNlabelPixmap , ButtonPixmap, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , X1, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , X2, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , Y1, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , Y2, + NULL + ); + } + else + { + Button[ Counter ].BUTTON = + + XtVaCreateManagedWidget( Label, + xmPushButtonWidgetClass, + Panel->FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , X1, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , X2, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , Y1, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , Y2, + NULL + ); + } + + if ( Button[ Counter ].FOREGROUND != (char *)NULL ) + { + XtVaSetValues ( Button[ Counter ].BUTTON , + XtVaTypedArg , XmNforeground, + XmRString , + Button[ Counter ].FOREGROUND , + strlen ( Button[ Counter ].FOREGROUND ) + 1, + NULL + ); + } + + if ( Button[ Counter ].BACKGROUND != (char *)NULL ) + { + XtVaSetValues ( Button[ Counter ].BUTTON , + XtVaTypedArg , XmNbackground, + XmRString , + Button[ Counter ].BACKGROUND , + strlen ( Button[ Counter ].BACKGROUND ) + 1, + NULL + ); + } + + if ( Button[ Counter ].CALLBACK != NULL ) + { + if ( ( Button[ Counter ].TEXT != (char *)NULL ) && + ( Button[ Counter ].BITMAP != (char *)NULL ) ) + { + XtAddCallback( Button[ Counter ].BUTTON, + XmNdefaultActionCallback, + Button[ Counter ].CALLBACK, + (XtPointer)NULL ); + + XtAddCallback( Button[ Counter ].BUTTON, + XmNmultipleSelectionCallback, + Button[ Counter ].CALLBACK, + Button[ Counter ].CALLDATA ); + + } + else + { + XtAddCallback( Button[ Counter ].BUTTON, + XmNactivateCallback, + Button[ Counter ].CALLBACK, + Button[ Counter ].CALLDATA ); + } + } + } + + XtVaSetValues( Panel->PANEL , + XmNresizable , False, + XmNx , Panel->X, + XmNy , Panel->Y, + XmNheight , Panel->HEIGHT, + XmNwidth , Panel->WIDTH, + NULL ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalEnterPanel | +| | +\------------------------------------------------------------*/ + +void GraalEnterPanel( Panel ) + + GraalPanelItem *Panel; +{ + rdsbegin(); + + XtManageChild( Panel->PANEL ); + + if ( Panel->COMPUTE == 1 ) + { + XtVaSetValues( Panel->PANEL , + XmNresizable , False, + XmNx , Panel->X, + XmNy , Panel->Y, + XmNheight , Panel->HEIGHT, + XmNwidth , Panel->WIDTH, + NULL ); + + Panel->COMPUTE = 0; + } + + Panel->MANAGED = 1; + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| GraalExitPanel | +| | +\------------------------------------------------------------*/ + +void GraalExitPanel( Panel ) + + GraalPanelItem *Panel; +{ + rdsbegin(); + + XtUnmanageChild( Panel->PANEL ); + + Panel->MANAGED = 0; + + rdsend(); +} diff --git a/alliance/src/graal/src/GTB_panel.h b/alliance/src/graal/src/GTB_panel.h new file mode 100644 index 00000000..0ade8920 --- /dev/null +++ b/alliance/src/graal/src/GTB_panel.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : panel.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_MTB_PANEL +# define GRAAL_MTB_PANEL + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/GTB_pixmap.c b/alliance/src/graal/src/GTB_pixmap.c new file mode 100644 index 00000000..9a0164c9 --- /dev/null +++ b/alliance/src/graal/src/GTB_pixmap.c @@ -0,0 +1,103 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : Pixmap.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +# include +# include +# include "rds.h" +# include "GTB.h" + +# include "GTB_pixmap.h" + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalCreatePixmap | +| | +\------------------------------------------------------------*/ + +Pixmap GraalCreatePixmap( MainWidget, IconBits, IconWidth, IconHeight ) + + Widget MainWidget; + char *IconBits; + int IconWidth; + int IconHeight; +{ + Pixel Foreground; + Pixel Background; + Pixmap IconPixmap; + + rdsbegin(); + + XtVaGetValues( MainWidget, XmNforeground, &Foreground, + XmNbackground, &Background, NULL ); + + IconPixmap = XCreatePixmapFromBitmapData( XtDisplay( MainWidget ), + RootWindowOfScreen( XtScreen( MainWidget ) ), + IconBits, IconWidth, IconHeight, + Foreground, Background, + DefaultDepthOfScreen( XtScreen( MainWidget ) ) ); + + rdsend(); + return( IconPixmap ); +} + diff --git a/alliance/src/graal/src/GTB_pixmap.h b/alliance/src/graal/src/GTB_pixmap.h new file mode 100644 index 00000000..a83b63b7 --- /dev/null +++ b/alliance/src/graal/src/GTB_pixmap.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : pixmap.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_MTB_PIXMAP +# define GRAAL_MTB_PIXMAP + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/graal/src/LIP6bw.h b/alliance/src/graal/src/LIP6bw.h new file mode 100644 index 00000000..cfecd995 --- /dev/null +++ b/alliance/src/graal/src/LIP6bw.h @@ -0,0 +1,293 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +#define LIP6bw_width 164 +#define LIP6bw_height 150 +static char LIP6bw_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x70, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, + 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x70, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0xfc, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x01, + 0xe0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x7f, 0x00, 0xc0, 0xff, 0x7f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x3f, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xe0, + 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xe0, 0x01, 0xff, 0xff, + 0x01, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x01, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, + 0x01, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, + 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x03, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0xf0, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, + 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0xf9, 0xff, 0xff, + 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0x20, 0xc0, 0xff, 0xff, 0x07, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0x00, 0x80, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0x00, + 0x00, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, + 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x03, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0xe0, 0x00, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xe0, + 0x01, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, + 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x03, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, + 0x01, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, + 0x01, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x01, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0xe0, 0x01, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x3f, 0xc0, + 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x3f, 0x00, 0x80, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x7f, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x03, + 0xf0, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x1f, 0xff, 0xff, 0x1f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; diff --git a/alliance/src/graal/src/Makefile b/alliance/src/graal/src/Makefile new file mode 100644 index 00000000..67ac6b46 --- /dev/null +++ b/alliance/src/graal/src/Makefile @@ -0,0 +1,527 @@ +# /*------------------------------------------------------------\ +# | | +# | This file is part of the Alliance CAD System Copyright | +# | (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +# | | +# | Home page : http://www-asim.lip6.fr/alliance/ | +# | E-mail support : mailto:alliance-support@asim.lip6.fr | +# | | +# | This progam is free software; you can redistribute it | +# | and/or modify it under the terms of the GNU General Public | +# | License as published by the Free Software Foundation; | +# | either version 2 of the License, or (at your option) any | +# | later version. | +# | | +# | Alliance VLSI CAD System is distributed in the hope that | +# | it will be useful, but WITHOUT ANY WARRANTY; | +# | without even the implied warranty of MERCHANTABILITY or | +# | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +# | Public License for more details. | +# | | +# | You should have received a copy of the GNU General Public | +# | License along with the GNU C Library; see the file COPYING. | +# | If not, write to the Free Software Foundation, Inc., | +# | 675 Mass Ave, Cambridge, MA 02139, USA. | +# | | +# \------------------------------------------------------------*/ + +# /*------------------------------------------------------------\ +# | | +# | Tool : GRAAL | +# | | +# | File : Makefile | +# | | +# | Author : Jacomme Ludovic | +# | | +# | Date : 27.06.95 | +# | | +# \------------------------------------------------------------*/ + +include $(ALLIANCE_TOP)/etc/$(ALLIANCE_OS).mk +include $(ALLIANCE_TOP)/etc/libraries.mk +include local.mk + +# /*------------------------------------------------------------\ +# | | +# | Variables | +# | | +# \------------------------------------------------------------*/ + +LOCAL_CFLAGS = $(CFLAGS) -D$(ALLIANCE_OS) + +# /*------------------------------------------------------------\ +# | | +# | Binary | +# | | +# \------------------------------------------------------------*/ + +LOCAL_GRAAL_BIN = graal + +# /*------------------------------------------------------------\ +# | | +# | Include | +# | | +# \------------------------------------------------------------*/ + +LOCAL_INCLUDE = $(MOTIF_INCLUDE) $(XPM_INCLUDE) -I$(X11_INCLUDE) \ + -I$(ALLIANCE_INCLUDE) + +# /*------------------------------------------------------------\ +# | | +# | Library | +# | | +# \------------------------------------------------------------*/ + +LOCAL_MOTIF_LIB = -L$(MOTIF_LIB) -lXm + +LOCAL_X11_LIB = -L$(X11_LIB) -lXt -lX11 $(XPM_LIB) + +LOCAL_MBK_LIB = -L$(ALLIANCE_LIB) \ + $(MPU_L) \ + $(MAP_L) \ + $(MMG_L) \ + $(MCP_L) \ + $(MPH_L) \ + $(MUT_L) + +# RDS_LIBRARY = -L$(TARGET_LIB) + +LOCAL_RDS_LIB = $(RDS_LIBRARY) \ + -L$(ALLIANCE_LIB) \ + $(RTL_L) \ + $(RGS_L) \ + $(RCF_L) \ + $(RFM_L) \ + $(RPR_L) \ + $(RWI_L) \ + $(RUT_L) \ + $(RDS_L) + +LOCAL_DRC_LIB = $(RDS_LIBRARY) \ + $(VRD_LIBRARY) \ + -L$(ALLIANCE_LIB) \ + $(VRD_L) + +LOCAL_LIB = $(LOCAL_MOTIF_LIB) $(LOCAL_X11_LIB) $(LOCAL_DRC_LIB) \ + $(LOCAL_RDS_LIB) $(LOCAL_MBK_LIB) + +# /*------------------------------------------------------------\ +# | | +# | Define | +# | | +# \------------------------------------------------------------*/ + +LOCAL_X11_DEFINE = -D_NO_PROTO + +LOCAL_MBK_DEFINE = -DMUT_H='"$(MUT_H)"' \ + -DMPU_H='"$(MPU_H)"' \ + -DMPH_H='"$(MPH_H)"' + +LOCAL_RDS_DEFINE = $(RDS_INCLUDE) \ + -DRDS_H='"$(RDS_H)"' \ + -DRPR_H='"$(RPR_H)"' \ + -DRFM_H='"$(RFM_H)"' \ + -DRUT_H='"$(RUT_H)"' \ + -DRWI_H='"$(RWI_H)"' \ + -DRTL_H='"$(RTL_H)"' + +LOCAL_GRAAL_DEFINE = -DGTB_H='"GTB.h"' -DGSB_H='"GSB.h"' -DGME_H='"GME.h"' \ + -DGMF_H='"GMF.h"' -DGMC_H='"GMC.h"' -DGMV_H='"GMV.h"' \ + -DGMT_H='"GMT.h"' -DGMS_H='"GMS.h"' -DGMH_H='"GMH.h"' \ + -DGMX_H='"GMX.h"' -DGRM_H='"GRM.h"' \ + -DALLIANCE_TOP='"$(ALLIANCE_TOP)"' \ + -DGRAAL_DEFAULT_TECHNO_NAME='"etc/cmos_11.$(LOCAL_GRAAL_BIN)"' \ + -DGMS_FILE_NAME='".$(LOCAL_GRAAL_BIN).cfg"' \ + -DGRAAL_WINDOW_DX='"GRAAL_WINDOW_DX"' \ + -DGRAAL_WINDOW_DY='"GRAAL_WINDOW_DY"' \ + -DGRAAL_WINDOW_XMIN='"GRAAL_WINDOW_XMIN"' \ + -DGRAAL_WINDOW_YMIN='"GRAAL_WINDOW_YMIN"' \ + -DGRAAL_WINDOW_SIDE='"GRAAL_WINDOW_SIDE"' \ + -DALLIANCE_VERSION=$(ALLIANCE_VERSION) \ + -DGRAAL_TOOL_NAME='"$(LOCAL_GRAAL_BIN)"' \ + -DGRAAL_VERSION='"1.27"' + +LOCAL_DRC_DEFINE = $(VRD_INCLUDE) \ + -DDRC_H='"$(VRD_H)"' + +LOCAL_DEFINE = $(LOCAL_X11_DEFINE) $(LOCAL_MBK_DEFINE) \ + $(LOCAL_RDS_DEFINE) $(LOCAL_DRC_DEFINE) \ + $(LOCAL_GRAAL_DEFINE) + +LOCAL_HEADER = $(LOCAL_INCLUDE) $(LOCAL_DEFINE) + +# /*------------------------------------------------------------\ +# | | +# | Object | +# | | +# \------------------------------------------------------------*/ + +LOCAL_GRAAL_OBJ = graal.o +LOCAL_GSB_OBJ = GSB_share.o GSB_parse.o GSB_error.o +LOCAL_GRM_OBJ = GRM_mbkrds.o GRM_equi.o GRM_window.o GRM_undo.o \ + GRM_select.o GRM_search.o GRM_peek.o GRM_connector.o \ + GRM_error.o GRM_druc.o +LOCAL_GTB_OBJ = GTB_icon.o GTB_panel.o GTB_menu.o GTB_pixmap.o \ + GTB_cursor.o GTB_dialog.o +LOCAL_GMX_OBJ = GMX_motif.o GMX_color.o GMX_graphic.o GMX_panel.o \ + GMX_menu.o GMX_message.o GMX_grid.o GMX_event.o \ + GMX_cursor.o GMX_dialog.o GMX_view.o \ + GMX_icon.o +LOCAL_GMF_OBJ = GMF_menu.o GMF_panel.o GMF_dialog.o GMF_file.o +LOCAL_GME_OBJ = GME_edit.o GME_panel.o GME_dialog.o GME_menu.o \ + GME_message.o GME_modify.o GME_search.o GME_select.o +LOCAL_GMC_OBJ = GMC_create.o GMC_menu.o GMC_panel.o GMC_dialog.o \ + GMC_message.o +LOCAL_GMV_OBJ = GMV_view.o GMV_panel.o GMV_menu.o GMV_dialog.o \ + GMV_message.o GMV_map.o +LOCAL_GMT_OBJ = GMT_tools.o GMT_menu.o GMT_panel.o GMT_dialog.o \ + GMT_message.o GMT_druc.o +LOCAL_GMS_OBJ = GMS_setup.o GMS_menu.o GMS_dialog.o GMS_panel.o +LOCAL_GMH_OBJ = GMH_help.o GMH_menu.o GMH_panel.o + +LOCAL_OBJ = $(LOCAL_GSB_OBJ) $(LOCAL_GRM_OBJ) $(LOCAL_GTB_OBJ) \ + $(LOCAL_GMX_OBJ) $(LOCAL_GMF_OBJ) $(LOCAL_GME_OBJ) \ + $(LOCAL_GMC_OBJ) $(LOCAL_GMV_OBJ) $(LOCAL_GMT_OBJ) \ + $(LOCAL_GMS_OBJ) $(LOCAL_GMH_OBJ) $(LOCAL_GRAAL_OBJ) + +# /*------------------------------------------------------------\ +# | | +# | Graal | +# | | +# \------------------------------------------------------------*/ + +distrib : $(LOCAL_TARGET_BIN)/$(LOCAL_GRAAL_BIN) + +$(LOCAL_TARGET_BIN)/$(LOCAL_GRAAL_BIN) : $(LOCAL_OBJ) + $(CC) $(LOCAL_CFLAGS) -o $(LOCAL_TARGET_BIN)/$(LOCAL_GRAAL_BIN) \ + $(LOCAL_OBJ) $(LOCAL_LIB) -lm + $(STRIP) $(LOCAL_TARGET_BIN)/$(LOCAL_GRAAL_BIN) + +no_strip : $(LOCAL_OBJ) + $(CC) $(LOCAL_CFLAGS) -o $(LOCAL_TARGET_BIN)/$(LOCAL_GRAAL_BIN) \ + $(LOCAL_OBJ) $(LOCAL_LIB) -lm + +force : $(LOCAL_OBJ) + $(CC) $(LOCAL_CFLAGS) -o $(LOCAL_TARGET_BIN)/$(LOCAL_GRAAL_BIN) \ + $(LOCAL_OBJ) $(LOCAL_LIB) -lm + $(STRIP) $(LOCAL_TARGET_BIN)/$(LOCAL_GRAAL_BIN) + +graal.o : graal.c graal.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c graal.c + +# /*------------------------------------------------------------\ +# | | +# | Graal Share Box | +# | | +# \------------------------------------------------------------*/ + +GSB_parse.o : GSB.h GSB_parse.c GSB_parse.h GSB_error.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GSB_parse.c + +GSB_error.o : GSB.h GSB_error.c GSB_error.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GSB_error.c + +GSB_share.o : GSB.h GSB_share.c GSB_share.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GSB_share.c + +# /*------------------------------------------------------------\ +# | | +# | Graal Rds Mbk | +# | | +# \------------------------------------------------------------*/ + +GRM_connector.o : GSB.h GRM.h GRM_connector.c GRM_connector.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GRM_connector.c + +GRM_equi.o : GSB.h GRM.h GRM_equi.c GRM_equi.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GRM_equi.c + +GRM_mbkrds.o : GSB.h GRM.h GRM_mbkrds.c GRM_mbkrds.h GRM_window.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GRM_mbkrds.c + +GRM_peek.o : GSB.h GRM.h GRM_peek.c GRM_peek.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GRM_peek.c + +GRM_search.o : GSB.h GRM.h GRM_search.c GRM_search.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GRM_search.c + +GRM_select.o : GSB.h GRM.h GRM_select.c GRM_select.h GRM_window.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GRM_select.c + +GRM_undo.o : GSB.h GRM.h GRM_undo.c GRM_undo.h GRM_window.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GRM_undo.c + +GRM_window.o : GSB.h GRM.h GRM_window.c GRM_window.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GRM_window.c + +GRM_error.o : GSB.h GRM.h GRM_error.c GRM_error.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GRM_error.c + +GRM_druc.o : GSB.h GRM.h GRM_druc.c GRM_druc.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GRM_druc.c + + +# /*------------------------------------------------------------\ +# | | +# | Graal Tools Box | +# | | +# \------------------------------------------------------------*/ + +GTB_cursor.o : GTB.h GTB_cursor.c GTB_cursor.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GTB_cursor.c + +GTB_dialog.o : GTB.h GTB_dialog.c GTB_dialog.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GTB_dialog.c + +GTB_icon.o : GTB.h GTB_icon.c GTB_icon.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GTB_icon.c + +GTB_menu.o : GTB.h GTB_menu.c GTB_menu.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GTB_menu.c + +GTB_panel.o : GTB.h GTB_panel.c GTB_panel.h GTB_dialog.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GTB_panel.c + +GTB_pixmap.o : GTB.h GTB_pixmap.c GTB_pixmap.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GTB_pixmap.c + +# /*------------------------------------------------------------\ +# | | +# | Graal Motif X11 | +# | | +# \------------------------------------------------------------*/ + +GMX_icon.o : GSB.h GMX.h GMX_icon.c GMX_icon.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMX_icon.c + +GMX_color.o : GSB.h GMX.h GMX_color.c GMX_color.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMX_color.c + +GMX_cursor.o : GSB.h GMX.h GMX_cursor.c GMX_cursor.h GMX_view.h GMX_grid.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMX_cursor.c + +GMX_dialog.o : GSB.h GMX.h GMX_dialog.c GMX.h GMX_dialog.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMX_dialog.c + +GMX_graphic.o : GSB.h GMX.h GMX_graphic.c GMX_graphic.h GMX_view.h GMX_grid.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMX_graphic.c + +GMX_grid.o : GSB.h GMX.h GMX_grid.c GMX_grid.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMX_grid.c + +GMX_menu.o : GSB.h GTB.h GMX.h GMF.h GME.h GMC.h GMV.h GMS.h GMT.h GMH.h \ + GMX_menu.c GMX_menu.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMX_menu.c + +GMX_message.o : GSB.h GTB.h GMX.h GMX_message.c GMX_message.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMX_message.c + +GMX_motif.o : GSB.h GTB.h GMX.h GMX_motif.c GMX_motif.h GMX_graphic.h \ + GMX_event.h GMX_message.h GMX_menu.h GMX_color.h \ + GMX_panel.h GMX_dialog.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMX_motif.c + +GMX_event.o : GSB.h GTB.h GRM.h GMX.h GMV.h GMX_event.c GMX_grid.h \ + GMX_event.h GMX_cursor.h GMX_event.h \ + GMX_message.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMX_event.c + +GMX_panel.o : GSB.h GTB.h GMF.h GME.h GMC.h GMV.h GMT.h GMS.h GMH.h GMX.h \ + GMX_panel.c GMX_panel.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMX_panel.c + +GMX_view.o : GSB.h GRM.h GMX_view.c GMX_view.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMX_view.c + +# /*------------------------------------------------------------\ +# | | +# | Graal Menu File | +# | | +# \------------------------------------------------------------*/ + +GMF_panel.o : GSB.h GRM.h GTB.h GMX.h GMF.h GMF_panel.c GMF_panel.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMF_panel.c + +GMF_menu.o : GSB.h GRM.h GTB.h GMX.h GMF.h GMF_menu.c GMF_menu.h \ + GMF_dialog.h GMF_file.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMF_menu.c + +GMF_dialog.o : GSB.h GRM.h GTB.h GMX.h GMF.h GMF_dialog.c GMF_dialog.h \ + GMF_file.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMF_dialog.c + +GMF_file.o : GSB.h GRM.h GTB.h GMX.h GMF.h GMF_file.c GMF_file.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMF_file.c + +# /*------------------------------------------------------------\ +# | | +# | Graal Menu Edit | +# | | +# \------------------------------------------------------------*/ + +GME_search.o : GSB.h GRM.h GMX.h GTB.h GME.h GME_search.c GME_search.h \ + GME_panel.h GME_edit.h GME_message.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GME_search.c + +GME_modify.o : GSB.h GRM.h GMX.h GTB.h GME.h GME_modify.c GME_modify.h \ + GME_panel.h GME_edit.h GME_message.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GME_modify.c + +GME_edit.o : GSB.h GRM.h GMX.h GTB.h GME.h GME_edit.c GME_edit.h \ + GME_message.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GME_edit.c + +GME_select.o : GSB.h GRM.h GMX.h GTB.h GME.h GME_select.c GME_select.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GME_select.c + +GME_panel.o : GSB.h GRM.h GMX.h GTB.h GME.h GME_panel.c GME_panel.h \ + GME_message.h GME_dialog.h GME_modify.h GME_search.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GME_panel.c + +GME_menu.o : GSB.h GRM.h GMX.h GTB.h GME.h GME_menu.c GME_menu.h \ + GME_edit.h GME_modify.h GME_message.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GME_menu.c + +GME_dialog.o : GSB.h GRM.h GMX.h GTB.h GME.h GME_dialog.c GME_dialog.h \ + GME_modify.h GME_search.h GME_edit.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GME_dialog.c + +GME_message.o : GSB.h GRM.h GMX.h GTB.h GME.h GME_message.c GME_message.h \ + GME_modify.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GME_message.c + +# /*------------------------------------------------------------\ +# | | +# | Graal Menu Create | +# | | +# \------------------------------------------------------------*/ + +GMC_menu.o : GSB.h GRM.h GTB.h GMX.h GMC.h GMC_menu.c GMC_menu.h \ + GMC_create.h GMC_message.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMC_menu.c + +GMC_panel.o : GSB.h GRM.h GTB.h GMX.h GMC.h GMC_panel.c GMC_panel.h \ + GMC_dialog.h GMC_create.h GMC_message.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMC_panel.c + +GMC_dialog.o : GSB.h GRM.h GTB.h GMX.h GMC.h GMC_dialog.c GMC_dialog.h \ + GMC_create.h GMC_message.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMC_dialog.c + +GMC_create.o : GSB.h GRM.h GTB.h GMX.h GMC.h GMC_create.c GMC_create.h \ + GMC_dialog.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMC_create.c + +GMC_message.o : GSB.h GRM.h GTB.h GMX.h GMC.h GMC_message.c GMC_message.h \ + GMC_create.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMC_message.c + +# /*------------------------------------------------------------\ +# | | +# | Graal Menu View | +# | | +# \------------------------------------------------------------*/ + +GMV_panel.o : GSB.h GTB.h GMX.h GMV.h GMV_panel.c GMV_panel.h \ + GMV_dialog.h GMV_view.h GMV_message.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMV_panel.c + +GMV_menu.o : GSB.h GTB.h GMX.h GMV.h GMV_menu.c GMV_menu.h\ + GMV_dialog.h GMV_view.h GMV_map.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMV_menu.c + +GMV_dialog.o : GSB.h GTB.h GMX.h GMV.h GMV_dialog.c GMV_dialog.h \ + GMV_view.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMV_dialog.c + +GMV_map.o : GSB.h GTB.h GMX.h GMV.h GMV_map.c GMV_map.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMV_map.c + +GMV_message.o : GSB.h GTB.h GMX.h GMV.h GMV_message.c GMV_message.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMV_message.c + +GMV_view.o : GSB.h GTB.h GMX.h GMV.h GMV_view.c GMV_view.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMV_view.c + +# /*------------------------------------------------------------\ +# | | +# | Graal Menu Tools | +# | | +# \------------------------------------------------------------*/ + +GMT_tools.o : GTB.h GSB.h GMX.h GRM.h GMT.h GMT_tools.c GMT_tools.h \ + GMT_message.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMT_tools.c + +GMT_druc.o : GTB.h GSB.h GMX.h GRM.h GMT.h GMT_druc.c GMT_druc.h \ + GMT_message.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMT_druc.c + +GMT_menu.o : GTB.h GSB.h GMX.h GRM.h GMT.h GMT_menu.c GMT_menu.h \ + GMT_message.h GMT_tools.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMT_menu.c + +GMT_panel.o : GTB.h GSB.h GMX.h GRM.h GMT.h GMT_panel.c GMT_panel.h \ + GMT_message.h GMT_tools.h GMT_dialog.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMT_panel.c + +GMT_dialog.o : GTB.h GSB.h GMX.h GRM.h GMT.h GMT_dialog.c GMT_dialog.h \ + GMT_tools.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMT_dialog.c + +GMT_message.o : GTB.h GSB.h GMX.h GRM.h GMT.h GMT_message.c GMT_message.h \ + GMT_tools.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMT_message.c + +# /*------------------------------------------------------------\ +# | | +# | Graal Menu Setup | +# | | +# \------------------------------------------------------------*/ + +GMS_menu.o : GTB.h GSB.h GMS.h GMS_menu.c GMS_menu.h GMS_setup.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMS_menu.c + +GMS_dialog.o : GTB.h GSB.h GMS.h GMS_dialog.c GMS_dialog.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMS_dialog.c + +GMS_panel.o : GTB.h GSB.h GMS.h GMS_panel.c GMS_panel.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMS_panel.c + +GMS_setup.o : GTB.h GSB.h GMX.h GMF.h GME.h GMC.h GMV.h GMT.h GMS.h GMH.h \ + GMS_setup.c GMS_setup.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMS_setup.c + +# /*------------------------------------------------------------\ +# | | +# | Graal Menu Help | +# | | +# \------------------------------------------------------------*/ + +GMH_menu.o : GTB.h GSB.h GMH.h GMH_menu.c GMH_menu.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMH_menu.c + +GMH_panel.o : GTB.h GSB.h GMH.h GMH_panel.c GMH_panel.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMH_panel.c + +GMH_help.o : GTB.h GSB.h GMX.h GMH.h GMH_help.c GMH_help.h + $(CC) $(LOCAL_CFLAGS) $(LOCAL_HEADER) -c GMH_help.c + +# /*------------------------------------------------------------\ +# | | +# | Clean | +# | | +# \------------------------------------------------------------*/ + +realclean : clean + $(RM) -f $(LOCAL_TARGET_BIN)/$(LOCAL_GRAAL_BIN) + +# /*------------------------------------------------------------\ +# | | +# | Clean Object | +# | | +# \------------------------------------------------------------*/ + +clean : + $(RM) -f $(LOCAL_OBJ) + diff --git a/alliance/src/graal/src/Makefile.am b/alliance/src/graal/src/Makefile.am new file mode 100644 index 00000000..3f19b956 --- /dev/null +++ b/alliance/src/graal/src/Makefile.am @@ -0,0 +1,44 @@ +## Process this file with automake to produce Makefile.in + +bin_PROGRAMS = graal +CFLAGS = @CFLAGS@ @X_CFLAGS@ -DGRAAL_VERSION=\"@GRAAL_VERSION@\" \ + -DGRAAL_TOOL_NAME=\"graal\" \ + -DALLIANCE_TOP=\"${ALLIANCE_TOP}\" \ + -DGRAAL_DEFAULT_TECHNO_NAME=\"etc/cmos_12.graal\" \ + -DGMS_FILE_NAME=\".graal.cfg\" \ + -DGRAAL_WINDOW_DX=\"GRAAL_WINDOW_DX\" \ + -DGRAAL_WINDOW_DY=\"GRAAL_WINDOW_DY\" \ + -DGRAAL_WINDOW_XMIN=\"GRAAL_WINDOW_XMIN\" \ + -DGRAAL_WINDOW_YMIN=\"GRAAL_WINDOW_YMIN\" \ + -DGRAAL_WINDOW_SIDE=\"GRAAL_WINDOW_SIDE\" + +graal_LDADD = @LIBS@ @X_LIBS@ @LINK_MOTIF@ \ +-lVrd -lRtl -lRgs -lRcf -lRfm -lRpr -lRwi -lRut -lRds -lMpu \ +-lMap -lMmg -lMcp -lMph -lMut -lm + +INCLUDES = @INCLUDES@ @INCLUDE_MOTIF@ + +graal_SOURCES = \ +GMC_create.c GMC_create.h GMC_dialog.c GMC_dialog.h GMC.h GMC_menu.c GMC_menu.h \ +GMC_message.c GMC_message.h GMC_panel.c GMC_panel.h GME_dialog.c GME_dialog.h \ +GME_edit.c GME_edit.h GME.h GME_menu.c GME_menu.h GME_message.c GME_message.h \ +GME_modify.c GME_modify.h GME_panel.c GME_panel.h GME_search.c GME_search.h \ +GME_select.c GME_select.h GMF_dialog.c GMF_dialog.h GMF_file.c GMF_file.h GMF.h \ +GMF_menu.c GMF_menu.h GMF_panel.c GMF_panel.h GMH.h GMH_help.c GMH_help.h \ +GMH_menu.c GMH_menu.h GMH_panel.c GMH_panel.h GMS_dialog.c GMS_dialog.h GMS.h \ +GMS_menu.c GMS_menu.h GMS_panel.c GMS_panel.h GMS_setup.c GMS_setup.h \ +GMT_dialog.c GMT_dialog.h GMT_druc.c GMT_druc.h GMT.h GMT_menu.c GMT_menu.h \ +GMT_message.c GMT_message.h GMT_panel.c GMT_panel.h GMT_tools.c GMT_tools.h \ +GMV_dialog.c GMV_dialog.h GMV.h GMV_map.c GMV_map.h GMV_menu.c GMV_menu.h \ +GMV_message.c GMV_message.h GMV_panel.c GMV_panel.h GMV_view.c GMV_view.h \ +GMX_color.c GMX_color.h GMX_cursor.c GMX_cursor.h GMX_dialog.c GMX_dialog.h \ +GMX_event.c GMX_event.h GMX_graphic.c GMX_graphic.h GMX_grid.c GMX_grid.h GMX.h \ +GMX_icon.c GMX_icon.h GMX_menu.c GMX_menu.h GMX_message.c GMX_message.h \ +GMX_motif.c GMX_motif.h GMX_panel.c GMX_panel.h GMX_view.c GMX_view.h graal.c \ +graal.h GRM_connector.c GRM_connector.h GRM_druc.c GRM_druc.h GRM_equi.c \ +GRM_equi.h GRM_error.c GRM_error.h GRM.h GRM_mbkrds.c GRM_mbkrds.h GRM_peek.c \ +GRM_peek.h GRM_search.c GRM_search.h GRM_select.c GRM_select.h GRM_undo.c \ +GRM_undo.h GRM_window.c GRM_window.h GSB_error.c GSB_error.h GSB.h GSB_parse.c \ +GSB_parse.h GSB_share.c GSB_share.h GTB_cursor.c GTB_cursor.h GTB_dialog.c \ +GTB_dialog.h GTB.h GTB_icon.c GTB_icon.h GTB_menu.c GTB_menu.h GTB_panel.c \ +GTB_panel.h GTB_pixmap.c GTB_pixmap.h LIP6bw.h diff --git a/alliance/src/graal/src/graal.c b/alliance/src/graal/src/graal.c new file mode 100644 index 00000000..f813f673 --- /dev/null +++ b/alliance/src/graal/src/graal.c @@ -0,0 +1,205 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : graal.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +# ident "@(#)GRAAL ver 1.10 January 1995" + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rpr.h" +# include "rwi.h" +# include "rut.h" +# include "GSB.h" +# include "GRM.h" +# include "GMX.h" + +# include "graal.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| present | +| | +\------------------------------------------------------------*/ + +void GraalPresent() +{ + alliancebanner_with_authors( "Graal", GRAAL_VERSION, + "Graphic layout editor", "1999", + ALLIANCE_VERSION, + "Ludovic Jacomme and Frederic Venot" ); +} + +/*------------------------------------------------------------\ +| | +| main | +| | +\------------------------------------------------------------*/ + +int main( argc, argv ) + + int argc; + char *argv[]; +{ + char *FileName = (char *)NULL; + char WindowInfo = 0; + char Debug = 0; + int Index; + + GraalPresent(); + + mbkenv(); + rdsenv(); + + for ( Index = 1; + Index < argc; + Index++ ) + { + if ( ! strcmp( argv[ Index ], "-l" ) ) + { + if ( ( Index + 1 ) < argc ) + { + Index = Index + 1; + FileName = argv[ Index ]; + } + } + else + if ( ! strcmp( argv[ Index ], "-w" ) ) + { + WindowInfo = 1; + } + else + if ( ! strcmp( argv[ Index ], "-debug" ) ) + { + Debug = 1; + } + else + if ( ! strcmp( argv[ Index ], "-scale" ) ) + { + Index++; + + if ( Index < argc ) + { + GRAAL_SCALE = atol( argv[ Index ] ); + if ( GRAAL_SCALE <= 0 ) GRAAL_SCALE = 1; + } + } + else + if ( ! strcmp( argv[ Index ], "-xor" ) ) + { + GRAAL_XOR_CURSOR = GRAAL_TRUE; + } + else + if ( ! strcmp( argv[ Index ], "-force" ) ) + { + GRAAL_FORCE_DISPLAY = GRAAL_TRUE; + } + else + if ( ! strcmp( argv[ Index ], "-install" ) ) + { + GRAAL_SWITCH_COLOR_MAP = GRAAL_TRUE; + } + } + + if ( Debug ) rdsdebug(); + + rdsbegin(); + + Graalenv(); + loadrdsparam(); + GraalLoadParameters(); + + GraalInitializeRessources( &argc, argv ); + GraalInitializeWindow(); + + if ( WindowInfo ) + { + fprintf( stdout, "\nGraal window\n" ); + fprintf( stdout, "\n XMIN : %d" , GraalWindowXmin / GRAAL_RDS_LAMBDA ); + fprintf( stdout, "\n XMAX : %d" , GraalWindowXmax / GRAAL_RDS_LAMBDA ); + fprintf( stdout, "\n YMIN : %d" , GraalWindowYmin / GRAAL_RDS_LAMBDA ); + fprintf( stdout, "\n YMAX : %d" , GraalWindowYmax / GRAAL_RDS_LAMBDA ); + fprintf( stdout, "\n SIDE : %d" , GraalWindowSide / GRAAL_RDS_LAMBDA ); + fprintf( stdout, "\n DX : %d" , GraalWindowDx ); + fprintf( stdout, "\n DY : %d" , GraalWindowDy ); + fprintf( stdout, "\n SIZE : %d\n", GraalWindowSize ); + } + + GraalInitializeCutCxTable(); + GraalInitializeErrorMessage( Debug ); + + if ( FileName != (char *)NULL ) + { + GraalFigureMbk = Graalgetphfig( FileName, 'A' ); + } + + XtAppMainLoop( GraalApplication ); + + rdsend(); + + return( 0 ); +} diff --git a/alliance/src/graal/src/graal.h b/alliance/src/graal/src/graal.h new file mode 100644 index 00000000..0dae06fb --- /dev/null +++ b/alliance/src/graal/src/graal.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : GRAAL | +| | +| File : graal.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 28.03.95 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef GRAAL_GRAAL +# define GRAAL_GRAAL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| GraalInitializeRessources | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/lynx/Makefile.am b/alliance/src/lynx/Makefile.am new file mode 100644 index 00000000..5fcaa0d3 --- /dev/null +++ b/alliance/src/lynx/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src man1 diff --git a/alliance/src/lynx/configure.in b/alliance/src/lynx/configure.in new file mode 100644 index 00000000..6e01ebaf --- /dev/null +++ b/alliance/src/lynx/configure.in @@ -0,0 +1,35 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(src/lynx.c) + +LYNX_MAJOR_VERSION=1 +LYNX_MINOR_VERSION=21 +LYNX_VERSION=$LYNX_MAJOR_VERSION.$LYNX_MINOR_VERSION + +AC_SUBST(LYNX_MAJOR_VERSION) +AC_SUBST(LYNX_MINOR_VERSION) +AC_SUBST(LYNX_VERSION) + +# For automake. +VERSION=$LYNX_VERSION +PACKAGE=lynx + +dnl Initialize automake stuff +AM_INIT_AUTOMAKE($PACKAGE, $VERSION) + +dnl Checks for programs. +AC_PROG_CC +AM_PROG_LEX +AC_PROG_YACC +AC_PROG_RANLIB +AC_PROG_MAKE_SET + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST + +AM_ALLIANCE + +AC_OUTPUT([ +Makefile +man1/Makefile +src/Makefile +]) diff --git a/alliance/src/lynx/man1/Makefile.am b/alliance/src/lynx/man1/Makefile.am new file mode 100644 index 00000000..e15a7392 --- /dev/null +++ b/alliance/src/lynx/man1/Makefile.am @@ -0,0 +1,2 @@ +man_MANS = lynx.1 +EXTRA_DIST = $(man_MANS) diff --git a/alliance/src/lynx/man1/lynx.1 b/alliance/src/lynx/man1/lynx.1 new file mode 100644 index 00000000..dea25549 --- /dev/null +++ b/alliance/src/lynx/man1/lynx.1 @@ -0,0 +1,167 @@ +.\" $Id: lynx.1,v 1.1 2002/03/29 17:43:39 ludo Exp $ +.\" @(#)lynx 1.09 94/10/10 UPMC/ASIM/LIP6/CAO-VLSI " Ludovic Jacomme, Frederic Petrot +.TH LYNX 1 "October 1, 1997" "ASIM/LIP6" "ALLIANCE USER COMMANDS" +.SH NAME +lynx \- Hierarchical netlist extractor +.SH SYNOPSIS +.B lynx +[ +.I \-v +] +[ +.I \-c +] +[ +.I \-f +] +[ +.I \-t +] +[ +.I \-ar +] +[ +.I \-ac +] +.I input_name +[ +.I output_name +] +.br +.so man1/alc_origin.1 +.SH DESCRIPTION +\fBLynx\fP is a hierarchical layout extractor. +It builds a netlist of interconnections from a symbolic layout view. +The \fIinput\fP argument is the name of the symbolic layout cell to +be extracted, using as input format the one selected by the +\fBMBK_IN_PH\fP(1) environment variable. +If \fIoutput\fP is present, the resulting netlist will be given this name. +If no \fIoutput\fP is given, then \fIinput\fP will also be the generated +netlist name. +The output format is specified by the \fBMBK_OUT_LO\fP(1) environment variable. +.br +As most of the Alliance cad tools, \fBlynx\fP uses \fBmbk\fP(1) environment +variables. +.BR MBK_CATA_LIB (1), +.BR MBK_WORK_LIB (1), +.BR MBK_IN_PH (1), +.BR MBK_OUT_LO (1), +.BR RDS_TECHNO_NAME (1). +.PP +\fBLynx\fP computes capacitances attached to the signals if +the -ac option is set. At the moment, +the value of these capacitances is computed for a typical one micron +technology, and cannot be changed by the user through a technology file. +The extracted netlist can be simulated for performance evaluation. +.br +The typical capacitances are given below in 10e-18 farad / lamda^2 : +.TP 20 +POLY +100 +.TP 20 +ALU1 +50 +.TP 20 +ALU2 +25 +.SH OPTIONS +\fBLynx\fP checks the two basic \fBALLIANCE\fP rules regarding connector names: +.br +.RS +If two physical connectors are connected to the same net, they must have +the same name. +.br +If two physical connectors have the same name, they must be internally +connected to the same net. +.RE +.br +As a result only one logical connector will appear in the netlist. +A fatal error occurs if one of those two rules is violated ( even for power +and ground connectors ) + +When no options are specified, the current hierarchical level is extracted. +The resulting netlist is the list of interconnections of the current +layout hierarchy level. +Three options are available to change \fBlynx\fP behaviour : +.TP +\-t +Notifies a transistor level extraction, the symbolic layout cell is flattened to +transistor layout before extraction. +.TP +\-f +The symbolic layout cell is flattened to the catalog level before extraction. +Use "man catal" for detail on the catalog file. +If the catalog is empty, or doesn't exist, the netlist is an interconection of +transistors, if it isn't, the netlist is an interconection of gates or blocks +whose names are defined in the catalog. +.TP +\-v +Verbose mode on. +Each step of the extraction is displayed on the standard output, +along with some statistics. +.TP +\-c +Generates a \fBcore\fP file representing the conflictuel net, when +\fBlynx\fP detects two external connectors with different names on +the same signal, or when it finds two external connectors having +the same name but not internally connected to the same net, or when +it cannot correctly extract an L shaped transistor. +.TP +\-ac +Extract capacitance to ground on losig. +.TP +\-ar +Extract interconnect resistance and capacitance to ground. Value of +resistance foreach layer can be changed in the RDS file. +.SH EXAMPLES +.ie t \{\ +.ft CR \} +.el \fB +prompt> lynx -v amd2901 +.ft R +.RS +Gives a logical netlist of the chip amd2901, for one hierarchical +level, using verbose mode. +This would be typically used to verify the work of the \fBring\fP(1) +router, in conjunction with \fBlvx\fP on the specificated netlist and +the extracted one. +.RE +.ie t \{\ +.ft CR \} +.el \fB +.nf +prompt> cat $MBK_WORK_LIB/$MBK_CATAL_NAME +a2_y +a2p_y + . + . +prompt> lynx -f amd2901 +.fi +.ft R +.RS +Gives a logical netlist of the chip amd2901, after a flatten operation stopping +on the cells specified in the catalog ( the standard cell library in our case ). +.RE +.ie t \{\ +.ft CR \} +.el \fB +.nf +prompt> lynx -t amd2901 +.fi +.ft R +.RS +Gives a logical netlist of the amd2901 chip at the transistor level. +This is useful with \fByagle\fP(1), to retrieve logical equations from +a layout. +.RE +.SH SEE ALSO +.BR al (1), +.BR MBK_CATA_LIB (1), +.BR MBK_WORK_LIB (1), +.BR MBK_CATAL_NAME (1), +.BR MBK_IN_PH (1), +.BR catal (5), +.BR RDS_TECHNO_NAME (1). + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/lynx/src/Makefile.am b/alliance/src/lynx/src/Makefile.am new file mode 100644 index 00000000..5fc88f44 --- /dev/null +++ b/alliance/src/lynx/src/Makefile.am @@ -0,0 +1,29 @@ +## Process this file with automake to produce Makefile.in + +bin_PROGRAMS = lynx flatrds + +CFLAGS = @CFLAGS@ -DLYNX_VERSION=\"@LYNX_VERSION@\" + +lynx_LDADD = @LIBS@ \ + -lMlu -lMpu -lMap -lMmg -lMcp -lMcl -lMel \ + -lMhl -lMvl -lMlo -lMph -lMut -lMal -lRcn \ + -lMsl -lMgl \ + -lRtl -lRgs -lRcf -lRfm -lRpr -lRwi -lRut -lRds + +flatrds_LDADD = @LIBS@ \ + -lMlu -lMpu -lMap -lMmg -lMcp -lMcl -lMel \ + -lMhl -lMvl -lMlo -lMph -lMut -lMal -lRcn \ + -lMsl -lMgl \ + -lRtl -lRgs -lRcf -lRfm -lRpr -lRwi -lRut -lRds + +flatrds_SOURCES = flatrds.c + +lynx_SOURCES = \ +addlynxrcn.c addlynxrcn.h box.c box.h buildrcn.c \ +buildrcn.h bulk.c bulk.h chklynxrcn.c chklynxrcn.h \ +cutelbow.c cutelbow.h diffusion.c diffusion.h error.c \ +error.h extract.c extract.h hole.c \ +hole.h inter.c inter.h interval.c interval.h \ +lynx.c lynx.h lynxrcn.h mbkrds.c mbkrds.h netlist.c \ +netlist.h parse.c parse.h pattern.c pattern.h via.h \ +Windows95.c Windows95.h znc.c znc.h diff --git a/alliance/src/lynx/src/Windows95.c b/alliance/src/lynx/src/Windows95.c new file mode 100644 index 00000000..1ca26a22 --- /dev/null +++ b/alliance/src/lynx/src/Windows95.c @@ -0,0 +1,621 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +#include +#include +#include +#include "rds.h" +#include "mut.h" +#include "mlo.h" +#include "mph.h" +#include "Windows95.h" +#include "lynxrcn.h" +#include "inter.h" +#include "mbkrds.h" +#include "extract.h" + +char GrgWinDebug=0; +GrgWinChRec *FREE_GrgWinChRec=NULL; + +#define MXFREE 5 + +typedef struct smystack +{ + struct smystack *NEXT; + ptype_list *PILE[MAXSTACK]; + long int CASEIN; +} mystack; + +mystack* creatmystack __P((void)); +void freemystack __P((mystack*)); +mystack* addinmystack __P((mystack*, ptype_list*)); +GrgWinChRec* addwinchrec __P((GrgWinChRec*, rdsrec_list*)); + + +GrgWindow* GrgCreatWindows(Signal) +losig_list *Signal; +{ + rdsrec_list *Rec,fenetre; + char End_Equi=0; + GrgWindow *Win=NULL; + long nbrec=0,N,k; /* N: nombre de fenetre sur un cote du + fenetrage */ + long x1,x2,y1,y2,x,y; + GrgWinChRec *ptwinchrec; + ptype_list *ptGrgWin; + chain_list *sl; + long i; + ptype_list *ptdebug; + chain_list *scanchain; + + if(GrgWinDebug) + fprintf(stderr,"Création du fenetrage.\n"); + + for( scanchain = (chain_list*)(getptype( Signal->USER, RCN_FEQUI )->DATA ) ; + scanchain ; + scanchain = scanchain->NEXT + ) + if( scanchain->DATA ) + break; + + if( scanchain ) + { + /* + Calcul de la taille occupee par le signal et du nombre + de rectangle le constituant. + */ + + Win=(GrgWindow*)mbkalloc(sizeof(GrgWindow)); + Win->mx= INT_MAX; + Win->my= INT_MAX; + Win->Mx= INT_MIN; + Win->My= INT_MIN; + + for( scanchain = (chain_list*)(getptype( Signal->USER, RCN_FEQUI )->DATA ) ; + scanchain ; + scanchain = scanchain->NEXT + ) + { + + Rec = (rdsrec_list*)(scanchain->DATA ); + if( !Rec ) + continue; + End_Equi = 0; + + while(!End_Equi) + { + nbrec++; + if(Rec->X < Win->mx) Win->mx = Rec->X; + if(Rec->Y < Win->my) Win->my = Rec->Y; + if(Rec->X+Rec->DX > Win->Mx) Win->Mx = Rec->X+Rec->DX; + if(Rec->Y+Rec->DY > Win->My) Win->My = Rec->Y+Rec->DY; + + if(IsLynxEndEqui(Rec)) + End_Equi=1; + else + Rec=LYNX_EQUI(Rec); + } + } + + + N=(long)(sqrt((double)nbrec)); + + Win->Px=(Win->Mx-Win->mx)/N; + Win->Py=(Win->My-Win->my)/N; + + if( Win->Px == 0 ) + Win->Px = 1; + + if( Win->Py == 0 ) + Win->Py = 1; + + Win->nx=(Win->Mx-Win->mx)/Win->Px+1; + Win->ny=(Win->My-Win->my)/Win->Py+1; + + if(GrgWinDebug) + { + fprintf(stderr,"Taille du signal: (%ld;%ld)-(%ld;%ld)\n",Win->mx, + Win->my, + Win->Mx, + Win->My); + fprintf(stderr,"Nombre de rectangles: %ld\n",nbrec); + fprintf(stderr,"Nombre de fenetre X: %ld Y: %ld\n",Win->nx,Win->ny); + fprintf(stderr,"Taille de fenetres: %ldx%ld\n",Win->Px,Win->Py); + } + Win->Windows=(GrgWinChRec**)mbkalloc( Win->nx*Win->ny*sizeof(GrgWinChRec*)); + k=Win->nx*Win->ny; + for(x=0;xWindows+x)=NULL; + + /* Rangement des rectangles dans leur fenetre */ + + for( scanchain = (chain_list*)(getptype( Signal->USER, RCN_FEQUI )->DATA ) ; + scanchain ; + scanchain = scanchain->NEXT + ) + { + Rec = (rdsrec_list*)(scanchain->DATA ); + if( !Rec ) + continue; + End_Equi = 0; + while(!End_Equi) + { + if(GrgWinDebug>=2) + { + fprintf(stderr,"Rectangle: (%6ld;%6ld)-(%6ld;%6ld) ",Rec->X, + Rec->Y, + Rec->X+Rec->DX, + Rec->Y+Rec->DY); + for( ptdebug = Rec->USER ; ptdebug ; ptdebug = ptdebug->NEXT ) + printf("[%5ld-%08X] ", ptdebug->TYPE, (int)(ptdebug->DATA) ); + printf("\n"); + } + + x1=(Rec->X-Win->mx)/Win->Px; + x2=(Rec->X+Rec->DX-Win->mx)/Win->Px; + y1=(Rec->Y-Win->my)/Win->Py; + y2=(Rec->Y+Rec->DY-Win->my)/Win->Py; + + x=x1; y=y1; + + /* Verification adjacence en bas et a gauche */ + if(x1>=1 && y1>=1) + { + fenetre.X= (x1-1)*Win->Px + Win->mx; + fenetre.DX= Win->Px; + fenetre.Y= (y1-1)*Win->Py + Win->my; + fenetre.DY= Win->Py; + fenetre.FLAGS= Rec->FLAGS; + + if(Intersect(&fenetre,Rec)!=NON_INTERSECT) + { + y=y1-1; + x=x1-1; + } + } + + /* Verification adjacence ŕ gauche */ + if(x1>=1) + { + fenetre.X= (x1-1)*Win->Px + Win->mx; + fenetre.DX= Win->Px; + fenetre.Y= y1*Win->Py + Win->my; + fenetre.DY= Win->Py; + fenetre.FLAGS= Rec->FLAGS; + + if(Intersect(&fenetre,Rec)!=NON_INTERSECT) + x=x1-1; + } + + /* Verification adjacence en bas */ + if(y1>=1) + { + fenetre.X= x1*Win->Px + Win->mx; + fenetre.DX= Win->Px; + fenetre.Y= (y1-1)*Win->Py + Win->my; + fenetre.DY= Win->Py; + fenetre.FLAGS= Rec->FLAGS; + + if(Intersect(&fenetre,Rec)!=NON_INTERSECT) + y=y1-1; + } + + x1=x; + y1=y; + + if(GrgWinDebug>=2) + fprintf(stderr,"x1=%ld; y1=%ld x2=%ld; y2=%ld\n",x1,y1,x2,y2); + + for(x=x1;x<=x2 && xnx;x++) + for(y=y1;y<=y2 && yny;y++) + { + if(GrgWinDebug>=2) + fprintf(stderr,"Fenetre: %ld,%ld\n",x,y); + ptwinchrec=*(Win->Windows+y*Win->nx+x); + ptwinchrec=addwinchrec(ptwinchrec,Rec); + *(Win->Windows+y*Win->nx+x)=ptwinchrec; + + if( (ptGrgWin=getptype(Rec->USER,GrgWin)) ) + ptGrgWin->DATA=addchain(ptGrgWin->DATA,Win->Windows+y*Win->nx+x); + else + Rec->USER=addptype(Rec->USER,GrgWin,addchain(NULL,Win->Windows+y*Win->nx+x)); + } + + if(IsLynxEndEqui(Rec)) + End_Equi=1; + else + Rec=LYNX_EQUI(Rec); + } + } + + if(GrgWinDebug) + { + fprintf(stderr,"\nRectangle par fenetre.\n"); + for(x=0;xWindows+x); + for(;ptwinchrec;ptwinchrec=ptwinchrec->NEXT) + { + for(i=0;iPOS;i++) + { + Rec=ptwinchrec->REC[i]; + fprintf( stderr,"Rectangle: (%6ld;%6ld)-(%6ld;%6ld) %s\n", + Rec->X, + Rec->Y, + Rec->X+Rec->DX, + Rec->Y+Rec->DY, + RDS_LAYER_NAME[ GetRdsLayer( Rec ) ] + ); + } + } + } + + fprintf(stderr,"\nFenetre par rectangle.\n"); + for( scanchain = (chain_list*)(getptype( Signal->USER, RCN_FEQUI )->DATA ) ; + scanchain ; + scanchain = scanchain->NEXT + ) + { + Rec = (rdsrec_list*)(scanchain->DATA ); + if( !Rec ) + continue; + End_Equi = 0; + while(!End_Equi) + { + fprintf(stderr,"Rectangle: (%6ld;%6ld)-(%6ld;%6ld)\n",Rec->X, + Rec->Y, + Rec->X+Rec->DX, + Rec->Y+Rec->DY); + if(! (ptGrgWin=getptype(Rec->USER,GrgWin))) + { + fprintf(stderr,"ERREUR: Pas de fenetre associee ŕ ce rectangle\n"); + exit(1745); + } + + for(sl=(chain_list*)(ptGrgWin->DATA); + sl; + sl=sl->NEXT) + fprintf(stderr,"Fenetre: %ld\n",(((long)(sl->DATA))-((long)(Win->Windows)))/sizeof(void*)); + + if(IsLynxEndEqui(Rec)) + End_Equi=1; + else + Rec=LYNX_EQUI(Rec); + } + fprintf(stderr,"Fin du fenetrage.\n"); + } + } + } + + /* Win=NULL si le signal n'a pas de rectangle */ + return(Win); +} + +chain_list* GrgGetInterWindows(Rec,WinInfo) +rdsrec_list *Rec; +GrgWindow *WinInfo; +{ + ptype_list *pt; + chain_list *ScanchWin,*InterRec=NULL,*sc; + GrgWinChRec *ScanchRec; + mystack *pile,*scanmystack; + rdsrec_list *R; + long i; + + if(GrgWinDebug) + { + fprintf(stderr,"Debut procedure de recherche des intersections pour le\n"); + fprintf(stderr,"Rectangle: (%6ld;%6ld)-(%6ld;%6ld)\n",Rec->X, + Rec->Y, + Rec->X+Rec->DX, + Rec->Y+Rec->DY); + } + + pt=getptype(Rec->USER,GrgWin); + if(pt) + { + /* Pour eviter d'entrer deux fois un rectangle dans la liste des + rectangles de sortie, on met le champs USER a la valeur 1 ( + valeur non cadree, impossible en fonctionnement normal). A la + fin, on remet les bonnes valeurs que l'on avait sauvegardees + dans une pile. + */ + + pile=creatmystack(); + + for(ScanchWin=(chain_list*)(pt->DATA); + ScanchWin; + ScanchWin=ScanchWin->NEXT) + { + if(GrgWinDebug) + fprintf(stderr,"Fenetre: %ld\n", + (((long)(ScanchWin->DATA))-((long)(WinInfo->Windows)))/sizeof(chain_list*)); + + for(ScanchRec=*((GrgWinChRec**)(ScanchWin->DATA)); + ScanchRec; + ScanchRec=ScanchRec->NEXT) + { + for(i=0;iPOS;i++) + { + if(Intersect(Rec,ScanchRec->REC[i])!=NON_INTERSECT && + Rec!=ScanchRec->REC[i]) + { + + /* Ajout du nouveau rectangle dans la chaine InterRec si il + n'y est deja pas present */ + + if(GrgWinDebug) + fprintf(stderr," (%6ld;%6ld)-(%6ld;%6ld) USERS: %X\n", + ScanchRec->REC[i]->X, + ScanchRec->REC[i]->Y, + ScanchRec->REC[i]->X+ScanchRec->REC[i]->DX, + ScanchRec->REC[i]->Y+ScanchRec->REC[i]->DY, + (int)(ScanchRec->REC[i]->USER) ); + + R=ScanchRec->REC[i]; + if(R->USER!=(ptype_list*)1) + { + pile=addinmystack(pile,R->USER); + InterRec=addchain(InterRec,R); + R->USER=(ptype_list*)1; + } + + } + } + } + } + if(GrgWinDebug) + fprintf(stderr,"Fin de la procedure de recherche des intersections.\n"); + fflush(stderr); + + /* Avant de renvoyer cette liste, on remet les (bonnes!) valeurs + dans le champs USER des rectangles */ + + scanmystack=pile; + for(sc=InterRec;sc;sc=sc->NEXT) + { + scanmystack->CASEIN--; + R=((rdsrec_list*)(sc->DATA)); + R->USER=scanmystack->PILE[scanmystack->CASEIN]; + + if(GrgWinDebug) + fprintf(stderr," (%6ld;%6ld)-(%6ld;%6ld) USERS: %X\n", + R->X,R->Y,R->X+R->DX,R->Y+R->DY,(int)(R->USER) ); + + if(scanmystack->CASEIN==0) + scanmystack=scanmystack->NEXT; + } + + if(InterRec && scanmystack) + { + fprintf(stderr,"Windows95 :\n"); + fprintf(stderr,"Pas de concordance entre les rectangles et la pile.\n"); + exit(1); + } + freemystack(pile); + return(InterRec); + } + fprintf(stderr,"ERREUR: Un rectangle n'est associe a aucune fenetre.\n"); + fprintf(stderr,"%s (%ld,%ld)-(%ld,%ld)\n", RDS_LAYER_NAME[ GetRdsLayer(Rec) ], + Rec->X, + Rec->Y, + Rec->DX, + Rec->DY + ); + fflush(stderr); + exit(4594); +} + +void GrgClearWindows(WinInfo,Signal) +GrgWindow *WinInfo; +losig_list *Signal; +{ + rdsrec_list *Rec; + char End_Equi; + long pt; + GrgWinChRec *sc,*old; + ptype_list *ptl; + chain_list *scanchain; + + if(GrgWinDebug) + fprintf(stderr,"Debut du nettoyage des fenetres.\n"); + + for( scanchain = (chain_list*)(getptype( Signal->USER, RCN_FEQUI )->DATA ) ; + scanchain ; + scanchain = scanchain->NEXT + ) + { + + Rec = (rdsrec_list*)(scanchain->DATA ); + if( !Rec ) + continue; + End_Equi=0; + + while(!End_Equi) + { + ptl=getptype(Rec->USER,GrgWin); + if(!ptl) + { + fprintf(stderr,"Un rectangle n'appartient a aucune fenetre (1).\n"); + fprintf(stderr,"Rectangle: (%6ld;%6ld)-(%6ld;%6ld)\n",Rec->X, + Rec->Y, + Rec->X+Rec->DX, + Rec->Y+Rec->DY); + exit(-1); + } + if(!ptl->DATA) + { + fprintf(stderr,"Un rectangle n'appartient a aucune fenetre (2).\n"); + fprintf(stderr,"Rectangle: (%6ld;%6ld)-(%6ld;%6ld)\n",Rec->X, + Rec->Y, + Rec->X+Rec->DX, + Rec->Y+Rec->DY); + exit(-1); + } + freechain((chain_list*)(ptl->DATA)); + Rec->USER=delptype(Rec->USER,GrgWin); + if(IsLynxEndEqui(Rec)) + End_Equi=1; + else + Rec=LYNX_EQUI(Rec); + } + } + + for(pt=0;ptnx*WinInfo->ny;pt++) + { + old=NULL; + for(sc= *(WinInfo->Windows+pt);sc;sc=sc->NEXT) + { + if(old) + { + old->NEXT=FREE_GrgWinChRec; + FREE_GrgWinChRec=old; + } + old=sc; + } + if(old) + { + old->NEXT=FREE_GrgWinChRec; + FREE_GrgWinChRec=old; + } + } + + mbkfree(WinInfo->Windows); + mbkfree(WinInfo); + + if(GrgWinDebug) + fprintf(stderr,"Nettoyage des fenetres termine.\n"); +} + + + +/* Fonction de gestion de piles */ + +mystack* creatmystack() +{ + mystack *new; + + new=(mystack*)mbkalloc(sizeof(mystack)); + new->NEXT=NULL; + new->CASEIN=0; + return(new); +} + +mystack* addinmystack(head,data) +mystack *head; +ptype_list *data; +{ + mystack *new; + if(head->CASEIN==MAXSTACK) + { + new=creatmystack(); + new->NEXT=head; + head=new; + } + + head->PILE[head->CASEIN]=data; + head->CASEIN++; + + return(head); +} + +void freemystack(head) +mystack *head; +{ + mystack *scan,*old; + + old=NULL; + for(scan=head;scan;scan=scan->NEXT) + { + if(old) + mbkfree(old); + old=scan; + } + if(old) + mbkfree(old); +} + +GrgWinChRec* addwinchrec(head,rec) +GrgWinChRec *head; +rdsrec_list *rec; +{ + GrgWinChRec *new; + int i; + + if(!head) + { + if(FREE_GrgWinChRec) + { + new=FREE_GrgWinChRec; + FREE_GrgWinChRec=FREE_GrgWinChRec->NEXT; + } + else + { + FREE_GrgWinChRec=(GrgWinChRec*)mbkalloc(sizeof(GrgWinChRec)*MXFREE); + + for(i=0;iNEXT=NULL; + } + new->NEXT=head; + new->POS=0; + head=new; + } + + if(head->POS==GRGWINMAXREC) + { + if(FREE_GrgWinChRec) + { + new=FREE_GrgWinChRec; + FREE_GrgWinChRec=FREE_GrgWinChRec->NEXT; + } + else + { + FREE_GrgWinChRec=(GrgWinChRec*)mbkalloc(sizeof(GrgWinChRec)*MXFREE); + + for(i=0;iNEXT=NULL; + } + + new->NEXT=head; + new->POS=0; + head=new; + } + + head->REC[head->POS]=rec; + head->POS++; + + return(head); +} diff --git a/alliance/src/lynx/src/Windows95.h b/alliance/src/lynx/src/Windows95.h new file mode 100644 index 00000000..d0a944cd --- /dev/null +++ b/alliance/src/lynx/src/Windows95.h @@ -0,0 +1,50 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +#define GrgWin 1983 +#define GRGWINMAXREC 8 +#define MAXSTACK 100 + +typedef struct stwin +{ + long mx,my,Mx,My; /* Coordonnées maximum du chip */ + long Px,Py; /* Taille des fenetres */ + long nx,ny; /* Nombre de fenetre */ + struct sGrgWinChRec **Windows; /* Pointeur vers liste chainee des fenetres */ +} GrgWindow; + +typedef struct sGrgWinChRec +{ + struct sGrgWinChRec *NEXT; + long POS; + rdsrec_list *REC[GRGWINMAXREC]; +} GrgWinChRec; + +GrgWindow* GrgCreatWindows __P((losig_list*)); +chain_list* GrgGetInterWindows __P((rdsrec_list*, GrgWindow*)); +void GrgClearWindows __P((GrgWindow*, losig_list*)); + diff --git a/alliance/src/lynx/src/addlynxrcn.c b/alliance/src/lynx/src/addlynxrcn.c new file mode 100644 index 00000000..e30c7dd4 --- /dev/null +++ b/alliance/src/lynx/src/addlynxrcn.c @@ -0,0 +1,401 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/************************************************************* +* SOURCES * +* * +* Changed by: Greg * +* Date: 05/07/95 * +* New file: - * +* Comments: * +* Fonctions permettant d'ajouter un nouveau reseau dans * +* la figure logique existante. * +* * +* * +*************************************************************/ + +# include "mut.h" +# include "rds.h" +# include "mlo.h" +# include "rcn.h" +# include "mph.h" +# include "rpr.h" +# include "extract.h" +# include "lynxrcn.h" +# include +# include +# include +# include "addlynxrcn.h" +# include "Windows95.h" +# include "inter.h" +# include "mbkrds.h" +# include "chklynxrcn.h" +# include "buildrcn.h" +# include "via.h" + +# include + +/************************************************************* +* La variable rcnlynxdebug doit etre fixee a 0 pour NE PAS * +* avoir d'affichage sur la sortie STDERR. * +* * +* * +*************************************************************/ + +short rcnlynxdebug=0; +short rcnlynxchk=0; + +long GrgNodeINDEX=1L; + +/************************************************************* +* * +* Fonctions utilisees en interne par le programme. * +* * +* * +*************************************************************/ + +void GrgConPh2ConLo __P((locon_list*, long)); +void GrgDualConLoPh __P((lofig_list*)); +void GrgGroupVia __P((lofig_list*)); +void SigMark __P(( lofig_list*)); + +/************************************************************* +* SOURCES * +* * +* * +* * +*************************************************************/ + +void generate_RCN(fig) +lofig_list *fig; + +/************************************************************* + +En entree, les rds doivent avoir dans leur champ user une ptype +normalement constituee. Les connecteurs logiques DOIVENT etre +relies aux connecteurs physiques grace a une liste chainee +accessible par un ptype du champ USER des locons. Les valeurs +que doit prendre l'identificateur de la ptype est definie +dans le fichier 'lynxrcn.h'. +A un connecteur physique, il n'y aura qu'un seul connecteur +logique attache, tandis qu'a un connecteur logique, il peut y +avoir plusieurs connecteurs physiques (ex des instances). +Pour les transistors, il n'y a qu'un connecteur physique par +connecteur logique. + +*************************************************************/ + +{ + losig_list *ScanSignal; + + fflush(stdout); + fflush(stderr); + + SigMark( fig); + + if(rcnlynxdebug) + { + fflush(stderr); + fprintf(stderr,"\n\n--------- DEBUT DE LA FONCTION generate_RCN -----------\n"); + fflush(stderr); + } + + printf("\t---> Net extract is running...\n"); fflush(stdout); + + if(rcnlynxdebug) + { + fprintf(stderr,"Figure d'entree\n"); + Grgdisplay_datain(fig); + fprintf(stderr,"____________________________________________\n"); + fflush(stderr); + } + + if(rcnlynxchk) + { + if(rcnlynxdebug) + fprintf(stderr, + "Verification de la conformite des structures d'entree...\n"); + GrgChkInConFEqui(fig); + } + + /* + Ajoute pour chaque rectangle representant un connecteur un pointeur vers + le connecteur logique correspondant. Ce pointeur est accessible par + la valeur RDSLOCON + */ + + GrgDualConLoPh(fig); + + /* + Permet de retrouver a partir d'un rectangle constituant un via les deux + autres rectangles constituant ce via. Le pointeur est accessible par la + valeur GRGVIA + */ + GrgGroupVia(fig); + + if(rcnlynxchk) + { + if(rcnlynxdebug) + fprintf(stderr,"Verification de la conformite des structures de travail...\n"); + GrgChkOutConVia(fig,rcnlynxdebug); + } + + if(rcnlynxdebug) + { + fprintf(stderr,"Figure apres liaisons connecteur physique-logique\n"); + Grgdisplay_datain(fig); + fprintf(stderr,"____________________________________________\n"); + fflush(stderr); + } + + for(ScanSignal=fig->LOSIG; ScanSignal; ScanSignal=ScanSignal->NEXT) + { + /* Remise a un du compteur de noeud pour chaque Signal */ + + GrgNodeINDEX=1L; + + buildrcn(fig,ScanSignal); + +/* + if(rcnlynxchk) + { + if(!rcn_check(getlorcnet(ScanSignal),0)) + printf("RCN error on signal %ld.\n",ScanSignal->INDEX); + } +*/ + } + + + if(rcnlynxdebug) + { + fprintf(stderr,"-------- SORTIE DE LA FONCTION generate_RCN -----------\n"); + } + + fflush(stderr); + fflush(stdout); + +} + +void GrgDualConLoPh(fig) +lofig_list *fig; +/************************************************************* +* Creer la relation connecteur physique vers connecteur * +* logique a partir de la relation connecteur logique vers * +* connecteur logique existante. * +* * +*************************************************************/ +{ + loins_list *ScanLoIns; /* Pour parcourir les instances logiques */ + lotrs_list *ScanTrs; /* Pour parcourir les transistors logiques */ + + if(rcnlynxdebug) + { + fprintf(stderr,"\nPlace dans le champ USER des rectangles connecteurs\n"); + fprintf(stderr,"le connecteur logique lui correspondant...\n"); + } + + if(rcnlynxdebug) + fprintf(stderr," Traitement des connecteurs externes de la figure...\n"); + GrgConPh2ConLo(fig->LOCON,RDSLOCON1); + + if(rcnlynxdebug) + fprintf(stderr," Traitement des connecteurs des instances...\n"); + for(ScanLoIns=fig->LOINS;ScanLoIns;ScanLoIns=ScanLoIns->NEXT) + { + GrgConPh2ConLo(ScanLoIns->LOCON,RDSLOCON2); + } + + if(rcnlynxdebug) + fprintf(stderr," Traitement des connecteurs des transistors...\n"); + for(ScanTrs=fig->LOTRS;ScanTrs;ScanTrs=ScanTrs->NEXT) + { + GrgConPh2ConLo(ScanTrs->DRAIN,RDSLOCON3); + GrgConPh2ConLo(ScanTrs->GRID,RDSLOCON3); + GrgConPh2ConLo(ScanTrs->SOURCE,RDSLOCON3); + GrgConPh2ConLo(ScanTrs->BULK,RDSLOCON3); + } +} + + + + + +void GrgConPh2ConLo(connector,identificateur) +locon_list *connector; /*Structure classique des connecteurs chaines */ +long identificateur; + +/************************************************************* +Cette fonction ajoute un ptype dans le champ USER des rectangles +connecteurs qui pointe sur le connecteur logique lui +correspondant. Les parametres de cette fonction sont: +-Une locon_list des connecteurs possedant un ptype repere par + 'identificateur' pointant sur une liste chainee contenant les + adresses des rdsrec_list connecteur. +-Un identificateur defini dans 'lynxrcn.h' +*************************************************************/ + +{ + locon_list *ScanLoCon; + chain_list *ScanChain; /* liste chainee des rectangles connecteur */ + rdsrec_list *Rec_a; + ptype_list *ptl; + + for(ScanLoCon=connector;ScanLoCon;ScanLoCon=ScanLoCon->NEXT) + { + ptl = getptype( ScanLoCon->USER, identificateur ); + if( !ptl ) + continue; + for(ScanChain=((chain_list*)(ptl->DATA)); + ScanChain; + ScanChain=ScanChain->NEXT) + { + Rec_a=((rdsrec_list*)(ScanChain->DATA)); + ptl = getptype( Rec_a->USER, RDSLOCON ); + if( ptl ) + printf( "***LYNX RCN : ptype RDSLOCON found on rectangle.\n" ); + + Rec_a->USER=addptype(Rec_a->USER,RDSLOCON,ScanLoCon); + + } + } +} + + + +void GrgFatalError(code) +int code; +{ + fprintf(stderr,"\n\n********************************************\n"); + fprintf(stderr,"* *\n"); + fprintf(stderr,"* ERREUR DANS LES STRUCTURES DE DONNEE *\n"); + fprintf(stderr,"* *\n"); + fprintf(stderr,"********************************************\n\n"); + + fprintf(stderr,"Code d'erreur: %d\n",code); + exit(code); +} + + + +int IsRdsRealVia(r) +rdsrec_list *r; +{ + + if(IsRdsVia(r)) + { + if(GetLynxAttribute(r)!= C_X_N && GetLynxAttribute(r)!=C_X_P) + return(1); + } + return(0); +} + +void GrgGroupVia( lofig_list *fig) +{ + losig_list *ScanLoSig; + chain_list *Vias; + chain_list *scanchain; + rdsrec_list *ScanPhRec; + int EndEqui; + rdsrec_list *scanvia; + ptype_list *ptl; + + for(ScanLoSig=fig->LOSIG; ScanLoSig; ScanLoSig=ScanLoSig->NEXT) + { + Vias=NULL; + + for( scanchain = (chain_list*)(getptype(ScanLoSig->USER,RCN_FEQUI)->DATA) ; + scanchain ; + scanchain = scanchain->NEXT + ) + { + ScanPhRec = (rdsrec_list*)(scanchain->DATA); + EndEqui = 0 ; + + while(!EndEqui) + { + if( IsRdsRealVia(ScanPhRec) && + (ScanPhRec->FLAGS & RCN_TAGVIA_MASK) != RCN_TAGVIA_MASK + ) + { + Vias=addchain(Vias,ScanPhRec); + scanvia=ScanPhRec; + do + { + ptl = getptype( scanvia->USER, RCN_SIG_PTR ); + if( !ptl ) + { + scanvia = LYNX_LINK( scanvia ); + continue; + } + if( ptl->DATA == ScanLoSig ) + { + scanvia->FLAGS = scanvia->FLAGS | RCN_TAGVIA_MASK; + } + scanvia = LYNX_LINK( scanvia ); + } + while( scanvia != ScanPhRec ); + } + + if(IsLynxEndEqui(ScanPhRec)) + EndEqui=1; + else + ScanPhRec=LYNX_EQUI(ScanPhRec); + } + } + + ScanLoSig->USER = addptype( ScanLoSig->USER, GRGVIA, Vias ); + } +} + +void SigMark( lofig_list *fig) +{ + losig_list *ScanLoSig; + chain_list *scanchain; + rdsrec_list *ScanPhRec; + int EndEqui; + + for(ScanLoSig=fig->LOSIG; ScanLoSig; ScanLoSig=ScanLoSig->NEXT) + { + for( scanchain = (chain_list*)(getptype(ScanLoSig->USER,RCN_FEQUI)->DATA) ; + scanchain ; + scanchain = scanchain->NEXT + ) + { + ScanPhRec = (rdsrec_list*)(scanchain->DATA); + EndEqui = 0 ; + + while(!EndEqui) + { + ScanPhRec->USER = addptype( ScanPhRec->USER, RCN_SIG_PTR, ScanLoSig ); + if(IsLynxEndEqui(ScanPhRec)) + EndEqui=1; + else + ScanPhRec=LYNX_EQUI(ScanPhRec); + } + } + } +} diff --git a/alliance/src/lynx/src/addlynxrcn.h b/alliance/src/lynx/src/addlynxrcn.h new file mode 100644 index 00000000..b6984519 --- /dev/null +++ b/alliance/src/lynx/src/addlynxrcn.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + + +/************************************************************* +* HEADERS * +* * +* Changed by: Greg * +* Date: 05/07/95 * +* New file: - * +* Comments: * +* Fonctions permettant d'ajouter un nouveau reseau dans * +* la figure logique existante. * +* * +* * +*************************************************************/ + +void GrgFatalError __P((int)); +int IsRdsRealVia __P((rdsrec_list*)); +void generate_RCN __P((lofig_list*)); + +/************************************************************ +Codes de sortie en cas d'erreur: +Le nom de fichier entre parenthese indique l'origine +probable de l'erreur. + 10: Il existe deja un reseau RC dans la figure. + 22: Un signal logique n'est relie a aucune equipotentielle + physique (netlist.c: LynxBuildLogicalSignal() ); + 23: Un connecteur physique n'est pas relie a un connecteur + logique (netlist.c: LynxBuildLogicalSignal()); + 24: Un connecteur physique n'est pas relie a un connecteur + logique (netlist.c: LynxBuildLogicalInstance()); + 25: Un connecteur physique n'est pas relie a un connecteur + logique (netlist.c: LynxBuildLogicalTransistor()); + 26: Un connecteur logique n'est pas relie a un connecteur + physique (addlynx.c); + 28: Une structure GrgPhVia possede un de ces trois champs + NULL (addlynx.c). + 29: Un rectangle n'appartient a aucune des deux structures + GrgGroup1 ou GrgGroup2 alors qu'il DOIT l'etre + 30: Type d'intersection entre deux rectangles non prevu + (Intersect). + +************************************************************/ + +#define min(a,b) ((a>b)?b:a) +#define max(a,b) ((a>b)?a:b) + +#define RCN_TAGVIA_MASK 0x80000000 diff --git a/alliance/src/lynx/src/box.c b/alliance/src/lynx/src/box.c new file mode 100644 index 00000000..1eddd36b --- /dev/null +++ b/alliance/src/lynx/src/box.c @@ -0,0 +1,271 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : LYNX | +| | +| File : box.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 01.07.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "mlo.h" +# include "mph.h" +# include "rds.h" +# include "rwi.h" +# include "rut.h" +# include "rpr.h" +# include "rfm.h" + +# include "mbkrds.h" +# include "box.h" +# include "error.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static int LYNX_SPLIT_POINT_INDEX[ 4 ][ 4 ] = + { + { 0, 0, 1, 3 }, + { 0, 0, 3, 1 }, + { 2, 0, 3, 3 }, + { 0, 2, 3, 3 } + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| LynxAddBox | +| | +\------------------------------------------------------------*/ + +lynxbox_list *LynxAddBox( X1, Y1, X2, Y2 ) + + long X1; + long Y1; + long X2; + long Y2; +{ + lynxbox_list *Box; + + Box = (lynxbox_list *)rdsallocheap( sizeof( lynxbox_list ) ); + + Box->X1 = X1; + Box->Y1 = Y1; + Box->X2 = X2; + Box->Y2 = Y2; + + return( Box ); +} + +/*------------------------------------------------------------\ +| | +| LynxDelAllBox | +| | +\------------------------------------------------------------*/ + +void LynxDelAllBox( Box ) + + lynxbox_list *Box; +{ + lynxbox_list *ScanBox; + + ScanBox = Box; + + while ( ScanBox != (lynxbox_list *)0 ) + { + Box = ScanBox->NEXT; + rdsfreeheap( ScanBox, sizeof( lynxbox_list ) ); + ScanBox = Box; + } +} + +/*------------------------------------------------------------\ +| | +| LynxViewBox | +| | +\------------------------------------------------------------*/ + +# ifdef LYNX_DEBUG + +void LynxViewBox( Box ) + + lynxbox_list *Box; +{ + lynxbox_list *ScanBox; + + fprintf( stdout, "-->Box:\n" ); + + for ( ScanBox = Box; + ScanBox != (lynxbox_list *)0; + ScanBox = ScanBox->NEXT ) + { + fprintf( stdout, "X1:%d, Y1:%d, X2:%d, Y2:%d\n", + ScanBox->X1 * SCALE_X / RDS_LAMBDA, + ScanBox->Y1 * SCALE_X / RDS_LAMBDA, + ScanBox->X2 * SCALE_X / RDS_LAMBDA, + ScanBox->Y2 * SCALE_X / RDS_LAMBDA ); + } + + fprintf( stdout, "<--Box\n" ); +} + +# endif + +/*------------------------------------------------------------\ +| | +| LynxIntersectBox | +| | +\------------------------------------------------------------*/ + +lynxbox_list *LynxIntersectBox( Box1, Box2 ) + + lynxbox_list *Box1; + lynxbox_list *Box2; +{ + long X1; + long Y1; + long X2; + long Y2; + + if ( ( Box1->X1 < Box2->X2 ) && + ( Box1->Y1 < Box2->Y2 ) && + ( Box1->X2 > Box2->X1 ) && + ( Box1->Y2 > Box2->Y1 ) ) + { + if ( Box1->X1 > Box2->X1 ) X1 = Box1->X1; + else X1 = Box2->X1; + + if ( Box1->X2 < Box2->X2 ) X2 = Box1->X2; + else X2 = Box2->X2; + + if ( Box1->Y1 > Box2->Y1 ) Y1 = Box1->Y1; + else Y1 = Box2->Y1; + + if ( Box1->Y2 < Box2->Y2 ) Y2 = Box1->Y2; + else Y2 = Box2->Y2; + + return( LynxAddBox( X1, Y1, X2, Y2 ) ); + } + + return( (lynxbox_list *)0 ); +} + +/*------------------------------------------------------------\ +| | +| LynxSplitBox | +| | +\------------------------------------------------------------*/ + +lynxbox_list *LynxSplitBox( Box1, Box2 ) + + lynxbox_list *Box1; + lynxbox_list *Box2; +{ + lynxbox_list *HeadBox; + lynxbox_list *NewBox; + long X1H; + long Y1H; + long X2H; + long Y2H; + long PointX[ 4 ]; + long PointY[ 4 ]; + int Index; + + HeadBox = (lynxbox_list *)0; + + if ( ( Box1->X1 < Box2->X2 ) && + ( Box1->Y1 < Box2->Y2 ) && + ( Box1->X2 > Box2->X1 ) && + ( Box1->Y2 > Box2->Y1 ) ) + { + PointX[ 1 ] = Box1->X1; + PointY[ 1 ] = Box1->Y1; + PointX[ 2 ] = Box1->X2; + PointY[ 2 ] = Box1->Y2; + + PointX[ 0 ] = Box2->X1; + PointY[ 0 ] = Box2->Y1; + PointX[ 3 ] = Box2->X2; + PointY[ 3 ] = Box2->Y2; + + for ( Index = 0; Index < 4; Index++ ) + { + X1H = PointX[ LYNX_SPLIT_POINT_INDEX[ Index ][ 0 ] ]; + Y1H = PointY[ LYNX_SPLIT_POINT_INDEX[ Index ][ 1 ] ]; + X2H = PointX[ LYNX_SPLIT_POINT_INDEX[ Index ][ 2 ] ]; + Y2H = PointY[ LYNX_SPLIT_POINT_INDEX[ Index ][ 3 ] ]; + + if ( ( X1H < X2H ) && + ( Y1H < Y2H ) ) + { + if ( ( X1H >= Box2->X1 ) && + ( Y1H >= Box2->Y1 ) && + ( X2H <= Box2->X2 ) && + ( Y2H <= Box2->Y2 ) ) + { + NewBox = LynxAddBox( X1H, Y1H, X2H, Y2H ); + + NewBox->NEXT = HeadBox; + HeadBox = NewBox; + } + } + } + } + + return( HeadBox ); +} diff --git a/alliance/src/lynx/src/box.h b/alliance/src/lynx/src/box.h new file mode 100644 index 00000000..0e7b7408 --- /dev/null +++ b/alliance/src/lynx/src/box.h @@ -0,0 +1,90 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : LYNX | +| | +| File : box.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.07.95 | +| | +\------------------------------------------------------------*/ + +# ifndef LYNX_BOX_H +# define LYNX_BOX_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macros | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Lynx Interval List | +| | +\------------------------------------------------------------*/ + + typedef struct lynxbox_list + { + struct lynxbox_list *NEXT; + long X1; + long Y1; + long X2; + long Y2; + + } lynxbox_list; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern lynxbox_list *LynxAddBox(); + extern lynxbox_list *LynxIntersectBox(); + extern lynxbox_list *LynxSplitBox(); + extern void LynxDelAllBox(); + +# endif diff --git a/alliance/src/lynx/src/buildrcn.c b/alliance/src/lynx/src/buildrcn.c new file mode 100644 index 00000000..af7298f6 --- /dev/null +++ b/alliance/src/lynx/src/buildrcn.c @@ -0,0 +1,1101 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/* Construction du reseau RC correspondant aux rectangles de + la figure */ + + +# include "mut.h" +# include "rds.h" +# include "mlo.h" +# include "rcn.h" +# include "mph.h" +# include "rpr.h" +# include "Windows95.h" +# include "znc.h" +# include "buildrcn.h" +# include "lynxrcn.h" +# include "extract.h" +# include "mbkrds.h" +# include "inter.h" +# include "via.h" + +/* A mettre en commentaire pour ne pas avoir de message de debuggage */ +/* +# define BUILDRCNDEBUG +*/ + +/* +#define BUILDRCNCTL +*/ + +int RectangleValide __P((rdsrec_list*)); +int RectangleDiff __P((rdsrec_list*)); +void traiteinterparra __P((rdsrec_list*, chain_list*, WinZnc*)); +void traiteinterperpen __P((rdsrec_list*, chain_list*, WinZnc*)); +void addzncvia __P((chain_list*,WinZnc*,GrgWindow*,losig_list*)); +void znc2rcn __P((WinZnc*, losig_list*)); +chain_list* sortchain __P((chain_list*, char)); +void sortloconnode __P((chain_list*, WinZnc*)); +void sortbullelocon __P((locon_list*, chain_list*)); +int isviacontact( int ); +void affrec( rdsrec_list* ); + +#define min(a,b) ((a>b)?b:a) +#define max(a,b) ((a>b)?a:b) + +/******************************************************************************/ + + + +void buildrcn(fig,scansignal) +lofig_list *fig; +losig_list *scansignal; +{ + GrgWindow *WindowsInfo; + rdsrec_list *scanrec,*irec; + int EndEqui; + WinZnc *zncwininfo; + chain_list *inter_list,*parra,*perpen,*scanchain; + ptype_list *ptlvia; + chain_list *connect; + long layer; + chain_list *scanchrec; + +#ifdef BUILDRCNCTL +fprintf(stderr,"Traitement du signal %ld [%s]\n", + scansignal->INDEX, + getsigname(scansignal)?getsigname(scansignal):"no name"); +#endif + +#ifdef BUILDRCNDEBUG +fprintf(stderr,"Traitement du signal %ld [%s]\n", + scansignal->INDEX, + getsigname(scansignal)?getsigname(scansignal):"no name"); +#endif + +#ifdef BUILDRCNDEBUG +fprintf(stderr,"Construction des fenetrages\n"); +#endif +#ifdef BUILDRCNCTL +fprintf(stderr,"Construction du fenetrage... "); +#endif + + WindowsInfo=GrgCreatWindows(scansignal); + + zncwininfo=creatwinznc( WindowsInfo->mx, + WindowsInfo->my, + WindowsInfo->Mx, + WindowsInfo->My, + WindowsInfo->Px, + WindowsInfo->Py, + WindowsInfo->nx, + WindowsInfo->ny ); + + connect=NULL; + for( scanchrec = (chain_list*)(getptype(scansignal->USER,RCN_FEQUI)->DATA) ; + scanchrec ; + scanchrec = scanchrec->NEXT + ) + { + scanrec=(rdsrec_list*)(scanchrec->DATA); + + EndEqui=0; + + + #ifdef BUILDRCNCTL + fprintf(stderr,"\rTraitement de l'equipotentielle... "); + #endif + + while(!EndEqui) + { + if(RectangleValide(scanrec)) + { + #ifdef BUILDRCNDEBUG + fprintf(stderr,"\n\n******** Rectangle traité :\n"); + dbg_affrec(scanrec); + #endif + inter_list=GrgGetInterWindows(scanrec,WindowsInfo); + parra=NULL; + perpen=NULL; + + for(scanchain=inter_list;scanchain;scanchain=scanchain->NEXT) + { + irec=(rdsrec_list*)(scanchain->DATA); + + if(RectangleValide(irec)) + { + if(Intersect(scanrec,irec)==PERPEN) + perpen=addchain(perpen,scanchain->DATA); + else + parra=addchain(parra,scanchain->DATA); + } + } + + /* Traite les extremités du rectangle */ + + if(GETDIRECTION(scanrec)==HORIZ_DIR) /* horizontal */ + { + addznc(scanrec->X,scanrec->Y,scanrec->X,scanrec->Y+scanrec->DY, + GetRdsLayer(scanrec),zncwininfo); + addznc(scanrec->X+scanrec->DX,scanrec->Y, + scanrec->X+scanrec->DX,scanrec->Y+scanrec->DY, + GetRdsLayer(scanrec),zncwininfo); + } + else + { + addznc(scanrec->X,scanrec->Y,scanrec->X+scanrec->DX,scanrec->Y, + GetRdsLayer(scanrec),zncwininfo); + addznc(scanrec->X,scanrec->Y+scanrec->DY, + scanrec->X+scanrec->DX,scanrec->Y+scanrec->DY, + GetRdsLayer(scanrec),zncwininfo); + } + + /* Traite les rectangles en intersection perpendiculaire */ + + traiteinterperpen(scanrec,perpen,zncwininfo); + + /* Traite les rectangles en intersection parralelles */ + + traiteinterparra(scanrec,parra,zncwininfo); + + + if(perpen) freechain(perpen); + if(parra) freechain(parra); + if(inter_list) freechain(inter_list); + } + /* On ajoute les CxP et les CxN qui servent dans les transistors + coud\'es. Ils sont fait en GATE, que l'on traite pour l'extraction + comme du POLY. Ces morceaux seront toujours isoles a ce stade, + on a juste qu'a ajouter une ZNC le representant */ + + if( IsRdsVia(scanrec) && + ( GetLynxAttribute(scanrec) == C_X_N || + GetLynxAttribute(scanrec) == C_X_P ) + ) + addznc(scanrec->X,scanrec->Y, + scanrec->X+scanrec->DX,scanrec->Y+scanrec->DY, + RDS_POLY,zncwininfo); + + if(getptype(scanrec->USER,RDSLOCON)) + { + connect=addchain(connect,scanrec); + } + else /* plus clean : on traite les connecteurs plus loin */ + if(RectangleDiff(scanrec)) + { + addznc(scanrec->X,scanrec->Y, + scanrec->X+scanrec->DX,scanrec->Y+scanrec->DY, + GetRdsLayer(scanrec),zncwininfo); + } + + if(IsLynxEndEqui(scanrec)) + EndEqui=1; + else + scanrec=LYNX_EQUI(scanrec); + } + } + + /* Ajoute les vias dans les znc */ + if( (ptlvia=getptype(scansignal->USER,GRGVIA)) ) + addzncvia((chain_list*)(ptlvia->DATA),zncwininfo,WindowsInfo,scansignal); + + +#ifdef BUILDRCNDEBUG +fprintf(stderr,"ZNC apres le traitement des vias\n"); +dbg_affznc(zncwininfo); +#endif + + /* Traitement des connecteurs */ + + for(scanchain=connect;scanchain;scanchain=scanchain->NEXT) + { + + scanrec=(rdsrec_list*)(scanchain->DATA); + layer=GetRdsLayer(scanrec); + + if(layer==RDS_GATE) + { + addznc(scanrec->X,scanrec->Y,scanrec->X+scanrec->DX, + scanrec->Y+scanrec->DY,RDS_POLY,zncwininfo); + } + else + { + addznc(scanrec->X,scanrec->Y,scanrec->X+scanrec->DX, + scanrec->Y+scanrec->DY,layer,zncwininfo); + } + } + +#ifdef BUILDRCNDEBUG +fprintf(stderr,"ZNC apres le traitement des connecteurs\n"); +dbg_affznc(zncwininfo); +#endif + + +#ifdef BUILDRCNCTL +fprintf(stderr,"\rCreation des lonodes... "); +#endif + + makezncnode(zncwininfo,scansignal); + +#ifdef BUILDRCNCTL +fprintf(stderr,"\rConstruction de la table... "); +#endif + + buildtable(scansignal); + +#ifdef BUILDRCNCTL +fprintf(stderr,"\rConstruction des Wires... "); +#endif + + znc2rcn(zncwininfo,scansignal); + +#ifdef BUILDRCNCTL +fprintf(stderr,"\rAjout des lonodes dans les locons... "); +#endif + + linklonodelocon( connect, scansignal, zncwininfo, WindowsInfo ); + +#ifdef BUILDRCNCTL +fprintf(stderr,"\rLiberation de la table... "); +#endif + + + freetable(scansignal); + + +#ifdef BUILDRCNCTL +fprintf(stderr,"\rTrie des connecteurs d'instance... "); +#endif + + sortloconnode(connect,zncwininfo); + + if(connect) + freechain(connect); + + + +#ifdef BUILDRCNDEBUG +fprintf(stderr,"Liberation du fenetrage\n"); +#endif + +#ifdef BUILDRCNCTL +fprintf(stderr,"\rLiberation des fenetrages... "); +#endif + + + GrgClearWindows(WindowsInfo,scansignal); + freewinznc(zncwininfo); + +#ifdef BUILDRCNCTL +fprintf(stderr,"\rOk. \n"); +#endif + + + +#ifdef BUILDRCNDEBUG +fprintf(stderr,"fin du traitement des rectangles du signal %ld\n\n\n", + scansignal->INDEX); +#endif +} + +int IsRcn( R ) +rdsrec_list *R; +{ + /* Layers pour lesquels les interconnexions sont extraites */ + if( GetRdsLayer(R)==RDS_ALU1 + || GetRdsLayer(R)==RDS_ALU2 + || GetRdsLayer(R)==RDS_ALU3 + || GetRdsLayer(R)==RDS_ALU4 + || GetRdsLayer(R)==RDS_ALU5 + || GetRdsLayer(R)==RDS_ALU6 + || GetRdsLayer(R)==RDS_POLY ) + return( 1 ); + return(0); +} + +int isviacontact( int layer ) +{ + /* On ne peut prendre un ieme element de la table des vias car les elements + * C_X_N et C_X_P posent des problčmes */ + + if( layer == RDS_CONT || + layer == RDS_VIA1 || + layer == RDS_VIA2 || + layer == RDS_VIA3 || + layer == RDS_VIA4 || + layer == RDS_VIA5 + ) + return(1); + return(0); +} + +int RectangleValide(R) +rdsrec_list *R; +{ + if( !IsRdsVia(R) + && !IsRdsConnector(R) + && IsRcn( R ) + ) + { + return(1); + } + return(0); +} + +int RectangleDiff(R) +rdsrec_list *R; +{ + /* Layer dont on extrait pas les resistances mais qu'on considere pour + * recuperer les locon correspondants */ + if( GetRdsLayer(R)==RDS_PDIF || + GetRdsLayer(R)==RDS_NDIF ) + return(1); + return(0); +} + +void traiteinterperpen(scanrec,perpen,zncwininfo) +rdsrec_list *scanrec; +chain_list *perpen; +WinZnc *zncwininfo; +{ + chain_list *scanchain; + rdsrec_list *irec; + + for(scanchain=perpen;scanchain;scanchain=scanchain->NEXT) + { + irec=(rdsrec_list*)(scanchain->DATA); + + if(RectangleValide(irec)) + { +#ifdef BUILDRCNDEBUG +fprintf(stderr,"Intersection perpendiculaire : \n"); +dbg_affrec(irec); +#endif + + if(GETDIRECTION(scanrec)==HORIZ_DIR) /* horizontal */ + addznc(irec->X,scanrec->Y,irec->X+irec->DX,scanrec->Y+scanrec->DY, + GetRdsLayer(scanrec),zncwininfo); + else /* vertical */ + addznc(scanrec->X,irec->Y,scanrec->X+scanrec->DX,irec->Y+irec->DY, + GetRdsLayer(scanrec),zncwininfo); + } + } +} + +void traiteinterparra(scanrec,parra,zncwininfo) +rdsrec_list *scanrec; +chain_list *parra; +WinZnc *zncwininfo; +{ + chain_list *scanchain,*scanchain2; + rdsrec_list *irec,*irec2; + long mx,my,Mx,My; + + for(scanchain=parra;scanchain;scanchain=scanchain->NEXT) + { + irec=(rdsrec_list*)(scanchain->DATA); + + if(GETDIRECTION(scanrec)==HORIZ_DIR) + { + if(irec->X>=scanrec->X) + { + my=min(irec->Y,scanrec->Y); + My=max(irec->Y+irec->DY,scanrec->Y+scanrec->DY); + for(scanchain2=parra;scanchain2;scanchain2=scanchain2->NEXT) + { + irec2=(rdsrec_list*)(scanchain2->DATA); + if(irec2->X<=irec->X && irec2->X+irec2->DX>=irec->X) + { + my=min(my,irec2->Y); + My=max(My,irec2->Y+irec2->DY); + } + } + addznc(irec->X,my,irec->X,My,GetRdsLayer(scanrec),zncwininfo); + } + + if(irec->X+irec->DX<=scanrec->X+scanrec->DX) + { + my=min(irec->Y,scanrec->Y); + My=max(irec->Y+irec->DY,scanrec->Y+scanrec->DY); + for(scanchain2=parra;scanchain2;scanchain2=scanchain2->NEXT) + { + irec2=(rdsrec_list*)(scanchain2->DATA); + if( irec2->X<=irec->X+irec->DX && + irec2->X+irec2->DX>=irec->X+irec->DX ) + { + my=min(my,irec2->Y); + My=max(My,irec2->Y+irec2->DY); + } + } + addznc(irec->X+irec->DX,my,irec->X+irec->DX,My, + GetRdsLayer(scanrec),zncwininfo); + } + } + else + { + if(irec->Y>=scanrec->Y) + { + mx=min(irec->X,scanrec->X); + Mx=max(irec->X+irec->DX,scanrec->X+scanrec->DX); + for(scanchain2=parra;scanchain2;scanchain2=scanchain2->NEXT) + { + irec2=(rdsrec_list*)(scanchain2->DATA); + if(irec2->Y<=irec->Y && irec2->Y+irec2->DY>=irec->Y) + { + mx=min(mx,irec2->X); + Mx=max(Mx,irec2->X+irec2->DX); + } + } + addznc(mx,irec->Y,Mx,irec->Y,GetRdsLayer(scanrec),zncwininfo); + } + + if(irec->Y+irec->DY<=scanrec->Y+scanrec->DY) + { + mx=min(irec->X,scanrec->X); + Mx=max(irec->X+irec->DX,scanrec->X+scanrec->DX); + for(scanchain2=parra;scanchain2;scanchain2=scanchain2->NEXT) + { + irec2=(rdsrec_list*)(scanchain2->DATA); + if( irec2->Y<=irec->Y+irec->DY && + irec2->Y+irec2->DY>=irec->Y+irec->DY ) + { + mx=min(mx,irec2->X); + Mx=max(Mx,irec2->X+irec2->DX); + } + } + addznc(mx,irec->Y+irec->DY,Mx,irec->Y+irec->DY, + GetRdsLayer(scanrec),zncwininfo); + } + } + } +} + +void addzncvia(headvia,winznc,winrec, ptsig ) +chain_list *headvia; +WinZnc *winznc; +GrgWindow *winrec; +losig_list *ptsig; +{ + chain_list *intervia; + chain_list *scaninter; + long mx=0,my=0,Mx=0,My=0,layer=0; + rdsrec_list *rec; + rdsrec_list *scanrec; + chain_list *scanvia; + ptype_list *ptl; + +#ifdef BUILDRCNDEBUG +fprintf(stderr,"Traitement des vias\n"); +#endif + + for(scanvia=headvia;scanvia;scanvia=scanvia->NEXT) + { + intervia=NULL; + rec = (rdsrec_list*)(scanvia->DATA); + do + { + ptl = getptype( rec->USER, RCN_SIG_PTR ); + if( !ptl ) + { + rec = LYNX_LINK( rec ); + continue; + } + + if( ptl->DATA == ptsig ) + { + layer = GetRdsLayer( rec ); + if( !isviacontact( layer ) && + ( IsRcn( rec ) || RectangleDiff( rec ) ) + ) + { + + mx = rec->X; + my = rec->Y; + Mx = rec->X+rec->DX; + My = rec->Y+rec->DY; + intervia = GrgGetInterWindows(rec,winrec); + + if(intervia) + { + for(scaninter=intervia;scaninter;scaninter=scaninter->NEXT) + { + scanrec=(rdsrec_list*)(scaninter->DATA); + /* + if(IsRcn(scanrec) || RectangleDiff( rec ) ) + */ + { + if(GETDIRECTION(scanrec)==HORIZ_DIR) + { + my=min(my,scanrec->Y); + My=max(My,scanrec->Y+scanrec->DY); + } + else + { + mx=min(mx,scanrec->X); + Mx=max(Mx,scanrec->X+scanrec->DX); + } + } + } + addznc(mx,my,Mx,My,layer,winznc); + freechain(intervia); + } + else + addznc(mx,my,Mx,My,layer,winznc); + } + } + rec = LYNX_LINK( rec ); + } + while( rec != scanvia->DATA ); + } +} + +void znc2rcn(win,sig) +WinZnc *win; +losig_list *sig; +{ + rdsrec_list *scanrec,*r; + short EndEqui; + znc elem,*noeud1,*noeud2=NULL; + chain_list *interznc,*scaninter; + chain_list *scanchain,*scanchain1,*scanchain2; + long n1=0,n2=0; + long N1,N2; + long rcntype; + float rcnresi=0.0,rcncapa; + long x,y,dx,dy,mx1,my1,mx2,my2; + ptype_list *ptl; + lowire_list *w; + chain_list *scanchrec; + chain_list *scanvia; + int layer; + rdsrec_list *rec; + ptype_list *ptl2; + +#ifdef BUILDRCNDEBUG + fprintf(stderr,"\n\nConstruction des wires \n\n"); +#endif + +/* On place dans les intersections les rectangles qui les composent */ + + for( scanchrec = (chain_list*)(getptype(sig->USER,RCN_FEQUI)->DATA) ; + scanchrec ; + scanchrec = scanchrec->NEXT + ) + { + scanrec=(rdsrec_list*)(scanchrec->DATA); + + EndEqui=0; + while(!EndEqui) + { + if(RectangleValide(scanrec)) + { + elem.x1=scanrec->X; + elem.y1=scanrec->Y; + elem.x2=scanrec->X+scanrec->DX; + elem.y2=scanrec->Y+scanrec->DY; + elem.layer=GetRdsLayer(scanrec); + elem.NEXT=NULL; + + interznc=getwininterznc(&elem,win,1); + for(scaninter=interznc;scaninter;scaninter=scaninter->NEXT) + { + noeud1=(znc*)(scaninter->DATA); + for(scanchain=noeud1->rec;scanchain;scanchain=scanchain->NEXT) + if(scanchain->DATA==scanrec) + break; + if(!scanchain) + noeud1->rec=addchain(noeud1->rec,scanrec); + } + } + + if(IsLynxEndEqui(scanrec)) + EndEqui=1; + else + scanrec=LYNX_EQUI(scanrec); + } + } + + for( scanchrec = (chain_list*)(getptype(sig->USER,RCN_FEQUI)->DATA) ; + scanchrec ; + scanchrec = scanchrec->NEXT + ) + { + scanrec=(rdsrec_list*)(scanchrec->DATA); + + EndEqui=0; + + while(!EndEqui) + { + if(RectangleValide(scanrec)) + { + elem.x1=scanrec->X; + elem.y1=scanrec->Y; + elem.x2=scanrec->X+scanrec->DX; + elem.y2=scanrec->Y+scanrec->DY; + elem.layer=GetRdsLayer(scanrec); + elem.NEXT=NULL; + + interznc=getwininterznc(&elem,win,1); + + + if(interznc) + { + #ifdef BUILDRCNDEBUG + fprintf(stderr,"Traite le rectangle (%ld,%ld)-(%ld,%ld)\n", + scanrec->X,scanrec->Y,scanrec->X+scanrec->DX,scanrec->Y+scanrec->DY); + #endif + + if(GETDIRECTION(scanrec)==HORIZ_DIR) + interznc=sortchain(interznc,'X'); + else + interznc=sortchain(interznc,'Y'); + + n1=0l; + n2=0l; + + for(scaninter=interznc;scaninter;scaninter=scaninter->NEXT) + { + noeud1=(znc*)(scaninter->DATA); + n1=noeud1->node; + + if(n1 && n2 && getlowire(sig,n1,n2)==NULL) + { + /* Place les rectangles communs au noeud1 et au noeud2 dans une + chain_list */ + + mx1=scanrec->X; + mx2=mx1+scanrec->DX; + my1=scanrec->Y; + my2=my1+scanrec->DY; + for(scanchain1=noeud1->rec;scanchain1;scanchain1=scanchain1->NEXT) + { + for(scanchain2=noeud2->rec;scanchain2;scanchain2=scanchain2->NEXT) + if(scanchain1->DATA==scanchain2->DATA) + { + r=(rdsrec_list*)(scanchain1->DATA); + mx1=min(mx1,r->X); + mx2=max(mx2,r->X+r->DX); + my1=min(my1,r->Y); + my2=max(my2,r->Y+r->DY); + } + } + + if(GETDIRECTION(scanrec)==HORIZ_DIR) + { + x=(noeud2->x2-noeud2->x1)/2 + noeud2->x1; + dx=(noeud1->x2-noeud1->x1)/2 + noeud1->x1 - x; + y=scanrec->Y+ scanrec->DY/2; + dy=my2-my1; + rcnresi=dx/dy*GET_LYNX_RESISTOR_LAYER(GetRdsLayer(scanrec)); + rcncapa=2*dx*GET_LYNX_PERIMETER_CAPA_LAYER(GetRdsLayer(scanrec))+ + dx*dy*GET_LYNX_SURFACE_CAPA_LAYER(GetRdsLayer(scanrec)); + } + else + { + x=scanrec->X+scanrec->DX/2; + dx=mx2-mx1; + y=(noeud2->y2-noeud2->y1)/2 + noeud2->y1; + dy=(noeud1->y2-noeud1->y1)/2 + noeud1->y1 -y; + + rcnresi=dy/dx*GET_LYNX_RESISTOR_LAYER(GetRdsLayer(scanrec)); + rcncapa=2*dy*GET_LYNX_PERIMETER_CAPA_LAYER(GetRdsLayer(scanrec))+ + dx*dy*GET_LYNX_SURFACE_CAPA_LAYER(GetRdsLayer(scanrec)); + } + + rcntype=RCN_WIRE_UNKNOW; + + if( GetRdsLayer(scanrec)==RDS_ALU1 ) rcntype=RCN_WIRE_ALU1; + if( GetRdsLayer(scanrec)==RDS_ALU2 ) rcntype=RCN_WIRE_ALU2; + if( GetRdsLayer(scanrec)==RDS_POLY ) rcntype=RCN_WIRE_POLY; + + + #ifdef BUILDRCNDEBUG + fprintf(stderr,"Ajout d'un wire en (%ld,%ld) de dimensions (%ld,%ld)\n", + x,y,dx,dy); + #endif + + if(dx>dy) + { + if( noeud1->x1 < noeud2->x1 ) + { + N1=n1; + N2=n2; + } + else + { + N1=n2; + N2=n1; + } + } + else + { + if(noeud1->y1 < noeud2->y1) + { + N1=n1; + N2=n2; + } + else + { + N1=n2; + N2=n1; + } + } + addlowire( sig, rcntype, 0, rcnresi, rcncapa, x, y, dx, dy, N1, N2); + } + n2=n1; + noeud2=noeud1; + } + + freechain(interznc); + } + } + + if(IsLynxEndEqui(scanrec)) + EndEqui=1; + else + scanrec=LYNX_EQUI(scanrec); + } + } + + /* On s'occupe maintenant des vias */ + if( (ptl=getptype(sig->USER,GRGVIA)) ) + { + for(scanvia=(chain_list*)(ptl->DATA);scanvia;scanvia=scanvia->NEXT) + { + layer=-1; + rec = (rdsrec_list*)(scanvia->DATA); + n1 = 0; + n2 = 0; + do + { + ptl2 = getptype( rec->USER, RCN_SIG_PTR ); + if( !ptl2 ) + { + rec = LYNX_LINK( rec ); + continue; + } + if( ptl2->DATA == sig ) + { + layer = GetRdsLayer( rec ); + if( !isviacontact( layer ) && + ( IsRcn( rec ) || RectangleDiff( rec ) ) + ) + { + + elem.x1 = rec->X ; + elem.y1 = rec->Y ; + elem.x2 = rec->DX + elem.x1 ; + elem.y2 = rec->DY + elem.y1 ; + elem.layer = layer ; + scanchain1 = getwininterznc( &elem, win, 1 ) ; + if( n1 == 0 ) + n1=((znc*)(scanchain1->DATA))->node; + else + n2=((znc*)(scanchain1->DATA))->node; + freechain(scanchain1); + } + else + { + if( isviacontact( layer ) ) + rcnresi=GET_LYNX_RESISTOR_LAYER(layer); + } + } + rec = LYNX_LINK( rec ); + } + while( rec != scanvia->DATA ); + + if( n1>0 && n2>0 ) + { + if((w=getlowire(sig,n1,n2))==NULL) + { + addlowire(sig,RCN_WIRE_CONT_VIA,0,rcnresi,0.0, + (elem.x2-elem.x1)/2+elem.x1, + (elem.y2-elem.y1)/2+elem.y1,0,0,n1,n2); + } + else + { + addpararesiwire(w,rcnresi); + } + } + } + } +} + +chain_list* sortchain(entree,champ) +chain_list *entree; +char champ; +{ + chain_list *scanchain,*sortie,*last,*prevmax,*eff; + znc *maxi,*z; + + /* tri a bulle de la liste des znc */ + + /* On veut faire un tri par ordre croissant en utilisant la fonction + chain_list qui ajoute les elements a l'envers : on va donc faire + un tri par ordre decroissant */ + + if(!entree) + { + fprintf(stderr,"Trie de chaine (null). \n"); + exit(-1); + } + + if(entree->NEXT==NULL) + return(entree); + + sortie=NULL; + + while(entree) + { + /* il faut debuter avec qqchose */ + maxi=(znc*)entree->DATA; + + /* recherche de l'element le plus grand dans la liste */ + last=NULL; + prevmax=NULL; + + for(scanchain=entree;scanchain;scanchain=scanchain->NEXT) + { + z=(znc*)(scanchain->DATA); + + if( ( champ=='X' && z->x1 > maxi->x1 ) || + ( champ=='Y' && z->y1 > maxi->y1 ) ) + { + maxi = z; + prevmax=last; + } + last=scanchain; + } + + /* maitenant qu'on l'a trouve, on le met dans la chainlist de sortie */ + sortie=addchain(sortie,maxi); + + /* efface l'element de la liste chainee d'entree */ + if(prevmax) + { + eff=prevmax->NEXT; + prevmax->NEXT=prevmax->NEXT->NEXT; + } + else + { + eff=entree; + entree=entree->NEXT; + } + if(!eff) + { + fprintf(stderr,"eff=null\n"); + exit(-1); + } + eff->NEXT=NULL; + freechain(eff); + } + +#ifdef BUILDRCNDEBUG +{ + chain_list *scan; + for(scan=sortie;scan;scan=scan->NEXT) + fprintf(stderr,"znc : (%ld,%ld)-(%ld,%ld) [%ld] lonode :%ld\n", + ((znc*)(scan->DATA))->x1, + ((znc*)(scan->DATA))->y1, + ((znc*)(scan->DATA))->x2, + ((znc*)(scan->DATA))->y2, + ((znc*)(scan->DATA))->layer, + ((znc*)(scan->DATA))->node); +} +#endif + return(sortie); +} + +void sortloconnode(connect,winznc) +chain_list *connect; +WinZnc *winznc; +{ + + chain_list *scanchain; + rdsrec_list *rec; + ptype_list *ptl; + locon_list *logical_connector; + + struct ssort + { + struct ssort *NEXT; + locon_list *connector; + chain_list *conlofig; + } *sort,*scansort; + + + /* Recupere la liste des connecteurs de la figure */ + sort=NULL; + for(scanchain=connect;scanchain;scanchain=scanchain->NEXT) + { + rec=(rdsrec_list*)(scanchain->DATA); + if( (ptl=getptype(rec->USER,RDSLOCON)) ) + { + logical_connector=(locon_list*)(ptl->DATA); + if( !logical_connector ) + continue; /* cas des connecteurs superposes */ + + if(logical_connector->TYPE=='I' || + logical_connector->TYPE=='E' ) + { + + for(scansort=sort;scansort;scansort=scansort->NEXT) + { + if(scansort->connector == logical_connector) + break; + } + + if(scansort) + { + scansort->conlofig=addchain(scansort->conlofig,rec); + } + else + { + scansort=mbkalloc(sizeof(struct ssort)); + scansort->NEXT=sort; + scansort->connector=logical_connector; + scansort->conlofig=addchain(NULL,rec); + + sort=scansort; + } + } + } + } + + for(scansort=sort;scansort;scansort=scansort->NEXT) + { + if(! scansort->conlofig) + { + fprintf(stderr,"Connecteur-> %s\n",scansort->connector->NAME); + exit(1); + } + sortbullelocon(scansort->connector,scansort->conlofig); + } +} + +void sortbullelocon(logical_connector,conlofig) +locon_list *logical_connector; +chain_list *conlofig; +{ + chain_list *scanchain,*trie; + rdsrec_list *rec,*maxi; + chain_list *prevmax,*last; + chain_list *eff; + ptype_list *ptl; + num_list *node; + + /* Dans la chain_list conlofig on a la liste des rectangles connecteurs + de la figure */ + + /* on effectue un trie a bulle sur le champ Y */ + + if(conlofig->NEXT!=NULL) + { + trie=NULL; + while(conlofig) + { + maxi=(rdsrec_list*)conlofig->DATA; + last=NULL; + prevmax=NULL; + + for(scanchain=conlofig;scanchain;scanchain=scanchain->NEXT) + { + rec=(rdsrec_list*)(scanchain->DATA); + if( rec->Y < maxi->Y ) + { + maxi=rec; + prevmax=last; + } + else + { + if(rec->Y == maxi->Y) + if(rec->X < maxi->X) + { + maxi=rec; + prevmax=last; + } + } + + last=scanchain; + } + + trie=addchain(trie,maxi); + + if(prevmax) + { + eff=prevmax->NEXT; + prevmax->NEXT=prevmax->NEXT->NEXT; + } + else + { + eff=conlofig; + conlofig=conlofig->NEXT; + } + eff->NEXT=NULL; + freechain(eff); + } + } + else + trie=conlofig; + + node=NULL; + for(scanchain=trie;scanchain;scanchain=scanchain->NEXT) + { + rec=((rdsrec_list*)(scanchain->DATA)); + ptl=getptype(rec->USER,TMPLONODE); + if(!ptl) + { + fprintf(stderr,"Un connecteur (%s) n'est relie a aucun lonode. %c\n", + logical_connector->NAME, + logical_connector->TYPE); + exit(1); + } + node=addnum(node,((long)(ptl->DATA))); + } + + /* on a la liste des connecteurs triee dans la chain_list trie */ + + freenum(logical_connector->PNODE); + logical_connector->PNODE = node; + freechain(trie); +} + +void affrec( rdsrec_list *r) +{ + printf( "%s (%ld,%ld)-(%ld,%ld) Cont=%d Rcn=%d Diff=%d Val=%d\n", + RDS_LAYER_NAME[GetRdsLayer(r)], + r->X, + r->Y, + r->X+r->DX, + r->Y+r->DY, + isviacontact( GetRdsLayer(r) ), + IsRcn(r), + RectangleDiff(r), + RectangleValide(r) + ); +} diff --git a/alliance/src/lynx/src/buildrcn.h b/alliance/src/lynx/src/buildrcn.h new file mode 100644 index 00000000..c31c9867 --- /dev/null +++ b/alliance/src/lynx/src/buildrcn.h @@ -0,0 +1,28 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +void buildrcn __P((lofig_list*, losig_list*)); diff --git a/alliance/src/lynx/src/bulk.c b/alliance/src/lynx/src/bulk.c new file mode 100644 index 00000000..ee4f0cd5 --- /dev/null +++ b/alliance/src/lynx/src/bulk.c @@ -0,0 +1,113 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : LYNX | +| | +| File : bulk.c | +| | +| Author : Picault Stephane *4p* | +| | +| Date : 15.07.98 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "mlo.h" +# include "mph.h" +# include "rds.h" +# include "rwi.h" +# include "rut.h" +# include "rpr.h" +# include "rfm.h" + +# include "mbkrds.h" +# include "box.h" +# include "bulk.h" +# include "error.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| LynxAddLayerImplicit | +| | +\------------------------------------------------------------*/ + +void LynxAddLayerImplicit( Figure, Window ) + + rdsfig_list *Figure; + rdswindow *Window; +{ + long Layer; + rdsrec_list *Rec; + + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + if ( GET_LYNX_BULK_IMPLICIT ( Layer ) != RDS_LYNX_BULK_IMPLICIT_EMPTY ) + { + Rec = addrdsfigrec( Figure, + "implicit", + Layer, + Window->XMIN, + Window->YMIN, + Window->XMAX, + Window->YMAX ); + + SetLynxTreat( Rec ); + LYNX_LINK( Rec ) = Rec; + addrdsrecwindow( Rec, Window ); + } + } +} diff --git a/alliance/src/lynx/src/bulk.h b/alliance/src/lynx/src/bulk.h new file mode 100644 index 00000000..5d95dbb1 --- /dev/null +++ b/alliance/src/lynx/src/bulk.h @@ -0,0 +1,71 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : LYNX | +| | +| File : bulk.h | +| | +| Authors : Picault Stephane *4p* | +| | +| Date : 01.07.98 | +| | +\------------------------------------------------------------*/ + +# ifndef LYNX_BULK_H +# define LYNX_BULK_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macros | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void LynxAddLayerImplicit(); + +# endif diff --git a/alliance/src/lynx/src/chklynxrcn.c b/alliance/src/lynx/src/chklynxrcn.c new file mode 100644 index 00000000..b261ee1f --- /dev/null +++ b/alliance/src/lynx/src/chklynxrcn.c @@ -0,0 +1,325 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/************************************************************* +* SOURCES * +* * +* Changed by: Greg * +* Date: 05/07/95 * +* New file: - * +* Comments: * +* Fonction permettant la verification et le debuggage * +* des structures. * +* * +* * +*************************************************************/ + +# include "rds.h" +# include "mut.h" +# include "mlo.h" +# include "rcn.h" +# include "mph.h" +# include "rpr.h" +# include "lynxrcn.h" +# include "chklynxrcn.h" +# include "addlynxrcn.h" +# include "mbkrds.h" +# include "extract.h" +# include "via.h" +# include +# include +# include + +void GrgChkInConFEqui(fig) +lofig_list *fig; + +/************************************************************* +* Cette procedure verifie la presence d'une equipotentielle * +* physique pour chaque signal logique et la correspondance * +* connecteur logique vers connecteur physique. * +* * +*************************************************************/ +{ + losig_list *ScanLoSig; /* Pour parcourir la liste des equipotentielles */ + rdsrec_list *ScanPhRec; /* Pour la meme chose */ + char EndEqui; /* Indique la fin du traitement de l'equi */ + loins_list *ScanLoIns; + lotrs_list *ScanLoTrs; + locon_list *ScanLoCon; + + for(ScanLoSig=fig->LOSIG; ScanLoSig; ScanLoSig=ScanLoSig->NEXT) + { + EndEqui=0; + ScanPhRec=(rdsrec_list*)(getptype(ScanLoSig->USER,RCN_FEQUI)->DATA); + while(!EndEqui) + { + if(ScanPhRec==NULL) + GrgFatalError(22); + ScanPhRec->USER=NULL; + if(IsLynxEndEqui(ScanPhRec)) + EndEqui=1; + else + ScanPhRec=LYNX_EQUI(ScanPhRec); + } + } + for(ScanLoCon=fig->LOCON; ScanLoCon; ScanLoCon=ScanLoCon->NEXT) + { + if(!getptype(ScanLoCon->USER,RDSLOCON1)) + GrgFatalError(23); + } + for(ScanLoIns=fig->LOINS; ScanLoIns; ScanLoIns=ScanLoIns->NEXT) + { + for(ScanLoCon=ScanLoIns->LOCON; ScanLoCon; ScanLoCon=ScanLoCon->NEXT) + { + if(!getptype(ScanLoCon->USER,RDSLOCON2)) + GrgFatalError(24); + } + } + for(ScanLoTrs=fig->LOTRS; ScanLoTrs; ScanLoTrs=ScanLoTrs->NEXT) + { + if(!getptype(ScanLoTrs->DRAIN->USER,RDSLOCON3)) + GrgFatalError(25); + if(!getptype(ScanLoTrs->GRID->USER,RDSLOCON3)) + GrgFatalError(25); + if(!getptype(ScanLoTrs->SOURCE->USER,RDSLOCON3)) + GrgFatalError(25); + } +} + + + + + +void GrgChkOutConVia(fig,rcnlynxdebug) +lofig_list *fig; +short rcnlynxdebug; + +/************************************************************* +* Cette procedure verifie la correspondance entre connecteur * +* physique vers connecteur logique, et le regroupement des * +* vias. * +* * +*************************************************************/ +{ + losig_list *ScanLoSig; /* Pour parcourir la liste des equipotentielles */ + rdsrec_list *ScanPhRec; /* Pour la meme chose */ + char EndEqui; /* Indique la fin du traitement de l'equi */ + + for(ScanLoSig=fig->LOSIG; ScanLoSig; ScanLoSig=ScanLoSig->NEXT) + { + EndEqui=0; + ScanPhRec=(rdsrec_list*)(getptype(ScanLoSig->USER,RCN_FEQUI)->DATA); + while(!EndEqui) + { + if(IsRdsConnector(ScanPhRec)) + { + if(!getptype(ScanPhRec->USER,RDSLOCON)) + GrgFatalError(26); + } + if(IsLynxEndEqui(ScanPhRec)) + EndEqui=1; + else + ScanPhRec=LYNX_EQUI(ScanPhRec); + } + } +} + + +void Grgdisplay_datain(fig) +lofig_list *fig; +{ + rdsrec_list *scan; + losig_list *sg; + chain_list *name; + locon_list *con,*locon; + loins_list *ins; + lotrs_list *trs; + GrgPhVia_list *via; + char EndEqui=0; + ptype_list *ptptype; + + fprintf(stderr,"Figure name: %s\n",fig->NAME); + fprintf(stderr,"RDS_PHYSICAL_GRID: %ld\n",RDS_PHYSICAL_GRID); + fprintf(stderr,"RDS_UNIT: %ld\n",RDS_UNIT); + fprintf(stderr,"RDS_LAMBDA: %ld\n",RDS_LAMBDA); + fprintf(stderr,"SCALE_X: %ld\n",SCALE_X); + fprintf(stderr,"Valeurs techno (deja divisee par RDS_LAMBDA(2)) :\n"); + fprintf(stderr,"Alu1 Capacite surfacique (pf/u^2): %e\n",GET_LYNX_SURFACE_CAPA_LAYER(RDS_ALU1)); + fprintf(stderr," Capacite perimetrique (pf/u): %e\n",GET_LYNX_PERIMETER_CAPA_LAYER(RDS_ALU1)); + fprintf(stderr," Resistance par carre (om/sq): %e\n",GET_LYNX_RESISTOR_LAYER(RDS_ALU1)); + fprintf(stderr,"Alu2 Capacite surfacique (pf/u^2): %e\n",GET_LYNX_SURFACE_CAPA_LAYER(RDS_ALU2)); + fprintf(stderr," Capacite perimetrique (pf/u): %e\n",GET_LYNX_PERIMETER_CAPA_LAYER(RDS_ALU2)); + fprintf(stderr," Resistance par carre (om/sq): %e\n",GET_LYNX_RESISTOR_LAYER(RDS_ALU2)); + fprintf(stderr,"Alu3 Capacite surfacique (pf/u^2): %e\n",GET_LYNX_SURFACE_CAPA_LAYER(RDS_ALU3)); + fprintf(stderr," Capacite perimetrique (pf/u): %e\n",GET_LYNX_PERIMETER_CAPA_LAYER(RDS_ALU3)); + fprintf(stderr," Resistance par carre (om/sq): %e\n",GET_LYNX_RESISTOR_LAYER(RDS_ALU3)); + + for(sg=fig->LOSIG;sg;sg=sg->NEXT) + { + scan=((rdsrec_list*)(getptype(sg->USER,RCN_FEQUI)->DATA)); + EndEqui=0; + fprintf(stderr,"\nNouvelle equi: %ld\n",sg->INDEX); + fprintf(stderr,"Nom(s) du signal logique: %s\n",(sg->NAMECHAIN!=NULL)?((char*)(sg->NAMECHAIN->DATA)):"-"); + if(sg->NAMECHAIN!=NULL) + for(name=sg->NAMECHAIN->NEXT;name;name=name->NEXT) + fprintf(stderr," %s\n",(char*)name->DATA); + while(!EndEqui) + { + fprintf(stderr," %6ld %6ld %6ld %6ld | ",scan->X,scan->Y,scan->X+scan->DX,scan->Y+scan->DY); + fprintf(stderr,"%15s (%3d) | ",RDS_LAYER_NAME[GetRdsLayer(scan)],GetRdsLayer(scan)); + if (IsRdsConnector(scan)) fprintf(stderr,"%20s | ","Connecteur"); + if (IsRdsSegment(scan)) fprintf(stderr,"%20s | ","Segment"); + if (IsRdsReference(scan)) fprintf(stderr,"%20s | ","Reference"); + if (IsRdsRealVia(scan)) fprintf(stderr,"%20s | ","Via"); + if (IsRdsInstance(scan)) fprintf(stderr,"%20s | ","Instance"); + if (IsRdsFigure(scan)) fprintf(stderr,"%20s | ","Figure"); + + if(scan->NAME!=NULL) + fprintf(stderr," %s",scan->NAME); + + for(ptptype = scan->USER ; ptptype ; ptptype = ptptype->NEXT ) + printf("[%ld-%08X] ", ptptype->TYPE, (int)(ptptype->DATA) ); + printf("*\n"); + + if(getptype(scan->USER,RDSLOCON)) + { + locon=((locon_list*)(getptype(scan->USER,RDSLOCON)->DATA)); + fprintf(stderr,"\n -> Logique: %10s signal %ld",locon->NAME,locon->SIG->INDEX); + } + if(getptype(scan->USER,GRGVIA)) + { + via=((GrgPhVia_list*)(getptype(scan->USER,GRGVIA)->DATA)); + fprintf(stderr,"\n ->Autres couches: %6ld %6ld %6ld %6ld %s\n",via->LAYER1->X, + via->LAYER1->Y, + via->LAYER1->X+via->LAYER1->DX, + via->LAYER1->Y+via->LAYER1->DY, + RDS_LAYER_NAME[GetRdsLayer(via->LAYER1)]); + if(via->LAYER2) + fprintf(stderr," %6ld %6ld %6ld %6ld %s\n",via->LAYER2->X, + via->LAYER2->Y, + via->LAYER2->X+via->LAYER2->DX, + via->LAYER2->Y+via->LAYER2->DY, + RDS_LAYER_NAME[GetRdsLayer(via->LAYER2)]); + if(via->LAYER3) + fprintf(stderr," %6ld %6ld %6ld %6ld %s\n",via->LAYER3->X, + via->LAYER3->Y, + via->LAYER3->X+via->LAYER3->DX, + via->LAYER3->Y+via->LAYER3->DY, + RDS_LAYER_NAME[GetRdsLayer(via->LAYER3)]); + } + + fprintf(stderr,"\n"); + + if(IsLynxEndEqui(scan)) + EndEqui=1; + else + scan=LYNX_EQUI(scan); + } + } + fprintf(stderr,"\n\nListe des connecteurs de la figure:\n"); + for(con=fig->LOCON;con;con=con->NEXT) + { + fprintf(stderr,"Connecteur logique: %s -> %ld\n",con->NAME,con->SIG->INDEX); + Grgdisplayrdscon(con->USER,RDSLOCON1); + } + fprintf(stderr,"\n\nListe des instances de la figure:\n"); + for(ins=fig->LOINS;ins;ins=ins->NEXT) + { + fprintf(stderr,"Instance: %s basee sur %s\n",ins->INSNAME,ins->FIGNAME); + for(con=ins->LOCON;con;con=con->NEXT) + { + fprintf(stderr,"Connecteur logique: %s -> %ld\n",con->NAME,con->SIG->INDEX); + Grgdisplayrdscon(con->USER,RDSLOCON2); + } + } + fprintf(stderr,"\n\nListe des transistors de la figure:\n"); + for(trs=fig->LOTRS;trs;trs=trs->NEXT) + { + fprintf(stderr,"Transistor: %c W=%ld L=%ld\n",(trs->TYPE==TRANSN)?'N':'P',trs->WIDTH,trs->LENGTH); + fprintf(stderr,"Connecteur logique drain: %s -> %ld\n",trs->DRAIN->NAME,trs->DRAIN->SIG->INDEX); + Grgdisplayrdscon(trs->DRAIN->USER,RDSLOCON3); + fprintf(stderr,"Connecteur logique grille: %s -> %ld\n",trs->GRID->NAME,trs->GRID->SIG->INDEX); + Grgdisplayrdscon(trs->GRID->USER,RDSLOCON3); + fprintf(stderr,"Connecteur logique source: %s -> %ld\n",trs->SOURCE->NAME,trs->SOURCE->SIG->INDEX); + Grgdisplayrdscon(trs->SOURCE->USER,RDSLOCON3); + } +} + + + + + +void Grgdisplayrdscon(ptptype,t) +ptype_list *ptptype; +long t; +{ + rdsrec_list *scan; + chain_list *scanchain; + if(getptype(ptptype,t)) + { + for( scanchain=((chain_list*)(getptype(ptptype,t)->DATA));scanchain;scanchain=scanchain->NEXT) + { + scan=((rdsrec_list*)(scanchain->DATA)); + fprintf(stderr," - Connecteur physique:\n"); + fprintf(stderr," %6ld %6ld %6ld %6ld ",scan->X,scan->Y,scan->X+scan->DX,scan->Y+scan->DY); + fprintf(stderr,"%15s ",RDS_LAYER_NAME[GetRdsLayer(scan)]); + if (IsRdsConnector(scan)) fprintf(stderr,"%20s ","Connecteur"); + if (IsRdsSegment(scan)) fprintf(stderr,"%20s ","Segment"); + if (IsRdsReference(scan)) fprintf(stderr,"%20s ","Reference"); + if (IsRdsRealVia(scan)) fprintf(stderr,"%20s ","Via"); + if (IsRdsInstance(scan)) fprintf(stderr,"%20s ","Instance"); + if (IsRdsFigure(scan)) fprintf(stderr,"%20s ","Figure"); + + if(scan->NAME!=NULL) + fprintf(stderr," %s",scan->NAME); + fprintf(stderr,"\n"); + } + } +} +void dbg_affrec(scan) +rdsrec_list *scan; +{ + locon_list *locon; + + fprintf(stderr,"(%6ld,%6ld) - (%6ld,%6ld) ",scan->X,scan->Y,scan->X+scan->DX,scan->Y+scan->DY); + fprintf(stderr,"%15s (%3d) ",RDS_LAYER_NAME[GetRdsLayer(scan)],GetRdsLayer(scan)); + if (IsRdsConnector(scan)) fprintf(stderr,"%20s ","Connecteur"); + if (IsRdsSegment(scan)) fprintf(stderr,"%20s ","Segment"); + if (IsRdsReference(scan)) fprintf(stderr,"%20s ","Reference"); + if (IsRdsRealVia(scan)) fprintf(stderr,"%20s ","Via"); + if (IsRdsInstance(scan)) fprintf(stderr,"%20s ","Instance"); + if (IsRdsFigure(scan)) fprintf(stderr,"%20s ","Figure"); + + if(scan->NAME!=NULL) + fprintf(stderr," %s",scan->NAME); + if(getptype(scan->USER,RDSLOCON)) + { + locon=((locon_list*)(getptype(scan->USER,RDSLOCON)->DATA)); + fprintf(stderr,"\n -> Logique: %10s signal %ld",locon->NAME,locon->SIG->INDEX); + } + fprintf(stderr,"\n"); +} diff --git a/alliance/src/lynx/src/chklynxrcn.h b/alliance/src/lynx/src/chklynxrcn.h new file mode 100644 index 00000000..e96e7454 --- /dev/null +++ b/alliance/src/lynx/src/chklynxrcn.h @@ -0,0 +1,52 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +void GrgChkInConFEqui __P((lofig_list*)); +/************************************************************* +* Cette procedure verifie la presence d'une equipotentielle * +* physique pour chaque signal logique et la correspondance * +* connecteur logique vers connecteur physique. * +* * +*************************************************************/ + + +void GrgChkOutConVia __P((lofig_list*, short)); +/************************************************************* +* Cette procedure verifie la correspondance entre connecteur * +* physique vers connecteur logique, et le regroupement des * +* vias. * +* * +*************************************************************/ + + +void Grgdisplay_datain __P((lofig_list*)); + + +void Grgdisplayrdscon __P((ptype_list*, long)); + + +void dbg_affrec __P((rdsrec_list*)); diff --git a/alliance/src/lynx/src/cutelbow.c b/alliance/src/lynx/src/cutelbow.c new file mode 100644 index 00000000..bbe5d9e3 --- /dev/null +++ b/alliance/src/lynx/src/cutelbow.c @@ -0,0 +1,482 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : LYNX | +| | +| File : cutelbow.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 01.08.93 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include + +# include "mut.h" +# include "mlo.h" +# include "mph.h" +# include "rds.h" +# include "rwi.h" +# include "rut.h" +# include "rpr.h" +# include "rfm.h" +# include "mpu.h" + +# include "mbkrds.h" +# include "cutelbow.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +static phfig_list *FigureDumpContact = (phfig_list *)0; + +/*------------------------------------------------------------\ +| | +| Cut Transistor Table | +| | +\------------------------------------------------------------*/ + +static long LYNX_CUT_C_X_PARAM[ 5 ]; + +/* 0 -> Constant 0 */ +/* 1 -> Nothing to do */ +/* 2 -> D */ +/* 3 -> ( D + d ) / 2 */ +/* 4 -> ( D - d ) / 2 */ + +long LYNX_CUT_C_X_TABLE [ 16 ] [ 4 ] [ 4 ] = + +{ + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy */ + /* O */ + { { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 } }, /* */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy | */ + /* O */ + { { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 } }, /* */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy */ + /* O */ + { { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 } }, /* | */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy | */ + /* O */ + { { 0, 0, 4, 2 }, { 3, 0, 4, 2 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 } }, /* | */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy */ + /* --O */ + { { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 } }, /* */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy | */ + /* --O */ + { { 0, 0, 2, 4 }, { 0, 3, 4, 4 }, { 3, 4, 4, 3 }, { 1, 1, 1, 1 } }, /* */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy */ + /* --O */ + { { 0, 0, 4, 4 }, { 3, 0, 4, 2 }, { 0, 3, 3, 4 }, { 1, 1, 1, 1 } }, /* | */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy | */ + /* --O */ + { { 0, 0, 4, 4 }, { 3, 0, 4, 2 }, { 0, 3, 4, 4 }, { 1, 1, 1, 1 } }, /* | */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy */ + /* O-- */ + { { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 } }, /* */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy | */ + /* O-- */ + { { 0, 0, 4, 2 }, { 4, 0, 3, 4 }, { 3, 3, 4, 4 }, { 1, 1, 1, 1 } }, /* */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy */ + /* O-- */ + { { 0, 0, 4, 2 }, { 3, 0, 4, 4 }, { 4, 3, 3, 4 }, { 1, 1, 1, 1 } }, /* | */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy | */ + /* O-- */ + { { 0, 0, 4, 2 }, { 3, 0, 4, 4 }, { 3, 3, 4, 4 }, { 1, 1, 1, 1 } }, /* | */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy */ + /* --O-- */ + { { 0, 0, 2, 4 }, { 0, 3, 2, 4 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 } }, /* */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy | */ + /* --O-- */ + { { 0, 0, 2, 4 }, { 0, 3, 4, 4 }, { 3, 3, 4, 4 }, { 1, 1, 1, 1 } }, /* */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy */ + /* --O-- */ + { { 0, 0, 4, 4 }, { 3, 0, 4, 4 }, { 0, 3, 2, 4 }, { 1, 1, 1, 1 } }, /* | */ + + /* X Y Dx Dy X Y Dx Dy X Y Dx Dy X Y Dx Dy | */ + /* --O-- */ + { { 0, 0, 4, 4 }, { 3, 0, 4, 4 }, { 0, 3, 4, 4 }, { 3, 3, 4, 4 } }, /* | */ + +}; + +long *LYNX_CUT_C_X_ARRAY[ MBK_MAX_LAYER ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| LynxInitializeCutCxTable | +| | +\------------------------------------------------------------*/ + +void LynxInitializeCutCxTable() + +{ + int Index; + long DeltaGate; + long DeltaDiff; + char Layer; + char GateLayer; + char DiffLayer; + long *Table; + int MbkLayer; + int TransType; + int CXType; + + rdsbegin(); + + for ( MbkLayer = 0; MbkLayer < MBK_MAX_LAYER; MbkLayer++ ) + { + TransType = GET_LYNX_TRANSISTOR_TYPE( MbkLayer ); + CXType = GET_LYNX_TRANSISTOR_CX( MbkLayer ); + + if ( ( TransType == RDS_LYNX_TRANSISTOR_EMPTY ) || + ( CXType == RDS_LYNX_TRANSISTOR_EMPTY ) ) + { + LYNX_CUT_C_X_ARRAY[ MbkLayer ] = (long *)0; + } + else + { + Table = (long *)rdsalloc( sizeof( LYNX_CUT_C_X_TABLE ), RDS_ALLOC_BLOCK ); + memcpy( Table, LYNX_CUT_C_X_TABLE, sizeof( LYNX_CUT_C_X_TABLE ) ); + + LYNX_CUT_C_X_ARRAY[ MbkLayer ] = Table; + + DeltaGate = -1; + DeltaDiff = -1; + Index = 0; + GateLayer = GET_LYNX_TRANSISTOR_GATE_LAYER( MbkLayer ); + DiffLayer = GET_LYNX_TRANSISTOR_DIFF_LAYER( MbkLayer ); + Layer = GET_VIA_LAYER( CXType, Index ); + + while ( Layer != RDS_VIA_EMPTY ) + { + if ( Layer == GateLayer ) + { + DeltaGate = GET_VIA_SIZE( CXType, Index ); + } + else + if ( Layer == DiffLayer ) + { + DeltaDiff = GET_VIA_SIZE( CXType, Index ); + } + + Index = Index + 1; + + Layer = GET_VIA_LAYER( CXType, Index ); + } + + if ( ( DeltaGate == -1 ) || + ( DeltaDiff == -1 ) ) + { + for ( Index = 0; Index < 256; Index++ ) + { + Table[ Index ] = -1; + } + } + else + { + /* 0 -> Constant 0 */ + /* 1 -> Nothing to do */ + /* 2 -> D */ + /* 3 -> ( D + d ) / 2 */ + /* 4 -> ( D - d ) / 2 */ + + LYNX_CUT_C_X_PARAM[ 0 ] = 0; + LYNX_CUT_C_X_PARAM[ 1 ] = -1; + LYNX_CUT_C_X_PARAM[ 2 ] = DeltaDiff; + LYNX_CUT_C_X_PARAM[ 3 ] = ( DeltaDiff + DeltaGate ) >> 1; + LYNX_CUT_C_X_PARAM[ 4 ] = ( DeltaDiff - DeltaGate ) >> 1; + + for ( Index = 0; Index < 256; Index++ ) + { + Table[ Index ] = LYNX_CUT_C_X_PARAM[ Table[ Index ] ]; + } + } + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| LynxCutTransistorElbow | +| | +\------------------------------------------------------------*/ + +long LynxCutTransistorElbow( Figure, Window, Core ) + + rdsfig_list *Figure; + rdswindow *Window; + char Core; +{ + rdsrec_list *Rectangle; + rdsrec_list *ScanRec; + rdsrecwin_list StaticRecWin; + rdsrecwin_list *RecWin; + rdsrecwin_list *ScanRecWin; + rdswinrec_list *ScanWinRec; + rdswin_list *ScanWin; + long *LineTable; + long *Table; + long Counter; + char FoundError; + char Error; + int Flag; + char Type; + int Index; + int GateLayer; + int Layer; + int DiffLayer; + long X1; + long X2; + long Y1; + long Y2; + long X; + long Y; + int MbkLayer; + char TransType; + char CXType; + + rdsbegin(); + + StaticRecWin.NEXT = (rdsrecwin_list *)0; + FigureDumpContact = addphfig( "core_cx" ); + FoundError = 0; + Counter = 0; + + Lynxrecrdsmbk( FigureDumpContact, Figure->LAYERTAB[ RDS_ABOX ], 0 ); + + for ( MbkLayer = 0; MbkLayer < MBK_MAX_LAYER; MbkLayer++ ) + { + Table = LYNX_CUT_C_X_ARRAY[ MbkLayer ]; + + if ( Table == (long *)0 ) continue; + + TransType = GET_LYNX_TRANSISTOR_TYPE( MbkLayer ); + CXType = GET_LYNX_TRANSISTOR_CX( MbkLayer ); + GateLayer = GET_LYNX_TRANSISTOR_GATE_LAYER( MbkLayer ); + DiffLayer = GET_LYNX_TRANSISTOR_DIFF_LAYER( MbkLayer ); + + for ( Rectangle = Figure->LAYERTAB[ GateLayer ]; + Rectangle != (rdsrec_list *)0; + Rectangle = Rectangle->NEXT ) + { + if ( IsRdsVia( Rectangle ) ) + { + Type = GetLynxAttribute( Rectangle ); + + if ( Type == CXType ) + { + X1 = Rectangle->X; + X2 = Rectangle->DX + X1; + Y1 = Rectangle->Y; + Y2 = Rectangle->DY + Y1; + X = X1 + ( Rectangle->DX >> 1 ); + Y = Y1 + ( Rectangle->DY >> 1 ); + + Error = 0; + Flag = 0; + + if ( IsRdsOneWindow ( Rectangle ) ) + { + StaticRecWin.WINDOW = (rdswin_list *)Rectangle->USER; + RecWin = &StaticRecWin; + } + else + { + RecWin = (rdsrecwin_list *)Rectangle->USER; + } + + for ( ScanRecWin = RecWin ; + ( ScanRecWin != (rdsrecwin_list *)0 ) && + ( Error == 0 ); + ScanRecWin = ScanRecWin->NEXT ) + { + ScanWin = ScanRecWin->WINDOW; + + for ( ScanWinRec = ScanWin->LAYERTAB[ GateLayer ]; + ( ScanWinRec != (rdswinrec_list *)0 ) && + ( Error == 0 ); + ScanWinRec = ScanWinRec->NEXT ) + { + for ( Index = 0; Index < RWI_MAX_REC; Index++ ) + { + ScanRec = ScanWinRec->RECTAB[ Index ]; + + if ( ( ScanRec != (rdsrec_list *)0 ) && + ( IsRdsFigRec( ScanRec ) ) && + ( IsRdsSegment( ScanRec ) ) ) + { + Layer = GetLynxAttribute( ScanRec ); + + if ( ( Layer == MbkLayer ) && + ( ScanRec->X <= X2 ) && + ( ScanRec->Y <= Y2 ) && + ( ( ScanRec->X + ScanRec->DX ) >= X1 ) && + ( ( ScanRec->Y + ScanRec->DY ) >= Y1 ) ) + { + if ( ScanRec->Y == Y ) + { + Flag |= LYNX_NORTH_MASK; + } + else + + if ( ( ScanRec->Y + ScanRec->DY ) == Y ) + { + Flag |= LYNX_SOUTH_MASK; + } + else + + if ( ( ScanRec->X + ScanRec->DX ) == X ) + { + Flag |= LYNX_WEST_MASK; + } + else + if ( ScanRec->X == X ) + { + Flag |= LYNX_EAST_MASK; + } + else + { + Error = 1; break; + } + } + } + } + } + } + + if ( Error == 0 ) + { + if ( Flag != 0 ) + { + LineTable = &Table[ Flag << 4 ]; + ScanRec = LYNX_LINK( Rectangle ); + + while ( ScanRec != Rectangle ) + { + if ( GetRdsLayer( ScanRec ) == DiffLayer ) + { + SetLynxDeleted( ScanRec ); + + X = ScanRec->X; + Y = ScanRec->Y; + } + + ScanRec = LYNX_LINK( ScanRec ); + } + + for ( Index = 0; Index < 16; Index = Index + 4 ) + { + if ( LineTable[ Index ] == -1 ) break; + + ScanRec = addrdsfigrec( Figure, + 0, + DiffLayer, + X + LineTable[ Index + 0 ], + Y + LineTable[ Index + 1 ], + LineTable[ Index + 2 ], + LineTable[ Index + 3 ] ); + + SetLynxCut( ScanRec ); + + addrdsrecwindow( ScanRec, Window ); + } + + Counter = Counter + 1; + } + } + else + { + if ( Core ) + { + Lynxrecrdsmbk( FigureDumpContact, Rectangle, 0 ); + + FoundError = 1; + } + else + { + rdsend(); + return( -1 ); + } + } + } + } + } + } + + if ( FoundError ) + { + savephfig( FigureDumpContact ); + + rdsend(); + return( -1 ); + } + + rdsend(); + return( Counter ); +} diff --git a/alliance/src/lynx/src/cutelbow.h b/alliance/src/lynx/src/cutelbow.h new file mode 100644 index 00000000..b0d54f37 --- /dev/null +++ b/alliance/src/lynx/src/cutelbow.h @@ -0,0 +1,102 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : LYNX | +| | +| File : cut.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.08.93 | +| | +\------------------------------------------------------------*/ + +# ifndef LYNX_CUTELBOW +#define LYNX_CUTELBOW + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define LYNX_CUT (long)0x00200000 +# define LYNX_DELETED (long)0x00400000 + +/*------------------------------------------------------------\ +| | +| Macros | +| | +\------------------------------------------------------------*/ + +# define IsLynxCut( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS & LYNX_CUT ) + +# define SetLynxCut( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS |= LYNX_CUT ) + +# define ClearLynxCut( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS &= ~LYNX_CUT ) + + +# define IsLynxDeleted( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS & LYNX_DELETED ) + +# define SetLynxDeleted( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS |= LYNX_DELETED ) + +# define ClearLynxDeleted( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS &= ~LYNX_DELETED ) + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern long LynxCutTransistorElbow __P((rdsfig_list*, rdswindow*, char )); + extern void LynxInitializeCutCxTable __P((void)); + +# endif diff --git a/alliance/src/lynx/src/diffusion.c b/alliance/src/lynx/src/diffusion.c new file mode 100644 index 00000000..3057bfdd --- /dev/null +++ b/alliance/src/lynx/src/diffusion.c @@ -0,0 +1,262 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : LYNX | +| | +| File : diffusion.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 01.07.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "mlo.h" +# include "mph.h" +# include "rds.h" +# include "rwi.h" +# include "rut.h" +# include "rpr.h" +# include "rfm.h" + +# include "mbkrds.h" +# include "box.h" +# include "diffusion.h" +# include "error.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| LynxDiffusionFigure | +| | +\------------------------------------------------------------*/ + +void LynxDiffusionFigure( FigureRds, WindowRds ) + + rdsfig_list *FigureRds; + rdswindow *WindowRds; +{ + rdsrec_list *ScanRec; + rdsrec_list *NewRec; + rdsrec_list *ActiveRec; + rdswin_list *ScanWin; + rdswinrec_list *ScanWinRec; + rdsrecwin_list *RecWin; + rdsrecwin_list *ScanRecWin; + rdsrecwin_list StaticRecWin; + lynxbox_list *DiffBox; + lynxbox_list *ScanBox; + lynxbox_list *ActiveBox; + lynxbox_list *InterBox; + lynxbox_list *SplitBox; + lynxbox_list **PrevBox; + lynxbox_list RectBox; + int ScanRecIndex; + int Index; + int RdsLayer; + int DiffLayer; + int ActiveLayer; + char Present; + + StaticRecWin.NEXT = (rdsrecwin_list *)0; + RectBox.NEXT = (lynxbox_list *)0; + + for ( RdsLayer = 0; RdsLayer < RDS_MAX_LAYER; RdsLayer++ ) + { + ActiveLayer = GET_LYNX_DIFFUSION_LAYER( RdsLayer, 0 ); + + if ( ActiveLayer == RDS_LYNX_DIFFUSION_EMPTY ) continue; + + for ( ActiveRec = FigureRds->LAYERTAB[ ActiveLayer ]; + ActiveRec != (rdsrec_list *)0; + ActiveRec = ActiveRec->NEXT ) + { + ActiveBox = LynxAddBox( ActiveRec->X, ActiveRec->Y, + ActiveRec->X + ActiveRec->DX, + ActiveRec->Y + ActiveRec->DY ); + Index = 1; + DiffLayer = GET_LYNX_DIFFUSION_LAYER( RdsLayer, Index ); + Present = GET_LYNX_DIFFUSION_Y_OR_N( RdsLayer, Index ); + + while ( DiffLayer != RDS_LYNX_DIFFUSION_EMPTY ) + { + if ( IsRdsOneWindow( ActiveRec ) ) + { + StaticRecWin.WINDOW = (rdswin_list *)ActiveRec->USER; + RecWin = &StaticRecWin; + } + else + { + RecWin = (rdsrecwin_list *)ActiveRec->USER; + } + + DiffBox = (lynxbox_list *)0; + + for ( ScanRecWin = RecWin; + ScanRecWin != (rdsrecwin_list *) 0; + ScanRecWin = ScanRecWin->NEXT ) + { + ScanWin = ScanRecWin->WINDOW; + + for ( ScanWinRec = ScanWin->LAYERTAB[ DiffLayer ]; + ScanWinRec != (rdswinrec_list *)0; + ScanWinRec = ScanWinRec->NEXT ) + { + for ( ScanRecIndex = 0; + ScanRecIndex < RWI_MAX_REC; + ScanRecIndex++ ) + { + ScanRec = ScanWinRec->RECTAB[ ScanRecIndex ]; + + if ( ScanRec != (rdsrec_list *)0 ) + { + ScanBox = ActiveBox; + PrevBox = &ActiveBox; + + RectBox.X1 = ScanRec->X; + RectBox.Y1 = ScanRec->Y; + RectBox.X2 = ScanRec->DX + RectBox.X1; + RectBox.Y2 = ScanRec->DY + RectBox.Y1; + + while ( ScanBox != (lynxbox_list *)0 ) + { + InterBox = LynxIntersectBox( &RectBox, ActiveBox ); + + if ( InterBox != (lynxbox_list *)0 ) + { + SplitBox = LynxSplitBox( &RectBox, ActiveBox ); + + if ( Present ) + { + InterBox->NEXT = DiffBox; + DiffBox = InterBox; + } + else + { + LynxDelAllBox( InterBox ); + } + + if ( SplitBox != (lynxbox_list *)0 ) + { + *PrevBox = SplitBox; + + while ( SplitBox->NEXT != (lynxbox_list *)0 ) + { + SplitBox = SplitBox->NEXT; + } + + SplitBox->NEXT = ScanBox->NEXT; + } + else + { + *PrevBox = ScanBox->NEXT; + } + + ScanBox->NEXT = (lynxbox_list *)0; + LynxDelAllBox( ScanBox ); + + ScanBox = *PrevBox; + } + else + { + PrevBox = &ScanBox->NEXT; + ScanBox = ScanBox->NEXT; + } + } + } + + if ( ActiveBox == (lynxbox_list *)0 ) break; + } + + if ( ActiveBox == (lynxbox_list *)0 ) break; + } + + if ( ActiveBox == (lynxbox_list *)0 ) break; + } + + if ( Present ) + { + LynxDelAllBox( ActiveBox ); + + ActiveBox = DiffBox; + } + + if ( ActiveBox == (lynxbox_list *)0 ) break; + + Index = Index + 1; + DiffLayer = GET_LYNX_DIFFUSION_LAYER( RdsLayer, Index ); + Present = GET_LYNX_DIFFUSION_Y_OR_N( RdsLayer, Index ); + } + + if ( DiffLayer == RDS_LYNX_DIFFUSION_EMPTY ) + { + for ( ScanBox = ActiveBox; + ScanBox != (lynxbox_list *)0; + ScanBox = ScanBox->NEXT ) + { + NewRec = addrdsfigrec( FigureRds, ActiveRec->NAME, RdsLayer, + ScanBox->X1 , ScanBox->Y1, + ScanBox->X2 - ScanBox->X1, ScanBox->Y2 - ScanBox->Y1 ); + + addrdsrecwindow( NewRec, WindowRds ); + } + } + + LynxDelAllBox( ActiveBox ); + } + } +} diff --git a/alliance/src/lynx/src/diffusion.h b/alliance/src/lynx/src/diffusion.h new file mode 100644 index 00000000..0f34b85c --- /dev/null +++ b/alliance/src/lynx/src/diffusion.h @@ -0,0 +1,71 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : LYNX | +| | +| File : diffusion.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.07.95 | +| | +\------------------------------------------------------------*/ + +# ifndef LYNX_DIFFUSION_H +# define LYNX_DIFFUSION_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macros | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void LynxDiffusionFigure(); + +# endif diff --git a/alliance/src/lynx/src/error.c b/alliance/src/lynx/src/error.c new file mode 100644 index 00000000..55ed2b45 --- /dev/null +++ b/alliance/src/lynx/src/error.c @@ -0,0 +1,178 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : LYNX | +| | +| File : error.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 01.08.93 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" + +# include "error.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Lynx Error | +| | +\------------------------------------------------------------*/ + +void lynx_error( Error, Text1, Text2, File, Line ) + + char Error; + char *Text1; + char *Text2; + char *File; + long Line; +{ + char *Name; + + Name = mbkstrdup( File ); + Name[ strlen( File ) - 1 ] = '\0'; + + fprintf( stderr, "\n\t%s%ld Error : ", Name, Line ); + + switch( Error ) + { + case LYNX_ERROR_PHYSICAL_CONNECTOR : + fprintf( stderr, "connector \"%s\" is on two different equis !\n\n", Text1 ); + break; + + case LYNX_ERROR_PHYSICAL_CONNECTORS : + fprintf( stderr, "connectors \"%s\" and \"%s\" are on the same equi !\n\n", Text1, Text2 ); + break; + + case LYNX_ERROR_MISSING_CONNECTOR : + fprintf( stderr, "No connector found in %s !\n\n", Text1 ); + break; + + case LYNX_ERROR_CUT_TRANSISTOR_ELBOW : + fprintf( stderr, "Unable to cut transistor elbow\n\n" ); + break; + + case LYNX_ERROR_MASK_COUNTER_NULL : + fprintf( stderr, "No rectangle found\n\n" ); + break; + + case LYNX_ERROR_ILLEGAL_COMBINATION : + fprintf( stderr, "Illegal combination %s %s !\n\n", Text1, Text2 ); + break; + + case LYNX_ERROR_ILLEGAL_OPTION : + fprintf( stderr, "Illegal option %s !\n\n", Text1 ); + break; + + case LYNX_ERROR_ILLEGAL_FILENAME : + fprintf( stderr, "Illegal file name \"%s\" !\n\n", Text1 ); + break; + + case LYNX_ERROR_MINIMUM_LENGTH : + fprintf( stderr, "Unable to compute minimum length\n\n" ); + break; + + case LYNX_ERROR_TRANSISTOR_GATE : + fprintf( stderr, "Unable to compute transistor gate\n\n" ); + break; + + case LYNX_ERROR_TRANSISTOR_LOGICAL : + fprintf( stderr, "Unable to create logical transistor (X=%ld,Y=%ld)\n\n", + (long)Text1, (long)Text2 ); + break; + + default : + fprintf( stderr, "unknown internal error %d !\n", Error ); + } + + exit( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Lynx Warning | +| | +\------------------------------------------------------------*/ + +void lynx_warning( Warning, Text, File, Line ) + + char Warning; + char *Text; + char *File; + long Line; +{ + char *Name; + + Name = mbkstrdup( File ); + Name[ strlen( File ) - 1 ] = '\0'; + + fprintf( stderr, "\n\t%s%ld Warning : ", Name, Line ); + + switch( Warning ) + { + case LYNX_WARNING_PHYSICAL_CONNECTOR : + fprintf( stderr, "connector %s is on two different equis !\n", Text ); + break; + case LYNX_WARNING_CORE_FILE : + fprintf( stderr, "Generates %s file !\n", Text ); + break; + default : + fprintf( stderr, "unknown internal warning %d !\n", Warning ); + } +} diff --git a/alliance/src/lynx/src/error.h b/alliance/src/lynx/src/error.h new file mode 100644 index 00000000..ef98217a --- /dev/null +++ b/alliance/src/lynx/src/error.h @@ -0,0 +1,103 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : LYNX | +| | +| File : lyerror.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.08.93 | +| | +\------------------------------------------------------------*/ + +# ifndef LYNX_ERROR +# define LYNX_ERROR + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Error | +| | +\------------------------------------------------------------*/ + +# define LYNX_ERROR_PHYSICAL_CONNECTOR 0 +# define LYNX_ERROR_PHYSICAL_CONNECTORS 1 +# define LYNX_ERROR_MISSING_CONNECTOR 2 +# define LYNX_ERROR_CUT_TRANSISTOR_ELBOW 3 +# define LYNX_ERROR_MASK_COUNTER_NULL 4 +# define LYNX_ERROR_ILLEGAL_COMBINATION 5 +# define LYNX_ERROR_ILLEGAL_OPTION 6 +# define LYNX_ERROR_ILLEGAL_FILENAME 7 +# define LYNX_ERROR_MINIMUM_LENGTH 8 +# define LYNX_ERROR_TRANSISTOR_GATE 9 +# define LYNX_ERROR_TRANSISTOR_LOGICAL 10 + +/*------------------------------------------------------------\ +| | +| Warning | +| | +\------------------------------------------------------------*/ + +# define LYNX_WARNING_PHYSICAL_CONNECTOR 0 +# define LYNX_WARNING_CORE_FILE 1 + +/*------------------------------------------------------------\ +| | +| Macros | +| | +\------------------------------------------------------------*/ + +# define LynxError( E, T1, T2 )(lynx_error( (E), (T1), (T2), __FILE__, __LINE__ )) +# define LynxWarning( W, T ) (lynx_warning( (W), (T), __FILE__, __LINE__ )) + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void lynx_error(); + extern void lynx_warning(); + +# endif diff --git a/alliance/src/lynx/src/extract.c b/alliance/src/lynx/src/extract.c new file mode 100644 index 00000000..e8a0030b --- /dev/null +++ b/alliance/src/lynx/src/extract.c @@ -0,0 +1,357 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : LYNX | +| | +| File : extract.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 01.08.93 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include + +# include "mut.h" +# include "mlo.h" +# include "mph.h" +# include "rds.h" +# include "rwi.h" +# include "rut.h" +# include "rpr.h" +# include "rfm.h" + +# include "mbkrds.h" +# include "extract.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| LynxBuildEqui | +| | +\------------------------------------------------------------*/ + +long LynxBuildEqui( HeadEqui, FigureRds, Window ) + + rdsrec_list **HeadEqui; + rdsfig_list *FigureRds; + rdswindow *Window; +{ + rdswin_list *Win; + rdswin_list *ScanWin; + rdswinrec_list *WinRec; + rdswinrec_list *ScanWinRec; + rdsrecwin_list *RecWin; + rdsrecwin_list *ScanRecWin; + rdsrecwin_list StaticRecWin; + + rdsrec_list **Previous; + rdsrec_list *Rec; + rdsrec_list *EquiRec; + rdsrec_list *ScanRec; + rdsrec_list *ScanInsRec; + rdsins_list *ScanIns; + + long X1; + long Y1; + long X2; + long Y2; + + int RecIndex; + int ScanRecIndex; + int Index; + long WinIndex; + + int Layer; + int WinLayer; + int RecLayer; + int InsLayer; + + long Counter; + + rdsbegin(); + + Counter = 0; + + Previous = HeadEqui; + + StaticRecWin.NEXT = (rdsrecwin_list *)0; + + for ( WinIndex = 0; WinIndex < Window->SIZE; WinIndex++ ) + { + Win = Window->WINTAB + WinIndex; + + if ( Win->LAYERTAB == (rdswinrec_list **)0 ) continue; + + for ( WinLayer = 0; WinLayer < RWI_MAX_LAYER; WinLayer++ ) + { + Layer = GET_LYNX_GRAPH_LAYER( WinLayer, 0 ); + + if ( Layer == RDS_LYNX_GRAPH_EMPTY ) continue; + + for ( WinRec = Win->LAYERTAB[ WinLayer ]; + WinRec != (rdswinrec_list *)0; + WinRec = WinRec->NEXT ) + { + for ( RecIndex = 0; RecIndex < RWI_MAX_REC; RecIndex++ ) + { + Rec = WinRec->RECTAB[ RecIndex ]; + + if ( ( Rec != (rdsrec_list *)0 ) && + ( ! IsLynxDeleted( Rec ) ) && + ( ! IsLynxEqui( Rec ) ) ) + { + if ( IsRdsFigRec( Rec ) ) + { + SetLynxEqui( Rec ); + + *Previous = Rec; + Previous = &LYNX_EQUI( Rec ); + } + else + if ( ( IsRdsConInter( Rec ) ) || + ( IsRdsRefCon( Rec ) ) ) + { + SetLynxEqui( Rec ); + + *Previous = Rec; + Previous = &LYNX_EQUI( Rec ); + + ScanIns = (rdsins_list *)LYNX_LINK( Rec ); + + for ( InsLayer = 0 ; + InsLayer < RWI_MAX_LAYER ; + InsLayer++ ) + { + for ( ScanInsRec = ScanIns->LAYERTAB[ InsLayer ]; + ScanInsRec != (rdsrec_list *)0; + ScanInsRec = ScanInsRec->NEXT ) + { + if ( ( ( IsRdsConInter( ScanInsRec ) ) || + ( IsRdsRefCon( ScanInsRec ) ) ) && + ( ! IsLynxEqui( ScanInsRec ) ) && + ( Rec->NAME == ScanInsRec->NAME ) ) + { + SetLynxEqui( ScanInsRec ); + + *Previous = ScanInsRec; + Previous = &LYNX_EQUI( ScanInsRec ); + } + } + } + } + + EquiRec = Rec; + + do + { + X1 = EquiRec->X; + Y1 = EquiRec->Y; + X2 = EquiRec->DX + X1; + Y2 = EquiRec->DY + Y1; + + RecLayer = GetRdsLayer ( EquiRec ); + + if ( IsRdsOneWindow( EquiRec ) ) + { + StaticRecWin.WINDOW = (rdswin_list *)EquiRec->USER; + RecWin = &StaticRecWin; + } + else + { + RecWin = (rdsrecwin_list *)EquiRec->USER; + } + + for ( ScanRecWin = RecWin; + ScanRecWin != (rdsrecwin_list *) 0; + ScanRecWin = ScanRecWin->NEXT ) + { + ScanWin = ScanRecWin->WINDOW; + + Index = 0; + Layer = GET_LYNX_GRAPH_LAYER( RecLayer, Index ); + + while ( Layer != RDS_LYNX_GRAPH_EMPTY ) + { + for ( ScanWinRec = ScanWin->LAYERTAB[ Layer ]; + ScanWinRec != (rdswinrec_list *)0; + ScanWinRec = ScanWinRec->NEXT ) + { + for ( ScanRecIndex = 0; + ScanRecIndex < RWI_MAX_REC; + ScanRecIndex++ ) + { + ScanRec = ScanWinRec->RECTAB[ ScanRecIndex ]; + + if ( ( ScanRec != (rdsrec_list *)0 ) && + ( ! IsLynxEqui( ScanRec ) ) && + ( ! IsLynxDeleted( ScanRec ) ) && + ( ( ScanRec->X ) <= X2 ) && + ( ( ScanRec->Y ) <= Y2 ) && + ( ( ScanRec->X + ScanRec->DX ) >= X1 ) && + ( ( ScanRec->Y + ScanRec->DY ) >= Y1 ) ) + { + SetLynxEqui( ScanRec ); + + *Previous = ScanRec; + Previous = &LYNX_EQUI( ScanRec ); + + if ( ( ! IsRdsFigRec( ScanRec ) ) && + ( ( IsRdsConInter( ScanRec ) ) || + ( IsRdsRefCon( ScanRec ) ) ) ) + { + ScanIns = (rdsins_list *)LYNX_LINK( ScanRec ); + + for ( InsLayer = 0 ; + InsLayer < RWI_MAX_LAYER ; + InsLayer++ ) + { + for ( ScanInsRec = ScanIns->LAYERTAB[ InsLayer ]; + ScanInsRec != (rdsrec_list *)0; + ScanInsRec = ScanInsRec->NEXT ) + { + if ( ( ( IsRdsConInter( ScanInsRec ) ) || + ( IsRdsRefCon( ScanInsRec ) ) ) && + ( ! IsLynxEqui( ScanInsRec ) ) && + ( ScanRec->NAME == ScanInsRec->NAME ) ) + { + SetLynxEqui( ScanInsRec ); + + *Previous = ScanInsRec; + Previous = &LYNX_EQUI( ScanInsRec ); + } + } + } + } + } + } + } + + Index = Index + 1; + Layer = GET_LYNX_GRAPH_LAYER( RecLayer, Index ); + } + } + + ScanRec = EquiRec; + EquiRec = LYNX_EQUI( EquiRec ); + } + while ( EquiRec != (rdsrec_list *)0 ); + + SetLynxEndEqui( ScanRec ); + + Counter = Counter + 1; + } + } + } + } + } + + rdsend(); + return( Counter ); +} + +/*------------------------------------------------------------\ +| | +| LynxDumpAllEqui | +| | +\------------------------------------------------------------*/ + +void LynxDumpAllEqui( FigureRds, HeadEqui, Figure, Real ) + + rdsfig_list *FigureRds; + rdsrec_list *HeadEqui; + void *Figure; + char Real; +{ + rdsrec_list *ScanEqui; + + rdsbegin(); + + Lynxrecrdsmbk( Figure, FigureRds->LAYERTAB[ RDS_ABOX ], Real ); + + for ( ScanEqui = HeadEqui; + ScanEqui != (rdsrec_list *)0; + ScanEqui = LYNX_EQUI( ScanEqui ) ) + { + Lynxrecrdsmbk( Figure, ScanEqui, Real ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| LynxDumpEqui | +| | +\------------------------------------------------------------*/ + +void LynxDumpEqui( Figure, FirstEqui, Real ) + + void *Figure; + rdsrec_list *FirstEqui; + char Real; +{ + rdsbegin(); + + while ( FirstEqui != (rdsrec_list *)0 ) + { + Lynxrecrdsmbk( Figure, FirstEqui, Real ); + + if ( IsLynxEndEqui( FirstEqui ) ) break; + + FirstEqui = LYNX_EQUI( FirstEqui ); + } + + rdsend(); +} diff --git a/alliance/src/lynx/src/extract.h b/alliance/src/lynx/src/extract.h new file mode 100644 index 00000000..e91fb498 --- /dev/null +++ b/alliance/src/lynx/src/extract.h @@ -0,0 +1,113 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : LYNX | +| | +| File : extract.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.08.93 | +| | +\------------------------------------------------------------*/ + +# ifndef LYNX_EXTRACT +# define LYNX_EXTRACT + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define LYNX_TREAT_EQUI (long)0x00080000 +# define LYNX_END_EQUI (long)0x00100000 + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Lynx Equi | +| | +\------------------------------------------------------------*/ + +# define IsLynxEqui( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS & LYNX_TREAT_EQUI ) + +# define SetLynxEqui( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS |= LYNX_TREAT_EQUI ) + +# define ClearLynxEqui( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS &= ~LYNX_TREAT_EQUI ) + +/*------------------------------------------------------------\ +| | +| Lynx End Equi | +| | +\------------------------------------------------------------*/ + +# define IsLynxEndEqui( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS & LYNX_END_EQUI ) + +# define SetLynxEndEqui( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS |= LYNX_END_EQUI ) + +# define ClearLynxEndEqui( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS &= ~LYNX_END_EQUI ) + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern long LynxBuildEqui(); + extern void LynxDumpAllEqui(); + extern void LynxDumpEqui(); + +# endif diff --git a/alliance/src/lynx/src/flatrds.c b/alliance/src/lynx/src/flatrds.c new file mode 100644 index 00000000..9252e2a0 --- /dev/null +++ b/alliance/src/lynx/src/flatrds.c @@ -0,0 +1,144 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : RDS | +| | +| File : FlatRds.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.09.93 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include + +# include "mut.h" +# include "mph.h" +# include "rds.h" +# include "rwi.h" +# include "rut.h" +# include "rtl.h" +# include "rfm.h" +# include "rpr.h" + +/*------------------------------------------------------------\ +| | +| Banner | +| | +\------------------------------------------------------------*/ + +void Banner() +{ + alliancebanner_with_authors( "FlatRds", "1.02", + "Flatten RDS", "1994", + ALLIANCE_VERSION, "L.Jacomme, F.Petrot, F.Wajsburt" ); +} + +/*------------------------------------------------------------\ +| | +| Usage | +| | +\------------------------------------------------------------*/ + +void Usage() +{ + fprintf( stderr, "\n\tUsage : flatrds physical_figure instance output_name" ); + fprintf( stderr, "\n\t flatten the instance in the physical_figure" ); + fprintf( stderr, "\n\tUsage : flatrds -r physical_figure output_name" ); + fprintf( stderr, "\n\t flatten physical_figure to the catalog" ); + fprintf( stderr, "\n\tUsage : flatrds -t physical_figure output_name" ); + fprintf( stderr, "\n\t flatten physical_figure to the transistor\n\n" ); + + exit( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Main | +| | +\------------------------------------------------------------*/ + +int main( argc, argv ) + + int argc; + char *argv[]; +{ + rdsfig_list *Figure; + + Banner(); + + mbkenv(); + rdsenv(); + loadrdsparam(); + + if ( argc < 4 ) Usage(); + + if ( ! strcmp( "-r", argv[1] ) ) + { + Figure = getrdsfig( argv[2], 'A', 0 ); + + fprintf( stdout, "\n --> Flatten figure %s to the catalog\n", + Figure->NAME ); + + rflattenrdsfig( Figure, RDS_YES, RDS_YES ); + } + else + if ( ! strcmp( "-t", argv[1] ) ) + { + Figure = getrdsfig( argv[2], 'A', 0 ); + + fprintf( stdout, "\n --> Flatten figure %s to the transistor\n", + Figure->NAME ); + + rflattenrdsfig( Figure, RDS_YES, RDS_NO ); + } + else + { + Figure = getrdsfig( argv[1], 'A', 0 ); + + fprintf( stdout, "\n --> Flatten the instance %s in the figure %s\n", + argv[2], Figure->NAME ); + + flattenrdsfig( Figure, argv[2], RDS_YES ); + } + + Figure->NAME = namealloc( argv[3] ); + + fprintf( stdout, " --> Saving figure %s \n\n", Figure->NAME ); + + saverdsfig( Figure ); + + return( 0 ); +} diff --git a/alliance/src/lynx/src/hole.c b/alliance/src/lynx/src/hole.c new file mode 100644 index 00000000..0b474758 --- /dev/null +++ b/alliance/src/lynx/src/hole.c @@ -0,0 +1,216 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : LYNX | +| | +| File : hole.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 01.07.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "mlo.h" +# include "mph.h" +# include "rds.h" +# include "rwi.h" +# include "rut.h" +# include "rpr.h" +# include "rfm.h" + +# include "mbkrds.h" +# include "hole.h" +# include "box.h" +# include "error.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| LynxHoleFigure | +| | +\------------------------------------------------------------*/ + +void LynxHoleFigure( FigureHole, WindowRds, X1, Y1, X2, Y2, Layer ) + + rdsfig_list *FigureHole; + rdswindow *WindowRds; + long X1; + long Y1; + long X2; + long Y2; + int Layer; +{ + rdsrec_list *NewRec; + rdsrec_list *ScanRec; + rdswin_list *WinList; + rdswin_list *ScanWin; + rdswinrec_list *ScanWinRec; + lynxbox_list RectBox; + lynxbox_list HoleBox; + lynxbox_list *ScanBox; + lynxbox_list *HeadBox; + int ScanRecIndex; + long FirstX; + long WX1; + long WY1; + long WX2; + long WY2; + + HoleBox.NEXT = (lynxbox_list *)0; + RectBox.NEXT = (lynxbox_list *)0; + + HoleBox.X1 = X1; + HoleBox.Y1 = Y1; + HoleBox.X2 = X2; + HoleBox.Y2 = Y2; + + WY1 = ( Y1 - 1 - WindowRds->YMIN ) / WindowRds->SIDE; + WY2 = ( Y2 - WindowRds->YMIN ) / WindowRds->SIDE; + WX1 = ( X1 - 1 - WindowRds->XMIN ) / WindowRds->SIDE; + WX2 = ( X2 - WindowRds->XMIN ) / WindowRds->SIDE; + + if ( WX1 < 0 ) WX1 = 0; + if ( WX2 < 0 ) WX2 = 0; + if ( WX1 >= WindowRds->DX ) WX1 = WindowRds->DX - 1; + if ( WX2 >= WindowRds->DX ) WX2 = WindowRds->DX - 1; + + if ( WY1 < 0 ) WY1 = 0; + if ( WY2 < 0 ) WY2 = 0; + if ( WY1 >= WindowRds->DY ) WY1 = WindowRds->DY - 1; + if ( WY2 >= WindowRds->DY ) WY2 = WindowRds->DY - 1; + + FirstX = WX1; + + while ( WY1 <= WY2 ) + { + WinList = WindowRds->WINTAB + ( WY1 * WindowRds->DX ); + + WX1 = FirstX; + + while ( WX1 <= WX2 ) + { + ScanWin = WinList + WX1; + + if ( ScanWin->LAYERTAB != (rdswinrec_list **)NULL ) + { + for ( ScanWinRec = ScanWin->LAYERTAB[ Layer ]; + ScanWinRec != (rdswinrec_list *)NULL; + ScanWinRec = ScanWinRec->NEXT ) + { + for ( ScanRecIndex = 0; + ScanRecIndex < RWI_MAX_REC; + ScanRecIndex++ ) + { + ScanRec = ScanWinRec->RECTAB[ ScanRecIndex ]; + + if ( ( ScanRec == (rdsrec_list *)0 ) || + ( IsLynxDeleted( ScanRec ) ) ) continue; + + RectBox.X1 = ScanRec->X; + RectBox.Y1 = ScanRec->Y; + RectBox.X2 = ScanRec->DX + RectBox.X1; + RectBox.Y2 = ScanRec->DY + RectBox.Y1; + + if ( ( RectBox.X1 < X2 ) && + ( RectBox.Y1 < Y2 ) && + ( RectBox.X2 > X1 ) && + ( RectBox.Y2 > Y1 ) ) + { + HeadBox = LynxSplitBox( &HoleBox, &RectBox ); + + for ( ScanBox = HeadBox; + ScanBox != (lynxbox_list *)0; + ScanBox = ScanBox->NEXT ) + { + if ( ScanBox == HeadBox ) + { + ScanRec->X = ScanBox->X1; + ScanRec->Y = ScanBox->Y1; + ScanRec->DX = ScanBox->X2 - ScanBox->X1; + ScanRec->DY = ScanBox->Y2 - ScanBox->Y1; + } + else + { + NewRec = addrdsfigrec( FigureHole, (char *)0, Layer, + ScanBox->X1 , ScanBox->Y1, + ScanBox->X2 - ScanBox->X1, + ScanBox->Y2 - ScanBox->Y1 ); + + addrdsrecwindow( NewRec, WindowRds ); + } + } + + if ( HeadBox == (lynxbox_list *)0 ) + { + SetLynxDeleted( ScanRec ); + } + else + { + LynxDelAllBox( HeadBox ); + } + } + } + } + } + + WX1 = WX1 + 1; + } + + WY1 = WY1 + 1; + } +} diff --git a/alliance/src/lynx/src/hole.h b/alliance/src/lynx/src/hole.h new file mode 100644 index 00000000..68600750 --- /dev/null +++ b/alliance/src/lynx/src/hole.h @@ -0,0 +1,71 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : LYNX | +| | +| File : hole.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.07.95 | +| | +\------------------------------------------------------------*/ + +# ifndef LYNX_HOLE_H +# define LYNX_HOLE_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macros | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void LynxHoleFigure(); + +# endif diff --git a/alliance/src/lynx/src/inter.c b/alliance/src/lynx/src/inter.c new file mode 100644 index 00000000..0d24176f --- /dev/null +++ b/alliance/src/lynx/src/inter.c @@ -0,0 +1,59 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +#include +#include "rds.h" +#include "mut.h" +#include "inter.h" + +int Intersect(Rec_A, Rec_B) +rdsrec_list *Rec_A, *Rec_B; +{ + long xa1,ya1,xa2,ya2; /*Coordonnees du rectangle A */ + long xb1,yb1,xb2,yb2; /*Coordonnees du rectangle B */ + int DirA, DirB; /*Direction des mediannes des rectangles */ + + xa1=Rec_A->X; xb1=Rec_B->X; + xa2=Rec_A->X+Rec_A->DX; xb2=Rec_B->X+Rec_B->DX; + ya1=Rec_A->Y; yb1=Rec_B->Y; + ya2=Rec_A->Y+Rec_A->DY; yb2=Rec_B->Y+Rec_B->DY; + + if(GetRdsLayer(Rec_A)!=GetRdsLayer(Rec_B) && + !((GetRdsLayer(Rec_A)==RDS_POLY && GetRdsLayer(Rec_B)==RDS_GATE)|| + (GetRdsLayer(Rec_A)==RDS_GATE && GetRdsLayer(Rec_B)==RDS_POLY) )) + return(NON_INTERSECT); + if((ya2DY>rect->DX?VERT_DIR:HORIZ_DIR) + + diff --git a/alliance/src/lynx/src/interval.c b/alliance/src/lynx/src/interval.c new file mode 100644 index 00000000..64137a0e --- /dev/null +++ b/alliance/src/lynx/src/interval.c @@ -0,0 +1,471 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : LYNX | +| | +| File : inter.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 01.07.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "mlo.h" +# include "mph.h" +# include "rds.h" +# include "rwi.h" +# include "rut.h" +# include "rpr.h" +# include "rfm.h" + +# include "mbkrds.h" +# include "interval.h" +# include "error.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| LynxAddInterval | +| | +\------------------------------------------------------------*/ + +static lynxinter_list *LynxAddInterval( Min, Max ) + + long Min; + long Max; +{ + lynxinter_list *Interval; + + Interval = (lynxinter_list *)rdsallocheap( sizeof( lynxinter_list ) ); + Interval->MIN = Min; + Interval->MAX = Max; + + return( Interval ); +} + +/*------------------------------------------------------------\ +| | +| LynxDelInterval | +| | +\------------------------------------------------------------*/ + +static void LynxDelInterval( Interval ) + + lynxinter_list *Interval; +{ + rdsfreeheap( Interval, sizeof( lynxinter_list ) ); +} + +/*------------------------------------------------------------\ +| | +| LynxDelAllInterval | +| | +\------------------------------------------------------------*/ + +void LynxDelAllInterval( Interval ) + + lynxinter_list *Interval; +{ + lynxinter_list *ScanInter; + + ScanInter = Interval; + + while ( ScanInter != (lynxinter_list *)0 ) + { + Interval = ScanInter->NEXT; + rdsfreeheap( ScanInter, sizeof( lynxinter_list ) ); + ScanInter = Interval; + } +} + +/*------------------------------------------------------------\ +| | +| LynxViewInterval | +| | +\------------------------------------------------------------*/ + +# ifdef LYNX_DEBUG + +void LynxViewInterval( Interval ) + + lynxinter_list *Interval; +{ + lynxinter_list *ScanInter; + + fprintf( stdout, "-->Interval:\n" ); + + for ( ScanInter = Interval; + ScanInter != (lynxinter_list *)0; + ScanInter = ScanInter->NEXT ) + { + fprintf( stdout, "[%d,%d]", + ScanInter->MIN * SCALE_X / RDS_LAMBDA, + ScanInter->MAX * SCALE_X / RDS_LAMBDA ); + } + + fprintf( stdout, "<--Interval\n" ); +} + +# endif + +/*------------------------------------------------------------\ +| | +| LynxUnionInterval | +| | +\------------------------------------------------------------*/ + +lynxinter_list *LynxUnionInterval( Interval, Min, Max ) + + lynxinter_list *Interval; + long Min; + long Max; +{ + lynxinter_list *ScanInter; + lynxinter_list *NextInter; + lynxinter_list *NewInter; + lynxinter_list *DelInter; + lynxinter_list **PrevInter; + char Stop; + + ScanInter = Interval; + PrevInter = &Interval; + Stop = 0; + + while ( ( ScanInter != (lynxinter_list *)0 ) && + ( Stop == 0 ) ) + { + if ( Max < ScanInter->MIN ) + { + NewInter = LynxAddInterval( Min, Max ); + NewInter->NEXT = *PrevInter; + *PrevInter = NewInter; + + Stop = 1; + } + else + if ( Min > ScanInter->MAX ) + { + PrevInter = &ScanInter->NEXT; + ScanInter = ScanInter->NEXT; + } + else + if ( Max <= ScanInter->MAX ) + { + if ( Min < ScanInter->MIN ) + { + ScanInter->MIN = Min; + } + + Stop = 1; + } + else + { + if ( Min < ScanInter->MIN ) + { + ScanInter->MIN = Min; + } + + ScanInter->MAX = Max; + + NextInter = ScanInter->NEXT; + + while ( NextInter != (lynxinter_list *)0 ) + { + if ( NextInter->MAX <= Max ) + { + ScanInter->NEXT = NextInter->NEXT; + DelInter = NextInter; + NextInter = NextInter->NEXT; + + LynxDelInterval( DelInter ); + } + else + { + if ( NextInter->MIN <= Max ) + { + ScanInter->MAX = NextInter->MAX; + ScanInter->NEXT = NextInter->NEXT; + DelInter = NextInter; + + LynxDelInterval( DelInter ); + } + + break; + } + } + + Stop = 1; + } + } + + if ( ! Stop ) + { + NewInter = LynxAddInterval( Min, Max ); + *PrevInter = NewInter; + } + + return( Interval ); +} + +/*------------------------------------------------------------\ +| | +| LynxSplitInterval | +| | +\------------------------------------------------------------*/ + +lynxinter_list *LynxSplitInterval( Interval, Min, Max ) + + lynxinter_list *Interval; + long Min; + long Max; +{ + lynxinter_list *ScanInter; + lynxinter_list *NewInter; + lynxinter_list *DelInter; + lynxinter_list **PrevInter; + char Stop; + + ScanInter = Interval; + PrevInter = &Interval; + Stop = 0; + + while ( ( ScanInter != (lynxinter_list *)0 ) && + ( Stop == 0 ) ) + { + if ( Max < ScanInter->MIN ) + { + Stop = 1; + } + else + if ( Min > ScanInter->MAX ) + { + PrevInter = &ScanInter->NEXT; + ScanInter = ScanInter->NEXT; + } + else + if ( Max < ScanInter->MAX ) + { + if ( Min > ScanInter->MIN ) + { + NewInter = LynxAddInterval( ScanInter->MIN, Min ); + + *PrevInter = NewInter; + NewInter->NEXT = ScanInter; + } + + ScanInter->MIN = Max; + + Stop = 1; + } + else + { + if ( Min <= ScanInter->MIN ) + { + *PrevInter = ScanInter->NEXT; + DelInter = ScanInter; + ScanInter = ScanInter->NEXT; + + LynxDelInterval( DelInter ); + } + else + { + ScanInter->MAX = Min; + + PrevInter = &ScanInter->NEXT; + ScanInter = ScanInter->NEXT; + } + } + } + + return( Interval ); +} + +/*------------------------------------------------------------\ +| | +| LynxIntersectInterval | +| | +\------------------------------------------------------------*/ + +lynxinter_list *LynxIntersectInterval( Interval1, Interval2 ) + + lynxinter_list *Interval1; + lynxinter_list *Interval2; +{ + lynxinter_list *ScanInter1; + lynxinter_list *ScanInter2; + lynxinter_list *Interval; + lynxinter_list **PrevInter; + lynxinter_list *NewInter; + char Stop; + long Min; + long Max; + + PrevInter = &Interval; + Interval = (lynxinter_list *)0; + + ScanInter1 = Interval1; + ScanInter2 = Interval2; + + while ( ScanInter1 != (lynxinter_list *)0 ) + { + Stop = 0; + + while ( ( ScanInter2 != (lynxinter_list *)0 ) && + ( Stop == 0 ) ) + { + if ( ScanInter1->MAX <= ScanInter2->MIN ) + { + Stop = 1; + } + else + if ( ScanInter1->MIN < ScanInter2->MAX ) + { + if ( ScanInter1->MAX > ScanInter2->MAX ) + { + Max = ScanInter2->MAX; + } + else + { + Max = ScanInter1->MAX; + Stop = 1; + } + + if ( ScanInter1->MIN > ScanInter2->MIN ) + { + Min = ScanInter1->MIN; + } + else + { + Min = ScanInter2->MIN; + } + + NewInter = LynxAddInterval( Min, Max ); + *PrevInter = NewInter; + PrevInter = &NewInter->NEXT; + } + + if ( Stop == 0 ) ScanInter2 = ScanInter2->NEXT; + } + + ScanInter1 = ScanInter1->NEXT; + } + + return( Interval ); +} + +/*------------------------------------------------------------\ +| | +| LynxTestInterval | +| | +\------------------------------------------------------------*/ + +# ifdef LYNX_DEBUG + +void LynxTestInterval() +{ + lynxinter_list *Interval1; + lynxinter_list *Interval2; + lynxinter_list *Interval; + char Buffer[ 32 ]; + long Min; + long Max; + + Interval = (lynxinter_list *)0; + Interval1 = (lynxinter_list *)0; + Interval2 = (lynxinter_list *)0; + + fprintf( stdout, "Union Interval1\n" ); + + while ( fgets( Buffer, 32, stdin ) ) + { + if ( sscanf( Buffer, "%d %d", &Min, &Max ) != 2 ) break; + + Interval1 = LynxUnionInterval( Interval1, Min, Max ); + LynxViewInterval( Interval1 ); + } + + fprintf( stdout, "Split Interval1\n" ); + + while ( fgets( Buffer, 32, stdin ) ) + { + if ( sscanf( Buffer, "%d %d", &Min, &Max ) != 2 ) break; + + Interval1 = LynxSplitInterval( Interval1, Min, Max ); + LynxViewInterval( Interval1 ); + } + + fprintf( stdout, "Interval2\n" ); + + while ( fgets( Buffer, 32, stdin ) ) + { + if ( sscanf( Buffer, "%d %d", &Min, &Max ) != 2 ) break; + + Interval2 = LynxUnionInterval( Interval2, Min, Max ); + LynxViewInterval( Interval2 ); + + fprintf( stdout, "Intersect\n" ); + Interval = LynxIntersectInterval( Interval1, Interval2 ); + LynxViewInterval( Interval ); + LynxDelAllInterval( Interval ); + } + + LynxDelAllInterval( Interval1 ); + LynxDelAllInterval( Interval2 ); +} + +# endif diff --git a/alliance/src/lynx/src/interval.h b/alliance/src/lynx/src/interval.h new file mode 100644 index 00000000..1189153c --- /dev/null +++ b/alliance/src/lynx/src/interval.h @@ -0,0 +1,88 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : LYNX | +| | +| File : inter.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.07.95 | +| | +\------------------------------------------------------------*/ + +# ifndef LYNX_INTER_H +# define LYNX_INTER_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macros | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Lynx Interval List | +| | +\------------------------------------------------------------*/ + + typedef struct lynxinter_list + { + struct lynxinter_list *NEXT; + long MIN; + long MAX; + + } lynxinter_list; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern lynxinter_list *LynxUnionInterval(); + extern lynxinter_list *LynxSplitInterval(); + extern lynxinter_list *LynxIntersectInterval(); + extern void LynxDelAllInterval(); + +# endif diff --git a/alliance/src/lynx/src/lynx.c b/alliance/src/lynx/src/lynx.c new file mode 100644 index 00000000..964417ad --- /dev/null +++ b/alliance/src/lynx/src/lynx.c @@ -0,0 +1,507 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : LYNX | +| | +| File : lynx.c | +| | +| Author : Jacomme Ludovic | +| Grégoire Avot | +| Picault Stephane *4p* | +| | +| Date : 10.11.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "mlo.h" +# include "mph.h" +# include "mpu.h" +# include "mlu.h" +# include "rds.h" +# include "rwi.h" +# include "rut.h" +# include "rtl.h" +# include "rpr.h" +# include "rfm.h" + +# include "parse.h" +# include "mbkrds.h" +# include "pattern.h" +# include "cutelbow.h" +# include "extract.h" +# include "netlist.h" +# include "bulk.h" +# include "error.h" +# include "lynx.h" + +/************************************************************* +* MODIFICATIONS * +*************************************************************/ + +# include "addlynxrcn.h" + +/************************************************************* +* END OF MODIFICATIONS * +*************************************************************/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +static rdsfig_list *LynxFigureRds; +static phfig_list *LynxFigureMbk; +static lofig_list *LynxLogicalFigure; +static void *LynxFigureTrace; +static rdswindow *LynxWindow; +static rdsrec_list *LynxHeadEqui; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Presents | +| | +\------------------------------------------------------------*/ + +void LynxPresents() + +{ + alliancebanner_with_contrib( "Lynx", "1.21", + "Netlist extractor", "1998", + ALLIANCE_VERSION, + "Ludovic Jacomme and Gregoire Avot", + "Picault Stephane" ); +} + +/*------------------------------------------------------------\ +| | +| Usage | +| | +\------------------------------------------------------------*/ + +void LynxUsage() + +{ + fprintf( stderr, + "\n\tSyntax : lynx [-v] [-c] [ -f or -t ] [-nl] Input_name [ Output_name ]\n\n"); + + fprintf( stderr,"\t -v Sets verbose mode on\n"); + fprintf( stderr,"\t -r Extracts real layout\n"); + fprintf( stderr,"\t -c Generates a core file when an error occurs\n"); + fprintf( stderr,"\t -f Flattens the layout to the catalog level before extracting\n" ); + fprintf( stderr,"\t -t Flattens the layout to transistors level before extracting\n" ); + fprintf( stderr,"\t -ax Extracts analogics parameters (only for symbolic layout)\n"); + fprintf( stderr,"\t if x is c, capacitance are extracted\n"); + fprintf( stderr,"\t if x is r, rc are extracted\n"); + exit( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Main | +| | +\------------------------------------------------------------*/ + +int main( argc, argv) + + int argc; + char *argv[]; + +{ + long Number; + + char *Name; + char *LynxInputName = (char *)0; + char *LynxOutputName = (char *)0; + + char *LynxTraceMode = (char *)0; + char LynxTrace = LYNX_TRACE_NONE; + + char CoreFloat = LYNX_FALSE; + char Core = LYNX_FALSE; + char Verbose = LYNX_FALSE; + char Flatten = LYNX_FALSE; + char Transistor = LYNX_FALSE; + char Warning = LYNX_FALSE; + char Debug = LYNX_FALSE; + char Real = LYNX_FALSE; + char Rcnet = 0; + + LynxPresents(); + + if ( argc < 2 ) + { + LynxUsage(); + } + + mbkenv(); + rdsenv(); + + for ( Number = 1; + Number < argc; + Number++ ) + { + if ( ! strcmp( argv[ Number ], "-c" )) Core = LYNX_TRUE; + else + if ( ! strcmp( argv[ Number ], "-v" )) Verbose = LYNX_TRUE; + else + if ( ! strcmp( argv[ Number ], "-t" )) Transistor = LYNX_TRUE; + else + if ( ! strcmp( argv[ Number ], "-f" )) Flatten = LYNX_TRUE; + else + if ( ! strcmp( argv[ Number ], "-r" )) Real = LYNX_TRUE; + else + if ( ! strcmp( argv[ Number ], "-debug" )) Debug = LYNX_TRUE; + else + if ( ! strcmp( argv[ Number ], "-w" )) Warning = LYNX_TRUE; + else + if ( ! strcmp( argv[ Number ], "-ac" )) Rcnet = 'c'; + else + if ( ! strcmp( argv[ Number ], "-ar" )) Rcnet = 'r'; + else + if ( LynxInputName == 0 ) LynxInputName = argv[ Number ]; + else + if ( LynxOutputName == 0 ) LynxOutputName = argv[ Number ]; + else + LynxError( LYNX_ERROR_ILLEGAL_OPTION, argv[ Number ], 0 ); + } + + if ( LynxInputName == 0 ) + { + LynxError( LYNX_ERROR_ILLEGAL_FILENAME, argv[ Number - 1 ], 0 ); + } + + if ( LynxOutputName == 0 ) + { + LynxOutputName = LynxInputName; + } + + if ( Transistor && Flatten ) + { + LynxError( LYNX_ERROR_ILLEGAL_COMBINATION, "-t", "-f" ); + } + + if ( Real && Rcnet ) + { + LynxError( LYNX_ERROR_ILLEGAL_COMBINATION, "-r", "-n" ); + } + + LynxTraceMode = mbkgetenv( "LYNX_TRACE" ); + + if ( LynxTraceMode != (char *)0 ) + { + LynxTrace = LynxTraceMode[ 0 ] - '0'; + + if ( LynxTrace == LYNX_TRACE_EQUI ) + { + if ( LynxParseEqui() == LYNX_FALSE ) + { + LynxTrace = LYNX_TRACE_NONE; + } + } + + if ( LynxTrace > LYNX_MAX_TRACE ) + { + LynxTrace = LYNX_TRACE_NONE; + } + } + + if ( Debug ) + { + rdsdebug(); + } + + rdsbegin(); + + if ( Verbose ) + { + fprintf( stdout, "\t---> Parse technological file %s\n\n" , RDS_TECHNO_NAME ); + } + + loadrdsparam(); + + if ( Verbose ) + { + fprintf( stdout, "\t\t RDS_LAMBDA = %ld\n", RDS_LAMBDA ); + fprintf( stdout, "\t\t RDS_UNIT = %ld\n", RDS_UNIT ); + fprintf( stdout, "\t\t RDS_PHYSICAL_GRID = %ld\n", RDS_PHYSICAL_GRID ); + fprintf( stdout, "\t\t MBK_SCALE_X = %ld\n", SCALE_X ); + } + + if ( ! Real ) + { + LynxInitializeCutCxTable(); + } + + if ( ! Real ) + { + fprintf( stdout, "\n\t---> Extract symbolic figure %s\n", LynxInputName ); + + LynxFigureMbk = getphfig( LynxInputName, 'A' ); + + if ( Flatten || Transistor ) + { + if ( Verbose ) + { + fprintf( stdout, "\n\t\t---> Flatten figure\n"); + } + + rflattenphfig( LynxFigureMbk, YES, ( Flatten ) ? YES : NO ); + } + + if ( Verbose ) + { + fprintf( stdout, "\n\t\t---> Translate Mbk -> Rds\n\n"); + + } + + LynxFigureRds = Lynxfigmbkrds( LynxFigureMbk ); + + if ( LynxTrace == LYNX_TRACE_MBKRDS ) + { + LynxFigureTrace = (void *)addphfig( "trace_mbkrds" ); + Lynxfigrdsmbk( LynxFigureRds, LynxFigureTrace ); + LynxSaveFigure( LynxFigureTrace, Real ); + LynxDelFigure( LynxFigureTrace, Real ); + } + } + else + { + fprintf( stdout, "\n\t---> Extract real figure %s\n", LynxInputName ); + + LynxFigureRds = getrdsfig( LynxInputName, 'V', LYNX_MODE ); + + if ( Flatten || Transistor ) + { + if ( Verbose ) + { + fprintf( stdout, "\n\t\t---> Flatten figure\n"); + } + + rflattenrdsfig( LynxFigureRds, RDS_YES, ( Flatten ) ? RDS_YES : RDS_NO ); + } + + Lynxfigrds( LynxFigureRds ); + + if ( Verbose ) + { + fprintf( stdout, "\n\t\t---> Recognize Transistors\n"); + } + Number = LynxReconizeTransistor( LynxFigureRds ); + + if ( Verbose ) + { + fprintf( stdout, "\t\t<--- %ld\n", Number ); + } + + if ( LynxTrace == LYNX_TRACE_REAL ) + { + LynxFigureRds->NAME = namealloc( "trace_real" ); + saverdsfig( LynxFigureRds ); + } + } + + if ( Verbose ) + { + fprintf( stdout, "\t\t---> Build windows\n"); + } + LynxWindow = buildrdswindow( LynxFigureRds ); + + if ( LynxWindow->SIZE == 0 ) + { + LynxError( LYNX_ERROR_MASK_COUNTER_NULL, 0 , 0 ); + } + + if ( Verbose ) + { + fprintf( stdout, "\t\t<--- %ld\n", LynxWindow->SIZE ); + fprintf( stdout, "\n\t\t---> Rectangles : %ld", LynxWindow->MASK ); + fprintf( stdout, "\n\t\t---> Figure size : ( %6ld, %6ld )", + LynxWindow->XMIN * SCALE_X / RDS_LAMBDA, + LynxWindow->YMIN * SCALE_X / RDS_LAMBDA ); + fprintf( stdout, "\n\t\t ( %6ld, %6ld )\n", + LynxWindow->XMAX * SCALE_X / RDS_LAMBDA, + LynxWindow->YMAX * SCALE_X / RDS_LAMBDA ); + } + + LynxAddLayerImplicit( LynxFigureRds, LynxWindow); /*4p*/ + + if ( ! Real ) + { + if ( Verbose ) + { + fprintf( stdout, "\n\t\t---> Cut transistors\n"); + } + Number = LynxCutTransistorElbow( LynxFigureRds, LynxWindow, Core ); + + if ( Number == -1 ) + { + if ( Core ) + { + LynxWarning( LYNX_WARNING_CORE_FILE, "core_cx" ); + } + + LynxError( LYNX_ERROR_CUT_TRANSISTOR_ELBOW, 0, 0 ); + } + + if ( Verbose ) + { + fprintf( stdout, "\t\t<--- %ld", Number ); + } + } + + if ( Verbose ) + { + fprintf( stdout, "\n\t\t---> Build equis\n"); + } + Number = LynxBuildEqui( &LynxHeadEqui, LynxFigureRds, LynxWindow ); + + if ( LynxTrace == LYNX_TRACE_CHAIN ) + { + if ( ! Real ) + { + LynxFigureTrace = (void *)addphfig( "trace_chain" ); + } + else + { + LynxFigureTrace = (void *)addrdsfig( "trace_chain", 0 ); + } + + LynxDumpAllEqui( LynxFigureRds, LynxHeadEqui, LynxFigureTrace, Real ); + + LynxSaveFigure( LynxFigureTrace, Real ); + LynxDelFigure( LynxFigureTrace, Real ); + } + + if ( Verbose ) + { + fprintf( stdout, "\t\t<--- %ld\n", Number); + fprintf( stdout, "\t\t---> Delete windows\n"); + } + destroyrdswindow( LynxFigureRds, LynxWindow ); + + LynxLogicalFigure = addlofig( LynxOutputName ); + + if ( Verbose ) + { + fprintf( stdout, "\t\t---> Build signals\n"); + } + + Number = LynxBuildLogicalSignal( LynxFigureRds, LynxHeadEqui, + LynxLogicalFigure, Core, Real, + Rcnet, Warning ); + if ( Number < 0 ) + { + Number = -Number; + CoreFloat = LYNX_TRUE; + } + + if ( Verbose ) + { + fprintf( stdout, "\t\t<--- %ld\n", Number); + fprintf( stdout, "\t\t---> Build instances\n"); + } + Number = LynxBuildLogicalInstance( LynxFigureRds, LynxLogicalFigure ); + + if ( Verbose ) + { + fprintf( stdout, "\t\t<--- %ld\n", Number); + fprintf( stdout, "\t\t---> Build transistors\n"); + } + Number = LynxBuildLogicalTransistor( LynxFigureRds, LynxLogicalFigure ); + +/************************************************************* +* MODIFICATIONS * +*************************************************************/ + + lofigchain( LynxLogicalFigure ); + + if( Rcnet == 'r' ) + generate_RCN(LynxLogicalFigure); + +/************************************************************* +* END OF MODIFICATIONS * +*************************************************************/ + + if ( Verbose ) + { + fprintf( stdout, "\t\t<--- %ld\n", Number); + fprintf( stdout, "\t\t---> Save netlist\n\n"); + } + + delrdsfig( LynxFigureRds->NAME ); + + Name = LynxVectorizeConnector( LynxLogicalFigure ); + + if ( Name != (char *)0 ) + { + LynxError( LYNX_ERROR_MISSING_CONNECTOR, Name, 0 ); + } + + savelofig( LynxLogicalFigure ); + + fprintf( stdout, "\t<--- done !\n\n"); + + if ( CoreFloat ) + { + LynxWarning( LYNX_WARNING_CORE_FILE, "core_float" ); + } + + fprintf( stdout, "\t---> Total extracted capacitance\n" ); + fprintf( stdout, "\t<--- %.1fpF\n", LynxCapaInfo( LynxLogicalFigure ) ); + + rdsend(); + return( 0 ); +} diff --git a/alliance/src/lynx/src/lynx.h b/alliance/src/lynx/src/lynx.h new file mode 100644 index 00000000..495a6171 --- /dev/null +++ b/alliance/src/lynx/src/lynx.h @@ -0,0 +1,78 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : LYNX | +| | +| File : lynx.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.08.93 | +| | +\------------------------------------------------------------*/ + +# ifndef LYNX +# define LYNX + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define LYNX_TRACE_NONE 0 +# define LYNX_TRACE_MBKRDS 1 +# define LYNX_TRACE_CHAIN 2 +# define LYNX_TRACE_EQUI 3 +# define LYNX_TRACE_REAL 4 + +# define LYNX_MAX_TRACE 4 + +/*------------------------------------------------------------\ +| | +| Macros | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/lynx/src/lynxrcn.h b/alliance/src/lynx/src/lynxrcn.h new file mode 100644 index 00000000..1c3fa3bc --- /dev/null +++ b/alliance/src/lynx/src/lynxrcn.h @@ -0,0 +1,52 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/************************************************************* +* * +* * +* Changed by: Greg * +* Date: 10/07/95 * +* New file: . * +* Comments: * +* -Fichier des variables globales a verifier. * +* - * +* - * +* - * +*************************************************************/ + +#define RCN_FEQUI ((long)1972) +#define LYNX_DUMP ((long)1973) +#define RDSLOCON1 ((long)1974) /* Connecteur provenant de la figure */ +#define RDSLOCON2 ((long)1975) /* Connecteur provenant des instances */ +#define RDSLOCON3 ((long)1976) /* Connecteur provenant d'un transistor */ +#define RDSLOCON ((long)1977) /* Identificateur de LOCON dans la ptype d'un records */ +#define GRGVIA ((long)1978) /* Ident de regroupement des vias */ +#define INTER_PERPEN ((long)1979) +#define INTER_PARAL ((long)1980) +#define TMPLONODE ((long)1981) +#define RDSSIGNAL ((long)1982) /* Signal associe a un rectangle */ +#define RCN_SIG_PTR ((long)1984) diff --git a/alliance/src/lynx/src/mbkrds.c b/alliance/src/lynx/src/mbkrds.c new file mode 100644 index 00000000..ee60e15b --- /dev/null +++ b/alliance/src/lynx/src/mbkrds.c @@ -0,0 +1,872 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : LYNX | +| | +| File : mbkrds.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 01.08.93 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "mlo.h" +# include "mph.h" +# include "rds.h" +# include "rwi.h" +# include "rut.h" +# include "rpr.h" +# include "rfm.h" +# include "rtl.h" +# include "mpu.h" + +# include "mbkrds.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Local Variables | +| | +\------------------------------------------------------------*/ + + static int LynxConnectorOrientTable[ 4 ] = + + { + NORTH, SOUTH, EAST, WEST + }; + + static int LynxSegmentOrientTable[ 4 ] = + + { + UP, DOWN, RIGHT, LEFT + }; + + static char LynxNameBuffer[ 512 ]; + static char *LynxStaticRefRef = (char *)0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| LynxGetReferenceName | +| | +\------------------------------------------------------------*/ + +static char *LynxGetReferenceName( Name ) + + char *Name; +{ + char *ScanName; + + ScanName = strrchr( Name, '_' ); + + if ( ScanName != (char *)0 ) + { + strcpy( LynxNameBuffer, Name ); + + Name = strrchr( LynxNameBuffer, '_' ); + if ( Name != (char *)0 ) *Name = '\0'; + + Name = namealloc( LynxNameBuffer ); + } + + return( Name ); +} + +/*------------------------------------------------------------\ +| | +| LynxGetVectorName | +| | +\------------------------------------------------------------*/ + +static char *LynxGetVectorName( Name ) + + char *Name; +{ + char *ScanName; + + ScanName = strrchr( Name, ']' ); + + if ( ScanName != (char *)0 ) + { + strcpy( LynxNameBuffer, Name ); + + Name = strrchr( LynxNameBuffer, ']' ); + if ( Name != (char *)0 ) *Name = '\0'; + + Name = strrchr( LynxNameBuffer, '[' ); + if ( Name != (char *)0 ) *Name = ' '; + + Name = namealloc( LynxNameBuffer ); + } + + return( Name ); +} + +/*------------------------------------------------------------\ +| | +| Lynxsegmbkrds | +| | +\------------------------------------------------------------*/ + +void Lynxsegmbkrds( FigureRds, Segment ) + + rdsfig_list *FigureRds; + phseg_list *Segment; +{ + rdsrec_list *Rectangle; + rdsrec_list *ScanRec; + char Orient=0; + + rdsbegin(); + + ScanRec = Rectangle = segmbkrds( FigureRds, Segment, 1 ); + + if ( Rectangle == (rdsrec_list *)0 ) + { + rdsend(); + return; + } + + SetLynxFirstLink( Rectangle ); + + switch ( Segment->TYPE ) + { + case UP : Orient = LYNX_NORTH; + break; + case DOWN : Orient = LYNX_SOUTH; + break; + case LEFT : Orient = LYNX_WEST; + break; + case RIGHT : Orient = LYNX_EAST; + break; + } + + do + { + SetLynxAttribute( ScanRec, Segment->LAYER ); + SetLynxOrient( ScanRec, Orient ); + + LYNX_LINK( ScanRec ) = (rdsrec_list *)ScanRec->USER; + ScanRec = (rdsrec_list *)ScanRec->USER; + } + while ( ScanRec != Rectangle ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Lynxconmbkrds | +| | +\------------------------------------------------------------*/ + +void Lynxconmbkrds( FigureRds, Connector ) + + rdsfig_list *FigureRds; + phcon_list *Connector; +{ + rdsrec_list *Rectangle; + rdsrec_list *ScanRec; + char Orient=0; + + rdsbegin(); + + ScanRec = Rectangle = conmbkrds( FigureRds, Connector ); + + if ( Rectangle == (rdsrec_list *)0 ) + { + rdsend(); + return; + } + + SetLynxFirstLink( Rectangle ); + + switch( Connector->ORIENT ) + { + case NORTH : Orient = LYNX_NORTH; + break; + case SOUTH : Orient = LYNX_SOUTH; + break; + case EAST : Orient = LYNX_EAST; + break; + case WEST : Orient = LYNX_WEST; + break; + } + + do + { + SetLynxAttribute( ScanRec, Connector->LAYER ); + SetLynxOrient( ScanRec, Orient ); + + LYNX_LINK( ScanRec ) = (rdsrec_list *)ScanRec->USER; + ScanRec = (rdsrec_list *)ScanRec->USER; + } + while ( ScanRec != Rectangle ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Lynxrefmbkrds | +| | +\------------------------------------------------------------*/ + +void Lynxrefmbkrds( FigureRds, Reference ) + + rdsfig_list *FigureRds; + phref_list *Reference; +{ + rdsrec_list *Rectangle; + rdsrec_list *ScanRec; + char *ReferenceName; + + rdsbegin(); + + if ( LynxStaticRefRef == (char *)0 ) + { + LynxStaticRefRef = namealloc( "ref_ref" ); + } + + if ( Reference->FIGNAME == LynxStaticRefRef ) + { + rdsend(); + return; + } + + ScanRec = Rectangle = refmbkrds( FigureRds, Reference ); + + if ( Rectangle == (rdsrec_list *)0 ) + { + rdsend(); + return; + } + + SetLynxFirstLink( Rectangle ); + + if ( ( IsRdsRefCon( Rectangle ) ) && + ( Rectangle->NAME != (char *)0 ) ) + { + ReferenceName = LynxGetReferenceName( Rectangle->NAME ); + } + else + { + ReferenceName = Rectangle->NAME; + } + + do + { + ScanRec->NAME = ReferenceName; + + LYNX_LINK( ScanRec ) = (rdsrec_list *)ScanRec->USER; + ScanRec = (rdsrec_list *)ScanRec->USER; + } + while ( ScanRec != Rectangle ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Lynxviambkrds | +| | +\------------------------------------------------------------*/ + +void Lynxviambkrds( FigureRds, Via ) + + rdsfig_list *FigureRds; + phvia_list *Via; +{ + rdsrec_list *Rectangle; + rdsrec_list *ScanRec; + + rdsbegin(); + + ScanRec = Rectangle = viambkrds( FigureRds, Via, 1 ); + + if ( Rectangle == (rdsrec_list *)0 ) + { + rdsend(); + return; + } + + SetLynxFirstLink( Rectangle ); + + do + { + SetLynxAttribute( ScanRec, Via->TYPE ); + + LYNX_LINK( ScanRec ) = (rdsrec_list *)ScanRec->USER; + ScanRec = (rdsrec_list *)ScanRec->USER; + } + while ( ScanRec != Rectangle ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Lynxinsmbkrds | +| | +\------------------------------------------------------------*/ + +void Lynxinsmbkrds( FigureRds, InstanceMbk ) + + rdsfig_list *FigureRds; + phins_list *InstanceMbk; +{ + rdsrec_list *Rectangle; + rdsrec_list *DelRec; + rdsrec_list **Previous; + rdsins_list *InstanceRds; + int Layer; + + rdsbegin(); + + InstanceRds = insmbkrds( FigureRds, InstanceMbk, 'P', 1 ); + + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + Rectangle = InstanceRds->LAYERTAB[ Layer ]; + Previous = &InstanceRds->LAYERTAB[ Layer ]; + + while ( Rectangle != (rdsrec_list *)0 ) + { + if ( IsRdsRefRef( Rectangle ) ) + { + DelRec = Rectangle; + Rectangle = Rectangle->NEXT; + *Previous = Rectangle; + + freerdsrec( DelRec, FigureRds->SIZE ); + } + else + { + if ( ( IsRdsRefCon( Rectangle ) ) && + ( Rectangle->NAME != (char *)0 ) ) + { + Rectangle->NAME = LynxGetReferenceName( Rectangle->NAME ); + } + + LYNX_LINK( Rectangle ) = (rdsrec_list *)InstanceRds; + Previous = &Rectangle->NEXT; + Rectangle = Rectangle->NEXT; + } + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Lynxfigmbkrds | +| | +\------------------------------------------------------------*/ + +rdsfig_list *Lynxfigmbkrds( FigureMbk ) + + phfig_list *FigureMbk; +{ + rdsfig_list *FigureRds; + + rdsbegin(); + + FigureRds = addrdsfig( FigureMbk->NAME, LYNX_MODE ); + + aboxmbkrds( FigureMbk, FigureRds ); + + rdsbegin(); + + while ( FigureMbk->PHSEG != (phseg_list *)0 ) + { + Lynxsegmbkrds( FigureRds, FigureMbk->PHSEG, 1 ); + delphseg( FigureMbk, FigureMbk->PHSEG ); + } + + while ( FigureMbk->PHCON != (phcon_list *)0 ) + { + Lynxconmbkrds( FigureRds, FigureMbk->PHCON ); + delphcon( FigureMbk, FigureMbk->PHCON ); + } + + while ( FigureMbk->PHREF != (phref_list *)0 ) + { + Lynxrefmbkrds( FigureRds, FigureMbk->PHREF ); + delphref( FigureMbk, FigureMbk->PHREF ); + } + + while ( FigureMbk->PHVIA != (phvia_list *)0 ) + { + Lynxviambkrds( FigureRds, FigureMbk->PHVIA ); + delphvia( FigureMbk, FigureMbk->PHVIA ); + } + + while ( FigureMbk->PHINS != (phins_list *)0 ) + { + Lynxinsmbkrds( FigureRds, FigureMbk->PHINS ); + delphins( FigureMbk, FigureMbk->PHINS->INSNAME ); + } + + while ( HEAD_PHFIG != (phfig_list *)0 ) + { + delphfig( HEAD_PHFIG->NAME ); + } + + rdsend(); + return( FigureRds ); +} + +/*------------------------------------------------------------\ +| | +| LynxTreatRectangle | +| | +\------------------------------------------------------------*/ + +void LynxTreatRectangle( Rectangle ) + + rdsrec_list *Rectangle; +{ + rdsrec_list *ScanRec; + + rdsbegin(); + + ScanRec = Rectangle; + + do + { + SetLynxTreat( ScanRec ); + + ScanRec = LYNX_LINK( ScanRec ); + } + while ( ScanRec != Rectangle ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Lynxrecrdsmbk | +| | +\------------------------------------------------------------*/ + +void Lynxrecrdsmbk( Figure, Rectangle, Real ) + + void *Figure; + rdsrec_list *Rectangle; + char Real; +{ + rdsrec_list *ScanRec; + rdsins_list *InstanceRds; + + long X1; + long Y1; + long X2; + long Y2; + long Width; + char Orient; + int Layer; + int LayerRds; + long DLR; + long DWR; + long OFFSET; + long WS=0; + char TRANS; + char USE; + int Index; + + if ( Rectangle == (rdsrec_list *)0 ) return; + + rdsbegin(); + + if ( IsRdsFigRec( Rectangle ) ) + { + if ( ( ! IsLynxTreat( Rectangle ) ) && + ( ! IsLynxCut( Rectangle ) ) ) + { + if ( Real ) + { + LayerRds = GetRdsLayer( Rectangle ); + ScanRec = addrdsfigrec( Figure, Rectangle->NAME, LayerRds, + Rectangle->X , Rectangle->Y, + Rectangle->DX, Rectangle->DY ); + + if ( LayerRds != RDS_ABOX ) + { + SetLynxTreat( Rectangle ); + } + + rdsend(); + return; + } + else + if ( IsRdsFigure( Rectangle ) ) + { + ((phfig_list *)Figure)->XAB1 = Rectangle->X * SCALE_X / RDS_LAMBDA; + ((phfig_list *)Figure)->YAB1 = Rectangle->Y * SCALE_X / RDS_LAMBDA; + ((phfig_list *)Figure)->XAB2 = Rectangle->DX * SCALE_X / RDS_LAMBDA; + ((phfig_list *)Figure)->YAB2 = Rectangle->DY * SCALE_X / RDS_LAMBDA; + + ((phfig_list *)Figure)->XAB2 += ((phfig_list *)Figure)->XAB1; + ((phfig_list *)Figure)->YAB2 += ((phfig_list *)Figure)->YAB1; + + rdsend(); + return; + } + else + if ( IsRdsSegment( Rectangle ) ) + { + Orient = LynxSegmentOrientTable[ GetLynxOrient( Rectangle ) ]; + Layer = GetLynxAttribute( Rectangle ); + + while ( ! IsLynxFirstLink( Rectangle ) ) + { + Rectangle = LYNX_LINK( Rectangle ); + } + + Index = 0; + LayerRds = GET_SEGMENT_LAYER( Layer, 0 ); + + while ( LayerRds != RDS_SEGMENT_EMPTY ) + { + TRANS = GET_SEGMENT_TRANS( Layer, Index ); + USE = GET_SEGMENT_USE( Layer, Index ); + + if ( ( USE == RDS_USE_ALL ) || + ( USE == RDS_USE_EXTRACT ) ) + { + if ( TRANS == RDS_TRANS_VW ) + { + X1 = Rectangle->X; + Y1 = Rectangle->Y; + X2 = Rectangle->DX + X1; + Y2 = Rectangle->DY + Y1; + + DLR = GET_SEGMENT_DLR ( Layer, Index ); + DWR = GET_SEGMENT_DWR ( Layer, Index ); + OFFSET = GET_SEGMENT_OFFSET( Layer, Index ); + + switch ( Orient ) + { + case RIGHT : WS = Rectangle->DY - DWR; + X1 = X1 + DLR; + Y1 = Y1 + ( ( Rectangle->DY ) >> 1 ) + OFFSET; + X2 = X2 - DLR; + Y2 = Y2 - ( ( Rectangle->DY ) >> 1 ) + OFFSET; + + break; + + case LEFT : WS = Rectangle->DY - DWR; + X1 = X1 + DLR; + Y1 = Y1 + ( ( Rectangle->DY ) >> 1 ) - OFFSET; + X2 = X2 - DLR; + Y2 = Y2 - ( ( Rectangle->DY ) >> 1 ) - OFFSET; + + break; + + case UP : WS = Rectangle->DX - DWR; + X1 = X1 + ( ( Rectangle->DX ) >> 1 ) + OFFSET; + Y1 = Y1 + DLR; + X2 = X2 - ( ( Rectangle->DX ) >> 1 ) + OFFSET; + Y2 = Y2 - DLR; + + break; + + case DOWN : WS = Rectangle->DX - DWR; + X1 = X1 + ( ( Rectangle->DX ) >> 1 ) - OFFSET; + Y1 = Y1 + DLR; + X2 = X2 - ( ( Rectangle->DX ) >> 1 ) - OFFSET; + Y2 = Y2 - DLR; + + break; + } + + addphseg( Figure, + Layer, + WS * SCALE_X / RDS_LAMBDA, + X1 * SCALE_X / RDS_LAMBDA, + Y1 * SCALE_X / RDS_LAMBDA, + X2 * SCALE_X / RDS_LAMBDA, + Y2 * SCALE_X / RDS_LAMBDA, + Rectangle->NAME ); + break; + } + } + + Rectangle = LYNX_LINK( Rectangle ); + Index = Index + 1; + LayerRds = GET_SEGMENT_LAYER( Layer, Index ); + } + } + else + if ( IsRdsConnector( Rectangle ) ) + { + Orient = LynxConnectorOrientTable[ GetLynxOrient( Rectangle ) ]; + Layer = GetLynxAttribute( Rectangle ); + + X1 = Rectangle->X + ( Rectangle->DX >> 1 ); + Y1 = Rectangle->Y + ( Rectangle->DY >> 1 ); + + Width = ( Rectangle->DX > Rectangle->DY ) + ? Rectangle->DX : Rectangle->DY; + + addphcon( Figure, + Orient, + Rectangle->NAME, + X1 * SCALE_X / RDS_LAMBDA, + Y1 * SCALE_X / RDS_LAMBDA, + Layer, + Width * SCALE_X / RDS_LAMBDA ); + } + else + if ( IsRdsVia( Rectangle ) ) + { + X1 = Rectangle->X + ( Rectangle->DX >> 1 ); + Y1 = Rectangle->Y + ( Rectangle->DY >> 1 ); + + addphvia( Figure, + GetLynxAttribute( Rectangle ), + X1 * SCALE_X / RDS_LAMBDA, + Y1 * SCALE_X / RDS_LAMBDA, 0, 0, NULL ); + } + else + if ( IsRdsReference( Rectangle ) ) + { + X1 = Rectangle->X + ( Rectangle->DX >> 1 ); + Y1 = Rectangle->Y + ( Rectangle->DY >> 1 ); + + addphref( Figure, + ( IsRdsRefRef( Rectangle ) ) ? + "ref_ref" : "ref_con", + Rectangle->NAME, + X1 * SCALE_X / RDS_LAMBDA, + Y1 * SCALE_X / RDS_LAMBDA ); + } + + LynxTreatRectangle( Rectangle ); + } + } + else + { + InstanceRds = (rdsins_list *)LYNX_LINK( Rectangle ); + Rectangle = InstanceRds->LAYERTAB[ RDS_ABOX ]; + + if ( Rectangle != (rdsrec_list *)0 ) + { + if ( ! IsLynxTreat( Rectangle ) ) + { + if ( Real ) + { + addrdsins( Figure, + InstanceRds->FIGNAME, + InstanceRds->INSNAME, + InstanceRds->TRANSF, + InstanceRds->X, + InstanceRds->Y ); + } + else + { + addphins( Figure, + InstanceRds->FIGNAME, + InstanceRds->INSNAME, + InstanceRds->TRANSF, + Rectangle->X * SCALE_X / RDS_LAMBDA, + Rectangle->Y * SCALE_X / RDS_LAMBDA ); + } + + SetLynxTreat( Rectangle ); + } + } + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Lynxfigrdsmbk | +| | +\------------------------------------------------------------*/ + +void Lynxfigrdsmbk( FigureRds, Figure ) + + rdsfig_list *FigureRds; + void *Figure; +{ + rdsins_list *InstanceRds; + rdsrec_list *Rectangle; + int Layer; + + rdsbegin(); + + Lynxrecrdsmbk( Figure, FigureRds->LAYERTAB[ RDS_ABOX ], 0 ); + + for ( Layer = 0; Layer < RDS_ABOX; Layer++ ) + { + for ( Rectangle = FigureRds->LAYERTAB[ Layer ]; + Rectangle != (rdsrec_list *)0; + Rectangle = Rectangle->NEXT ) + { + Lynxrecrdsmbk( Figure, Rectangle, 0 ); + } + + } + + for ( InstanceRds = FigureRds->INSTANCE; + InstanceRds != (rdsins_list *)0; + InstanceRds = InstanceRds->NEXT ) + { + Lynxrecrdsmbk( Figure, InstanceRds->LAYERTAB[ RDS_ABOX ], 0 ); + } + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| Lynxfigrds | +| | +\------------------------------------------------------------*/ + +void Lynxfigrds( FigureRds ) + + rdsfig_list *FigureRds; +{ + rdsrec_list *Rectangle; + rdsins_list *Instance; + int Layer; + + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + for ( Rectangle = FigureRds->LAYERTAB[ Layer ]; + Rectangle != (rdsrec_list *)0; + Rectangle = Rectangle->NEXT ) + { + if ( Rectangle->NAME != (char *)0 ) + { + if ( IsRdsRefCon( Rectangle ) ) + { + Rectangle->NAME = LynxGetReferenceName( Rectangle->NAME ); + } + + Rectangle->NAME = LynxGetVectorName( Rectangle->NAME ); + } + } + } + + for ( Instance = FigureRds->INSTANCE; + Instance != (rdsins_list *)0; + Instance = Instance->NEXT ) + { + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + for ( Rectangle = Instance->LAYERTAB[ Layer ]; + Rectangle != (rdsrec_list *)0; + Rectangle = Rectangle->NEXT ) + { + if ( Rectangle->NAME != (char *)0 ) + { + if ( IsRdsRefCon( Rectangle ) ) + { + Rectangle->NAME = LynxGetReferenceName( Rectangle->NAME ); + } + + Rectangle->NAME = LynxGetVectorName( Rectangle->NAME ); + } + + LYNX_LINK( Rectangle ) = (rdsrec_list *)Instance; + } + } + } +} + +/*------------------------------------------------------------\ +| | +| LynxSaveFigure | +| | +\------------------------------------------------------------*/ + +void LynxSaveFigure( Figure, Real ) + + void *Figure; + char Real; +{ + if ( Real ) + { + saverdsfig( Figure ); + } + else + { + savephfig( Figure ); + } +} + +/*------------------------------------------------------------\ +| | +| LynxDelFigure | +| | +\------------------------------------------------------------*/ + +void LynxDelFigure( Figure, Real ) + + void *Figure; + char Real; +{ + if ( Real ) + { + delrdsfig( ((rdsfig_list *)Figure)->NAME ); + } + else + { + delphfig( ((phfig_list *)Figure)->NAME ); + } +} diff --git a/alliance/src/lynx/src/mbkrds.h b/alliance/src/lynx/src/mbkrds.h new file mode 100644 index 00000000..cb122010 --- /dev/null +++ b/alliance/src/lynx/src/mbkrds.h @@ -0,0 +1,242 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : LYNX | +| | +| File : mbkrds.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.08.93 | +| | +\------------------------------------------------------------*/ + +# ifndef LYNX_MBKRDS +# define LYNX_MBKRDS + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| General | +| | +\------------------------------------------------------------*/ + +# define LYNX_FALSE 0 +# define LYNX_TRUE 1 + +/*------------------------------------------------------------\ +| | +| Lynx Mode | +| | +\------------------------------------------------------------*/ + +# define LYNX_MODE (sizeof( lynxrec )) + +/*------------------------------------------------------------\ +| | +| Lynx Attributes | +| | +\------------------------------------------------------------*/ + +# define LYNX_TREAT (long)0x00020000 +# define LYNX_FIRST_LINK (long)0x00040000 + +/*------------------------------------------------------------\ +| | +| Lynx Orient | +| | +\------------------------------------------------------------*/ + +# define LYNX_NORTH (int)0 +# define LYNX_SOUTH (int)1 +# define LYNX_EAST (int)2 +# define LYNX_WEST (int)3 +# define LYNX_MAX_ORIENT (int)4 + +# define LYNX_NORTH_MASK (int)1 +# define LYNX_SOUTH_MASK (int)2 +# define LYNX_WEST_MASK (int)4 +# define LYNX_EAST_MASK (int)8 + +/*------------------------------------------------------------\ +| | +| Lynx Cut & Deleted | +| | +\------------------------------------------------------------*/ + +# define LYNX_CUT (long)0x00200000 +# define LYNX_DELETED (long)0x00400000 + +/*------------------------------------------------------------\ +| | +| Macros | +| | +\------------------------------------------------------------*/ + +# define IsLynxCut( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS & LYNX_CUT ) + +# define SetLynxCut( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS |= LYNX_CUT ) + +# define ClearLynxCut( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS &= ~LYNX_CUT ) + + +# define IsLynxDeleted( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS & LYNX_DELETED ) + +# define SetLynxDeleted( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS |= LYNX_DELETED ) + +# define ClearLynxDeleted( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS &= ~LYNX_DELETED ) + + +/*------------------------------------------------------------\ +| | +| Lynx Mode | +| | +\------------------------------------------------------------*/ + +# define LYNX_LINK( R ) \ + \ + (((lynxrec *)((char *)(R)+sizeof(rdsrec_list)))->LINK ) + +# define LYNX_EQUI( R ) \ + \ + (((lynxrec *)((char *)(R)+sizeof(rdsrec_list)))->EQUI ) + +/*------------------------------------------------------------\ +| | +| Mbk Attribute | +| | +\------------------------------------------------------------*/ + +# define SetLynxAttribute( Rectangle, Attribute ) \ + \ + ( ( Rectangle )->FLAGS |= (((long)Attribute) << 24 ) ) + +# define GetLynxAttribute( Rectangle ) \ + \ + ( ( ( ( Rectangle )->FLAGS ) >> 24 ) & 0x1F ) + +/*------------------------------------------------------------\ +| | +| Mbk Attribute | +| | +\------------------------------------------------------------*/ + +# define SetLynxOrient( Rectangle, Orient ) \ + \ + ( ( Rectangle )->FLAGS |= (((long)Orient) << 29 ) ) + +# define GetLynxOrient( Rectangle ) \ + \ + ( ( ( ( Rectangle )->FLAGS ) >> 29 ) & 0x7 ) + +/*------------------------------------------------------------\ +| | +| Lynx Treat | +| | +\------------------------------------------------------------*/ + +# define IsLynxTreat( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS & LYNX_TREAT ) + +# define SetLynxTreat( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS |= LYNX_TREAT ) + +# define ClearLynxTreat( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS &= ~LYNX_TREAT ) + +/*------------------------------------------------------------\ +| | +| Lynx First Link | +| | +\------------------------------------------------------------*/ + +# define IsLynxFirstLink( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS & LYNX_FIRST_LINK ) + +# define SetLynxFirstLink( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS |= LYNX_FIRST_LINK ) + +# define ClearLynxFirstLink( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS &= ~LYNX_FIRST_LINK ) + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct lynxrec + + { + rdsrec_list *EQUI; + rdsrec_list *LINK; + + } lynxrec; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern rdsfig_list* Lynxfigmbkrds __P((phfig_list* )); + extern void Lynxfigrds __P((rdsfig_list*)); + extern void Lynxfigrdsmbk __P((rdsfig_list*, void*)); + extern void LynxSaveFigure __P((void*,char)); + extern void LynxDelFigure __P((void*,char)); + extern void Lynxrecrdsmbk __P((void*,rdsrec_list*,char)); + +# endif diff --git a/alliance/src/lynx/src/netlist.c b/alliance/src/lynx/src/netlist.c new file mode 100644 index 00000000..c5dbd8e0 --- /dev/null +++ b/alliance/src/lynx/src/netlist.c @@ -0,0 +1,1113 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : LYNX | +| | +| File : netlist.c | +| | +| Authors : Jacomme Ludovic | +| Picault Stephane *4p* | +| | +| Date : 01.08.93 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include + +# include "mut.h" +# include "mlo.h" +# include "mlu.h" +# include "mph.h" +# include "rds.h" +# include "rwi.h" +# include "rut.h" +# include "rpr.h" +# include "rfm.h" + +/************************************************************* +* MODIFICATIONS * +*************************************************************/ +# include "rcn.h" +# include "lynxrcn.h" +/************************************************************* +* END OF MODIFICATIONS * +*************************************************************/ + +# include "parse.h" +# include "mbkrds.h" +# include "extract.h" +# include "netlist.h" +# include "error.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| LynxBuildLogicalSignal | +| | +\------------------------------------------------------------*/ + +long LynxBuildLogicalSignal( FigureRds, HeadEqui, LogicalFigure, Core, Real, Rcnet, Warning ) + + rdsfig_list *FigureRds; + rdsrec_list *HeadEqui; + lofig_list *LogicalFigure; + char Core; + char Real; + char Rcnet; + char Warning; +{ + void *FigureDumpFloat; + void *FigureDumpEqui; + void *FigureDumpScan; + + losig_list *Signal; + chain_list *SignalChain; + float SignalCapa; + float Capa; + char SignalFloat; + char FoundFloat; + char FoundScan; + long SignalIndex; + char SignalType; + + chain_list *ScanSignalChain; + chain_list *DeleteChain; + ptype_list *SignalPtype; + ptype_list *ScanPtype; + + char LayerMbk; + char LayerRds; + char Scan; + + char *ConnectorName=NULL; + locon_list *LogicalConnector; + + rdsrec_list *ScanEqui; + rdsrec_list *FirstEqui; + rdsrec_list *IndexEqui; + +/************************************************************* +* MODIFICATIONS * +*************************************************************/ + +/* +Cette liste contient la liste des rectangles connecteurs. */ + chain_list *RecConnector=NULL; + ptype_list *PtypeRec; + ptype_list *PrevFEQUI; + int DispWarning=0; + +/************************************************************* +* END OF MODIFICATIONS * +*************************************************************/ + + rdsbegin(); + + SignalIndex = 1; + SignalPtype = (ptype_list *)0; + Signal = (losig_list *)0; + SignalType = INTERNAL; + SignalCapa = 0.0; + SignalFloat = Core; + FoundFloat = 0; + FoundScan = 0; + + if ( ! Real ) + { + FigureDumpFloat = (void *)addphfig( "core_float" ); + FigureDumpEqui = (void *)addphfig( "core_equi" ); + FigureDumpScan = (void *)addphfig( "trace_equi" ); + } + else + { + FigureDumpFloat = (void *)addrdsfig( "core_float", 0 ); + FigureDumpEqui = (void *)addrdsfig( "core_equi" , 0 ); + FigureDumpScan = (void *)addrdsfig( "trace_equi", 0 ); + } + + Lynxrecrdsmbk( FigureDumpFloat, FigureRds->LAYERTAB[ RDS_ABOX ], Real ); + Lynxrecrdsmbk( FigureDumpEqui, FigureRds->LAYERTAB[ RDS_ABOX ], Real ); + Lynxrecrdsmbk( FigureDumpScan, FigureRds->LAYERTAB[ RDS_ABOX ], Real ); + + for ( FirstEqui = ScanEqui = HeadEqui; + ScanEqui != (rdsrec_list *)0; + ScanEqui = LYNX_EQUI( ScanEqui ) ) + { + if ( ! IsRdsTransGate( ScanEqui ) ) + { + Capa = GET_LYNX_SURFACE_CAPA_LAYER( GetRdsLayer( ScanEqui ) ); + + if ( Capa != RDS_LYNX_CAPA_EMPTY ) + { + SignalCapa += ( ScanEqui->DX * ScanEqui->DY ) * Capa; + } + + Capa = GET_LYNX_PERIMETER_CAPA_LAYER( GetRdsLayer( ScanEqui ) ); + + if ( Capa != RDS_LYNX_CAPA_EMPTY ) + { + if ( ScanEqui->DX > ScanEqui->DY ) + { + SignalCapa += ( ScanEqui->DX << 1 ) * Capa; + } + else + { + SignalCapa += ( ScanEqui->DY << 1 ) * Capa; + } + } + } + + if ( ScanEqui->NAME != (char *)0 ) + { + if ( ( ! IsRdsConInter( ScanEqui ) ) && + ( ( IsRdsFigRec( ScanEqui ) ) || + ( ! IsRdsRefCon( ScanEqui ) ) ) ) + { + for ( ScanPtype = SignalPtype; + ScanPtype != (ptype_list *)0; + ScanPtype = ScanPtype->NEXT ) + { + if ( (char *)(ScanPtype->DATA) == ScanEqui->NAME ) break; + } + + if ( ( IsRdsConExter( ScanEqui ) ) || + ( ( IsRdsFigRec( ScanEqui ) ) && + ( IsRdsRefCon( ScanEqui ) ) ) ) + { + SignalType = EXTERNAL; + ConnectorName = ScanEqui->NAME; + +/************************************************************* +* MODIFICATIONS * +*************************************************************/ + if( !IsRdsRefCon( ScanEqui ) ) + { + RecConnector=addchain(RecConnector,ScanEqui); + } + else + { + if( DispWarning==0 && Rcnet == 'r' ) + { + DispWarning=1; + fprintf( stderr,"\n\tWarning : Lynx found a refcon on a figure extracted with the option -ar.\n"); + fprintf( stderr,"\tit will not be possible to correctly use the extracted figure.\n" ); + } + } +/************************************************************* +* END OF MODIFICATIONS * +*************************************************************/ + + if ( ScanPtype == (ptype_list *)0 ) + { + SignalPtype = addptype + ( + SignalPtype, LYNX_ONLY_ONE, + (void *)( ScanEqui->NAME ) + ); + } + else + { + ScanPtype->TYPE = LYNX_ONLY_ONE; + } + } + else + { + if ( ScanPtype == (ptype_list *)0 ) + { + SignalPtype = addptype + ( + SignalPtype, LYNX_GOOD, + (void *)( ScanEqui->NAME ) + ); + } + } + } + } + + if ( Core ) + { + if ( IsRdsSegment( ScanEqui ) ) + { + if ( ( IsRdsConInter( ScanEqui ) ) || + ( IsRdsConExter( ScanEqui ) ) ) + { + SignalFloat = 0; + } + else + { + LayerMbk = GetLynxAttribute( ScanEqui ); + LayerRds = GetRdsLayer( ScanEqui ); + + if ( GET_LYNX_TRANSISTOR_TYPE( LayerMbk ) != + RDS_LYNX_TRANSISTOR_EMPTY ) + { + SignalFloat = 0; + } + } + } + else + if ( ( IsRdsConnector( ScanEqui ) ) || + ( IsRdsReference( ScanEqui ) ) ) + { + SignalFloat = 0; + } + } + + if ( IsLynxEndEqui( ScanEqui ) ) + { + if ( SignalFloat ) + { + LynxDumpEqui( FigureDumpFloat, FirstEqui, Real ); + FoundFloat = 1; + } + + if ( SignalPtype != (ptype_list *)0 ) + { + for ( Signal = LogicalFigure->LOSIG; + Signal != (losig_list *)0; + Signal = Signal->NEXT ) + { + for ( ScanPtype = SignalPtype; + ScanPtype != (ptype_list *)0; + ScanPtype = ScanPtype->NEXT ) + { + ScanSignalChain = Signal->NAMECHAIN; + + while ( ScanSignalChain != (chain_list *)0 ) + { + if ( ScanPtype->DATA == ScanSignalChain->DATA ) + { + DeleteChain = ScanSignalChain; + ScanSignalChain = ScanSignalChain->NEXT; + ScanPtype->TYPE = LYNX_BAD; + + Signal->NAMECHAIN = delchain + ( + Signal->NAMECHAIN, + DeleteChain + ); + } + else + { + ScanSignalChain = ScanSignalChain->NEXT; + } + } + } + } + } + + SignalChain = (chain_list *)0; + + if ( SignalType == EXTERNAL ) + { + for ( ScanPtype = SignalPtype; + ScanPtype != (ptype_list *)0; + ScanPtype = ScanPtype->NEXT ) + { + if ( ScanPtype->TYPE == LYNX_ONLY_ONE ) + { + SignalChain = addchain( SignalChain, ScanPtype->DATA ); + + break; + } + } + } + + if ( SignalChain == (chain_list *)0 ) + { + for ( ScanPtype = SignalPtype; + ScanPtype != (ptype_list *)0; + ScanPtype = ScanPtype->NEXT ) + { + if ( ScanPtype->TYPE == LYNX_GOOD ) + { + SignalChain = addchain( SignalChain, ScanPtype->DATA ); + } + } + } + + freeptype ( SignalPtype ); + + Signal = addlosig + ( + LogicalFigure, + SignalIndex, + SignalChain, + SignalType + ); + /* ajoute capa si Rcnet SignalCapa */ + +/************************************************************* +* MODIFICATIONS * +*************************************************************/ + Signal->USER=addptype(Signal->USER,RCN_FEQUI,addchain(NULL,FirstEqui) ); + + if( Rcnet == 'r' || Rcnet == 'c' ) + { + addlorcnet( Signal ); + setcapa( Signal, SignalCapa ); + } +/************************************************************* +* END OF MODIFICATIONS * +*************************************************************/ + + if ( ( Signal->NAMECHAIN != (chain_list *)0 ) && + ( Signal->NAMECHAIN->NEXT != (chain_list *)0 ) ) + { + Signal->NAMECHAIN->DATA = (void *)getsigname( Signal ); + freechain( Signal->NAMECHAIN->NEXT ); + Signal->NAMECHAIN->NEXT = (chain_list *)0; + } + + if ( SignalType == EXTERNAL ) + { + for ( LogicalConnector = LogicalFigure->LOCON; + LogicalConnector != (locon_list *)0; + LogicalConnector = LogicalConnector->NEXT ) + { + if ( LogicalConnector->NAME == ConnectorName ) break; + } + + if ( LogicalConnector == (locon_list *)0) + { + LogicalConnector = addlocon + ( + LogicalFigure, ConnectorName, + Signal, UNKNOWN + ); + +/************************************************************* +* MODIFICATIONS * +*************************************************************/ + +/* REPLACE + LogicalConnector->USER = (ptype_list *)FirstEqui; + WITH */ + + LogicalConnector->USER = addptype(LogicalConnector->USER,LYNX_DUMP,FirstEqui); + LogicalConnector->USER = addptype(LogicalConnector->USER,RDSLOCON1,RecConnector); + RecConnector=NULL; + +/************************************************************* +* END OF MODIFICATIONS * +*************************************************************/ + + } + else + { + if ( Core ) + { + LynxDumpEqui( FigureDumpEqui, + FirstEqui, Real ); + +/************************************************************* +* MODIFICATIONS * +*************************************************************/ + +/* REPLACE + LynxDumpEqui( FigureDumpEqui, + (rdsrec_list *)(LogicalConnector->USER), Real ); + WITH */ + LynxDumpEqui( FigureDumpEqui, + (rdsrec_list *)(getptype(LogicalConnector->USER,LYNX_DUMP)->DATA), Real ); +/************************************************************* +* END OF MODIFICATIONS * +*************************************************************/ + + } + + if ( Warning || isvdd(ConnectorName) || isvss(ConnectorName) ) + { + if( !isvdd(ConnectorName) && !isvss(ConnectorName) ) + LynxWarning( LYNX_WARNING_PHYSICAL_CONNECTOR, ConnectorName ); + + lofigchain( LogicalFigure ); + + freechain( ((chain_list*)( getptype( Signal->USER, RCN_FEQUI )->DATA ) ) ); + delptype( Signal->USER, RCN_FEQUI ); + + dellosig( LogicalFigure, SignalIndex ); + + Signal = LogicalConnector->SIG; + Signal->NAMECHAIN = addchain( Signal->NAMECHAIN, ConnectorName ); + + + PtypeRec = getptype( LogicalConnector->USER, RDSLOCON1 ); + (chain_list*)( PtypeRec->DATA) = append( (chain_list*)(PtypeRec->DATA), RecConnector ); + RecConnector = NULL; + + if( Rcnet == 'c' || Rcnet == 'r' ) + { + Signal->PRCN->CAPA = Signal->PRCN->CAPA + SignalCapa; + } + + PrevFEQUI = getptype( Signal->USER, RCN_FEQUI ); + ((chain_list*)(PrevFEQUI->DATA)) = addchain( ((chain_list*)(PrevFEQUI->DATA)), FirstEqui ); + + } + else + { + if ( Core ) + { + LynxWarning( LYNX_WARNING_CORE_FILE, "core_equi" ); + + LynxSaveFigure( FigureDumpEqui, Real ); + } + + LynxError( LYNX_ERROR_PHYSICAL_CONNECTOR, ConnectorName, 0 ); + } + } + + IndexEqui = FirstEqui; + + Scan = (LynxScanEqui != (chain_list *)0); + + for ( IndexEqui = FirstEqui; + IndexEqui != LYNX_EQUI( ScanEqui ); + IndexEqui = LYNX_EQUI( IndexEqui ) ) + { + if ( ( IsRdsConExter( IndexEqui ) ) || + ( ( IsRdsFigRec( IndexEqui ) ) && + ( IsRdsRefCon( IndexEqui ) ) ) ) + { + if ( Scan ) + { + if ( IsLynxScanEqui( LynxScanEqui, IndexEqui->NAME ) ) + { + LynxDumpEqui( FigureDumpScan, FirstEqui, Real ); + Scan = 0; + FoundScan = 1; + } + } + + if ( IndexEqui->NAME != ConnectorName ) + { + if ( Core ) + { + LynxWarning( LYNX_WARNING_CORE_FILE, "core_equi" ); + + LynxDumpEqui( FigureDumpEqui, FirstEqui, Real ); + + LynxSaveFigure( FigureDumpEqui, Real ); + } + + LynxError( LYNX_ERROR_PHYSICAL_CONNECTORS, IndexEqui->NAME, ConnectorName ); + } + } + + IndexEqui->USER = addptype( IndexEqui->USER, RDSSIGNAL, (void *)Signal ); + } + } + else + { + for ( IndexEqui = FirstEqui; + IndexEqui != LYNX_EQUI( ScanEqui ); + IndexEqui = LYNX_EQUI( IndexEqui ) ) + { + IndexEqui->USER = addptype( IndexEqui->USER, RDSSIGNAL, (void *)Signal ); + } + } + + SignalCapa = 0.0; + SignalPtype = (ptype_list *)0; + SignalType = INTERNAL; + SignalFloat = Core; + SignalIndex = SignalIndex + 1; + + FirstEqui = LYNX_EQUI( ScanEqui ); + } + } + + SignalIndex = SignalIndex - 1; + + if ( FoundScan ) + { + LynxSaveFigure( FigureDumpScan, Real ); + } + + if ( FoundFloat ) + { + LynxSaveFigure( FigureDumpFloat, Real ); + + SignalIndex = - SignalIndex; + } + + rdsend(); + return( SignalIndex ); +} + +/*------------------------------------------------------------\ +| | +| LynxBuildLogicalInstance | +| | +\------------------------------------------------------------*/ + +long LynxBuildLogicalInstance( FigureRds, LogicalFigure ) + + rdsfig_list *FigureRds; + lofig_list *LogicalFigure; +{ + chain_list *SignalChain; + chain_list *ScanChain; + chain_list *NameChain; + + lofig_list *Model; + lofig_list *HeadModel; + loins_list *LogicalInstance; + rdsins_list *InstanceRds; + + rdsrec_list *Rec; + char *RecName; + + int Layer; + char BuildModel; + long Counter; +/************************************************************* +* MODIFICATIONS * +*************************************************************/ + chain_list *RDSConChain=NULL; + chain_list *HEADRDSConChain=NULL; + chain_list *ScanRDSConChain=NULL; + locon_list *ScanLocon=NULL; +/************************************************************* +* END OF MODIFICATIONS * +*************************************************************/ + + rdsbegin(); + Counter = 0; + + for ( InstanceRds = FigureRds->INSTANCE; + InstanceRds != (rdsins_list *)0; + InstanceRds = InstanceRds->NEXT ) + { + SignalChain = (chain_list *)0; + NameChain = (chain_list *)0; + Model = (lofig_list *)0; + HeadModel = (lofig_list *)0; + + if ( ! ( BuildModel = ( HeadModel == (lofig_list *)0 ))) + { + Model = getlomodel + ( + HeadModel, + InstanceRds->FIGNAME + ); + + BuildModel = ( Model == (lofig_list *)0); + } + + if ( BuildModel ) + { + Model = HeadModel = addlomodel + ( + HeadModel, + InstanceRds->FIGNAME + ); + } + + for ( Layer = 0; Layer < RWI_MAX_LAYER; Layer++ ) + { + for ( Rec = InstanceRds->LAYERTAB[ Layer ]; + Rec != (rdsrec_list *)0; + Rec = Rec->NEXT ) + { + + if ( ( ! IsRdsConInter( Rec ) ) && + ( ! IsRdsRefCon( Rec ) ) ) continue; + + RecName = Rec->NAME; +/************************************************************* +* MODIFICATIONS * +*************************************************************/ + +/* REPLACE + for ( ScanChain = NameChain; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + if ( (char *)ScanChain->DATA == RecName ) break; + } + WITH */ + for ( ScanChain = NameChain, ScanRDSConChain=RDSConChain; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT, ScanRDSConChain=ScanRDSConChain->NEXT ) + { + if ( ( (char *)ScanChain->DATA == RecName ) && + ! IsRdsRefCon( Rec ) + ) + { + ScanRDSConChain->DATA=addchain(ScanRDSConChain->DATA,Rec); + } + if ( (char *)ScanChain->DATA == RecName ) break; + } +/************************************************************* +* END OF MODIFICATIONS * +*************************************************************/ + + if ( ScanChain == (chain_list *)0 ) + { + NameChain = addchain + ( + NameChain, + RecName + ); + + if ( BuildModel ) + { + addlocon + ( + Model, RecName, + (losig_list *)0, + UNKNOWN + ); + } + + SignalChain = addchain + ( + SignalChain, + getptype( Rec->USER , RDSSIGNAL )->DATA + ); +/************************************************************* +* MODIFICATIONS * +*************************************************************/ + if( ! IsRdsRefCon( Rec ) ) + RDSConChain = addchain(RDSConChain,addchain(NULL,Rec)); + else + RDSConChain = addchain(RDSConChain,NULL); +/************************************************************* +* END OF MODIFICATIONS * +*************************************************************/ + } + } + } + + Counter = Counter + 1; + LogicalInstance = addloins + ( + LogicalFigure, + InstanceRds->INSNAME, + Model, SignalChain + ); + +/************************************************************* +* MODIFICATIONS * +*************************************************************/ + HEADRDSConChain=RDSConChain; + for(ScanLocon=LogicalInstance->LOCON; ScanLocon; ScanLocon=ScanLocon->NEXT) + { + ScanLocon->USER=addptype(ScanLocon->USER,RDSLOCON2,RDSConChain->DATA); + RDSConChain=RDSConChain->NEXT; + } + freechain(HEADRDSConChain); +/************************************************************* +* END OF MODIFICATIONS * +*************************************************************/ + + freechain( NameChain ); + } + + rdsend(); + return( Counter ); +} + + +/*------------------------------------------------------------\ +| | +| LynxTreatTransistor | +| | +\------------------------------------------------------------*/ + +void LynxTreatTransistor( Rectangle ) + + rdsrec_list *Rectangle; +{ + rdsrec_list *ScanRec; + + rdsbegin(); + + ScanRec = Rectangle; + + do + { + SetLynxTreatTransistor( ScanRec ); + + ScanRec = LYNX_LINK( ScanRec ); + } + while ( ScanRec != Rectangle ); + + rdsend(); +} + +/*------------------------------------------------------------\ +| | +| LynxBuildLogicalTransistor | +| | +\------------------------------------------------------------*/ + + +long LynxBuildLogicalTransistor( FigureRds, LogicalFigure ) + + rdsfig_list *FigureRds; + lofig_list *LogicalFigure; +{ + rdsrec_list *Gate; + rdsrec_list *Source; + rdsrec_list *Drain; + rdsrec_list *Diff; + rdsrec_list *Bulk; /*4p*/ + int BulkLayer; /*4p*/ + int GateLayer; + int DiffLayer; + int RdsLayer; + int MbkLayer; + int Orient; + long Width; + long Length; + long Ps; + long Pd; + long Xs; + long Xd; + long Counter; + long DiffMin; + long DiffMax; + long GateMin; + long GateMax; + int TransLayer; + int TransType; + int tridx = 1; + char trname[16]; + ptype_list *ptlbulk; + /************************************************************* +* MODIFICATIONS * +*************************************************************/ + lotrs_list *xxx_trs; +/************************************************************* +* END OF MODIFICATIONS * +*************************************************************/ + + rdsbegin(); + + Counter = 0; + + for ( TransLayer = 0; TransLayer < MBK_MAX_LAYER; TransLayer++ ) + { + TransType = GET_LYNX_TRANSISTOR_TYPE( TransLayer ); + GateLayer = GET_LYNX_TRANSISTOR_GATE_LAYER( TransLayer ); + DiffLayer = GET_LYNX_TRANSISTOR_DIFF_LAYER( TransLayer ); + BulkLayer = GET_LYNX_TRANSISTOR_BULK_LAYER( TransLayer ); /*4p*/ + + if ( ( TransType == RDS_LYNX_TRANSISTOR_EMPTY ) || + ( GateLayer == RDS_LYNX_TRANSISTOR_EMPTY ) || + ( DiffLayer == RDS_LYNX_TRANSISTOR_EMPTY ) || + ( BulkLayer == RDS_LYNX_TRANSISTOR_EMPTY )) continue; /*4p*/ + + + if ( TransType == NTRANS ) TransType = TRANSN; + else TransType = TRANSP; + + for ( Gate = FigureRds->LAYERTAB[ GateLayer ]; + Gate != (rdsrec_list *)0; + Gate = Gate->NEXT ) + { + if ( ( ! IsLynxTreatTransistor( Gate ) ) && + ( IsRdsSegment( Gate ) ) ) + { + MbkLayer = GetLynxAttribute( Gate ); + + if ( MbkLayer == TransLayer ) + { + LynxTreatTransistor( Gate ); + + Orient = GetLynxOrient( Gate ); + Source = (rdsrec_list *)0; + Drain = (rdsrec_list *)0; + /* Modif Ludo : 4p is a b... */ + Bulk = (rdsrec_list *)0; + + if ( ( Orient == LYNX_NORTH ) || + ( Orient == LYNX_SOUTH ) ) + { + GateMin = Gate->X; + GateMax = GateMin + Gate->DX; + DiffMin = 0; + DiffMax = 0; + + Diff = LYNX_LINK( Gate ); + + while( Diff != Gate ) + { + RdsLayer = GetRdsLayer( Diff ); + + if ( RdsLayer == DiffLayer ) + { + if ( Source == (rdsrec_list *)0 ) + { + DiffMin = Diff->Y; + DiffMax = DiffMin + Diff->DY; + Source = Diff; + } + else + if ( Drain == (rdsrec_list *)0 ) + { + Drain = Diff; + } + + if ( DiffMin > Diff->Y ) DiffMin = Diff->Y; + if ( DiffMax < ( Diff->Y + Diff->DY ) ) DiffMax = Diff->Y + Diff->DY; + } + else + if ( RdsLayer == GateLayer ) + { + if ( GateMin > Diff->X ) GateMin = Diff->X; + if ( GateMax < ( Diff->X + Diff->DX ) ) GateMax = Diff->X + Diff->DX; + } + else + if ( RdsLayer == BulkLayer ) + { + Bulk = Diff; + } + Diff = LYNX_LINK( Diff ); + } + } + else + { + GateMin = Gate->Y; + GateMax = GateMin + Gate->DY; + DiffMin = 0; + DiffMax = 0; + + Diff = LYNX_LINK( Gate ); + + while( Diff != Gate ) + { + RdsLayer = GetRdsLayer( Diff ); + + if ( RdsLayer == DiffLayer ) + { + if ( Source == (rdsrec_list *)0 ) + { + DiffMin = Diff->X; + DiffMax = DiffMin + Diff->DX; + Source = Diff; + } + else + if ( Drain == (rdsrec_list *)0 ) + { + Drain = Diff; + } + + if ( DiffMin > Diff->X ) DiffMin = Diff->X; + if ( DiffMax < ( Diff->X + Diff->DX ) ) DiffMax = Diff->X + Diff->DX; + } + else + if ( RdsLayer == GateLayer ) + { + if ( GateMin > Diff->Y ) GateMin = Diff->Y; + if ( GateMax < ( Diff->Y + Diff->DY ) ) GateMax = Diff->Y + Diff->DY; + } + else + if ( RdsLayer == BulkLayer ) + { + Bulk = Diff; + } + + Diff = LYNX_LINK( Diff ); + } + } + + Length = GateMax - GateMin; + Width = DiffMax - DiffMin; + + if ( ( Source != (rdsrec_list *)0 ) && + ( Drain != (rdsrec_list *)0 ) ) + { + Ps = ( Source->DX << 1 ) + ( Source->DY << 1 ); + Pd = ( Drain->DX << 1 ) + ( Drain->DY << 1 ); + Xs = ( Source->DX * Source->DY ) / Width; + Xd = ( Drain->DX * Drain->DY ) / Width; + +/************************************************************* +* MODIFICATIONS * +*************************************************************/ + + + sprintf( trname, "tr_%05d", tridx++ ); + { + /* Modif Ludo : 4p is a b... */ + if ( Bulk != (rdsrec_list *)0 ) ptlbulk = getptype( Bulk->USER, RDSSIGNAL ); + else ptlbulk = (ptype_list *)0; + + xxx_trs=addlotrs + ( + LogicalFigure, + TransType, + ( Gate->X + ( Gate->DX >> 1 ) ) * SCALE_X / RDS_UNIT, + ( Gate->Y + ( Gate->DY >> 1 ) ) * SCALE_X / RDS_UNIT, + Width * SCALE_X / RDS_UNIT, + Length * SCALE_X / RDS_UNIT, + Ps * SCALE_X / RDS_UNIT, + Pd * SCALE_X / RDS_UNIT, + Xs * SCALE_X / RDS_UNIT, + Xd * SCALE_X / RDS_UNIT, + (losig_list*)(getptype( Gate->USER, RDSSIGNAL )->DATA), + (losig_list*)(getptype( Source->USER, RDSSIGNAL )->DATA), + (losig_list*)(getptype( Drain->USER, RDSSIGNAL )->DATA), + ptlbulk ? (losig_list*)( ptlbulk->DATA ) : NULL , + (Gate->NAME) ? Gate->NAME : namealloc(trname) + ); + } + +/* En attendant la rectification de mbk_lo.c */ + xxx_trs->DRAIN->USER=NULL; + xxx_trs->GRID->USER=NULL; + xxx_trs->SOURCE->USER=NULL; + xxx_trs->DRAIN->NEXT=NULL; + xxx_trs->GRID->NEXT=NULL; + xxx_trs->SOURCE->NEXT=NULL; + xxx_trs->BULK->USER=NULL; + xxx_trs->BULK->NEXT=NULL; + +/* Ajoute dans une ptype les rectangles connecteur */ + xxx_trs->DRAIN->USER=addptype(xxx_trs->DRAIN->USER,RDSLOCON3,addchain(NULL,Drain)); + xxx_trs->GRID->USER=addptype(xxx_trs->GRID->USER,RDSLOCON3,addchain(NULL,Gate)); + xxx_trs->SOURCE->USER=addptype(xxx_trs->SOURCE->USER,RDSLOCON3,addchain(NULL,Source)); + /* Modif Ludo : 4p is a b... */ + if ( Bulk != (rdsrec_list *)0 ) + { + xxx_trs->BULK->USER=addptype(xxx_trs->BULK->USER,RDSLOCON3,addchain(NULL,Bulk)); + } +/************************************************************* +* END OF MODIFICATIONS * +*************************************************************/ + + Counter = Counter + 1; + } + else + { + LynxError( LYNX_ERROR_TRANSISTOR_LOGICAL, + (char *)( ( Gate->X + ( Gate->DX >> 1 ) ) / RDS_UNIT ), + (char *)( ( Gate->Y + ( Gate->DY >> 1 ) ) / RDS_UNIT ) ); + } + } + } + } + } + + rdsend(); + return( Counter ); +} + +/*------------------------------------------------------------\ +| | +| LynxVectorizeConnector | +| | +\------------------------------------------------------------*/ + +char *LynxVectorizeConnector( LogicalFigure ) + + lofig_list *LogicalFigure; + { + loins_list *Instance; + + rdsbegin(); + + if ( LogicalFigure->LOCON == (locon_list *)0 ) + { + rdsend(); + return( LogicalFigure->NAME ); + } + + sortlocon( &LogicalFigure->LOCON ); + LogicalFigure->LOCON = (locon_list *)reverse( (chain_list *)LogicalFigure->LOCON ); + + for ( Instance = LogicalFigure->LOINS; + Instance != (loins_list *)0; + Instance = Instance->NEXT ) + { + if ( Instance->LOCON == (locon_list *)0 ) + { + rdsend(); + return( Instance->INSNAME ); + } + + sortlocon( &Instance->LOCON ); + Instance->LOCON = (locon_list *)reverse( (chain_list *)Instance->LOCON ); + } + + rdsend(); + return( (char *)0 ); + } + +float LynxCapaInfo( LogicalFigure ) + lofig_list *LogicalFigure; +{ + losig_list *scanlosig; + float cumulcapa; + + cumulcapa = 0.0; + for( scanlosig = LogicalFigure->LOSIG ; + scanlosig ; + scanlosig = scanlosig->NEXT + ) + { + if( scanlosig->PRCN ) + { + if( scanlosig->PRCN->PWIRE || scanlosig->PRCN->PCTC ) + rcncalccapa( scanlosig ); + cumulcapa+=scanlosig->PRCN->CAPA; + } + } + + return( cumulcapa ); +} diff --git a/alliance/src/lynx/src/netlist.h b/alliance/src/lynx/src/netlist.h new file mode 100644 index 00000000..94846555 --- /dev/null +++ b/alliance/src/lynx/src/netlist.h @@ -0,0 +1,95 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : LYNX | +| | +| File : netlist.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.08.93 | +| | +\------------------------------------------------------------*/ + +# ifndef LYNX_NETLIST +# define LYNX_NETLIST + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define LYNX_BAD 0x00 +# define LYNX_GOOD 0x01 +# define LYNX_ONLY_ONE 0x03 + +# define LYNX_TREAT_TRANSISTOR (long)0x00800000 + +/*------------------------------------------------------------\ +| | +| Macros | +| | +\------------------------------------------------------------*/ + +# define IsLynxTreatTransistor( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS & LYNX_TREAT_TRANSISTOR ) + +# define SetLynxTreatTransistor( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS |= LYNX_TREAT_TRANSISTOR ) + +# define ClearLynxTreatTransistor( Rectangle ) \ + \ + ( ( Rectangle )->FLAGS &= ~LYNX_TREAT_TRANSISTOR ) + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern long LynxBuildLogicalSignal(); + extern long LynxBuildLogicalInstance(); + extern long LynxBuildLogicalTransistor(); + extern char *LynxVectorizeConnector(); + extern float LynxCapaInfo(); + +# endif diff --git a/alliance/src/lynx/src/parse.c b/alliance/src/lynx/src/parse.c new file mode 100644 index 00000000..8f8d6a60 --- /dev/null +++ b/alliance/src/lynx/src/parse.c @@ -0,0 +1,136 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : LYNX | +| | +| File : Parse.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 01.08.93 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include + +# include "mut.h" +# include "mlo.h" +# include "mph.h" +# include "rds.h" + +# include "parse.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + chain_list *LynxScanEqui = (chain_list *)0; + + static char LynxBuffer[ 256 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| IsLynxScanEqui | +| | +\------------------------------------------------------------*/ + +char IsLynxScanEqui( LynxEqui, Name ) + + chain_list *LynxEqui; + char *Name; +{ + chain_list *Index; + + rdsbegin(); + + for ( Index = LynxEqui; + Index != (chain_list *)0; + Index = Index->NEXT ) + { + if ( (char *)(Index->DATA) == Name ) break; + } + + rdsend(); + return ( Index != (chain_list *)0 ); +} + +/*------------------------------------------------------------\ +| | +| LynxParseEqui | +| | +\------------------------------------------------------------*/ + +char LynxParseEqui() + +{ + FILE *LynxFile; + + rdsbegin(); + + if ( ( LynxFile = fopen( "LYNX_EQUI", "r" ) ) == (FILE *)0 ) + { + rdsend(); + return( 0 ); + } + + while ( fgets( LynxBuffer, LYNX_BUFFER_SIZE, LynxFile ) != (char *)0 ) + { + LynxBuffer[ strlen( LynxBuffer ) - 1 ] = '\0'; + + LynxScanEqui = addchain( LynxScanEqui, + (void *)namealloc( LynxBuffer ) ); + } + + fclose( LynxFile ); + + rdsend(); + return ( LynxScanEqui != (chain_list *)0 ); +} diff --git a/alliance/src/lynx/src/parse.h b/alliance/src/lynx/src/parse.h new file mode 100644 index 00000000..85e396e3 --- /dev/null +++ b/alliance/src/lynx/src/parse.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : LYNX | +| | +| File : Parse.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.08.93 | +| | +\------------------------------------------------------------*/ + +# ifndef LYNX_PARSE +# define LYNX_PARSE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define LYNX_BUFFER_SIZE 256 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern chain_list *LynxScanEqui; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern char LynxParseEqui(); + extern char IsLynxScanEqui(); + +# endif diff --git a/alliance/src/lynx/src/pattern.c b/alliance/src/lynx/src/pattern.c new file mode 100644 index 00000000..ea7d3af1 --- /dev/null +++ b/alliance/src/lynx/src/pattern.c @@ -0,0 +1,949 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : LYNX | +| | +| File : trans.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 01.07.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "mlo.h" +# include "mph.h" +# include "rds.h" +# include "rwi.h" +# include "rut.h" +# include "rpr.h" +# include "rfm.h" + +# include "mbkrds.h" +# include "interval.h" +# include "hole.h" +# include "diffusion.h" +# include "pattern.h" +# include "error.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static lynxtrans_list *LYNX_HEAD_TRANSISTOR = (lynxtrans_list *)0; + static char LYNX_UNIFY_LAYER_TABLE[ RDS_ALL_LAYER ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| LynxPurgeFigure | +| | +\------------------------------------------------------------*/ + +static void LynxPurgeFigure( FigurePurge ) + + rdsfig_list *FigurePurge; +{ + rdsrec_list *ScanRec; + rdsrec_list *NextRec; + int Layer; + + for ( Layer = 0; Layer < RDS_MAX_LAYER; Layer++ ) + { + ScanRec = FigurePurge->LAYERTAB[ Layer ]; + FigurePurge->LAYERTAB[ Layer ] = (rdsrec_list *)0; + + while ( ScanRec != (rdsrec_list *)NULL ) + { + NextRec = ScanRec->NEXT; + + freerdsrec( ScanRec, FigurePurge->SIZE ); + + ScanRec = NextRec; + } + } +} + +/*------------------------------------------------------------\ +| | +| LynxUnifyFigure | +| | +\------------------------------------------------------------*/ + +static void LynxUnifyFigure( FigureUnify ) + + rdsfig_list *FigureUnify; +{ + rdswindow *WindowRds; + rdsrec_list *HeadEqui; + rdsrec_list *ScanEqui; + + WindowRds = buildrdswindow( FigureUnify ); + HeadEqui = equirdsfig( FigureUnify, WindowRds ); + destroyrdswindow( FigureUnify, WindowRds ); + unifyrdsfig( FigureUnify, HeadEqui ); + + while ( HeadEqui != (rdsrec_list *)0 ) + { + ClearRdsEqui( HeadEqui ); + ClearRdsEndEqui( HeadEqui ); + + ScanEqui = HeadEqui; + HeadEqui = RDS_EQUI( HeadEqui ); + RDS_EQUI( ScanEqui ) = (rdsrec_list *)0; + } +} + +/*------------------------------------------------------------\ +| | +| LynxInitializeLayer | +| | +\------------------------------------------------------------*/ + +static void LynxInitializeLayer() +{ + int RdsLayer; + int MbkLayer; + int GateLayer; + int DiffLayer; + long Index; + + for ( RdsLayer = 0; RdsLayer < RDS_MAX_LAYER; RdsLayer++ ) + { + LYNX_UNIFY_LAYER_TABLE[ RdsLayer ] = 0; + } + + for ( MbkLayer = 0; MbkLayer < MBK_MAX_LAYER; MbkLayer++ ) + { + GateLayer = GET_LYNX_TRANSISTOR_GATE_LAYER( MbkLayer ); + DiffLayer = GET_LYNX_TRANSISTOR_DIFF_LAYER( MbkLayer ); + + if ( ( GateLayer == RDS_LYNX_TRANSISTOR_EMPTY ) || + ( DiffLayer == RDS_LYNX_TRANSISTOR_EMPTY ) ) continue; + + Index = 0; + RdsLayer = GET_SEGMENT_LAYER( MbkLayer, Index ); + + while ( RdsLayer != RDS_SEGMENT_EMPTY ) + { + LYNX_UNIFY_LAYER_TABLE[ RdsLayer ] = 1; + + Index = Index + 1; + RdsLayer = GET_SEGMENT_LAYER( MbkLayer, Index ); + } + } + + for ( RdsLayer = 0; RdsLayer < RDS_MAX_LAYER; RdsLayer++ ) + { + Index = 0; + DiffLayer = GET_LYNX_DIFFUSION_LAYER( RdsLayer, Index ); + + while ( DiffLayer != RDS_LYNX_DIFFUSION_EMPTY ) + { + LYNX_UNIFY_LAYER_TABLE[ RdsLayer ] = 1; + LYNX_UNIFY_LAYER_TABLE[ DiffLayer ] = 1; + + Index = Index + 1; + DiffLayer = GET_LYNX_DIFFUSION_LAYER( RdsLayer, Index ); + } + } +} + +/*------------------------------------------------------------\ +| | +| LynxInitializePattern | +| | +\------------------------------------------------------------*/ + +static void LynxInitializePattern() +{ + rdsfig_list *FigurePattern; + rdsrec_list *FirstRec; + rdsrec_list *ScanRec; + rdsrec_list *OrientRec; + rdsrec_list *PrevRec; + lynxtrans_list *Transistor; + lynxpattern *Pattern; + phseg_list Segment; + char BadLength; + int MbkLayer; + int GateLayer; + int DiffLayer; + int ActivLayer; + int RdsLayer; + int Orient; + char CheckOrient; + long Length; + long Width; + long GateX; + long GateY; + + FigurePattern = addrdsfig( "_pattern_", LYNX_MODE ); + + Segment.NEXT = (phseg_list *)0; + Segment.NAME = (char *)0; + Segment.X1 = 0; + Segment.Y1 = 0; + + LYNX_HEAD_TRANSISTOR = (lynxtrans_list *)0; + + for ( MbkLayer = 0; MbkLayer < MBK_MAX_LAYER; MbkLayer++ ) + { + GateLayer = GET_LYNX_TRANSISTOR_GATE_LAYER( MbkLayer ); + DiffLayer = GET_LYNX_TRANSISTOR_DIFF_LAYER( MbkLayer ); + ActivLayer = GET_LYNX_TRANSISTOR_ACTIV_LAYER( MbkLayer ); + + if ( ( GateLayer == RDS_LYNX_TRANSISTOR_EMPTY ) || + ( DiffLayer == RDS_LYNX_TRANSISTOR_EMPTY ) ) continue; + + Transistor = (lynxtrans_list *)rdsallocblock( sizeof( lynxtrans_list ) ); + + Transistor->NEXT = LYNX_HEAD_TRANSISTOR; + LYNX_HEAD_TRANSISTOR = Transistor; + + Transistor->GATE_LAYER = GateLayer; + Transistor->DIFF_LAYER = DiffLayer; + Transistor->ACTIV_LAYER = ActivLayer; + Transistor->MBK_LAYER = MbkLayer; + Transistor->ORIENT = ( LYNX_MAX_ORIENT >> 1 ); +/* +** Compute transistor minimum symbolic length +*/ + Segment.LAYER = MbkLayer; + Segment.WIDTH = SCALE_X; + Segment.X2 = 0; + Segment.TYPE = UP; + + for ( Length = 1; Length < LYNX_MAX_LENGTH; Length++ ) + { + Segment.Y2 = Length * SCALE_X; + ScanRec = FirstRec = segmbkrds( FigurePattern, &Segment, 0 ); + BadLength = 0; + + do + { + if ( ( ScanRec->DX <= 0 ) || + ( ScanRec->DY <= 0 ) ) + { + BadLength = 1; break; + } + + ScanRec = (rdsrec_list *)ScanRec->USER; + } + while ( ScanRec != FirstRec ); + + if ( ! BadLength ) break; + } + + if ( BadLength ) + { + LynxError( LYNX_ERROR_MINIMUM_LENGTH, 0, 0 ); + } + + LynxPurgeFigure( FigurePattern ); + + Pattern = Transistor->PATTERN; + CheckOrient = 1; + + for ( Width = 0; Width < LYNX_MAX_WIDTH; Width++ ) + { + Segment.WIDTH = ( Width + 1 ) * SCALE_X; + + for ( Orient = 0; Orient < LYNX_MAX_ORIENT; Orient++ ) + { + if ( ( Transistor->ORIENT == 1 ) && + ( ( Orient == LYNX_SOUTH ) || + ( Orient == LYNX_WEST ) ) ) continue; + + switch ( Orient ) + { + case LYNX_NORTH : Segment.X2 = 0; + Segment.Y2 = Length * SCALE_X; + Segment.TYPE = UP; + break; + + case LYNX_SOUTH : Segment.X2 = 0; + Segment.Y2 = Length * SCALE_X; + Segment.TYPE = DOWN; + break; + + case LYNX_EAST : Segment.X2 = Length * SCALE_X; + Segment.Y2 = 0; + Segment.TYPE = RIGHT; + break; + + case LYNX_WEST : Segment.X2 = Length * SCALE_X; + Segment.Y2 = 0; + Segment.TYPE = LEFT; + break; + } + + ScanRec = segmbkrds( FigurePattern, &Segment, 0 ); + + LynxUnifyFigure( FigurePattern ); + + FirstRec = FigurePattern->LAYERTAB[ GateLayer ]; + + if ( ( FirstRec == (rdsrec_list *)0 ) || + ( FirstRec->NEXT != (rdsrec_list *)0 ) ) + { + LynxError( LYNX_ERROR_TRANSISTOR_GATE, 0, 0 ); + } + + GateX = FirstRec->X; + GateY = FirstRec->Y; + + if ( Orient == LYNX_NORTH ) + { + Pattern[ Width ].WIDTH = FirstRec->DX; + Transistor->LENGTH = FirstRec->DY; + } + + FirstRec->X = 0; + FirstRec->Y = 0; + + PrevRec = FirstRec; + + for ( RdsLayer = 0; RdsLayer < RDS_MAX_LAYER; RdsLayer++ ) + { + for ( ScanRec = FigurePattern->LAYERTAB[ RdsLayer ]; + ScanRec != (rdsrec_list *)0; + ScanRec = ScanRec->NEXT ) + { + if ( ScanRec != FirstRec ) + { + LYNX_LINK( PrevRec ) = ScanRec; + PrevRec = ScanRec; + + ScanRec->X -= GateX; + ScanRec->Y -= GateY; + } + } + + FigurePattern->LAYERTAB[ RdsLayer ] = (rdsrec_list *)0; + } + + LYNX_LINK( PrevRec ) = FirstRec; + Pattern[ Width ].REAL[ Orient ] = FirstRec; + + FirstRec = segmbkrds( FigurePattern, &Segment, 1 ); + ScanRec = FirstRec; + + do + { + LYNX_LINK( ScanRec ) = (rdsrec_list *)ScanRec->USER; + + ScanRec->X -= GateX; + ScanRec->Y -= GateY; + + ScanRec = (rdsrec_list *)ScanRec->USER; + } + while ( ScanRec != FirstRec ); + + for ( RdsLayer = 0; RdsLayer < RDS_MAX_LAYER; RdsLayer++ ) + { + FigurePattern->LAYERTAB[ RdsLayer ] = (rdsrec_list *)0; + } + + Pattern[ Width ].SYMB[ Orient ] = FirstRec; + + if ( ( CheckOrient ) && + ( Orient == LYNX_SOUTH ) ) + { + CheckOrient = 0; + + FirstRec = Pattern[ Width ].REAL[ LYNX_NORTH ]; + ScanRec = FirstRec; + OrientRec = Pattern[ Width ].REAL[ LYNX_SOUTH ]; + + do + { + if ( ( ScanRec->X != OrientRec->X ) || + ( ScanRec->Y != OrientRec->Y ) || + ( ScanRec->DX != OrientRec->DX ) || + ( ScanRec->DY != OrientRec->DY ) || + ( ScanRec->FLAGS != OrientRec->FLAGS ) ) + { + break; + } + + ScanRec = LYNX_LINK( ScanRec ); + OrientRec = LYNX_LINK( OrientRec ); + } + while ( ScanRec != FirstRec ); + + if ( ScanRec == FirstRec ) + { + Transistor->ORIENT = 1; + } + } + } + } + } +} + +/*------------------------------------------------------------\ +| | +| LynxPatternMatching | +| | +\------------------------------------------------------------*/ + +long LynxPatternMatching( FigureRds ) + + rdsfig_list *FigureRds; +{ + lynxtrans_list *Transistor; + lynxpattern *Pattern; + lynxinter_list *NewInter; + lynxinter_list *ScanInter; + lynxinter_list *DelInter; + lynxinter_list **PrevInter; + lynxinter_list *Interval; + rdsrec_list *GateRec; + rdsrec_list *ScanRec; + rdsrec_list *FirstRec; + rdsrec_list *InterRec; + rdsrec_list *NewRec; + rdsrec_list *FirstNewRec; + rdsrec_list *PrevNewRec; + rdswindow *WindowRds; + rdswin_list *WinList; + rdswin_list *ScanWin; + rdswinrec_list *ScanWinRec; + int ScanRecIndex; + long X1; + long X2; + long Y1; + long Y2; + long FirstX; + long FirstY; + long WX1; + long WY1; + long WX2; + long WY2; + long Min; + long Max; + long Width; + long DeltaGate; + long DeltaDn; + long DeltaUp; + long GateWidth; + long GateLength; + long GateLow; + long GateHigh; + int GateOrient; + long GateMin; + long GateMax; + char Orient; + char Vertical; + char GateVertical; + int GateLayer; + int DiffLayer; + int ActivLayer; + int MbkLayer; + int Layer; + long Number; + + WindowRds = buildrdswindow( FigureRds ); + Number = 0; + + LynxDiffusionFigure( FigureRds, WindowRds ); + +/* +** For all kind of transistor +*/ + for ( Transistor = LYNX_HEAD_TRANSISTOR; + Transistor != (lynxtrans_list *)0; + Transistor = Transistor->NEXT ) + { + Pattern = Transistor->PATTERN; + GateLayer = Transistor->GATE_LAYER; + MbkLayer = Transistor->MBK_LAYER; + DiffLayer = Transistor->DIFF_LAYER; + ActivLayer = Transistor->ACTIV_LAYER; +/* +** For all possible gate +*/ + for ( GateRec = FigureRds->LAYERTAB[ GateLayer ]; + GateRec != (rdsrec_list *)0; + GateRec = GateRec->NEXT ) + { +/* +** If Gate not in window continue +*/ + if ( GateRec->USER == (void *)0 ) continue; + + GateVertical = ( GateRec->DX < GateRec->DY ); + Vertical = 0; + Interval = (lynxinter_list *)0; + + while ( ( Vertical < 2 ) && + ( Interval == (lynxinter_list *)0 ) ) + { + if ( GateVertical ) + { + GateOrient = LYNX_NORTH; + GateWidth = GateRec->DX; + GateLength = GateRec->DY; + GateMin = GateRec->Y; + GateMax = GateRec->DY + GateMin; + GateLow = GateRec->X; + GateHigh = GateRec->DX + GateLow; + } + else + { + GateOrient = LYNX_EAST; + GateWidth = GateRec->DY; + GateLength = GateRec->DX; + GateMin = GateRec->X; + GateMax = GateRec->DX + GateMin; + GateLow = GateRec->Y; + GateHigh = GateRec->DY + GateLow; + } + + DeltaGate = ( GateLength - Transistor->LENGTH ); + + if ( DeltaGate < 0 ) break; +/* +** Search minimum width +*/ + for ( Width = 0; Width < LYNX_MAX_WIDTH; Width++ ) + { + if ( Pattern[ Width ].WIDTH > GateWidth ) break; + } + + Width = Width - 1; + + if ( Width < 0 ) break; +/* +** For all possible orient +*/ + for ( Orient = 0; Orient < Transistor->ORIENT; Orient++ ) + { + GateOrient = GateOrient + Orient; + Interval = LynxUnionInterval( (lynxinter_list *)0, GateMin, GateMax ); + + FirstRec = Pattern[ Width ].REAL[ GateOrient ]; + ScanRec = LYNX_LINK( FirstRec ); + + do + { + Layer = GetRdsLayer( ScanRec ); + + X1 = ScanRec->X + GateRec->X; + Y1 = ScanRec->Y + GateRec->Y; + + if ( GateVertical ) + { + DeltaDn = ScanRec->Y; + DeltaUp = FirstRec->DY - ( ScanRec->Y + ScanRec->DY ); + + X2 = ScanRec->DX + X1; + Y2 = ScanRec->DY + Y1 + DeltaGate; + } + else + { + DeltaDn = ScanRec->X; + DeltaUp = FirstRec->DX - ( ScanRec->X + ScanRec->DX ); + + X2 = ScanRec->DX + X1 + DeltaGate; + Y2 = ScanRec->DY + Y1; + } +/* +** Compute possible matching for each pattern's rectangle. +*/ + NewInter = (lynxinter_list *)0; + + WY1 = ( Y1 - 1 - WindowRds->YMIN ) / WindowRds->SIDE; + WY2 = ( Y2 - WindowRds->YMIN ) / WindowRds->SIDE; + WX1 = ( X1 - 1 - WindowRds->XMIN ) / WindowRds->SIDE; + WX2 = ( X2 - WindowRds->XMIN ) / WindowRds->SIDE; + + if ( WX1 < 0 ) WX1 = 0; + if ( WX2 < 0 ) WX2 = 0; + if ( WX1 >= WindowRds->DX ) WX1 = WindowRds->DX - 1; + if ( WX2 >= WindowRds->DX ) WX2 = WindowRds->DX - 1; + + if ( WY1 < 0 ) WY1 = 0; + if ( WY2 < 0 ) WY2 = 0; + if ( WY1 >= WindowRds->DY ) WY1 = WindowRds->DY - 1; + if ( WY2 >= WindowRds->DY ) WY2 = WindowRds->DY - 1; + + FirstX = WX1; + FirstY = WY1; + + while ( WY1 <= WY2 ) + { + WinList = WindowRds->WINTAB + ( WY1 * WindowRds->DX ); + + WX1 = FirstX; + + while ( WX1 <= WX2 ) + { + ScanWin = WinList + WX1; + + if ( ScanWin->LAYERTAB != (rdswinrec_list **)NULL ) + { + for ( ScanWinRec = ScanWin->LAYERTAB[ Layer ]; + ScanWinRec != (rdswinrec_list *)NULL; + ScanWinRec = ScanWinRec->NEXT ) + { + for ( ScanRecIndex = 0; + ScanRecIndex < RWI_MAX_REC; + ScanRecIndex++ ) + { + InterRec = ScanWinRec->RECTAB[ ScanRecIndex ]; + + if ( InterRec != (rdsrec_list *)0 ) + { + if ( GateVertical ) + { + if ( ( ( InterRec->X ) <= X1 ) && + ( ( InterRec->X + InterRec->DX ) >= X2 ) ) + { + Min = InterRec->Y; + Max = InterRec->Y + InterRec->DY; + + NewInter = LynxUnionInterval( NewInter, Min, Max ); + } + } + else + { + if ( ( ( InterRec->Y ) <= Y1 ) && + ( ( InterRec->Y + InterRec->DY ) >= Y2 ) ) + { + Min = InterRec->X; + Max = InterRec->X + InterRec->DX; + + NewInter = LynxUnionInterval( NewInter, Min, Max ); + } + } + } + } + } + } + + WX1 = WX1 + 1; + } + + WY1 = WY1 + 1; + } +/* +** No gate rectangle under activ rectangle +*/ + if ( Layer == ActivLayer ) + { + WY1 = FirstY; + + while ( WY1 <= WY2 ) + { + WinList = WindowRds->WINTAB + ( WY1 * WindowRds->DX ); + + WX1 = FirstX; + + while ( WX1 <= WX2 ) + { + ScanWin = WinList + WX1; + + if ( ScanWin->LAYERTAB != (rdswinrec_list **)NULL ) + { + for ( ScanWinRec = ScanWin->LAYERTAB[ GateLayer ]; + ScanWinRec != (rdswinrec_list *)NULL; + ScanWinRec = ScanWinRec->NEXT ) + { + for ( ScanRecIndex = 0; + ScanRecIndex < RWI_MAX_REC; + ScanRecIndex++ ) + { + InterRec = ScanWinRec->RECTAB[ ScanRecIndex ]; + + if ( InterRec != (rdsrec_list *)0 ) + { + if ( GateVertical ) + { + if ( ( ( ( InterRec->X ) < GateLow ) && + ( ( InterRec->X + InterRec->DX ) > X1 ) ) || + ( ( ( InterRec->X ) < X2 ) && + ( ( InterRec->X + InterRec->DX ) > GateHigh ) ) ) + { + Min = InterRec->Y; + Max = InterRec->Y + InterRec->DY; + + NewInter = LynxSplitInterval( NewInter, Min, Max ); + } + } + else + { + if ( ( ( ( InterRec->Y ) < GateLow ) && + ( ( InterRec->Y + InterRec->DY ) > Y1 ) ) || + ( ( ( InterRec->Y ) < Y2 ) && + ( ( InterRec->Y + InterRec->DY ) > GateHigh ) ) ) + { + Min = InterRec->X; + Max = InterRec->X + InterRec->DX; + + NewInter = LynxSplitInterval( NewInter, Min, Max ); + } + } + } + + if ( NewInter == (lynxinter_list *)0 ) break; + } + + if ( NewInter == (lynxinter_list *)0 ) break; + } + } + + if ( NewInter == (lynxinter_list *)0 ) break; + + WX1 = WX1 + 1; + } + + if ( NewInter == (lynxinter_list *)0 ) break; + + WY1 = WY1 + 1; + } + } + + for ( ScanInter = NewInter; + ScanInter != (lynxinter_list *)0; + ScanInter = ScanInter->NEXT ) + { + ScanInter->MIN -= DeltaDn; + ScanInter->MAX += DeltaUp; + } + + ScanInter = Interval; + Interval = LynxIntersectInterval( ScanInter, NewInter ); + + LynxDelAllInterval( NewInter ); + LynxDelAllInterval( ScanInter ); + + ScanRec = LYNX_LINK( ScanRec ); + } + while ( ( ScanRec != FirstRec ) && + ( Interval != (lynxinter_list *)0 ) ); + + if ( Interval != (lynxinter_list *)0 ) break; + } +/* +** For all interval +*/ + PrevInter = &Interval; + ScanInter = Interval; + + while ( ScanInter != (lynxinter_list *)0 ) + { + DeltaGate = ( ScanInter->MAX - ScanInter->MIN - Transistor->LENGTH ); + + if ( DeltaGate < 0 ) + { + *PrevInter = ScanInter->NEXT; + DelInter = ScanInter; + ScanInter = ScanInter->NEXT; + + DelInter->NEXT = (lynxinter_list *)0; + LynxDelAllInterval( DelInter ); + + continue; + } + + if ( GateVertical ) + { + X1 = GateRec->X; + Y1 = ScanInter->MIN; + X2 = GateRec->DX + X1; + Y2 = ScanInter->MAX - ScanInter->MIN + Y1; + } + else + { + X1 = ScanInter->MIN; + Y1 = GateRec->Y; + X2 = ScanInter->MAX - ScanInter->MIN + X1; + Y2 = GateRec->DY + Y1; + } +/* +** Make hole diffusion under gate +*/ + if ( DiffLayer != RDS_LYNX_TRANSISTOR_EMPTY ) + { + LynxHoleFigure( FigureRds, WindowRds, X1, Y1, X2, Y2, DiffLayer ); + } +/* +** Build symbolic transistor +*/ + FirstRec = Pattern[ Width ].SYMB[ GateOrient ]; + ScanRec = FirstRec; + + FirstNewRec = (rdsrec_list *)0; + PrevNewRec = (rdsrec_list *)0; + + do + { + Layer = GetRdsLayer( ScanRec ); + + if ( GateVertical ) + { + X1 = ScanRec->X + GateRec->X; + Y1 = ScanRec->Y + ScanInter->MIN; + X2 = ScanRec->DX + X1; + Y2 = ScanRec->DY + Y1 + DeltaGate; + } + else + { + X1 = ScanRec->X + ScanInter->MIN; + Y1 = ScanRec->Y + GateRec->Y; + X2 = ScanRec->DX + X1 + DeltaGate; + Y2 = ScanRec->DY + Y1; + } + + NewRec = addrdsfigrec( FigureRds, (char *)0, Layer, + X1, Y1, X2 - X1, Y2 - Y1 ); + + if ( FirstNewRec == (rdsrec_list *)0 ) + { + FirstNewRec = NewRec; + PrevNewRec = NewRec; + + SetLynxFirstLink( FirstNewRec ); + } + else + { + LYNX_LINK( PrevNewRec ) = NewRec; + PrevNewRec = NewRec; + } + + SetLynxAttribute( NewRec, MbkLayer ); + SetLynxOrient( NewRec, GateOrient ); + + SetRdsSegment( NewRec ); + + if ( Layer == GateLayer ) + { + SetRdsTransGate( NewRec ); + } + + ScanRec = LYNX_LINK( ScanRec ); + } + while ( ScanRec != FirstRec ); + + LYNX_LINK( PrevNewRec ) = FirstNewRec; + + Number++; + + PrevInter = &ScanInter->NEXT; + ScanInter = ScanInter->NEXT; + } + + GateVertical = ! GateVertical; + Vertical = Vertical + 1; + } + + if ( Interval != (lynxinter_list *)0 ) + { + LynxDelAllInterval( Interval ); + } + } + } + + destroyrdswindow( FigureRds, WindowRds ); + + return( Number ); +} + +/*------------------------------------------------------------\ +| | +| LynxReconizeTransistor | +| | +\------------------------------------------------------------*/ + +long LynxReconizeTransistor( FigureRds ) + + rdsfig_list *FigureRds; +{ + rdsfig_list *FigureUnify; + int RdsLayer; + long Number; + + LynxInitializeLayer(); + LynxInitializePattern(); + + FigureUnify = addrdsfig( "_unify_", LYNX_MODE ); + + for ( RdsLayer = 0; RdsLayer < RDS_MAX_LAYER; RdsLayer++ ) + { + if ( LYNX_UNIFY_LAYER_TABLE[ RdsLayer ] ) + { + FigureUnify->LAYERTAB[ RdsLayer ] = FigureRds->LAYERTAB[ RdsLayer ]; + FigureRds->LAYERTAB [ RdsLayer ] = (rdsrec_list *)0; + } + } + + LynxUnifyFigure( FigureUnify ); + + Number = LynxPatternMatching( FigureUnify ); + + for ( RdsLayer = 0; RdsLayer < RDS_MAX_LAYER; RdsLayer++ ) + { + if ( LYNX_UNIFY_LAYER_TABLE[ RdsLayer ] ) + { + FigureRds->LAYERTAB[ RdsLayer ] = FigureUnify->LAYERTAB[ RdsLayer ]; + FigureUnify->LAYERTAB [ RdsLayer ] = (rdsrec_list *)0; + } + } + + delrdsfig( FigureUnify->NAME ); + + return( Number ); +} diff --git a/alliance/src/lynx/src/pattern.h b/alliance/src/lynx/src/pattern.h new file mode 100644 index 00000000..d5d12221 --- /dev/null +++ b/alliance/src/lynx/src/pattern.h @@ -0,0 +1,113 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : LYNX | +| | +| File : pattern.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.07.95 | +| | +\------------------------------------------------------------*/ + +# ifndef LYNX_PATTERN_H +# define LYNX_PATTERN_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Max Width and Length in lambda | +| | +\------------------------------------------------------------*/ + +# define LYNX_MAX_WIDTH 10 +# define LYNX_MAX_LENGTH 10 + +/*------------------------------------------------------------\ +| | +| Macros | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Lynx Pattern List | +| | +\------------------------------------------------------------*/ + + typedef struct lynxpattern + { + rdsrec_list *REAL[ LYNX_MAX_ORIENT ]; + rdsrec_list *SYMB[ LYNX_MAX_ORIENT ]; + long WIDTH; + + } lynxpattern; + +/*------------------------------------------------------------\ +| | +| Lynx Transistor List | +| | +\------------------------------------------------------------*/ + + typedef struct lynxtrans + { + struct lynxtrans *NEXT; + struct lynxpattern PATTERN[ LYNX_MAX_WIDTH ]; + char MBK_LAYER; + char GATE_LAYER; + char DIFF_LAYER; + char ACTIV_LAYER; + char ORIENT; + long LENGTH; + + } lynxtrans_list; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern long LynxReconizeTransistor(); + +# endif diff --git a/alliance/src/lynx/src/via.h b/alliance/src/lynx/src/via.h new file mode 100644 index 00000000..c9529e5c --- /dev/null +++ b/alliance/src/lynx/src/via.h @@ -0,0 +1,35 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +typedef struct GrgPhVia +{ + struct GrgPhVia *NEXT; + rdsrec_list *LAYER1; + rdsrec_list *LAYER2; + rdsrec_list *LAYER3; + long X,Y; +} GrgPhVia_list; diff --git a/alliance/src/lynx/src/znc.c b/alliance/src/lynx/src/znc.c new file mode 100644 index 00000000..4b877199 --- /dev/null +++ b/alliance/src/lynx/src/znc.c @@ -0,0 +1,562 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +#include "mut.h" +#include "mlo.h" +#include "rcn.h" +#include "rds.h" +#include "lynxrcn.h" +#include "Windows95.h" +#include "znc.h" + +znc *HEAD_FREE_ZNC; +#define BUFZNCSIZE 5 +/* +#define ZNCDEBUG +*/ +void freeznc __P((znc*)); /* Libere une structure znc. Cette structure + est remise dans la liste des structures + libres */ +znc* getznc __P((void)); /* Recupere une structure znc par allocation + par tas */ +void addwinznc __P((znc*, WinZnc*)); /* Cette fonction ajoute une znc dans le + fenetrage prevus a cet effet */ +void delwinznc __P((znc*,WinZnc*)); /* Efface un znc du fenetrage */ +long getmx __P((znc*,WinZnc*)); +long getmy __P((znc*,WinZnc*)); +long getMx __P((znc*,WinZnc*)); +long getMy __P((znc*,WinZnc*)); + +long addznc(x1,y1,x2,y2,layer,winznc) +long x1; +long y1; +long x2; +long y2; +long layer; +WinZnc *winznc; +{ + chain_list *interznc,*schinter; + znc *nouveau,*ancien,*recouvre; + znc last; + + nouveau=getznc(); + nouveau->x1=x1; + nouveau->x2=x2; + nouveau->y1=y1; + nouveau->y2=y2; + nouveau->layer=layer; + +#ifdef ZNCDEBUG +fprintf(stderr,"*** addznc ***\n"); +fprintf(stderr,"Zone ( %ld; %ld)-( %ld; %ld) sur layer %ld \n",x1,y1,x2,y2,nouveau->layer); +#endif + + do + { + last=*nouveau; + + interznc=getwininterznc(nouveau,winznc,1); + + for(schinter=interznc;schinter;schinter=schinter->NEXT) + { + recouvre=(znc*)(schinter->DATA); + + if(recouvre->x1 < nouveau->x1) nouveau->x1=recouvre->x1; + if(recouvre->y1 < nouveau->y1) nouveau->y1=recouvre->y1; + if(recouvre->x2 > nouveau->x2) nouveau->x2=recouvre->x2; + if(recouvre->y2 > nouveau->y2) nouveau->y2=recouvre->y2; + } + +#ifdef ZNCDEBUG +fprintf(stderr,"Nouvelle znc apres recouvrements\n"); +fprintf(stderr,"Zone ( %ld; %ld)-( %ld; %ld) sur layer %ld \n",nouveau->x1,nouveau->y1,nouveau->x2,nouveau->y2,nouveau->layer); +fprintf(stderr,"\n\nAjout de la nouvelle zone dans le fenetrage\n"); +#endif + + +#ifdef ZNCDEBUG +fprintf(stderr,"\nEffacement eventuel des zones recouvrantes\n\n"); +#endif + + if(interznc) + { + ancien=NULL; + for(schinter=interznc;schinter;schinter=schinter->NEXT) + { + if(ancien) + { + delwinznc(ancien,winznc); + freeznc(ancien); + } + ancien=(znc*)(schinter->DATA); + } + + if(ancien) + { + delwinznc(ancien,winznc); + freeznc(ancien); + } + freechain(interznc); + } + } + while(last.x1!=nouveau->x1 || + last.y1!=nouveau->y1 || + last.x2!=nouveau->x2 || + last.y2!=nouveau->y2 ); + + /* Attention lors de l'utilisation du connect : il ne devrait plus y + avoir de recouvrement sur cette znc. L'utilisateur doit prendre ces + precautions */ + + addwinznc(nouveau,winznc); + return(nouveau->node); +} + +znc* getznc() +{ + int i; + znc *newznc; + + if(HEAD_FREE_ZNC==NULL) + { + HEAD_FREE_ZNC=(znc*)mbkalloc(sizeof(znc)*BUFZNCSIZE); + newznc=HEAD_FREE_ZNC; + for(i=1;iNEXT=newznc+1; + newznc++; + } + newznc->NEXT=NULL; + } + newznc=HEAD_FREE_ZNC; + HEAD_FREE_ZNC=HEAD_FREE_ZNC->NEXT; + newznc->NEXT=NULL; + newznc->Win=NULL; + newznc->rec=NULL; + newznc->node=0; + return(newznc); +} + +void freeznc(z) +znc *z; +{ + if(z->rec) freechain(z->rec); + if(z->Win) freechain(z->Win); + z->NEXT=HEAD_FREE_ZNC; + HEAD_FREE_ZNC=z; +} + +void addwinznc(elem,wininfo) +znc *elem; +WinZnc *wininfo; +{ + long x1,y1,x2,y2; + long nx1,ny1; + chain_list *ptchain; + + + x1=getmx(elem,wininfo); + y1=getmy(elem,wininfo); + x2=getMx(elem,wininfo); + y2=getMy(elem,wininfo); + + /* Ajout de la znc dans les ChZnc qui vont bien */ + + for(nx1=x1;nx1<=x2;nx1++) + { + for(ny1=y1;ny1<=y2;ny1++) + { + /* Ajoute l'element dans le fenetrage */ +#ifdef ZNCDEBUG +fprintf(stderr,"Ajout de l'element dans la fenetre %ld\n",ny1*wininfo->nx + nx1); +#endif + + ptchain=*(wininfo->ChZnc + ny1*wininfo->nx + nx1); + ptchain=addchain(ptchain,elem); + *(wininfo->ChZnc + ny1*wininfo->nx + nx1)=ptchain; + + /* Fait pointer cet element vers ses fenetrages */ + + elem->Win=addchain(elem->Win,wininfo->ChZnc + ny1*wininfo->nx + nx1); + } + } +} + +chain_list* getwininterznc(elem,wininfo,chklayer) +znc *elem; +WinZnc *wininfo; +short chklayer; /* si chklayer != 0, alors une verification de layer + est effectuee */ +{ + chain_list *fenetre; + chain_list *candidats; + znc *zonecandidate; + chain_list *elus,*cleanelus; + long x1,y1,x2,y2,x,y; + + elus=NULL; +#ifdef ZNCDEBUG +fprintf(stderr,"Debut de recherche des intersections\n"); +#endif + + x1=getmx(elem,wininfo); + y1=getmy(elem,wininfo); + x2=getMx(elem,wininfo); + y2=getMy(elem,wininfo); + + for(x=x1;x<=x2;x++) + { + for(y=y1;y<=y2;y++) + { + fenetre=*(wininfo->ChZnc + y*wininfo->nx + x); + +#ifdef ZNCDEBUG +fprintf(stderr,"Examine fenetre %ld\n",y*wininfo->nx + x); +#endif + + for(candidats=fenetre; + candidats; + candidats=candidats->NEXT) + { + zonecandidate=(znc*)(candidats->DATA); + +#ifdef ZNCDEBUG +fprintf(stderr,"Zone : (%ld ; %ld)-(%ld ; %ld) layer %ld\n",zonecandidate->x1,zonecandidate->y1,zonecandidate->x2,zonecandidate->y2,zonecandidate->layer); +#endif + + /* On regarde les intersections */ + if( zonecandidate->x1 <= elem->x2 && + elem->x1 <= zonecandidate->x2 && + elem->y1 <= zonecandidate->y2 && + zonecandidate->y1 <= elem->y2 && + ( !chklayer || (chklayer && (zonecandidate->layer==elem->layer))) ) + { + if(zonecandidate->NEXT==NULL) + { + elus=addchain(elus,zonecandidate); + zonecandidate->NEXT=(znc*)1; +#ifdef ZNCDEBUG +fprintf(stderr,"---> OK\n"); +#endif + } + } + } + } + } + for(cleanelus=elus;cleanelus;cleanelus=cleanelus->NEXT) + ((znc*)(cleanelus->DATA))->NEXT=NULL; + + return(elus); +} + +WinZnc* creatwinznc(mx,my,MX,MY,PX,PY,nx,ny) +long mx,my,MX,MY,PX,PY,nx,ny; +{ + WinZnc *wznc; + long i,j; + + wznc = (WinZnc*)mbkalloc(sizeof(WinZnc)); + wznc->mx = mx; + wznc->my = my; + wznc->MX = MX; + wznc->MY = MY; + wznc->PX = PX; + wznc->PY = PY; + wznc->nx = nx; + wznc->ny = ny; + wznc->ChZnc = (chain_list**)mbkalloc(sizeof(chain_list*)*nx*ny); + + j=nx*ny; + for(i=0;iChZnc[i]=NULL; + +#ifdef ZNCDEBUG +fprintf(stderr,"Creation du fenetrage znc\n"); +fprintf(stderr,"Nombre des fenetres : %ld x %ld\n",wznc->nx,wznc->ny); +fprintf(stderr,"Taille des fenetres : %ld x %ld\n",wznc->PX,wznc->PY); +fprintf(stderr,"Origine des fenetres : %ld x %ld\n",wznc->mx,wznc->my); +#endif + return(wznc); +} + +void freewinznc(winfo) +WinZnc *winfo; +{ + long i,j; + + j=winfo->nx*winfo->ny; + + for(i=0;iChZnc[i]!=NULL) + freechain(winfo->ChZnc[i]); + + mbkfree(winfo->ChZnc); + mbkfree(winfo); + +} + +void delwinznc(elem,info) +znc *elem; +WinZnc *info; +{ + chain_list *chl,*chlw,*last=NULL; + chain_list **fenetre; + +#ifdef ZNCDEBUG +fprintf(stderr,"Elimination de fenetrage de la znc ( %ld; %ld)-( %ld; %ld) sur layer %ld\n",elem->x1,elem->y1,elem->x2,elem->y2,elem->layer); +#endif + + for(chl=elem->Win;chl;chl=chl->NEXT) + { + fenetre=(chain_list**)(chl->DATA); + +#ifdef ZNCDEBUG +fprintf(stderr," -> fenetre : %ld\n",(((long)fenetre)-((long)(info->ChZnc)))/sizeof(void*)); +#endif + + /* Libere l'element dans la fenetre pointant vers elem */ + + if( (*fenetre)->DATA == elem ) + { + last=*fenetre; + *fenetre=last->NEXT; + last->NEXT=NULL; + freechain(last); + } + else + { + for(chlw=*fenetre;chlw;chlw=chlw->NEXT) + { + if(chlw->DATA == elem) + break; + last=chlw; + } + if(!chlw) + { + fprintf(stderr,"Erreur impossible (1).\n"); + exit(-2); + } + last->NEXT=chlw->NEXT; + chlw->NEXT=NULL; + freechain(chlw); + } + } + freechain(elem->Win); + elem->Win=NULL; +} + +long getMx(elem,wininfo) +znc *elem; +WinZnc *wininfo; +{ + long x2; + x2=(elem->x2-wininfo->mx)/wininfo->PX; + return(x2); +} + +long getMy(elem,wininfo) +znc *elem; +WinZnc *wininfo; +{ + long y2; + y2=(elem->y2-wininfo->my)/wininfo->PY; + return(y2); +} + +long getmx(elem,wininfo) +znc *elem; +WinZnc *wininfo; +{ + long x1,y1,nx1; + long ix1,ix2,iy1,iy2; + + x1=(elem->x1-wininfo->mx)/wininfo->PX; + y1=(elem->y1-wininfo->my)/wininfo->PY; + nx1=x1; + if(x1>=1) + { + ix1=(x1-1)*wininfo->PX+wininfo->mx; + iy1=y1*wininfo->PY+wininfo->my; + ix2=ix1+wininfo->PX; + iy2=iy1+wininfo->PY; + + /* verifie l'intersection des deux rectangles */ + if( elem->x1<=ix2 && ix1<=elem->x2 && iy1<=elem->y2 && elem->y1<=iy2 ) + nx1=x1-1; + } + x1=nx1; + return(nx1); +} + +long getmy(elem,wininfo) +znc *elem; +WinZnc *wininfo; +{ + long x1,y1,ny1; + long ix1,ix2,iy1,iy2; + + y1=(elem->y1-wininfo->my)/wininfo->PY; + x1=(elem->x1-wininfo->mx)/wininfo->PX; + ny1=y1; + if(y1>=1) + { + ix1=x1*wininfo->PX+wininfo->mx; + iy1=(y1-1)*wininfo->PY+wininfo->my; + ix2=ix1+wininfo->PX; + iy2=iy1+wininfo->PY; + + /* verifie l'intersection des deuy rectangles */ + if( elem->x1<=ix2 && ix1<=elem->x2 && iy1<=elem->y2 && elem->y1<=iy2 ) + ny1=y1-1; + } + y1=ny1; + return(ny1); +} + +void makezncnode(win,ptsig) +WinZnc *win; +losig_list *ptsig; +{ + /* Pour parcourir toutes les znc, on se sert du fenetrage */ + chain_list *scanwin; + znc *zone; + long i; + + for(i=0;i<(win->nx*win->ny);i++) + { + for(scanwin=*(win->ChZnc+i);scanwin;scanwin=scanwin->NEXT) + { + zone=(znc*)(scanwin->DATA); + if(! zone->node) + zone->node=addlonode(ptsig,NULL); + } + } +} + +void linklonodelocon(connect, ptsig, wz, gwin) +chain_list *connect; +losig_list *ptsig; +WinZnc *wz; +GrgWindow *gwin; +{ + chain_list *scanchain; + rdsrec_list *rec; + rdsrec_list *zncrec; + znc test; + chain_list *interznc; + long noeud; + locon_list *connecteur; + locon_list *tstlocon; + ptype_list *ptrdslocon; + chain_list *scanzncrec; + chain_list *headzncrec; + + for(scanchain=connect;scanchain;scanchain=scanchain->NEXT) + { + rec=(rdsrec_list*)(scanchain->DATA); + ptrdslocon = getptype( rec->USER, RDSLOCON ); + connecteur = ((locon_list*)(ptrdslocon->DATA)); + if( !connecteur ) + continue; /* cas ou plusieurs rectangles connecteurs sont superposes */ + + /* La znc test ne sert qu'ŕ récupérer la 'vraie' qui regroupe celles + qu'il faut pour avoir le lonode */ + + test.x1=rec->X; + test.y1=rec->Y; + test.x2=rec->X+rec->DX; + test.y2=rec->Y+rec->DY; + test.layer = (GetRdsLayer(rec)==RDS_GATE) ? RDS_POLY : GetRdsLayer(rec); + + interznc=getwininterznc(&test,wz,1); + + if(interznc->NEXT) + { + chain_list *scanznc; + fprintf(stderr,"Un locon correspond ŕ plusieurs ZNC.\n"); + fprintf(stderr,"Rectangle : (%ld,%ld)-(%ld,%ld) [%s]\n",test.x1,test.y1, + test.x2,test.y2, + RDS_LAYER_NAME[test.layer]); + for(scanznc=interznc;scanznc;scanznc=scanznc->NEXT) + fprintf(stderr,"ZNC : (%ld,%ld)-(%ld,%ld) [%s]\n", + ((znc*)(scanznc->DATA))->x1, + ((znc*)(scanznc->DATA))->y1, + ((znc*)(scanznc->DATA))->x2, + ((znc*)(scanznc->DATA))->y2, + RDS_LAYER_NAME[((znc*)(scanznc->DATA))->layer]); + exit(-1); + } + + noeud=((znc*)(interznc->DATA))->node; + + setloconnode(connecteur, noeud); + + headzncrec = GrgGetInterWindows( rec, gwin ); + for( scanzncrec = headzncrec ; scanzncrec ; scanzncrec = scanzncrec->NEXT ) + { + zncrec = (rdsrec_list*)( scanzncrec->DATA ); + ptrdslocon = getptype( zncrec->USER, RDSLOCON ); + if( ptrdslocon ) + { + tstlocon = ((locon_list*)(ptrdslocon->DATA)); + if( tstlocon == connecteur ) + ptrdslocon->DATA = NULL; + } + } + freechain( headzncrec ); + /* pour pouvoir trier les connecteurs dans l'ordre */ + + rec->USER=addptype(rec->USER,TMPLONODE,(void*)noeud); + } +} + +/* ============================================================================= +! FONCTION DE DEBUGGAGE ! +==============================================================================*/ + +void dbg_affznc(winznc) +WinZnc *winznc; +{ + chain_list *scanwin; + znc *zone; + long i; + + for(i=0;i<(winznc->nx*winznc->ny);i++) + { + fprintf(stderr,"fenetre %ld\n",i); + for(scanwin=*(winznc->ChZnc+i);scanwin;scanwin=scanwin->NEXT) + { + zone=(znc*)(scanwin->DATA); + fprintf(stderr,"\t%X : (%ld,%ld)-(%ld,%ld) [%s]\n", (int)zone, + zone->x1, + zone->y1, + zone->x2, + zone->y2, + RDS_LAYER_NAME[zone->layer]); + } + } +} diff --git a/alliance/src/lynx/src/znc.h b/alliance/src/lynx/src/znc.h new file mode 100644 index 00000000..c69205a6 --- /dev/null +++ b/alliance/src/lynx/src/znc.h @@ -0,0 +1,56 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +#define ZNCMAXREC 5 + +typedef struct sznc +{ + struct sznc *NEXT; /* seulement pour l'allocation par tas */ + long x1; + long y1; + long x2; + long y2; + long layer; + chain_list *Win; + chain_list *rec; + long node; +} znc; + +typedef struct sWinZnc +{ + long mx,my,MX,MY; + long PX,PY,nx,ny; + chain_list **ChZnc; +} +WinZnc; + +long addznc __P((long,long,long,long,long,WinZnc*)); +WinZnc* creatwinznc __P((long,long,long,long,long,long,long,long)); /* long mx,my,MX,MY,PX,PY,nx,ny */ +void freewinznc __P((WinZnc*)); /* WinZnc* */ +chain_list* getwininterznc __P((znc*, WinZnc*,short)); +void makezncnode __P((WinZnc*, losig_list*)); +void linklonodelocon __P((chain_list*, losig_list*, WinZnc*, GrgWindow* )); /* chain_list*, lorcnet_list*, WinZnc* */ diff --git a/alliance/src/pat/Makefile.am b/alliance/src/pat/Makefile.am new file mode 100644 index 00000000..af437a64 --- /dev/null +++ b/alliance/src/pat/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src diff --git a/alliance/src/pat/configure.in b/alliance/src/pat/configure.in new file mode 100644 index 00000000..dac8ea70 --- /dev/null +++ b/alliance/src/pat/configure.in @@ -0,0 +1,44 @@ +dnl +/* +dnl This file is part of the Alliance CAD System +dnl Copyright (C) Laboratoire LIP6 - Département ASIM +dnl Universite Pierre et Marie Curie +dnl +dnl Home page : http://www-asim.lip6.fr/alliance/ +dnl E-mail support : mailto:alliance-support@asim.lip6.fr +dnl +dnl This library is free software; you can redistribute it and/or modify it +dnl under the terms of the GNU Library General Public License as published +dnl by the Free Software Foundation; either version 2 of the License, or (at +dnl your option) any later version. +dnl +dnl Alliance VLSI CAD System is distributed in the hope that it will be +dnl useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +dnl Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License along +dnl with the GNU C Library; see the file COPYING. If not, write to the Free +dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +dnl +dnl Purpose : Auto stuffing Alliance +dnl Almost ten years since I wrote this stuff, I just can't +dnl believe it +dnl Date : 01/02/2002 +dnl Author : Frederic Petrot +dnl $Id: configure.in,v 1.1 2002/03/29 17:38:21 ludo Exp $ +dnl +dnl +AC_INIT(src/pat.h) +AM_INIT_AUTOMAKE(pat, 1.9) +AC_PROG_INSTALL +AC_PROG_CC +AC_HEADER_STDC +AC_C_CONST +AC_PROG_RANLIB +AM_ALLIANCE + +AC_OUTPUT([ +Makefile +src/Makefile +]) diff --git a/alliance/src/pat/src/Makefile.am b/alliance/src/pat/src/Makefile.am new file mode 100644 index 00000000..4d38d905 --- /dev/null +++ b/alliance/src/pat/src/Makefile.am @@ -0,0 +1,10 @@ +CFLAGS = @CFLAGS@ \ + -DALLIANCE_TOP=\"${ALLIANCE_TOP}\" +lib_LIBRARIES = libPat.a +include_HEADERS = pat.h +libPat_a_SOURCES = \ +pat_addpacom.c pat_addpaevt.c pat_addpagrp.c pat_addpaini.c \ +pat_addpains.c pat_addpaiol.c pat_addpapat.c pat_addpaseq.c \ +pat_crtpaiol.c pat_error.c pat_frepacom.c pat_frepaevt.c \ +pat_frepaini.c pat_frepaiol.c pat_frepapat.c pat_globals.c \ +pat.h pat_message.c pat_warning.c diff --git a/alliance/src/pat/src/pat.h b/alliance/src/pat/src/pat.h new file mode 100644 index 00000000..bd1fd257 --- /dev/null +++ b/alliance/src/pat/src/pat.h @@ -0,0 +1,203 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* ###--------------------------------------------------------------### */ +/* file : pat109.h */ +/* date : Mar 10 2000 */ +/* version : v109 */ +/* authors : Pirouz BAZARGAN SABET */ +/* description : header for PAT library */ +/* ###--------------------------------------------------------------### */ + +#ifndef PAT_PATDEF +#define PAT_PATDEF + + /* ###------------------------------------------------------### */ + /* defines */ + /* ###------------------------------------------------------### */ + +#define PAT_SEQ__IOLARRAY 0x01 /* paseq FLAGS: array of paiols */ +#define PAT_SEQ__ZERODELAY 0x02 /* paseq FLAGS: zero delay desc */ + +#define PAT_IOL__SPY 0x01 /* paiol FLAG : spied */ +#define PAT_IOL__TRACE 0x02 /* paiol FLAG : traced */ + +#define PAT_PAT__SPY 0x01 /* papat FLAG : spy pattern */ + +#define PAT_SEQ__TIMEUNIT 0x07 /* time unit */ +#define PAT_TU__VU 0 /* time unit : virtual unit */ +#define PAT_TU__FS 1 /* time unit : fs */ +#define PAT_TU__PS 2 /* time unit : ps */ +#define PAT_TU__NS 3 /* time unit : ns */ +#define PAT_TU__US 4 /* time unit : us */ +#define PAT_TU__MS 5 /* time unit : ms */ + + /* ###------------------------------------------------------### */ + /* global variables */ + /* ###------------------------------------------------------### */ + +extern unsigned int PAT_LINNUM ; + +extern unsigned char PAT_TIMEUNIT; +extern unsigned int PAT_TIMESTEP; + +extern float PAT_CNV_FS ; +extern float PAT_CNV_PS ; +extern float PAT_CNV_NS ; +extern float PAT_CNV_US ; +extern float PAT_CNV_MS ; + + /* ###------------------------------------------------------### */ + /* data structures */ + /* ###------------------------------------------------------### */ + +typedef struct paseq /* sequence of patterns */ + { + struct paseq *NEXT ; /* next sequence */ + char *NAME ; /* sequence's name */ + struct pagrp *PAGRP ; /* list of declared arraies */ + struct paiol *PAIOL ; /* list of inputs-outputs */ + struct pacom *DECCOM ; /* declaration part comments */ + struct papat *OLDPAT ; /* old list of patterns */ + struct pacom *OLDCOM ; /* old list of comments */ + struct papat *CURPAT ; /* current patterns */ + struct pacom *CURCOM ; /* current comments */ + struct papat *NXTPAT ; /* next patterns */ + char *MODEL ; /* model of a pttern */ + char *BUFFER ; /* accu. buffer to build pettern*/ + struct pains *PAINS ; /* inspected instances */ + unsigned int PATNBR ; /* # of patterns for simulation */ + unsigned int LINENO ; /* current line number */ + unsigned short IOLNBR ; /* # of inputs-outputs */ + unsigned short SUBSEQ ; /* subsequence number */ + unsigned short DRVSEQ ; /* last drived subsequence */ + char SAVFLG ; /* save flag 'Y' or 'N' */ + char ENDFLG ; /* end flag 'Y' or 'N' */ + unsigned char ERRFLG ; /* error flag */ + unsigned char FLAGS ; /* flags */ + unsigned char TIME_UNIT; /* time unit */ + unsigned int TIME_STEP; /* time step */ + } +paseq_list; + +typedef struct pains /* inspected instance */ + { + struct pains *NEXT ; /* next inspected instance */ + char *INSNAME ; /* instance name */ + char *FILNAME ; /* file name */ + void *INSTANCE ; /* instance pointer */ + FILE *FILPNT ; /* file pointer */ + char *MODEL ; /* model of generated pattern */ + char **VALUE ; /* instance's interface values */ + } +pains_list; + +typedef struct pagrp /* actual or virtual array */ + { + struct pagrp *NEXT ; /* next array */ + char *NAME ; /* array's name */ + unsigned short LENGTH ; /* array's number of bit */ + unsigned short FINDEX ; /* index of the first paiol */ + short FLAG ; /* actual or virtual (0,1) */ + } +pagrp_list; + +typedef struct paiol /* input-output signal */ + { + struct paiol *NEXT ; /* next input-output */ + char *NAME ; /* input-output's name */ + void *SIG ; /* pointer on the signal */ + char FORMAT ; /* read-write format B,O,X */ + char MODE ; /* mode I,B,O,Z,T,R,S,X,W,U */ + char BLANK ; /* number of blank columns */ + char VALUE ; /* (not used) */ + char FLAG ; /* flag */ + } +paiol_list; + +typedef struct papat /* pattern */ + { + struct papat *NEXT ; /* next pattern */ + char *LABEL ; /* pattern's label */ + struct paini *PAINI ; /* list of initializations */ + struct paevt *PAEVT ; /* list of events */ + unsigned int TIME ; /* pattern's absolute time */ + unsigned short LINE ; /* pattern's line number */ + char BLANK ; /* number of blank lines */ + char ACTFLAG ; /* action flag (U,I) */ + char SIMFLAG ; /* simulation flag (U,S) */ + unsigned char FLAG ; /* flag */ + } +papat_list; + +typedef struct paini /* initialized register */ + { + struct paini *NEXT ; /* next initialization */ + char *NAME ; /* register's name */ + char VALUE ; /* initialization's value */ + } +paini_list; + +typedef struct paevt /* event */ + { + struct paevt *NEXT ; /* next event */ + unsigned short INDEX ; /* input-output's index */ + char USRVAL ; /* value given by the user */ + char SIMVAL ; /* calculated value */ + } +paevt_list; + +typedef struct pacom /* comment line */ + { + struct pacom *NEXT ; /* next comment */ + char *TEXT ; /* text of the comment */ + unsigned short POSITION ; /* nbr of decl. or pat. before */ + } +pacom_list; + + /* ###------------------------------------------------------### */ + /* low-level functions */ + /* ###------------------------------------------------------### */ + +extern struct paseq *pat_addpaseq (); /* add a paseq structure */ +extern struct papat *pat_addpapat (); /* add a papat structure */ +extern struct paevt *pat_addpaevt (); /* add a paevt structure */ +extern struct paini *pat_addpaini (); /* add a paini structure */ +extern struct pacom *pat_addpacom (); /* add a pacom structure */ +extern struct pagrp *pat_addpagrp (); /* add a pagrp structure */ +extern struct paiol *pat_addpaiol (); /* add a paiol structure */ +extern struct pains *pat_addpains (); /* add a pains structure */ + +extern struct paiol *pat_crtpaiol (); /* create a table of paiols */ + +extern void pat_frepaiol (); /* delete a list of paiols */ +extern void pat_frepaini (); /* delete a list of painis */ +extern void pat_frepaevt (); /* delete a list of paevts */ +extern void pat_frepapat (); /* delete a list of papats */ +extern void pat_frepacom (); /* delete a list of pacoms */ + +extern int pat_error (); /* pat error function */ +extern int pat_warning (); /* pat warning function */ +extern int pat_message (); /* pat message function */ + +#endif diff --git a/alliance/src/pat/src/pat_addpacom.c b/alliance/src/pat/src/pat_addpacom.c new file mode 100644 index 00000000..434eec61 --- /dev/null +++ b/alliance/src/pat/src/pat_addpacom.c @@ -0,0 +1,59 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +/* ###--------------------------------------------------------------### */ +/* file : pat_addpacom.c */ +/* date : Aug 17 1993 */ +/* version : v104 */ +/* authors : Pirouz BAZARGAN SABET */ +/* content : low-level pat function */ +/* ###--------------------------------------------------------------### */ + +#include "mut.h" +#include "pat.h" + +/* ###--------------------------------------------------------------### */ +/* function : pat_addpacom */ +/* description : create an empty PACOM (comment) structure at the top */ +/* of a list */ +/* called func. : mbkalloc */ +/* ###--------------------------------------------------------------### */ + +struct pacom *pat_addpacom (lastpacom, text, position) + +struct pacom *lastpacom; /* pointer on the last pacom structure */ +char *text; /* text of the comment */ +unsigned short position; /* # of statements. since last comment */ + + { + struct pacom *ptcom; + + ptcom = (struct pacom *) mbkalloc (sizeof(struct pacom)); + ptcom->TEXT = text; + ptcom->POSITION = position; + + ptcom->NEXT = lastpacom; + + return (ptcom); + } diff --git a/alliance/src/pat/src/pat_addpaevt.c b/alliance/src/pat/src/pat_addpaevt.c new file mode 100644 index 00000000..f78cb9c8 --- /dev/null +++ b/alliance/src/pat/src/pat_addpaevt.c @@ -0,0 +1,59 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +/* ###--------------------------------------------------------------### */ +/* file : pat_addpaevt.c */ +/* date : Jul 23 1993 */ +/* version : v104 */ +/* authors : Pirouz BAZARGAN SABET */ +/* content : low-level pat function */ +/* ###--------------------------------------------------------------### */ + +#include "mut.h" +#include "pat.h" + +/* ###--------------------------------------------------------------### */ +/* function : pat_addpaevt */ +/* description : create a PAEVT (input-output event) structure at the */ +/* top of a list */ +/* called func. : mbkalloc */ +/* ###--------------------------------------------------------------### */ + +struct paevt *pat_addpaevt (lastpaevt, index, usrval) + +struct paevt *lastpaevt; /* pointer on the last paevt structure */ +unsigned short index; /* index of the input-output */ +char usrval; /* user predicted value */ + + { + struct paevt *ptevt; + + ptevt = (struct paevt *) mbkalloc (sizeof(struct paevt)); + ptevt->INDEX = index; + ptevt->USRVAL = usrval; + ptevt->SIMVAL = usrval; + ptevt->NEXT = lastpaevt; + + return (ptevt); + } diff --git a/alliance/src/pat/src/pat_addpagrp.c b/alliance/src/pat/src/pat_addpagrp.c new file mode 100644 index 00000000..c507017b --- /dev/null +++ b/alliance/src/pat/src/pat_addpagrp.c @@ -0,0 +1,64 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +/* ###--------------------------------------------------------------### */ +/* file : pat_addpagrp.c */ +/* date : Jul 16 1993 */ +/* version : v104 */ +/* authors : Pirouz BAZARGAN SABET */ +/* content : low-level pat function */ +/* ###--------------------------------------------------------------### */ + +#include "mut.h" +#include "pat.h" + +/* ###--------------------------------------------------------------### */ +/* function : pat_addpagrp */ +/* description : create a PAGRP (array of input-outputs) structure at */ +/* the top of a list */ +/* called func. : namealloc, mbkalloc */ +/* ###--------------------------------------------------------------### */ + +struct pagrp *pat_addpagrp (lastpagrp, name, length, index, flag) + +struct pagrp *lastpagrp; /* pointer on the last pagrp structure */ +char *name; /* array's name */ +unsigned short length; /* array's number of bit */ +unsigned short index; /* index of the first paiol of the array*/ +short flag; /* actual or virtual (0,1) array */ + + { + struct pagrp *ptgrp; + + name = namealloc (name); + + ptgrp = (struct pagrp *) mbkalloc (sizeof(struct pagrp)); + ptgrp->NAME = name; + ptgrp->LENGTH = length; + ptgrp->FINDEX = index; + ptgrp->FLAG = flag; + ptgrp->NEXT = lastpagrp; + + return (ptgrp); + } diff --git a/alliance/src/pat/src/pat_addpaini.c b/alliance/src/pat/src/pat_addpaini.c new file mode 100644 index 00000000..30b49637 --- /dev/null +++ b/alliance/src/pat/src/pat_addpaini.c @@ -0,0 +1,60 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +/* ###--------------------------------------------------------------### */ +/* file : pat_addpaini.c */ +/* date : Jul 16 1993 */ +/* version : v104 */ +/* authors : Pirouz BAZARGAN SABET */ +/* content : low-level pat function */ +/* ###--------------------------------------------------------------### */ + +#include "mut.h" +#include "pat.h" + +/* ###--------------------------------------------------------------### */ +/* function : pat_addpaini */ +/* description : create a PAINI (register initialization) structure */ +/* at the top of a list */ +/* called func. : namealloc, mbkalloc */ +/* ###--------------------------------------------------------------### */ + +struct paini *pat_addpaini (lastpaini, name, value) + +struct paini *lastpaini; /* pointer on the last paini structure */ +char *name; /* register's name */ +char value; /* value to be forced into the register */ + + { + struct paini *ptini; + + name = namealloc (name); + + ptini = (struct paini *) mbkalloc (sizeof(struct paini)); + ptini->NAME = name; + ptini->VALUE = value; + ptini->NEXT = lastpaini; + + return (ptini); + } diff --git a/alliance/src/pat/src/pat_addpains.c b/alliance/src/pat/src/pat_addpains.c new file mode 100644 index 00000000..8e055ed3 --- /dev/null +++ b/alliance/src/pat/src/pat_addpains.c @@ -0,0 +1,64 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +/* ###--------------------------------------------------------------### */ +/* file : pat_addpains.c */ +/* date : Sep 30 1996 */ +/* version : v106 */ +/* authors : Pirouz BAZARGAN SABET */ +/* content : low-level pat function */ +/* ###--------------------------------------------------------------### */ + +#include "mut.h" +#include "pat.h" + +/* ###--------------------------------------------------------------### */ +/* function : pat_addpains */ +/* description : create an empty PAINS (inspected instance) structure */ +/* at the top of a list */ +/* called func. : mbkalloc */ +/* ###--------------------------------------------------------------### */ + +struct pains *pat_addpains (lastpains, insname, filname) + +struct pains *lastpains; /* pointer on the last pains structure */ +char *insname ; /* name of instance */ +char *filname ; /* name of generated file */ + + { + struct pains *ptins; + + ptins = (struct pains *) mbkalloc (sizeof(struct pains)); + + ptins->INSNAME = insname; + ptins->FILNAME = filname; + ptins->MODEL = NULL; + ptins->VALUE = NULL; + ptins->INSTANCE = NULL; + ptins->FILPNT = NULL; + + ptins->NEXT = lastpains; + + return (ptins); + } diff --git a/alliance/src/pat/src/pat_addpaiol.c b/alliance/src/pat/src/pat_addpaiol.c new file mode 100644 index 00000000..d9f1aba6 --- /dev/null +++ b/alliance/src/pat/src/pat_addpaiol.c @@ -0,0 +1,67 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* ###--------------------------------------------------------------### */ +/* file : pat_addpaiol.c */ +/* date : Mar 13 2000 */ +/* version : v109 */ +/* authors : Pirouz BAZARGAN SABET */ +/* content : low-level pat function */ +/* ###--------------------------------------------------------------### */ + +#include "mut.h" +#include "pat.h" + +/* ###--------------------------------------------------------------### */ +/* function : pat_addpaiol */ +/* description : create a PAIOL (input-output) structure at the top */ +/* of a list */ +/* called func. : namealloc, mbkalloc */ +/* ###--------------------------------------------------------------### */ + +struct paiol *pat_addpaiol (lastpaiol, name, format, mode, blank) + +struct paiol *lastpaiol; /* pointer on the last paiol structure */ +char *name; /* input-output's name */ +char format; /* input-output format */ +char mode; /* input-output mode */ +unsigned char blank; /* nbr of blank column to be printed */ + /* after the input-output value */ + + { + struct paiol *ptiol; + + name = namealloc (name); + + ptiol = (struct paiol *) mbkalloc (sizeof(struct paiol)); + ptiol->NAME = name; + ptiol->FORMAT = format; + ptiol->MODE = mode; + ptiol->BLANK = blank; + ptiol->VALUE = '*'; + ptiol->SIG = NULL; + ptiol->FLAG = 0 ; + ptiol->NEXT = lastpaiol; + + return (ptiol); + } diff --git a/alliance/src/pat/src/pat_addpapat.c b/alliance/src/pat/src/pat_addpapat.c new file mode 100644 index 00000000..0c3f655e --- /dev/null +++ b/alliance/src/pat/src/pat_addpapat.c @@ -0,0 +1,66 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* ###--------------------------------------------------------------### */ +/* file : pat_addpapat.c */ +/* date : Mar 13 2000 */ +/* version : v109 */ +/* authors : Pirouz BAZARGAN SABET */ +/* content : low-level pat function */ +/* ###--------------------------------------------------------------### */ + +#include "mut.h" +#include "pat.h" + +/* ###--------------------------------------------------------------### */ +/* function : pat_addpapat */ +/* description : create an empty PAPAT (pattern) structure at the top */ +/* of a list */ +/* called func. : namealloc, mbkalloc */ +/* ###--------------------------------------------------------------### */ + +struct papat *pat_addpapat (lastpapat, label, line) + +struct papat *lastpapat; /* pointer on the last papat structure */ +char *label; /* pattern's label */ +unsigned short line; /* pattern' line number */ + + { + struct papat *ptpat; + + label = namealloc (label); + + ptpat = (struct papat *) mbkalloc (sizeof(struct papat)); + ptpat->LABEL = label ; + ptpat->PAEVT = NULL ; + ptpat->PAINI = NULL ; + ptpat->TIME = 0 ; + ptpat->LINE = line ; + ptpat->BLANK = 0 ; + ptpat->ACTFLAG = 'U' ; + ptpat->SIMFLAG = 'U' ; + ptpat->FLAG = 0 ; + ptpat->NEXT = lastpapat; + + return (ptpat); + } diff --git a/alliance/src/pat/src/pat_addpaseq.c b/alliance/src/pat/src/pat_addpaseq.c new file mode 100644 index 00000000..dd3beba7 --- /dev/null +++ b/alliance/src/pat/src/pat_addpaseq.c @@ -0,0 +1,79 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* ###--------------------------------------------------------------### */ +/* file : pat_addpaseq.c */ +/* date : Mar 8 2000 */ +/* version : v109 */ +/* authors : Pirouz BAZARGAN SABET */ +/* content : low-level pat function */ +/* ###--------------------------------------------------------------### */ + +#include "mut.h" +#include "pat.h" + +/* ###--------------------------------------------------------------### */ +/* function : pat_addpaseq */ +/* description : create an empty PASEQ (sequence of patterns) */ +/* structure at the top of a list */ +/* called func. : mbkalloc */ +/* ###--------------------------------------------------------------### */ + +struct paseq *pat_addpaseq (lastpaseq) + +struct paseq *lastpaseq; /* pointer on the last paseq structure */ + + { + struct paseq *ptseq ; + unsigned char err_flg = 0; + + ptseq = (struct paseq *) mbkalloc (sizeof(struct paseq)); + + ptseq->NAME = NULL ; + ptseq->PAGRP = NULL ; + ptseq->PAIOL = NULL ; + ptseq->DECCOM = NULL ; + ptseq->OLDPAT = NULL ; + ptseq->OLDCOM = NULL ; + ptseq->CURPAT = NULL ; + ptseq->CURCOM = NULL ; + ptseq->NXTPAT = NULL ; + ptseq->MODEL = NULL ; + ptseq->BUFFER = NULL ; + ptseq->PAINS = NULL ; + ptseq->PATNBR = 0 ; + ptseq->IOLNBR = 0 ; + ptseq->SUBSEQ = 0 ; + ptseq->LINENO = 1 ; + ptseq->SAVFLG = 'N' ; + ptseq->ENDFLG = 'N' ; + ptseq->DRVSEQ = 0 ; + ptseq->ERRFLG = err_flg ; + ptseq->FLAGS = 0 ; + ptseq->TIME_UNIT = PAT_TIMEUNIT; + ptseq->TIME_STEP = PAT_TIMESTEP; + + ptseq->NEXT = lastpaseq ; + + return (ptseq); + } diff --git a/alliance/src/pat/src/pat_crtpaiol.c b/alliance/src/pat/src/pat_crtpaiol.c new file mode 100644 index 00000000..ed5c1d96 --- /dev/null +++ b/alliance/src/pat/src/pat_crtpaiol.c @@ -0,0 +1,84 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +/* ###--------------------------------------------------------------### */ +/* file : pat_crtpaiol.c */ +/* date : Sep 30 1996 */ +/* version : v106 */ +/* authors : Pirouz BAZARGAN SABET */ +/* content : low-level pat function */ +/* ###--------------------------------------------------------------### */ + +#include +#include "mut.h" +#include "pat.h" + +/* ###--------------------------------------------------------------### */ +/* function : pat_crtpaiol */ +/* description : create a table of PAIOL (input-output) structures */ +/* organized in a simply chained list. Then, copy the */ +/* content of the old paiol list in the new table */ +/* called func. : mbkalloc */ +/* ###--------------------------------------------------------------### */ + +struct paiol *pat_crtpaiol (paiollist) + +struct paiol *paiollist; /* list of PAIOLs to be put in a table */ + + { + struct paiol *ptiol = NULL; + struct paiol *lcl_ptiol; + int size = 0; + + lcl_ptiol = paiollist; + while (lcl_ptiol != NULL) + { + size++; + lcl_ptiol = lcl_ptiol->NEXT; + } + + if (size != 0) + { + ptiol = (struct paiol *) mbkalloc (size * sizeof(struct paiol)); + lcl_ptiol = ptiol; + + while (paiollist != NULL) + { + lcl_ptiol->NAME = paiollist->NAME; + lcl_ptiol->FORMAT = paiollist->FORMAT; + lcl_ptiol->MODE = paiollist->MODE; + lcl_ptiol->BLANK = paiollist->BLANK; + lcl_ptiol->VALUE = paiollist->VALUE; + lcl_ptiol->SIG = paiollist->SIG; + lcl_ptiol->FLAG = paiollist->FLAG; + lcl_ptiol->NEXT = lcl_ptiol + 1; + + paiollist = paiollist->NEXT; + lcl_ptiol++; + } + (lcl_ptiol - 1)->NEXT = NULL; + + } + return (ptiol); + } diff --git a/alliance/src/pat/src/pat_error.c b/alliance/src/pat/src/pat_error.c new file mode 100644 index 00000000..56789899 --- /dev/null +++ b/alliance/src/pat/src/pat_error.c @@ -0,0 +1,136 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* ###--------------------------------------------------------------### */ +/* file : pat_error.c */ +/* date : Aug 27 1997 */ +/* version : v107 */ +/* author : Pirouz BAZARGAN SABET */ +/* content : system level functions */ +/* ###--------------------------------------------------------------### */ + +#include + +/* ###--------------------------------------------------------------### */ +/* function : pat_error */ +/* description : print an error message depending on the arg. `code` */ +/* called func. : none */ +/* ###--------------------------------------------------------------### */ + +unsigned int pat_error (code, str, dat, line) + +int code; +char *str ; +char dat ; +unsigned int line; + + { + if (code < 100) + fprintf (stderr,"PAT : Error %d line %d : ", code, line); + else + { + if (code < 200) + fprintf (stderr,"PAT : Compiler err. %d : ", code); + else + fprintf (stderr,"PAT : Error %d : ", code); + } + + switch (code) + { + case 1: + fprintf (stderr, "illegal format for one-bit signal\n"); + break; + case 2: + fprintf (stderr, "illegal input-output value `%c`\n", dat); + break; + case 3: + fprintf (stderr, "too many input-output values\n"); + break; + case 4: + fprintf (stderr, "cannot force the value of output `%s`\n", str); + break; + case 5: + fprintf (stderr, "cannot compare the value of input `%s`\n", str); + break; + case 6: + fprintf (stderr, "too many elements in virtual array\n"); + break; + case 7: + fprintf (stderr, "`%s` already declared with another mode\n", str); + break; + case 8: + fprintf (stderr, "group `%s` already declared\n", str); + break; + case 10: + fprintf (stderr, "illegal value for `%s` format `%c`\n", str, dat); + break; + case 12: + fprintf (stderr, "range of `%s` and value mismatch\n", str); + break; + case 13: + fprintf (stderr, "`%s` already declared as an input\n", str); + break; + case 14: + fprintf (stderr, "too many hierarchical names\n"); + break; + case 15: + fprintf (stderr, "no enough input-output values\n"); + break; + case 16: + fprintf (stderr, "patterns must have strictly increasing time\n"); + break; + case 17: + fprintf (stderr, "time overflow: max time is 2^31 steps of time unit\n"); + break; + + case 99: + fprintf (stderr, "%s\n", str); + break; + + case 100: + fprintf (stderr, "unexistent or erroneous sequence\n"); + break; + case 101: + fprintf (stderr, "cannot drive NULL or erroneous sequence\n"); + break; + case 102: + fprintf (stderr, "cannot open file `%s`\n", str); + break; + + case 200: + fprintf (stderr, "unknown time unit\n"); + break; + case 201: + fprintf (stderr, "illegal input-output value `%c`\n", dat); + break; + case 202: + fprintf (stderr, "illegal input-output mode `%c` : %s \n", dat, str); + break; + + default : + fprintf (stderr, "syntax error\n"); + break; + } + + return (1); + } diff --git a/alliance/src/pat/src/pat_frepacom.c b/alliance/src/pat/src/pat_frepacom.c new file mode 100644 index 00000000..1022917a --- /dev/null +++ b/alliance/src/pat/src/pat_frepacom.c @@ -0,0 +1,59 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +/* ###--------------------------------------------------------------### */ +/* file : pat_frepacom.c */ +/* date : Jul 16 1993 */ +/* version : v104 */ +/* authors : Pirouz BAZARGAN SABET */ +/* content : low-level pat function */ +/* ###--------------------------------------------------------------### */ + +#include "mut.h" +#include "pat.h" + +/* ###--------------------------------------------------------------### */ +/* function : pat_frepacom */ +/* description : release a list of PACOM (comment) structures */ +/* called func. : mbkfree */ +/* ###--------------------------------------------------------------### */ + +void pat_frepacom (listpacom) + +struct pacom *listpacom; + + { + struct pacom *ptcom; + + /* ###------------------------------------------------------### */ + /* for each object of the list delete the object itself */ + /* ###------------------------------------------------------### */ + + while (listpacom != NULL) + { + ptcom = listpacom; + listpacom = listpacom->NEXT; + mbkfree (ptcom); + } + } diff --git a/alliance/src/pat/src/pat_frepaevt.c b/alliance/src/pat/src/pat_frepaevt.c new file mode 100644 index 00000000..02dd466e --- /dev/null +++ b/alliance/src/pat/src/pat_frepaevt.c @@ -0,0 +1,59 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +/* ###--------------------------------------------------------------### */ +/* file : pat_frepaevt.c */ +/* date : Jul 16 1993 */ +/* version : v104 */ +/* authors : Pirouz BAZARGAN SABET */ +/* content : low-level pat function */ +/* ###--------------------------------------------------------------### */ + +#include "mut.h" +#include "pat.h" + +/* ###--------------------------------------------------------------### */ +/* function : pat_frepaevt */ +/* description : release a list of PAEVT (event) structures */ +/* called func. : mbkfree */ +/* ###--------------------------------------------------------------### */ + +void pat_frepaevt (listpaevt) + +struct paevt *listpaevt; + + { + struct paevt *ptevt; + + /* ###------------------------------------------------------### */ + /* for each object of the list delete the object itself */ + /* ###------------------------------------------------------### */ + + while (listpaevt != NULL) + { + ptevt = listpaevt; + listpaevt = listpaevt->NEXT; + mbkfree (ptevt); + } + } diff --git a/alliance/src/pat/src/pat_frepaini.c b/alliance/src/pat/src/pat_frepaini.c new file mode 100644 index 00000000..7162e631 --- /dev/null +++ b/alliance/src/pat/src/pat_frepaini.c @@ -0,0 +1,60 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +/* ###--------------------------------------------------------------### */ +/* file : pat_frepaini.c */ +/* date : Jul 16 1993 */ +/* version : v104 */ +/* authors : Pirouz BAZARGAN SABET */ +/* content : low-level pat function */ +/* ###--------------------------------------------------------------### */ + +#include "mut.h" +#include "pat.h" + +/* ###--------------------------------------------------------------### */ +/* function : pat_frepaini */ +/* description : release a list of PAINI (register initialization) */ +/* structures */ +/* called func. : mbkfree */ +/* ###--------------------------------------------------------------### */ + +void pat_frepaini (listpaini) + +struct paini *listpaini; + + { + struct paini *ptini; + + /* ###------------------------------------------------------### */ + /* for each object of the list delete the object itself */ + /* ###------------------------------------------------------### */ + + while (listpaini != NULL) + { + ptini = listpaini; + listpaini = listpaini->NEXT; + mbkfree (ptini); + } + } diff --git a/alliance/src/pat/src/pat_frepaiol.c b/alliance/src/pat/src/pat_frepaiol.c new file mode 100644 index 00000000..42cd1850 --- /dev/null +++ b/alliance/src/pat/src/pat_frepaiol.c @@ -0,0 +1,60 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +/* ###--------------------------------------------------------------### */ +/* file : pat_frepaiol.c */ +/* date : Jul 16 1993 */ +/* version : v104 */ +/* authors : Pirouz BAZARGAN SABET */ +/* content : low-level pat function */ +/* ###--------------------------------------------------------------### */ + +#include "mut.h" +#include "pat.h" + +/* ###--------------------------------------------------------------### */ +/* function : pat_frepaiol */ +/* description : release a list of PAIOL (input-output) structures */ +/* called func. : mbkfree */ +/* ###--------------------------------------------------------------### */ + +void pat_frepaiol (listpaiol) + +struct paiol *listpaiol; /* list of paiol to be deleted */ + + { + struct paiol *ptiol; + + /* ###------------------------------------------------------### */ + /* for each object of the list delete the object itself */ + /* ###------------------------------------------------------### */ + + while (listpaiol != NULL) + { + ptiol = listpaiol; + listpaiol = listpaiol->NEXT; + mbkfree (ptiol); + } + + } diff --git a/alliance/src/pat/src/pat_frepapat.c b/alliance/src/pat/src/pat_frepapat.c new file mode 100644 index 00000000..ce8d74ca --- /dev/null +++ b/alliance/src/pat/src/pat_frepapat.c @@ -0,0 +1,64 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +/* ###--------------------------------------------------------------### */ +/* file : pat_frepapat.c */ +/* date : Jul 16 1993 */ +/* version : v104 */ +/* authors : Pirouz BAZARGAN SABET */ +/* content : low-level pat function */ +/* ###--------------------------------------------------------------### */ + +#include "mut.h" +#include "pat.h" + +/* ###--------------------------------------------------------------### */ +/* function : pat_frepapat */ +/* description : release a list of PAPAT (pattern) structures */ +/* called func. : mbkfree */ +/* ###--------------------------------------------------------------### */ + +void pat_frepapat (listpapat) + +struct papat *listpapat; + + { + struct papat *ptpat; + + /* ###------------------------------------------------------### */ + /* for each object of the list delete the object and all */ + /* referenced objects */ + /* ###------------------------------------------------------### */ + + while (listpapat != NULL) + { + ptpat = listpapat; + + pat_frepaini (ptpat->PAINI); + pat_frepaevt (ptpat->PAEVT); + + listpapat = listpapat->NEXT; + mbkfree (ptpat); + } + } diff --git a/alliance/src/pat/src/pat_globals.c b/alliance/src/pat/src/pat_globals.c new file mode 100644 index 00000000..fcb6a722 --- /dev/null +++ b/alliance/src/pat/src/pat_globals.c @@ -0,0 +1,45 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +/* ###--------------------------------------------------------------### */ +/* file : pat_globals.c */ +/* date : Mar 9 2000 */ +/* version : v109 */ +/* authors : Pirouz BAZARGAN SABET */ +/* content : low-level pat function */ +/* ###--------------------------------------------------------------### */ + +#include "mut.h" +#include "pat.h" + +unsigned int PAT_LINNUM = 1 ; + +unsigned char PAT_TIMEUNIT = PAT_TU__PS; +unsigned int PAT_TIMESTEP = 1 ; + +float PAT_CNV_FS ; +float PAT_CNV_PS ; +float PAT_CNV_NS ; +float PAT_CNV_US ; +float PAT_CNV_MS ; diff --git a/alliance/src/pat/src/pat_message.c b/alliance/src/pat/src/pat_message.c new file mode 100644 index 00000000..2e3160fb --- /dev/null +++ b/alliance/src/pat/src/pat_message.c @@ -0,0 +1,69 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +/* ###--------------------------------------------------------------### */ +/* file : pat_message.c */ +/* date : Aug 16 1993 */ +/* version : v104 */ +/* author : Pirouz BAZARGAN SABET */ +/* content : system level functions */ +/* ###--------------------------------------------------------------### */ + +#include + +/* ###--------------------------------------------------------------### */ +/* function : pat_message */ +/* description : print a message depending on the argument `code` */ +/* called func. : none */ +/* ###--------------------------------------------------------------### */ + +int pat_message (code, str1, str2, line) + +int code; +char *str1; +char *str2; +unsigned int line; + + { + int flag = 1; + + fprintf (stdout, "%s : ", str1); + + switch (code) + { + case 1: + fprintf (stdout, "stop mark set\n"); + break; + + case 2: + fprintf (stdout, "\tSTACK OVERFLOW !!\tSTACK OVERFLOW !!\n"); + break; + + default : + fprintf (stderr,"unknown message\n"); + break; + } + + return (flag); + } diff --git a/alliance/src/pat/src/pat_warning.c b/alliance/src/pat/src/pat_warning.c new file mode 100644 index 00000000..a52e1eea --- /dev/null +++ b/alliance/src/pat/src/pat_warning.c @@ -0,0 +1,68 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +/* ###--------------------------------------------------------------### */ +/* file : pat_warning.c */ +/* date : Aug 16 1993 */ +/* version : v104 */ +/* author : Pirouz BAZARGAN SABET */ +/* content : system level functions */ +/* ###--------------------------------------------------------------### */ + +#include + +/* ###--------------------------------------------------------------### */ +/* function : pat_warning */ +/* description : print a warning message depending on the arg. `code` */ +/* called func. : none */ +/* ###--------------------------------------------------------------### */ + +int pat_warning (code, str, dat, line) + +int code; +char *str ; +char dat ; +unsigned int line; + + { + if (code > 100) + fprintf (stderr, "PAT : Warning %d line %d : ", code, line); + else + { + fprintf (stderr, "PAT : Warning %d : ", code); + } + + switch (code) + { + case 1: + fprintf (stderr, "switching to new file (%s) ?!\n", str); + break; + + default : + fprintf (stderr, "Warning\n"); + break; + } + + return (1); + } diff --git a/alliance/src/phl/Makefile.am b/alliance/src/phl/Makefile.am new file mode 100644 index 00000000..af437a64 --- /dev/null +++ b/alliance/src/phl/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src diff --git a/alliance/src/phl/configure.in b/alliance/src/phl/configure.in new file mode 100644 index 00000000..ecda5502 --- /dev/null +++ b/alliance/src/phl/configure.in @@ -0,0 +1,44 @@ +dnl +/* +dnl This file is part of the Alliance CAD System +dnl Copyright (C) Laboratoire LIP6 - Département ASIM +dnl Universite Pierre et Marie Curie +dnl +dnl Home page : http://www-asim.lip6.fr/alliance/ +dnl E-mail support : mailto:alliance-support@asim.lip6.fr +dnl +dnl This library is free software; you can redistribute it and/or modify it +dnl under the terms of the GNU Library General Public License as published +dnl by the Free Software Foundation; either version 2 of the License, or (at +dnl your option) any later version. +dnl +dnl Alliance VLSI CAD System is distributed in the hope that it will be +dnl useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +dnl Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License along +dnl with the GNU C Library; see the file COPYING. If not, write to the Free +dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +dnl +dnl Purpose : Auto stuffing Alliance +dnl Almost ten years since I wrote this stuff, I just can't +dnl believe it +dnl Date : 01/02/2002 +dnl Author : Frederic Petrot +dnl $Id: configure.in,v 1.1 2002/03/29 17:38:52 ludo Exp $ +dnl +dnl +AC_INIT(src/phl.h) +AM_INIT_AUTOMAKE(phl, 1.9) +AC_PROG_INSTALL +AC_PROG_CC +AC_HEADER_STDC +AC_C_CONST +AC_PROG_RANLIB +AM_ALLIANCE + +AC_OUTPUT([ +Makefile +src/Makefile +]) diff --git a/alliance/src/phl/src/Makefile b/alliance/src/phl/src/Makefile new file mode 100644 index 00000000..fd7de955 --- /dev/null +++ b/alliance/src/phl/src/Makefile @@ -0,0 +1,54 @@ +# +# This file is part of the Alliance CAD System +# Copyright (C) Laboratoire LIP6 - Département ASIM +# Universite Pierre et Marie Curie +# +# Home page : http://www-asim.lip6.fr/alliance/ +# E-mail support : mailto:alliance-support@asim.lip6.fr +# +# This progam is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# Alliance VLSI CAD System is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with the GNU C Library; see the file COPYING. If not, write to the Free +# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +include $(ALLIANCE_TOP)/etc/$(ALLIANCE_OS).mk +include $(ALLIANCE_TOP)/etc/libraries.mk + +#TARGET_LIB = ../../../archi/$(ALLIANCE_OS)/lib +#TARGET_INCLUDE = ../../../archi/$(ALLIANCE_OS)/include + +LOCAL_INC = ../include + +LOCAL_CFLAGS = $(CFLAGS) -c -g +LOCAL_CPPFLAGS = $(CPPFLAGS) -I$(LOCAL_INC) -I$(ALLIANCE_INCLUDE) \ + -DPAT_H='' \ + -DPHL_H='' \ + -DMUT_H='<$(MUT_H)>' + +LOCAL_OBJECTS = pat_debug.o pat_getusage.o + +.c.o : + $(CC) $(LOCAL_CFLAGS) $(LOCAL_CPPFLAGS) $< + +$(TARGET_LIB)/libPhl109.a : $(LOCAL_OBJECTS) + @$(CP) $(LOCAL_INC)/phl109.h $(TARGET_INCLUDE) + $(AR) $(ARFLAGS) $(TARGET_LIB)/libPhl109.a $(LOCAL_OBJECTS) + -$(RANLIB) $(TARGET_LIB)/libPhl109.a + +distrib : $(TARGET_LIB)/libPhl109.a + +clean : + $(RM) -f $(LOCAL_OBJECTS) + +realclean : clean + $(RM) -f $(TARGET_LIB)/libPhl109.a $(TARGET_INCLUDE)/phl109.h diff --git a/alliance/src/phl/src/Makefile.am b/alliance/src/phl/src/Makefile.am new file mode 100644 index 00000000..0d411703 --- /dev/null +++ b/alliance/src/phl/src/Makefile.am @@ -0,0 +1,6 @@ +CFLAGS = @CFLAGS@ \ + -DALLIANCE_TOP=\"${ALLIANCE_TOP}\" +lib_LIBRARIES = libPhl.a +include_HEADERS = phl.h +libPhl_a_SOURCES = \ +pat_debug.c pat_debug.h pat_getusage.c phl.h diff --git a/alliance/src/phl/src/pat_debug.c b/alliance/src/phl/src/pat_debug.c new file mode 100644 index 00000000..0fbf82fd --- /dev/null +++ b/alliance/src/phl/src/pat_debug.c @@ -0,0 +1,1012 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* ###--------------------------------------------------------------### */ +/* file : pat_debug.c */ +/* date : Mar 13 2000 */ +/* version : v109 */ +/* authors : Pirouz BAZARGAN SABET */ +/* content : high level function */ +/* ###--------------------------------------------------------------### */ + +#include +#include "mut.h" +#include "pat.h" +#include "pat_debug.h" + +/* ###--------------------------------------------------------------### */ +/* function : pat_debug */ +/* description : display any pat structure */ +/* called func. : pat_error, pat_message */ +/* go_forward, translate, splitline, pop, push */ +/* read_field, get_size */ +/* ###--------------------------------------------------------------### */ + +void pat_debug (head_pnt, type) + +void *head_pnt; /* structure's pointer */ +char *type; /* structure's type */ + + { + static void disp_immd (); + static void get_size (); + static void read_field (); + static void push (); + static void pop (); + static struct chain *go_forward (); + static int translate (); + static int splitline (); + + char line [128]; /* buffer to read a cmd line */ + char buffer [128]; /* buffer to split the cmd line */ + + char *words [ 10]; /* number of words on a line */ + int nmbrs [ 10]; /* words translated into number */ + char flags [ 10]; /* set if words is a number */ + int indxs [ 10]; /* index of words */ + + struct stack jtab [ 10]; /* list of memorized addresses */ + int idx; + int readflg = 0; + unsigned int size; + char *pntr = NULL; + long pshtype; + int wrdcnt = 1; + + struct stack stk [STKSIZ_DFN]; + int stkpnt = -1; + + union value pnt [MAXCMD_DFN]; + long typ [MAXCMD_DFN]; + unsigned int siz [MAXCMD_DFN]; + + static char *str [] = { + "_back" , "_exit" , "_jump" , "_save" , + "_stop" , "_top" , "_up" , "_display" , + + "character", "short" , "integer" , "long" , + "void" , "string" , + + "chain" , "ptype" , + + "paseq" , "pagrp" , "paiol" , "papat" , + "pacom" , "paini" , "paevt" , "pains" , + + "actflag" , "blank" , "buffer" , "curcom" , + "curpat" , "deccom" , "drvseq" , "endflg" , + "errflg" , "filname" , "filpnt" , "findex" , + "flag" , "format" , "index" , "insname" , + "instance" , "iolnbr" , "label" , "length" , + "line" , "lineno" , "mode" , "model" , + "name" , "next" , "nxtpat" , "oldcom" , + "oldpat" , "patnbr" , "position" , "savflg" , + "sig" , "simflag" , "simval" , "subseq" , + "text" , "time" , "usrval" , "value" , + "flags" , "time_unit", "time_step" + }; + + /* ###------------------------------------------------------### */ + /* initialisation : */ + /* - allocate a buffer for read words */ + /* - break the argument that identifies the structure (type) */ + /* into words */ + /* - search that words among recognized strings */ + /* ###------------------------------------------------------### */ + + words [0] = buffer; + get_size (siz); + + wrdcnt = splitline (words, type); + idx = translate (words, wrdcnt, str, nmbrs, flags, indxs); + + typ [idx] = POINTER_DFN | s_DFN | idx; + pnt [idx].dat = head_pnt; + + /* ###------------------------------------------------------### */ + /* process the command line until the _exit command */ + /* ###------------------------------------------------------### */ + + while ((idx & TYPE_DFN) != _exit_DFN) + { + /* ###------------------------------------------------------### */ + /* if the first word of the line has not been recognized, */ + /* print an error message. Otherwise, proccess the command line */ + /* (generally it is a request for displaying a specific field). */ + /* */ + /* At this point : */ + /* - pnt [] contains all available pointers */ + /* - typ [] contains the type of availabale pointers */ + /* ###------------------------------------------------------### */ + + if (idx == _error_DFN) + pat_error (103, NULL, NULL, 0); + else + { + + /* ###------------------------------------------------------### */ + /* define the type of the structure that may be pushed on */ + /* the stack : */ + /* - if the pointer is a VOID pointer the exact type must be */ + /* defined on the command line (last word of the command) */ + /* ###------------------------------------------------------### */ + + pshtype = POINTER_DFN | s_DFN | void_DFN; + if ((typ [idx] & TYPE_DFN) == void_DFN) + { + if ((wrdcnt >= 2) && (indxs [wrdcnt - 1] != _error_DFN)) + pshtype = POINTER_DFN | s_DFN | indxs [wrdcnt - 1]; + else + pat_error (105, NULL, NULL, 0); + } + else + pshtype = typ [idx]; + + /* ###------------------------------------------------------### */ + /* depending on the kind of the first word of the command */ + /* activate actions : */ + /* - COMMAND (_top, _up, ...) */ + /* - POINTER */ + /* - for NEXT go forward until the Nth element of the */ + /* list. Then, push it on the stack and read fields */ + /* - for others push and read fields */ + /* - ARRAY */ + /* - push the Nth element of the array and read its */ + /* fields */ + /* - ARRAY OF POINTER */ + /* - push the object which address is the Nth element of */ + /* the array and read its fields */ + /* ###------------------------------------------------------### */ + + switch (typ [idx] & KIND_DFN) + { + + /* ###------------------------------------------------------### */ + /* COMMANDS ... */ + /* ###------------------------------------------------------### */ + + case COMMAND_DFN : + + switch (typ [idx] & TYPE_DFN) + { + /* ###------------------------------------------------------### */ + /* _top COMMAND : reset the stack pointer, call read_field */ + /* to read the structure on the top of stack */ + /* ###------------------------------------------------------### */ + + case _top_DFN : + stkpnt = 0; + readflg = 1; + break; + + /* ###------------------------------------------------------### */ + /* _stop COMMAND : set the stop mark for the structure on */ + /* the top of stack */ + /* ###------------------------------------------------------### */ + + case _stop_DFN : + stk [stkpnt].mark = 1; + pat_message (1, "pat_debug", NULL, 0); + break; + + /* ###------------------------------------------------------### */ + /* _back COMMAND : pop structures from the stack until a */ + /* marked structure is found. Call read_field to read the */ + /* structure on the top of stack */ + /* ###------------------------------------------------------### */ + + case _back_DFN : + while ((stkpnt != 0) && (stk[--stkpnt].mark != 1)); + readflg = 1; + break; + + /* ###------------------------------------------------------### */ + /* _jump COMMAND : push on the stack the structure saved in */ + /* the jump table. Call read_field to read the structure on the */ + /* top of stack */ + /* ###------------------------------------------------------### */ + + case _jump_DFN : + if ((wrdcnt == 2) && (flags [1] == 1) && (nmbrs [1] < 10)) + { + push (stk, &stkpnt, jtab[nmbrs[1]].data, jtab[nmbrs[1]].type); + readflg = 1; + } + else + pat_error (103, NULL, NULL, 0); + break; + + /* ###------------------------------------------------------### */ + /* _up COMMAND : pop structure from the stack. Call */ + /* read_field to read the structure on the top of stack */ + /* ###------------------------------------------------------### */ + + case _up_DFN : + if (wrdcnt == 1) + { + pop (&stkpnt, 1); + readflg = 1; + } + else + { + if ((wrdcnt == 2) && (flags [1] == 1)) + { + pop (&stkpnt, nmbrs [1] + 1); + readflg = 1; + } + else + pat_error (103, NULL, NULL, 0); + } + break; + + /* ###------------------------------------------------------### */ + /* _save COMMAND : save the structure on the top of stack in */ + /* the jump table */ + /* ###------------------------------------------------------### */ + + case _save_DFN : + if ((wrdcnt == 2) && (flags [1] == 1) && (nmbrs [1] < 10)) + jtab [nmbrs[1]] = stk [stkpnt]; + else + pat_error (103, NULL, NULL, 0); + break; + + /* ###------------------------------------------------------### */ + /* _display COMMAND : display a specified field as an */ + /* immediate */ + /* ###------------------------------------------------------### */ + + case _display_DFN : + if ((wrdcnt == 3) && (indxs [1] != _error_DFN)) + disp_immd (str, pnt [indxs [1]], indxs [2]); + else + pat_error (103, NULL, NULL, 0); + break; + + } + break; + + /* ###------------------------------------------------------### */ + /* POINTERS ... */ + /* ###------------------------------------------------------### */ + + case POINTER_DFN : + if (idx == next_DFN) + { + if ((wrdcnt == 1) || ((wrdcnt == 2) && (flags [1] == 0))) + { + push (stk, &stkpnt, pnt [idx].dat, pshtype); + readflg = 1; + } + else + { + if (((wrdcnt == 3) || (wrdcnt == 2)) && (flags [1] == 1)) + { + pnt [idx].dat = (void *) go_forward (pnt [idx].dat, nmbrs [1]); + push (stk, &stkpnt, pnt [idx].dat, pshtype); + readflg = 1; + } + else + pat_error (103, NULL, NULL, 0); + } + } + else + { + push (stk, &stkpnt, pnt [idx].dat, pshtype); + readflg = 1; + } + break; + + /* ###------------------------------------------------------### */ + /* ARRAIES of structure */ + /* ###------------------------------------------------------### */ + + case ARRAY_DFN : + if ((wrdcnt > 1) && (flags [1] == 1)) + { + size = siz [(typ [idx] & TYPE_DFN)]; + pntr = (void *) + (((unsigned int) pnt [idx].dat) + (size * nmbrs [1])); + push (stk, &stkpnt, pntr, pshtype); + readflg = 1; + } + else + pat_error (103, NULL, NULL, 0); + break; + + /* ###------------------------------------------------------### */ + /* ARRAIES of pointers */ + /* ###------------------------------------------------------### */ + + case ARYOFPNT_DFN : + if ((wrdcnt > 1) && (flags [1] == 1)) + { + size = sizeof (void *); + pntr = * (void **) + (((unsigned int) pnt [idx].dat) + (size * nmbrs [1])); + push (stk, &stkpnt, pntr, pshtype); + readflg = 1; + } + else + pat_error (103, NULL, NULL, 0); + break; + + } + + if (readflg == 1) + { + readflg = 0; + read_field (stk [stkpnt], pnt, typ, str); + } + + } + + printf ("\n\nCOMMAND > "); + + gets (line); + wrdcnt = splitline (words, line); + idx = translate (words, wrdcnt, str, nmbrs, flags, indxs); + } + + } + +/* ###--------------------------------------------------------------### */ +/* function : read_field */ +/* description : read the content of a data structure */ +/* called func. : none */ +/* ###--------------------------------------------------------------### */ + +static void read_field (curpnt, pnt, typ, str) + +struct stack curpnt; /* current struct. to be read */ +union value *pnt ; /* child structures or data */ +long *typ ; /* child struct. or data type */ +char **str ; /* recognized strings */ + { + + int i; + + struct paseq *paseq_pnt; + struct pagrp *pagrp_pnt; + struct paiol *paiol_pnt; + struct papat *papat_pnt; + struct pacom *pacom_pnt; + struct paini *paini_pnt; + struct paevt *paevt_pnt; + struct pains *pains_pnt; + + char **string_pnt; + char *character_pnt; + int *integer_pnt; + + /* ###------------------------------------------------------### */ + /* initialization */ + /* ###------------------------------------------------------### */ + + for (i=0 ; iNEXT ; + pnt [name_DFN].dat = paseq_pnt->NAME ; + pnt [pagrp_DFN].dat = paseq_pnt->PAGRP ; + pnt [paiol_DFN].dat = paseq_pnt->PAIOL ; + pnt [deccom_DFN].dat = paseq_pnt->DECCOM ; + pnt [oldpat_DFN].dat = paseq_pnt->OLDPAT ; + pnt [oldcom_DFN].dat = paseq_pnt->OLDCOM ; + pnt [curpat_DFN].dat = paseq_pnt->CURPAT ; + pnt [curcom_DFN].dat = paseq_pnt->CURCOM ; + pnt [nxtpat_DFN].dat = paseq_pnt->NXTPAT ; + pnt [model_DFN].dat = paseq_pnt->MODEL ; + pnt [buffer_DFN].dat = paseq_pnt->BUFFER ; + pnt [pains_DFN].dat = paseq_pnt->PAINS ; + pnt [patnbr_DFN].imd = paseq_pnt->PATNBR ; + pnt [lineno_DFN].imd = paseq_pnt->LINENO ; + pnt [iolnbr_DFN].imd = paseq_pnt->IOLNBR ; + pnt [subseq_DFN].imd = paseq_pnt->SUBSEQ ; + pnt [drvseq_DFN].imd = paseq_pnt->DRVSEQ ; + pnt [savflg_DFN].imd = paseq_pnt->SAVFLG ; + pnt [endflg_DFN].imd = paseq_pnt->ENDFLG ; + pnt [errflg_DFN].imd = paseq_pnt->ERRFLG ; + pnt [flags_DFN].imd = paseq_pnt->FLAGS ; + pnt [time_unit_DFN].imd = paseq_pnt->TIME_UNIT; + pnt [time_step_DFN].imd = paseq_pnt->TIME_STEP; + + break; + + /* ###------------------------------------------------------### */ + /* pains */ + /* ###------------------------------------------------------### */ + + case pains_DFN : + + pains_pnt = (struct pains *) curpnt.data; + + typ [next_DFN] = POINTER_DFN | s_DFN | pains_DFN; + typ [insname_DFN] = IMMEDIATE_DFN | s_DFN | string_DFN; + typ [filname_DFN] = IMMEDIATE_DFN | s_DFN | string_DFN; + typ [instance_DFN] = POINTER_DFN | s_DFN | void_DFN; + typ [model_DFN] = IMMEDIATE_DFN | s_DFN | string_DFN; + typ [value_DFN] = ARYOFPNT_DFN | s_DFN | character_DFN; + + pnt [next_DFN].dat = pains_pnt->NEXT; + pnt [insname_DFN].dat = pains_pnt->INSNAME; + pnt [filname_DFN].dat = pains_pnt->FILNAME; + pnt [instance_DFN].dat = pains_pnt->INSTANCE; + pnt [model_DFN].dat = pains_pnt->MODEL; + pnt [value_DFN].dat = pains_pnt->VALUE; + + break; + + /* ###------------------------------------------------------### */ + /* pagrp */ + /* ###------------------------------------------------------### */ + + case pagrp_DFN : + + pagrp_pnt = (struct pagrp *) curpnt.data; + + typ [next_DFN] = POINTER_DFN | s_DFN | pagrp_DFN; + typ [name_DFN] = IMMEDIATE_DFN | s_DFN | string_DFN; + typ [length_DFN] = IMMEDIATE_DFN | u_DFN | short_DFN; + typ [findex_DFN] = IMMEDIATE_DFN | u_DFN | short_DFN; + typ [flag_DFN] = IMMEDIATE_DFN | d_DFN | short_DFN; + + pnt [next_DFN].dat = pagrp_pnt->NEXT; + pnt [name_DFN].dat = pagrp_pnt->NAME; + pnt [length_DFN].imd = pagrp_pnt->LENGTH; + pnt [findex_DFN].imd = pagrp_pnt->FINDEX; + pnt [flag_DFN].imd = pagrp_pnt->FLAG; + + break; + + /* ###------------------------------------------------------### */ + /* paiol */ + /* ###------------------------------------------------------### */ + + case paiol_DFN : + + paiol_pnt = (struct paiol *) curpnt.data; + + typ [next_DFN] = POINTER_DFN | s_DFN | paiol_DFN; + typ [name_DFN] = IMMEDIATE_DFN | s_DFN | string_DFN; + typ [format_DFN] = IMMEDIATE_DFN | c_DFN | character_DFN; + typ [mode_DFN] = IMMEDIATE_DFN | c_DFN | character_DFN; + typ [blank_DFN] = IMMEDIATE_DFN | u_DFN | character_DFN; + typ [value_DFN] = IMMEDIATE_DFN | x_DFN | character_DFN; + typ [sig_DFN] = POINTER_DFN | s_DFN | void_DFN; + typ [flag_DFN] = IMMEDIATE_DFN | d_DFN | character_DFN; + + pnt [next_DFN].dat = paiol_pnt->NEXT; + pnt [name_DFN].dat = paiol_pnt->NAME; + pnt [format_DFN].imd = paiol_pnt->FORMAT; + pnt [mode_DFN].imd = paiol_pnt->MODE; + pnt [blank_DFN].imd = paiol_pnt->BLANK; + pnt [value_DFN].imd = paiol_pnt->VALUE; + pnt [sig_DFN].dat = paiol_pnt->SIG; + pnt [flag_DFN].imd = paiol_pnt->FLAG; + + break; + + /* ###------------------------------------------------------### */ + /* papat */ + /* ###------------------------------------------------------### */ + + case papat_DFN : + + papat_pnt = (struct papat *) curpnt.data; + + typ [next_DFN] = POINTER_DFN | s_DFN | papat_DFN ; + typ [label_DFN] = IMMEDIATE_DFN | s_DFN | string_DFN ; + typ [paini_DFN] = POINTER_DFN | s_DFN | paini_DFN ; + typ [paevt_DFN] = POINTER_DFN | s_DFN | paevt_DFN ; + typ [time_DFN] = IMMEDIATE_DFN | u_DFN | integer_DFN ; + typ [line_DFN] = IMMEDIATE_DFN | u_DFN | short_DFN ; + typ [blank_DFN] = IMMEDIATE_DFN | u_DFN | character_DFN; + typ [actflag_DFN] = IMMEDIATE_DFN | c_DFN | character_DFN; + typ [simflag_DFN] = IMMEDIATE_DFN | c_DFN | character_DFN; + typ [flag_DFN] = IMMEDIATE_DFN | x_DFN | character_DFN; + + pnt [next_DFN].dat = papat_pnt->NEXT ; + pnt [label_DFN].dat = papat_pnt->LABEL ; + pnt [paini_DFN].dat = papat_pnt->PAINI ; + pnt [paevt_DFN].dat = papat_pnt->PAEVT ; + pnt [time_DFN].imd = papat_pnt->TIME ; + pnt [line_DFN].imd = papat_pnt->LINE ; + pnt [blank_DFN].imd = papat_pnt->BLANK ; + pnt [actflag_DFN].imd = papat_pnt->ACTFLAG; + pnt [simflag_DFN].imd = papat_pnt->SIMFLAG; + pnt [flag_DFN].imd = papat_pnt->FLAG ; + + break; + + /* ###------------------------------------------------------### */ + /* paini */ + /* ###------------------------------------------------------### */ + + case paini_DFN : + + paini_pnt = (struct paini *) curpnt.data; + + typ [next_DFN] = POINTER_DFN | s_DFN | paini_DFN ; + typ [name_DFN] = IMMEDIATE_DFN | s_DFN | string_DFN ; + typ [value_DFN] = IMMEDIATE_DFN | x_DFN | character_DFN; + + pnt [next_DFN].dat = paini_pnt->NEXT ; + pnt [name_DFN].dat = paini_pnt->NAME ; + pnt [value_DFN].imd = paini_pnt->VALUE; + + break; + + /* ###------------------------------------------------------### */ + /* paevt */ + /* ###------------------------------------------------------### */ + + case paevt_DFN : + + paevt_pnt = (struct paevt *) curpnt.data; + + typ [next_DFN] = POINTER_DFN | s_DFN | paevt_DFN; + typ [index_DFN] = IMMEDIATE_DFN | u_DFN | short_DFN; + typ [usrval_DFN] = IMMEDIATE_DFN | x_DFN | character_DFN; + typ [simval_DFN] = IMMEDIATE_DFN | x_DFN | character_DFN; + + pnt [next_DFN].dat = paevt_pnt->NEXT; + pnt [index_DFN].imd = paevt_pnt->INDEX; + pnt [usrval_DFN].imd = paevt_pnt->USRVAL; + pnt [simval_DFN].imd = paevt_pnt->SIMVAL; + + break; + + /* ###------------------------------------------------------### */ + /* pacom */ + /* ###------------------------------------------------------### */ + + case pacom_DFN : + + pacom_pnt = (struct pacom *) curpnt.data; + + typ [next_DFN] = POINTER_DFN | s_DFN | pacom_DFN; + typ [text_DFN] = IMMEDIATE_DFN | s_DFN | string_DFN; + typ [position_DFN] = IMMEDIATE_DFN | u_DFN | short_DFN; + + pnt [next_DFN].dat = pacom_pnt->NEXT; + pnt [text_DFN].dat = pacom_pnt->TEXT; + pnt [position_DFN].imd = pacom_pnt->POSITION; + + break; + + /* ###------------------------------------------------------### */ + /* string */ + /* ###------------------------------------------------------### */ + + case string_DFN : + + string_pnt = (char **) curpnt.data; + + typ [string_DFN] = IMMEDIATE_DFN | s_DFN | string_DFN; + pnt [string_DFN].dat = *string_pnt; + + break; + + /* ###------------------------------------------------------### */ + /* character */ + /* ###------------------------------------------------------### */ + + case character_DFN : + + character_pnt = (char *) curpnt.data; + + typ [character_DFN] = IMMEDIATE_DFN | x_DFN | character_DFN; + pnt [character_DFN].imd = *character_pnt; + + break; + + /* ###------------------------------------------------------### */ + /* integer */ + /* ###------------------------------------------------------### */ + + case integer_DFN : + + integer_pnt = (int *) curpnt.data; + + typ [integer_DFN] = IMMEDIATE_DFN | d_DFN | integer_DFN; + pnt [integer_DFN].imd = *integer_pnt; + + break; + + } + + /* ###------------------------------------------------------### */ + /* scan the list of recongnized strings to print those */ + /* values that are not empty (different form _error_DFN) : */ + /* */ + /* - if it contains an immediate, print it following the */ + /* required format */ + /* */ + /* - if it contains a pointer, just print the pointer */ + /* indication, ->, and "availbale" */ + /* */ + /* - if it contains an array, just print the array */ + /* indication, =>, and "availbale" */ + /* ###------------------------------------------------------### */ + + printf ("--------- current structure : %s ---------\n\n", + str [curpnt.type & TYPE_DFN]); + + for (i=0 ; i %-15s: ", str [i]); + if (pnt[i].dat != NULL) + printf ("available"); + printf ("\n"); + } + + if ( ((typ [i] & KIND_DFN) == ARRAY_DFN ) || + ((typ [i] & KIND_DFN) == ARYOFPNT_DFN) ) + { + printf ("=> %-15s: ", str [i]); + if (pnt[i].dat != NULL) + printf ("available"); + printf ("\n"); + } + } + + } + +/* ###--------------------------------------------------------------### */ +/* function : splitline */ +/* description : read a line (the space must have been reserved by the */ +/* caller - *words) from the standard input and split it */ +/* into seperate words. Return the number of words read. */ +/* called func. : none */ +/* ###--------------------------------------------------------------### */ + +static int splitline (words, line) + +char **words; +char *line ; + { + + char *heap = *words; + int new = 1; + int wrdcnt = 0; + int i = 0; + int j = 0; + + /* ###------------------------------------------------------### */ + /* copy the line read from input into the words until a */ + /* space has been found. Then, increment the word count and */ + /* begin filling the next word */ + /* ###------------------------------------------------------### */ + + while ((heap[j] = line[i++]) != '\0') + { + if ((heap[j] != ' ') && (heap[j] != '\t')) + { + new = 0; + j++; + } + else + { + if (new != 1) + { + heap [j++] = '\0'; + words [++wrdcnt] = heap + j; + new = 1; + } + } + } + + if (new != 1) + wrdcnt++; + + return (wrdcnt); + } + +/* ###--------------------------------------------------------------### */ +/* function : push */ +/* description : push a structure on the stack */ +/* called func. : none */ +/* ###--------------------------------------------------------------### */ + +static void push (stk, stkpnt, data, type) + +struct stack *stk; +int *stkpnt; +void *data; +short type; + + { + int stkidx = *stkpnt; + + if (stkidx == STKSIZ_DFN) + pat_message (2, "pat_debug", NULL, 0); + else + { + if (data != NULL) + { + stkidx++; + stk [stkidx].data = data; + stk [stkidx].type = type; + stk [stkidx].mark = 0; + *stkpnt = stkidx; + } + else + pat_error (104, NULL, NULL, 0); + } + } + +/* ###--------------------------------------------------------------### */ +/* function : pop */ +/* description : pop N structures from the stack */ +/* called func. : none */ +/* ###--------------------------------------------------------------### */ + +static void pop (stkpnt, count) + +int *stkpnt; +int count; + + { + int stkidx = *stkpnt; + + if (stkidx <= count) + stkidx = 0; + else + stkidx -= count; + + *stkpnt = stkidx; + } + +/* ###--------------------------------------------------------------### */ +/* function : go_forward */ +/* description : go forward through the NEXT field to find the Nth */ +/* structure in the list and return it */ +/* called func. : none */ +/* ###--------------------------------------------------------------### */ + +static struct chain *go_forward (pnt, count) + +struct chain *pnt; +int count; + + { + while ((count > 0) && (pnt != NULL) && (pnt->NEXT != NULL)) + { + pnt = pnt->NEXT; + count--; + } + return (pnt); + } + +/* ###--------------------------------------------------------------### */ +/* function : translate */ +/* description : find the index of each word read from the command */ +/* line. For each word check if it is a number. Return */ +/* the index of the first word. */ +/* called func. : none */ +/* ###--------------------------------------------------------------### */ + +static int translate (words, wrdcnt, strgs, nmbrs, flags, indxs) + +char **words ; /* list of words */ +int wrdcnt; /* number of words */ +char **strgs ; /* list of recognized strings */ +int *nmbrs ; /* words translated to numbers */ +char *flags ; /* set if word is a number */ +int *indxs ; /* words' index in strgs table */ + + { + int i , j; + + /* ###------------------------------------------------------### */ + /* initialize flags and indxs */ + /* ###------------------------------------------------------### */ + + for (i=0 ; i<10 ; i++) + { + flags [i] = 0; + indxs [i] = _error_DFN; + } + + /* ###------------------------------------------------------### */ + /* for each word : */ + /* - check if it is a number */ + /* - try to locate the word among the recognized strings. */ + /* If found save it's index */ + /* ###------------------------------------------------------### */ + + for (i=0 ; i +#include "pat.h" +#include "phl.h" + +void pat_getusage (ptseq, ptuse) + +struct paseq *ptseq; +struct pause *ptuse; + + { + struct paseq *seq_pnt; + struct paiol *iol_pnt; + struct pagrp *grp_pnt; + struct papat *pat_pnt; + struct paevt *evt_pnt; + struct paini *ini_pnt; + struct pacom *com_pnt; + struct pains *ins_pnt; + + /* ###------------------------------------------------------### */ + /* count pattern sequences */ + /* ###------------------------------------------------------### */ + + seq_pnt = ptseq; + while (seq_pnt != NULL) + { + + if (seq_pnt->SUBSEQ == 1) + { + ptuse->PASEQ++; + + if (seq_pnt->NAME != NULL) + ptuse->CHARACTER += strlen (seq_pnt->NAME); + + /* ###------------------------------------------------------### */ + /* inside each sequence count arraies of input-outputs */ + /* ###------------------------------------------------------### */ + + grp_pnt = seq_pnt->PAGRP; + while (grp_pnt != NULL) + { + ptuse->PAGRP++; + + if (grp_pnt->NAME != NULL) + ptuse->CHARACTER += strlen (grp_pnt->NAME); + + grp_pnt = grp_pnt->NEXT; + } + + /* ###------------------------------------------------------### */ + /* inside each sequence count input-outputs */ + /* ###------------------------------------------------------### */ + + iol_pnt = seq_pnt->PAIOL; + while (iol_pnt != NULL) + { + ptuse->PAIOL++; + + if (iol_pnt->NAME != NULL) + ptuse->CHARACTER += strlen (iol_pnt->NAME); + + iol_pnt = iol_pnt->NEXT; + } + + /* ###------------------------------------------------------### */ + /* inside each sequence count inspected instances */ + /* ###------------------------------------------------------### */ + + ins_pnt = seq_pnt->PAINS; + while (ins_pnt != NULL) + { + ptuse->PAINS++; + if (ins_pnt->INSNAME != NULL) + ptuse->CHARACTER += strlen (ins_pnt->INSNAME); + + if (ins_pnt->FILNAME != NULL) + ptuse->CHARACTER += strlen (ins_pnt->FILNAME); + + ins_pnt = ins_pnt->NEXT; + } + + /* ###------------------------------------------------------### */ + /* inside each sequence count (declaration) comments */ + /* ###------------------------------------------------------### */ + + com_pnt = seq_pnt->DECCOM; + while (com_pnt != NULL) + { + ptuse->PACOM++; + + if (com_pnt->TEXT != NULL) + ptuse->CHARACTER += strlen (com_pnt->TEXT); + + com_pnt = com_pnt->NEXT; + } + + } + + /* ###------------------------------------------------------### */ + /* inside each sequence count (description) comments */ + /* ###------------------------------------------------------### */ + + com_pnt = seq_pnt->CURCOM; + while (com_pnt != NULL) + { + ptuse->PACOM++; + + if (com_pnt->TEXT != NULL) + ptuse->CHARACTER += strlen (com_pnt->TEXT); + + com_pnt = com_pnt->NEXT; + } + + /* ###------------------------------------------------------### */ + /* inside each sequence count patterns */ + /* ###------------------------------------------------------### */ + + pat_pnt = seq_pnt->CURPAT; + while ((pat_pnt != NULL) && (pat_pnt != seq_pnt->NXTPAT)) + { + ptuse->PAPAT++; + + /* ###------------------------------------------------------### */ + /* for each pattern count events */ + /* ###------------------------------------------------------### */ + + evt_pnt = pat_pnt->PAEVT; + while (evt_pnt != NULL) + { + ptuse->PAEVT++; + evt_pnt = evt_pnt->NEXT; + } + + /* ###------------------------------------------------------### */ + /* for each pattern count initializations */ + /* ###------------------------------------------------------### */ + + ini_pnt = pat_pnt->PAINI; + while (ini_pnt != NULL) + { + ptuse->PAINI++; + + if (ini_pnt->NAME != NULL) + ptuse->CHARACTER += strlen (ini_pnt->NAME); + + ini_pnt = ini_pnt->NEXT; + } + + pat_pnt = pat_pnt->NEXT; + } + + seq_pnt = seq_pnt->NEXT; + } + + } diff --git a/alliance/src/phl/src/phl.h b/alliance/src/phl/src/phl.h new file mode 100644 index 00000000..ddd28490 --- /dev/null +++ b/alliance/src/phl/src/phl.h @@ -0,0 +1,37 @@ + +/* ###--------------------------------------------------------------### */ +/* file : phl109.h */ +/* date : Mar 9 2000 */ +/* version : v109 */ +/* authors : Pirouz BAZARGAN SABET */ +/* description : header for PHL library */ +/* ###--------------------------------------------------------------### */ + +#ifndef PAT_PHLDEF +#define PAT_PHLDEF + + /* ###------------------------------------------------------### */ + /* data structures */ + /* ###------------------------------------------------------### */ + +struct pause /* structures' usage */ + { + unsigned int PASEQ ; /* # of sequence of patterns */ + unsigned int PAGRP ; /* # of input-output arraies */ + unsigned int PAIOL ; /* # of input-outputs */ + unsigned int PACOM ; /* # of comments */ + unsigned int PAPAT ; /* # of patterns */ + unsigned int PAEVT ; /* # of events */ + unsigned int PAINI ; /* # of register's init. */ + unsigned int PAINS ; /* # of inspected instances */ + unsigned int CHARACTER; /* # of characters (in strings) */ + }; + + /* ###------------------------------------------------------### */ + /* high-level functions */ + /* ###------------------------------------------------------### */ + +extern void pat_debug (); /* pat structure displayer */ +extern void pat_getusage (); /* get structures' usage */ + +#endif diff --git a/alliance/src/ppt/Makefile.am b/alliance/src/ppt/Makefile.am new file mode 100644 index 00000000..af437a64 --- /dev/null +++ b/alliance/src/ppt/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src diff --git a/alliance/src/ppt/configure.in b/alliance/src/ppt/configure.in new file mode 100644 index 00000000..16bcbf0f --- /dev/null +++ b/alliance/src/ppt/configure.in @@ -0,0 +1,47 @@ +dnl +/* +dnl This file is part of the Alliance CAD System +dnl Copyright (C) Laboratoire LIP6 - Département ASIM +dnl Universite Pierre et Marie Curie +dnl +dnl Home page : http://www-asim.lip6.fr/alliance/ +dnl E-mail support : mailto:alliance-support@asim.lip6.fr +dnl +dnl This library is free software; you can redistribute it and/or modify it +dnl under the terms of the GNU Library General Public License as published +dnl by the Free Software Foundation; either version 2 of the License, or (at +dnl your option) any later version. +dnl +dnl Alliance VLSI CAD System is distributed in the hope that it will be +dnl useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +dnl Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License along +dnl with the GNU C Library; see the file COPYING. If not, write to the Free +dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +dnl +dnl Purpose : Auto stuffing Alliance +dnl Almost ten years since I wrote this stuff, I just can't +dnl believe it +dnl Date : 01/02/2002 +dnl Author : Frederic Petrot +dnl $Id: configure.in,v 1.1 2002/03/29 17:38:37 ludo Exp $ +dnl +dnl +AC_INIT(src/ppt.h) +AM_INIT_AUTOMAKE(ppt, 1.9) +AC_PROG_INSTALL +AC_PROG_CC +AC_PROG_YACC +AM_PROG_LEX +AC_HEADER_STDC +AC_C_CONST +AC_PROG_RANLIB + +AM_ALLIANCE + +AC_OUTPUT([ +Makefile +src/Makefile +]) diff --git a/alliance/src/ppt/src/Makefile.am b/alliance/src/ppt/src/Makefile.am new file mode 100644 index 00000000..27a377fc --- /dev/null +++ b/alliance/src/ppt/src/Makefile.am @@ -0,0 +1,23 @@ +lib_LIBRARIES = libPpt.a +include_HEADERS = ppt.h +libPpt_a_SOURCES = pat_decl_l.l pat_decl_y.y pat_desc_l.l pat_desc_y.y\ +pat_decl.h pat_defs.h \ +pat_desc.h pat_drvpat.c \ +pat_lodpaseq.c pat_pattostr.c pat_prspat.c pat_savpaseq.c \ +pat_type.h ppt.h + +CLEANFILES = pat_decl_y.c pat_decl_y.h pat_desc_y.h pat_desc_y.c \ + pat_decl_l.c pat_desc_l.c + +pat_decl_y.c pat_decl_y.h : $(srcdir)/pat_decl_y.y + $(YACC) -d $(YFLAGS) $(srcdir)/pat_decl_y.y && sed -e "s/yy/pat_decl_y_/g" -e "s/YY/PAT_DECL_Y_/g" y.tab.c > pat_decl_y.c && sed -e "s/yy/pat_decl_y_/g" -e "s/YY/PAT_DECL_Y_/g" y.tab.h > pat_decl_y.h + +pat_decl_l.c : $(srcdir)/pat_decl_l.l pat_decl_y.h + $(LEX) -t $(srcdir)/pat_decl_l.l | sed -e "s/yy/pat_decl_y_/g" -e "s/YY/PAT_DECL_Y_/g" > pat_decl_l.c + +pat_desc_y.c pat_desc_y.h : $(srcdir)/pat_desc_y.y + $(YACC) -d $(YFLAGS) $(srcdir)/pat_desc_y.y && sed -e "s/yy/pat_desc_y_/g" -e "s/YY/PAT_DESC_Y_/g" y.tab.c > pat_desc_y.c && sed -e "s/yy/pat_desc_y_/g" -e "s/YY/PAT_DESC_Y_/g" y.tab.h > pat_desc_y.h + +pat_desc_l.c : $(srcdir)/pat_desc_l.l pat_desc_y.h + $(LEX) -t $(srcdir)/pat_desc_l.l | sed -e "s/yy/pat_desc_y_/g" -e "s/YY/PAT_DESC_Y_/g" > pat_desc_l.c + diff --git a/alliance/src/ppt/src/Makefile.old b/alliance/src/ppt/src/Makefile.old new file mode 100644 index 00000000..3f9fd352 --- /dev/null +++ b/alliance/src/ppt/src/Makefile.old @@ -0,0 +1,72 @@ +# +# This file is part of the Alliance CAD System +# Copyright (C) Laboratoire LIP6 - Département ASIM +# Universite Pierre et Marie Curie +# +# Home page : http://www-asim.lip6.fr/alliance/ +# E-mail support : mailto:alliance-support@asim.lip6.fr +# +# This progam is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# Alliance VLSI CAD System is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with the GNU C Library; see the file COPYING. If not, write to the Free +# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +include $(ALLIANCE_TOP)/etc/$(ALLIANCE_OS).mk +include $(ALLIANCE_TOP)/etc/libraries.mk + +#TARGET_LIB = ../../../archi/$(ALLIANCE_OS)/lib +#TARGET_INCLUDE = ../../../archi/$(ALLIANCE_OS)/include + +LOCAL_INC = ../include + +LOCAL_CFLAGS = $(CFLAGS) -c -g +LOCAL_CPPFLAGS = $(CPPFLAGS) -I$(LOCAL_INC) -I$(ALLIANCE_INCLUDE) \ + -DPAT_H='' \ + -DPPT_H='' \ + -DMUT_H='<$(MUT_H)>' + +LOCAL_YACCFLAGS = $(YACCFLAGS) -d -p +LOCAL_LEXFLAGS = $(LEXFLAGS) -t + +LOCAL_OBJECTS = pat_lodpaseq.o pat_savpaseq.o pat_prspat.o pat_drvpat.o \ + pat_pattostr.o pat_decl.o pat_desc.o pat_lex.o + +.c.o : + $(CC) $(LOCAL_CFLAGS) $(LOCAL_CPPFLAGS) $< + +$(TARGET_LIB)/libPpt109.a : $(LOCAL_OBJECTS) + $(CP) $(LOCAL_INC)/ppt109.h $(TARGET_INCLUDE) + $(AR) $(ARFLAGS) $(TARGET_LIB)/libPpt109.a $(LOCAL_OBJECTS) + -$(RANLIB) $(TARGET_LIB)/libPpt109.a + +pat_decl.c : pat_decl.yac + $(YACC) $(LOCAL_YACCFLAGS) pat_decl pat_decl.yac + $(SED) -e 's/pat_decllex/pat_lex/g' y.tab.c > pat_decl.c + $(RM) y.tab.c + +pat_desc.c : pat_desc.yac + $(YACC) $(LOCAL_YACCFLAGS) pat_desc pat_desc.yac + $(SED) -e 's/pat_desclex/pat_lex/g' y.tab.c > pat_desc.c + $(RM) y.tab.c + +pat_lex.c : pat_pars.lex + $(LEX) $(LOCAL_LEXFLAGS) pat_pars.lex > pat_lex.c + +distrib : $(TARGET_LIB)/libPpt109.a + +clean : + $(RM) -f pat_lex.c y.tab.h pat_desc.c pat_decl.c + $(RM) -f $(LOCAL_OBJECTS) + +realclean : clean + $(RM) -f $(TARGET_LIB)/libPpt109.a $(TARGET_INCLUDE)/ppt109.h diff --git a/alliance/src/ppt/src/pat_decl.h b/alliance/src/ppt/src/pat_decl.h new file mode 100644 index 00000000..d9f33bd1 --- /dev/null +++ b/alliance/src/ppt/src/pat_decl.h @@ -0,0 +1,47 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* ###--------------------------------------------------------------### */ +/* file : pat_decl.h */ +/* date : Mar 9 2000 */ +/* version : v109 */ +/* author : Pirouz BAZARGAN SABET */ +/* content : parser-driver level library */ +/* ###--------------------------------------------------------------### */ + +static struct paseq *PAT_SEQPNT ; +static struct pagrp *PAT_GRPPNT ; +static struct paiol *PAT_IOLPNT ; +static struct pacom *PAT_COMPNT ; +static struct pains *PAT_INSPNT ; + +static unsigned int STT_NBR ; +static unsigned short DCL_NBR ; +static char ERR_FLG ; + +static short TAB_IDX ; +static struct array TAB [256]; +static short NAM_IDX ; +static char *NAMTAB [ 30]; +static struct entry *ENTRY_HEAD = NULL; +static struct entry **HSHTAB ; diff --git a/alliance/src/ppt/src/pat_decl_l.l b/alliance/src/ppt/src/pat_decl_l.l new file mode 100644 index 00000000..562953e4 --- /dev/null +++ b/alliance/src/ppt/src/pat_decl_l.l @@ -0,0 +1,253 @@ +%{ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* ###--------------------------------------------------------------### */ +/* file : pat_pars.lex */ +/* date : Mar 13 2000 */ +/* version : v109 */ +/* author : Pirouz BAZARGAN SABET */ +/* content : parser-driver function */ +/* ###--------------------------------------------------------------### */ + +#include +#include "mut.h" +#include "pat.h" +#include "pat_type.h" +#include "pat_decl_y.h" + +/* ICI LUDO +#ifdef YY_DECL +#undef YY_DECL +#endif + +#define YY_DECL int pat_lex (lval_pnt) YYSTYPE *lval_pnt; +#define yylval (*lval_pnt) + FIN LUDO +*/ + +static char buff [1024]; +%} + +%s INS_PAT +%s OUT_PAT +%s DTC_FRM + +letter [a-zA-Z] + +%% +\: { +/*printf ("Colon\n");*/ + BEGIN INS_PAT; + return (Colon); + } +(\;)+ { +/*printf ("Semicolon\n");*/ + BEGIN OUT_PAT; + + if (yyleng < 16) + yylval.valu = yyleng - 1; + else + yylval.valu = 15; + + return (Semicolons); + } +\. { +/*printf ("Dot\n");*/ + BEGIN OUT_PAT; + return (Dot); + } +\, { +/*printf ("Comma\n");*/ + return (Comma); + } +\< { +/*printf ("_LTSym\n");*/ + return (_LTSym); + } +\> { +/*printf ("_GTSym\n");*/ + return (_GTSym); + } +\( { +/*printf ("LeftParen\n");*/ + BEGIN INITIAL; + return (LeftParen); + } +\) { +/*printf ("RightParen\n");*/ + BEGIN DTC_FRM; + return (RightParen); + } +\+ { +/*printf ("Plus\n");*/ + return (Plus); + } +\<= { +/*printf ("_LESym\n");*/ + return (_LESym); + } +[xobXOB] { +/*printf ("Format\n");*/ + yylval.immd = yytext[0]; + return (Format); + } +\'[01]\' { +/*printf ("OneBit BitStringLit\n");*/ + strcpy (buff,yytext); + yylval.text = buff; + return (BitStringLit); + } +[xX]\"[0-9a-fA-F]+\" { +/*printf ("Hexa BitStringLit\n");*/ + strcpy (buff,yytext); + yylval.text = buff; + return (BitStringLit); + } +[oO]\"[0-7]+\" { +/*printf ("Octal BitStringLit\n");*/ + strcpy (buff,yytext); + yylval.text = buff; + return (BitStringLit); + } +[bB]?\"[01]+\" { +/*printf ("Binary BitStringLit\n");*/ + strcpy (buff,yytext); + yylval.text = buff; + return (BitStringLit); + } +(0|[1-9][0-9]*) { +/*printf ("AbstractLit\n");*/ + yylval.valu = atoi (yytext); + return (AbstractLit); + } +[0-9a-fA-FuU\*\+\-\? \t\n]+ { + int i = 0; + int j = 0; + +/*printf ("Literal\n");*/ + while ((buff[j] = yytext[i++]) != '\0') + { + if ((buff[j] != ' ' ) && (buff[j] != '\t') && + (buff[j] != '\n')) + { + if ((buff[j] == 'U') || (buff[j] == 'u')) + { + buff[j] = '*'; + } + j++; + } + else + { + if (buff[j] == '\n') + PAT_LINNUM++; + } + } + + buff[j] = '\0'; + + yylval.text = buff; + return (Literal); + } +{letter}(_?({letter}|[0-9]))* { + int code ; + static int lcl_search (); + + yylval.text = namealloc (yytext); + if ((code = lcl_search (yylval.text)) == -1) + { +/*printf ("Identifier : %s\n", yytext);*/ + BEGIN DTC_FRM; + return (Identifier); + } + else + { +/*printf ("KeyWord : %s\n", yytext);*/ + return (code); + } + } +\#.*$ { + yylval.text = namealloc (&yytext[1]); + return (Comment); + } +\-\-.*$ { + } +[ \t] { + } +\n { + PAT_LINNUM++; + } +. { + return (UnknownChar); + } +%% + +/* ###--------------------------------------------------------------### */ +/* function : yywrap */ +/* description : return 1 */ +/* called func. : none */ +/* ###--------------------------------------------------------------### */ + +int pat_decl_y_wrap () + { + return (1); + } + +/* ###--------------------------------------------------------------### */ +/* function : lcl_search */ +/* description : check that an identifier is a reserved word or not */ +/* called func. : addht, addhtitem, gethtitem, namealloc */ +/* ###--------------------------------------------------------------### */ + +static int lcl_search (key) + +char *key; + + { + static ht *pt_hash = NULL; + + if (pt_hash == NULL) + { + pt_hash = addht (32); + + addhtitem (pt_hash, namealloc ("begin" ), BEGIN_ ); + addhtitem (pt_hash, namealloc ("downto" ), DOWNTO ); + addhtitem (pt_hash, namealloc ("end" ), END_ ); + addhtitem (pt_hash, namealloc ("fs" ), FS ); + addhtitem (pt_hash, namealloc ("in" ), _IN ); + addhtitem (pt_hash, namealloc ("inout" ), _INOUT ); + addhtitem (pt_hash, namealloc ("inspect" ), INSPECT ); + addhtitem (pt_hash, namealloc ("ms" ), MS ); + addhtitem (pt_hash, namealloc ("ns" ), NS ); + addhtitem (pt_hash, namealloc ("ps" ), PS ); + addhtitem (pt_hash, namealloc ("out" ), _OUT ); + addhtitem (pt_hash, namealloc ("register"), REGISTER); + addhtitem (pt_hash, namealloc ("save" ), SAVE ); + addhtitem (pt_hash, namealloc ("signal" ), SIGNAL ); + addhtitem (pt_hash, namealloc ("spy" ), SPY ); + addhtitem (pt_hash, namealloc ("to" ), TO ); + addhtitem (pt_hash, namealloc ("trace" ), TRACE ); + addhtitem (pt_hash, namealloc ("us" ), US ); + } + return (gethtitem (pt_hash, namealloc (key))); + } diff --git a/alliance/src/ppt/src/pat_decl_y.y b/alliance/src/ppt/src/pat_decl_y.y new file mode 100644 index 00000000..c1770591 --- /dev/null +++ b/alliance/src/ppt/src/pat_decl_y.y @@ -0,0 +1,731 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* ###--------------------------------------------------------------### */ +/* file : pat_decl.yac */ +/* date : Mar 13 2000 */ +/* version : v109 */ +/* author : Pirouz BAZARGAN SABET */ +/* content : parser-driver function */ +/* ###--------------------------------------------------------------### */ + +%{ + +#include +#include +#include "mut.h" +#include "pat.h" +#include "ppt.h" +#include "pat_defs.h" +#include "pat_type.h" +#include "pat_decl.h" + +/* ###--------------------------------------------------------------### */ +/* function : yyerror */ +/* description : print an error message (errors detected by yacc) */ +/* called func. : none */ +/* ###--------------------------------------------------------------### */ + +static void pat_decl_y_error (str) + +char *str; + { + ERR_FLG += pat_error (99, str, ' ', PAT_LINNUM); + } + +/* ###--------------------------------------------------------------### */ +/* function : addiol */ +/* description : add a list of PAIOL structure at the top of the list */ +/* called func. : pat_addpaiol */ +/* ###--------------------------------------------------------------### */ + +static struct paiol *addiol (lastiol, gname, format, mode, blank, flag) + +struct paiol *lastiol; +struct array gname ; +char format ; +char mode ; +short blank ; +char flag ; + + { + struct paiol *ptiol = lastiol; + char extname [100] ; + short i ; + short inc = 1; + + if (gname.left == -1) + { + ptiol = pat_addpaiol (ptiol, gname.ident, format, mode, blank); + ptiol->FLAG = flag; + } + else + { + if (gname.left >= gname.right) + inc = -1; + + for (i=gname.left ; i!=(gname.right+inc) ; i+=inc) + { + sprintf (extname, "%s %d", gname.ident, i); + ptiol = pat_addpaiol (ptiol, extname, format, mode, blank); + ptiol->FLAG = flag; + } + } + + return (ptiol); + } + +/* ###--------------------------------------------------------------### */ +/* function : pshtab */ +/* description : push a name on the TAB stack to build a virtual array */ +/* called func. : none */ +/* ###--------------------------------------------------------------### */ + +static void pshtab (gname) + +struct array gname; + + { + if (TAB_IDX > 256) + ERR_FLG += pat_error (6, NULL, ' ', PAT_LINNUM); + else + { + TAB [TAB_IDX] = gname; + TAB_IDX++; + } + } + +/* ###--------------------------------------------------------------### */ +/* function : pshnam */ +/* description : push a name on the NAMTAB stack to build a */ +/* hierarchical name */ +/* called func. : none */ +/* ###--------------------------------------------------------------### */ + +static void pshnam (str) + +char *str; + + { + if (NAM_IDX > 30) + ERR_FLG += pat_error (14, NULL, ' ', PAT_LINNUM); + else + { + NAMTAB [NAM_IDX] = str; + NAM_IDX++; + } + } + +/* ###--------------------------------------------------------------### */ +/* function : initab */ +/* description : create a new dictionary */ +/* called func. : mbkalloc */ +/* ###--------------------------------------------------------------### */ + +static struct entry **initab () + + { + struct entry **head; + int i; + + head = (struct entry **) mbkalloc (sizeof(struct entry *) * PAT_HSZDFN); + + for (i=0 ; inext = entry + 1; + entry++; + } + entry->next = NULL; + } + + entry = ENTRY_HEAD; + ENTRY_HEAD = ENTRY_HEAD->next; + + entry->next = head; + + entry->fd0_val = 0; + entry->fd1_val = 0; + entry->pt0_val = 0; + entry->pt1_val = 0; + + entry->key = key; + + return (entry); + } + +/* ###--------------------------------------------------------------### */ +/* function : addtab */ +/* description : add a new information into a dictionary. If the key */ +/* doesn't exist create a new entry */ +/* called func. : addent */ +/* ###--------------------------------------------------------------### */ + +static void addtab (head, key_str, field, valu) + +struct entry **head ; +char *key_str; +int field ; +int valu ; + + { + int found = 0; + int index ; + struct entry *entry_pnt; + + index = ((unsigned long) key_str) % PAT_HSZDFN; + entry_pnt = head [index]; + + while (entry_pnt != NULL) + { + if (entry_pnt->key == key_str) + { + found = 1; + break; + } + entry_pnt = entry_pnt->next; + } + + if (found == 0) + { + head [index] = addent (head [index], key_str); + entry_pnt = head [index]; + } + + switch (field) + { + case 0 : + entry_pnt->fd0_val = valu; break; + case 1 : + entry_pnt->fd1_val = valu; break; + case 6 : + entry_pnt->pt0_val = valu; break; + case 7 : + entry_pnt->pt1_val = valu; break; + } + } + +/* ###--------------------------------------------------------------### */ +/* function : chktab */ +/* description : extract an information from a dictionary. Return */ +/* 0 if the information has not been found. */ +/* called func. : none */ +/* ###--------------------------------------------------------------### */ + +static int chktab (head, key_str, field) + +struct entry **head ; +char *key_str; +int field ; + + { + int found = 0; + int valu = 0; + struct entry *entry_pnt; + + entry_pnt = head [((unsigned long)key_str) % PAT_HSZDFN]; + + while (entry_pnt != NULL) + { + if (entry_pnt->key == key_str) + { + found = 1; + break; + } + entry_pnt = entry_pnt->next; + } + + if (found == 1) + { + switch (field) + { + case 0 : + valu = entry_pnt->fd0_val; break; + case 1 : + valu = entry_pnt->fd1_val; break; + case 6 : + valu = entry_pnt->pt0_val; break; + case 7 : + valu = entry_pnt->pt1_val; break; + } + } + + return (valu); + } + +/* ###--------------------------------------------------------------### */ +/* function : fretab */ +/* description : remove entirely a dictionary */ +/* called func. : mbkfree */ +/* ###--------------------------------------------------------------### */ + +static void fretab (pt_hash) + +struct entry **pt_hash; + { + struct entry *pt_entry; + int i ; + + if (pt_hash != NULL) + { + for (i=0 ; inext != NULL) + pt_entry = pt_entry->next; + + pt_entry->next = ENTRY_HEAD ; + ENTRY_HEAD = pt_hash [i]; + } + } + mbkfree (pt_hash); + } + } + +/* ###--------------------------------------------------------------### */ +/* function : pat_declpat */ +/* description : parse a file in pat format and return a PASEQ */ +/* called func. : yyparse */ +/* ###--------------------------------------------------------------### */ + +struct paseq *pat_declpat (fp, ptseq) + +FILE *fp ; +struct paseq *ptseq ; + + { + extern FILE *pat_decl_y_in ; + static int call_nbr = 0; + + PAT_SEQPNT = ptseq; + pat_decl_y_in = fp; + + PAT_INSPNT = NULL; + PAT_COMPNT = NULL; + PAT_GRPPNT = NULL; + PAT_IOLPNT = NULL; + PAT_LINNUM = 1; + STT_NBR = 0; + DCL_NBR = 0; + ERR_FLG = 0; + TAB_IDX = 0; + NAM_IDX = 0; + + HSHTAB = initab (); + + PAT_SEQPNT = pat_addpaseq (PAT_SEQPNT); + PAT_SEQPNT->FLAGS |= PAT_SEQ__ZERODELAY; + + if (call_nbr != 0) + pat_decl_y_restart (pat_decl_y_in); + + pat_decl_y_parse (); + call_nbr++; + + PAT_SEQPNT->PAINS = (struct pains *) reverse ((struct chain *)PAT_INSPNT); + PAT_SEQPNT->DECCOM = (struct pacom *) reverse ((struct chain *)PAT_COMPNT); + PAT_SEQPNT->PAGRP = (struct pagrp *) reverse ((struct chain *)PAT_GRPPNT); + PAT_IOLPNT = (struct paiol *) reverse ((struct chain *)PAT_IOLPNT); + PAT_SEQPNT->PAIOL = pat_crtpaiol (PAT_IOLPNT); + PAT_SEQPNT->FLAGS |= PAT_SEQ__IOLARRAY; + PAT_SEQPNT->LINENO = PAT_LINNUM ; + PAT_SEQPNT->IOLNBR = DCL_NBR; + + if (ERR_FLG == 0) + PAT_SEQPNT->ERRFLG = 0; + else + PAT_SEQPNT->ERRFLG = 1; + + pat_frepaiol (PAT_IOLPNT); + fretab (HSHTAB); + + return (PAT_SEQPNT); + } + +%} + +%union + { + int valu; + float fval; + char immd; + char *text; + struct array arra; + struct label labe; + } + +%token _GTSym +%token _IN +%token _INOUT +%token _LESym +%token _LTSym +%token _OUT +%token AbstractLit +%token BitStringLit +%token BEGIN_ +%token Colon +%token Comma +%token Comment +%token DOWNTO +%token Dot +%token END_ +%token FS +%token Format +%token INSPECT +%token Identifier +%token LeftParen +%token Literal +%token NS +%token MS +%token PS +%token Plus +%token REGISTER +%token RightParen +%token SAVE +%token SIGNAL +%token Semicolons +%token SPY +%token TO +%token TRACE +%token US +%token UnknownChar + +%type name +%type simple_name +%type instance_name +%type file_name +%type indexed_name +%type slice_name +%type .Format. +%type mode +%type Identifier...Identifier.. +%type Semicolons_ERR +%type .SPY. +%type .TRACE. + +/* %pure_parser */ +%start pat_format_file + +%% +pat_format_file + : declarative_block + BEGIN_ + { + YYACCEPT; + } + ; + +declarative_block + : ..declaration_item.. + ; + +..declaration_item.. + : declaration_item + | ..declaration_item.. + declaration_item + ; + +declaration_item + : input_output_declaration + | instance_inspection + | other_statement + | error + Semicolons_ERR + ; + +instance_inspection + : INSPECT + instance_name + file_name + Semicolons_ERR + { PAT_INSPNT = pat_addpains (PAT_INSPNT, $2, $3); } + ; + +instance_name + : Identifier...Identifier.. + { $$ = $1; } + ; + +file_name + : Identifier...Identifier.. + { $$ = $1; } + ; + +other_statement + : Comment + { + PAT_COMPNT = pat_addpacom (PAT_COMPNT, $1, STT_NBR); + STT_NBR = 0; + } + ; + +input_output_declaration + : signal_declaration + | group_declaration + ; + +signal_declaration + : mode + name + .Format. + .SPY. + .TRACE. + Semicolons_ERR + { + int length; + int lclmod; + unsigned char flag ; + + if ((lclmod = chktab (HSHTAB, $2.ident, PAT_MODDFN)) != 0) + { + if (lclmod == 'I') + ERR_FLG += pat_error (13, $2.ident, ' ', PAT_LINNUM); + if (lclmod != $1) + ERR_FLG += pat_error (7, $2.ident, ' ', PAT_LINNUM); + } + else + addtab (HSHTAB, $2.ident, PAT_MODDFN, $1); + + if ($2.left < $2.right) + length = $2.right - $2.left + 1; + else + length = $2.left - $2.right + 1; + + STT_NBR ++; + flag = $4 | $5; + PAT_IOLPNT = addiol (PAT_IOLPNT, $2, $3, $1, $6, flag); + + if (length != 1) + PAT_GRPPNT = pat_addpagrp (PAT_GRPPNT, $2.ident, length, + DCL_NBR , 0); + else + { + if ($3 != 'B') + ERR_FLG += pat_error (1, NULL, ' ', PAT_LINNUM); + } + + DCL_NBR += length; + } + ; + +group_declaration + : mode + Identifier...Identifier.. + LeftParen + ...name.. + RightParen + .Format. + .SPY. + .TRACE. + Semicolons_ERR + { + int i ; + int lclmod ; + int length = 0; + unsigned char flag ; + + if (chktab (HSHTAB, $2, PAT_MODDFN) != 0) + ERR_FLG += pat_error (8, $2, ' ', PAT_LINNUM); + else + addtab (HSHTAB, $2, PAT_MODDFN, $1); + + STT_NBR++; + + for (i=0 ; i 30) + YYABORT; + else + yyerrok; + } + ; + +.SPY. + : /*empty*/ + { $$ = 0 ; } + | SPY + { $$ = PAT_IOL__SPY; } + ; + +.TRACE. + : /*empty*/ + { $$ = 0 ; } + | TRACE + { $$ = PAT_IOL__TRACE; } + ; +%% diff --git a/alliance/src/ppt/src/pat_defs.h b/alliance/src/ppt/src/pat_defs.h new file mode 100644 index 00000000..bb9d71a9 --- /dev/null +++ b/alliance/src/ppt/src/pat_defs.h @@ -0,0 +1,35 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* ###--------------------------------------------------------------### */ +/* file : pat_defs.h */ +/* date : Mar 9 2000 */ +/* version : v109 */ +/* author : Pirouz BAZARGAN SABET */ +/* content : parser-driver level library */ +/* ###--------------------------------------------------------------### */ + +#define PAT_HSZDFN 97 +#define PAT_ALODFN 20 + +#define PAT_MODDFN 0 diff --git a/alliance/src/ppt/src/pat_desc.h b/alliance/src/ppt/src/pat_desc.h new file mode 100644 index 00000000..9bc4f948 --- /dev/null +++ b/alliance/src/ppt/src/pat_desc.h @@ -0,0 +1,57 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* ###--------------------------------------------------------------### */ +/* file : pat_desc.h */ +/* date : Mar 9 2000 */ +/* version : v109 */ +/* author : Pirouz BAZARGAN SABET */ +/* content : parser-driver level library */ +/* ###--------------------------------------------------------------### */ + +static struct paseq *PAT_SEQPNT ; +static struct paini *PAT_INIPNT ; +static struct pacom *PAT_COMPNT ; +static struct papat *PAT_PATPNT ; + +static struct paini *FRE_INIPNT = NULL; +static struct pacom *FRE_COMPNT = NULL; +static struct papat *FRE_PATPNT = NULL; +static struct paevt *FRE_EVTPNT = NULL; + +static float PAT_CNVFS = 1.0 ;/* convert Fs */ +static float PAT_CNVPS = 1.0 ;/* convert Ps */ +static float PAT_CNVNS = 1.0 ;/* convert Ns */ +static float PAT_CNVUS = 1.0 ;/* convert Us */ +static float PAT_CNVMS = 1.0 ;/* convert Ms */ + +static char *VALUE = NULL; +static unsigned short STT_NBR ; +static unsigned int ERR_FLG = 0 ; +static int DECVAL ; +static int MAXPAT = 1 ; +static unsigned int CURDATE = 0 ; +static unsigned char PAT_MODE = 0 ; + +static short NAM_IDX ; +static char *NAMTAB [30]; diff --git a/alliance/src/ppt/src/pat_desc_l.l b/alliance/src/ppt/src/pat_desc_l.l new file mode 100644 index 00000000..f6ede661 --- /dev/null +++ b/alliance/src/ppt/src/pat_desc_l.l @@ -0,0 +1,252 @@ +%{ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* ###--------------------------------------------------------------### */ +/* file : pat_pars.lex */ +/* date : Mar 13 2000 */ +/* version : v109 */ +/* author : Pirouz BAZARGAN SABET */ +/* content : parser-driver function */ +/* ###--------------------------------------------------------------### */ + +#include +#include "mut.h" +#include "pat.h" +#include "pat_type.h" +#include "pat_desc_y.h" + +/* ICI LUDO +#ifdef YY_DECL +#undef YY_DECL +#endif + +#define YY_DECL int pat_lex (lval_pnt) YYSTYPE *lval_pnt; +#define yylval (*lval_pnt) +FIN LUDO */ + +static char buff [1024]; +%} + +%s INS_PAT +%s OUT_PAT +%s DTC_FRM + +letter [a-zA-Z] + +%% +\: { +/*printf ("Colon\n");*/ + BEGIN INS_PAT; + return (Colon); + } +(\;)+ { +/*printf ("Semicolon\n");*/ + BEGIN OUT_PAT; + + if (yyleng < 16) + yylval.valu = yyleng - 1; + else + yylval.valu = 15; + + return (Semicolons); + } +\. { +/*printf ("Dot\n");*/ + BEGIN OUT_PAT; + return (Dot); + } +\, { +/*printf ("Comma\n");*/ + return (Comma); + } +\< { +/*printf ("_LTSym\n");*/ + return (_LTSym); + } +\> { +/*printf ("_GTSym\n");*/ + return (_GTSym); + } +\( { +/*printf ("LeftParen\n");*/ + BEGIN INITIAL; + return (LeftParen); + } +\) { +/*printf ("RightParen\n");*/ + BEGIN DTC_FRM; + return (RightParen); + } +\+ { +/*printf ("Plus\n");*/ + return (Plus); + } +\<= { +/*printf ("_LESym\n");*/ + return (_LESym); + } +[xobXOB] { +/*printf ("Format\n");*/ + yylval.immd = yytext[0]; + return (Format); + } +\'[01]\' { +/*printf ("OneBit BitStringLit\n");*/ + strcpy (buff,yytext); + yylval.text = buff; + return (BitStringLit); + } +[xX]\"[0-9a-fA-F]+\" { +/*printf ("Hexa BitStringLit\n");*/ + strcpy (buff,yytext); + yylval.text = buff; + return (BitStringLit); + } +[oO]\"[0-7]+\" { +/*printf ("Octal BitStringLit\n");*/ + strcpy (buff,yytext); + yylval.text = buff; + return (BitStringLit); + } +[bB]?\"[01]+\" { +/*printf ("Binary BitStringLit\n");*/ + strcpy (buff,yytext); + yylval.text = buff; + return (BitStringLit); + } +(0|[1-9][0-9]*) { +/*printf ("AbstractLit\n");*/ + yylval.valu = atoi (yytext); + return (AbstractLit); + } +[0-9a-fA-FuU\*\+\-\? \t\n]+ { + int i = 0; + int j = 0; + +/*printf ("Literal\n");*/ + while ((buff[j] = yytext[i++]) != '\0') + { + if ((buff[j] != ' ' ) && (buff[j] != '\t') && + (buff[j] != '\n')) + { + if ((buff[j] == 'U') || (buff[j] == 'u')) + { + buff[j] = '*'; + } + j++; + } + else + { + if (buff[j] == '\n') + PAT_LINNUM++; + } + } + + buff[j] = '\0'; + + yylval.text = buff; + return (Literal); + } +{letter}(_?({letter}|[0-9]))* { + int code ; + static int lcl_search (); + + yylval.text = namealloc (yytext); + if ((code = lcl_search (yylval.text)) == -1) + { +/*printf ("Identifier : %s\n", yytext);*/ + BEGIN DTC_FRM; + return (Identifier); + } + else + { +/*printf ("KeyWord : %s\n", yytext);*/ + return (code); + } + } +\#.*$ { + yylval.text = namealloc (&yytext[1]); + return (Comment); + } +\-\-.*$ { + } +[ \t] { + } +\n { + PAT_LINNUM++; + } +. { + return (UnknownChar); + } +%% + +/* ###--------------------------------------------------------------### */ +/* function : yywrap */ +/* description : return 1 */ +/* called func. : none */ +/* ###--------------------------------------------------------------### */ + +int pat_desc_y_wrap () + { + return (1); + } + +/* ###--------------------------------------------------------------### */ +/* function : lcl_search */ +/* description : check that an identifier is a reserved word or not */ +/* called func. : addht, addhtitem, gethtitem, namealloc */ +/* ###--------------------------------------------------------------### */ + +static int lcl_search (key) + +char *key; + + { + static ht *pt_hash = NULL; + + if (pt_hash == NULL) + { + pt_hash = addht (32); + + addhtitem (pt_hash, namealloc ("begin" ), BEGIN_ ); + addhtitem (pt_hash, namealloc ("downto" ), DOWNTO ); + addhtitem (pt_hash, namealloc ("end" ), END_ ); + addhtitem (pt_hash, namealloc ("fs" ), FS ); + addhtitem (pt_hash, namealloc ("in" ), _IN ); + addhtitem (pt_hash, namealloc ("inout" ), _INOUT ); + addhtitem (pt_hash, namealloc ("inspect" ), INSPECT ); + addhtitem (pt_hash, namealloc ("ms" ), MS ); + addhtitem (pt_hash, namealloc ("ns" ), NS ); + addhtitem (pt_hash, namealloc ("ps" ), PS ); + addhtitem (pt_hash, namealloc ("out" ), _OUT ); + addhtitem (pt_hash, namealloc ("register"), REGISTER); + addhtitem (pt_hash, namealloc ("save" ), SAVE ); + addhtitem (pt_hash, namealloc ("signal" ), SIGNAL ); + addhtitem (pt_hash, namealloc ("spy" ), SPY ); + addhtitem (pt_hash, namealloc ("to" ), TO ); + addhtitem (pt_hash, namealloc ("trace" ), TRACE ); + addhtitem (pt_hash, namealloc ("us" ), US ); + } + return (gethtitem (pt_hash, namealloc (key))); + } diff --git a/alliance/src/ppt/src/pat_desc_y.y b/alliance/src/ppt/src/pat_desc_y.y new file mode 100644 index 00000000..38300d7f --- /dev/null +++ b/alliance/src/ppt/src/pat_desc_y.y @@ -0,0 +1,1378 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* ###--------------------------------------------------------------### */ +/* file : pat_desc.yac */ +/* date : Mar 9 2000 */ +/* version : v109 */ +/* author : Pirouz BAZARGAN SABET */ +/* content : parser-driver function */ +/* ###--------------------------------------------------------------### */ + +%{ + +#include +#include +#include "mut.h" +#include "pat.h" +#include "ppt.h" +#include "pat_type.h" +#include "pat_desc.h" + +/* ###--------------------------------------------------------------### */ +/* function : lcl_addpacom */ +/* description : create PACOM structure if there is no more structure */ +/* available in free list */ +/* called func. : pat_addpacom */ +/* ###--------------------------------------------------------------### */ + +static struct pacom *lcl_addpacom (lastpacom, text, position) + +struct pacom *lastpacom; /* pointer on the last pacom structure */ +char *text; /* text of the comment */ +unsigned short position; /* # of statement since last comment */ + + { + struct pacom *ptcom = NULL; + + if (FRE_COMPNT == NULL) + ptcom = pat_addpacom (lastpacom, text, position); + else + { + ptcom = FRE_COMPNT; + FRE_COMPNT = ptcom->NEXT; + + ptcom->TEXT = text; + ptcom->POSITION = position; + ptcom->NEXT = lastpacom; + } + + return (ptcom); + } + +/* ###--------------------------------------------------------------### */ +/* function : lcl_addpapat */ +/* description : create PAPAT structure if there is no more structure */ +/* available in free list */ +/* called func. : pat_addpapat */ +/* ###--------------------------------------------------------------### */ + +static struct papat *lcl_addpapat (lastpapat, label, line) + +struct papat *lastpapat; /* pointer on the last papat structure */ +char *label; /* pattern's label */ +unsigned short line; /* pattern' line number */ + + { + struct papat *ptpat; + + if (FRE_PATPNT == NULL) + ptpat = pat_addpapat (lastpapat, label, line); + else + { + ptpat = FRE_PATPNT; + FRE_PATPNT = ptpat->NEXT; + + ptpat->LABEL = label; + ptpat->PAEVT = NULL; + ptpat->PAINI = NULL; + ptpat->LINE = line; + ptpat->BLANK = 0 ; + ptpat->ACTFLAG = 'U'; + ptpat->SIMFLAG = 'U'; + ptpat->NEXT = lastpapat; + } + + return (ptpat); + } + +/* ###--------------------------------------------------------------### */ +/* function : lcl_addpaini */ +/* description : create PAINI structure if there is no more structure */ +/* available in free list */ +/* called func. : pat_addpaini */ +/* ###--------------------------------------------------------------### */ + +static struct paini *lcl_addpaini (lastpaini, name, value) + +struct paini *lastpaini; /* pointer on the last paini structure */ +char *name; /* register's name */ +char value; /* value to be forced into the register */ + + { + struct paini *ptini; + + if (FRE_INIPNT == NULL) + ptini = pat_addpaini (lastpaini, name, value); + else + { + ptini = FRE_INIPNT; + FRE_INIPNT = ptini->NEXT; + + ptini->NAME = namealloc (name); + ptini->VALUE = value; + ptini->NEXT = lastpaini; + } + + return (ptini); + } + +/* ###--------------------------------------------------------------### */ +/* function : lcl_addpaevt */ +/* description : create PAEVT structure if there is no more structure */ +/* available in free list */ +/* called func. : pat_addpaevt */ +/* ###--------------------------------------------------------------### */ + +static struct paevt *lcl_addpaevt (lastpaevt, index, usrval) + +struct paevt *lastpaevt; /* pointer on the last paevt structure */ +unsigned short index; /* index of the input-output */ +char usrval; /* user predicted value */ + + { + struct paevt *ptevt; + + + if (FRE_EVTPNT == NULL) + ptevt = pat_addpaevt (lastpaevt, index, usrval); + else + { + ptevt = FRE_EVTPNT; + FRE_EVTPNT = ptevt->NEXT; + + ptevt->INDEX = index; + ptevt->USRVAL = usrval; + ptevt->SIMVAL = usrval; + ptevt->NEXT = lastpaevt; + } + + return (ptevt); + } + +/* ###--------------------------------------------------------------### */ +/* function : yyerror */ +/* description : print an error message (errors detected by yacc) */ +/* called func. : none */ +/* ###--------------------------------------------------------------### */ + +static void pat_desc_y_error (str) + +char *str; + { + ERR_FLG += pat_error (99, str, ' ', PAT_LINNUM); + } + +/* ###--------------------------------------------------------------### */ +/* function : tobin */ +/* description : change to binary */ +/* called func. : none */ +/* ###--------------------------------------------------------------### */ + +static void tobin (value, str1, str2) + +char value; +char **str1 ; +char **str2 ; + + { + switch (value) + { + case '*': + *str1 = "****"; *str2 = "****"; break; + case '-': + case '0': + *str1 = "0000"; *str2 = "----"; break; + case '+': + case '1': + *str1 = "0001"; *str2 = "---+"; break; + case '2': + *str1 = "0010"; *str2 = "--+-"; break; + case '3': + *str1 = "0011"; *str2 = "--++"; break; + case '4': + *str1 = "0100"; *str2 = "-+--"; break; + case '5': + *str1 = "0101"; *str2 = "-+-+"; break; + case '6': + *str1 = "0110"; *str2 = "-++-"; break; + case '7': + *str1 = "0111"; *str2 = "-+++"; break; + case '8': + *str1 = "1000"; *str2 = "+---"; break; + case '9': + *str1 = "1001"; *str2 = "+--+"; break; + case 'A': + case 'a': + *str1 = "1010"; *str2 = "+-+-"; break; + case 'B': + case 'b': + *str1 = "1011"; *str2 = "+-++"; break; + case 'C': + case 'c': + *str1 = "1100"; *str2 = "++--"; break; + case 'D': + case 'd': + *str1 = "1101"; *str2 = "++-+"; break; + case 'E': + case 'e': + *str1 = "1110"; *str2 = "+++-"; break; + case 'F': + case 'f': + *str1 = "1111"; *str2 = "++++"; break; + + default : + *str1 = "0000"; *str2 = "----"; break; + } + } + +/* ###--------------------------------------------------------------### */ +/* function : pshnam */ +/* description : push a name on the NAMTAB stack to build a */ +/* hierarchical name */ +/* called func. : none */ +/* ###--------------------------------------------------------------### */ + +static void pshnam (str) + +char *str; + + { + if (NAM_IDX > 30) + ERR_FLG += pat_error (14, NULL, ' ', PAT_LINNUM); + else + { + NAMTAB [NAM_IDX] = str; + NAM_IDX ++; + } + } + +/* ###--------------------------------------------------------------### */ +/* function : addini */ +/* description : add a list of PAINI structure at the top of the list */ +/* called func. : lcl_addpaini, tobin */ +/* ###--------------------------------------------------------------### */ + +static struct paini *addini (lastini, gname, value) + +struct paini *lastini; +struct array gname ; +char *value ; + + { + struct paini *ptini = lastini; + char *frc ; + char *cmp ; + int length ; + int size = 1; + int index = 1; + int i ; + int inc ; + char extname [100]; + char format = 'B'; + + if (gname.left < gname.right) + { + length = gname.right - gname.left + 1; + inc = 1; + } + else + { + length = gname.left - gname.right + 1; + inc = -1; + } + + switch (value [0]) + { + case 'X' : + case 'x' : + size = (strlen (value) - 3) * 4; + format = 'X'; + index = 2 ; + break; + case 'O' : + case 'o' : + size = (strlen (value) - 3) * 3; + format = 'O'; + index = 2 ; + break; + case 'B' : + case 'b' : + size = strlen (value) - 3; + format = 'B'; + index = 2 ; + break; + case '"' : + size = strlen (value) - 2; + format = 'B'; + index = 1 ; + break; + case '\'' : + size = 1 ; + format = 'B'; + index = 1 ; + break; + } + + if (length != size) + ERR_FLG += pat_error (12, gname.ident, ' ', PAT_LINNUM); + else + { + if (gname.left == -1) + ptini = lcl_addpaini (ptini, gname.ident, value[index]); + else + { + for (i=gname.left ; i!=(gname.right+inc) ;) + { + tobin (value[index], &frc, &cmp); + switch (format) + { + case 'X': + case 'x': + sprintf (extname, "%s %d", gname.ident, i); + i += inc; + ptini = lcl_addpaini (ptini, extname, frc[0]); + sprintf (extname, "%s %d", gname.ident, i); + i += inc; + ptini = lcl_addpaini (ptini, extname, frc[1]); + sprintf (extname, "%s %d", gname.ident, i); + i += inc; + ptini = lcl_addpaini (ptini, extname, frc[2]); + sprintf (extname, "%s %d", gname.ident, i); + i += inc; + ptini = lcl_addpaini (ptini, extname, frc[3]); + break; + case 'O': + case 'o': + sprintf (extname, "%s %d", gname.ident, i); + i += inc; + ptini = lcl_addpaini (ptini, extname, frc[1]); + sprintf (extname, "%s %d", gname.ident, i); + i += inc; + ptini = lcl_addpaini (ptini, extname, frc[2]); + sprintf (extname, "%s %d", gname.ident, i); + i += inc; + ptini = lcl_addpaini (ptini, extname, frc[3]); + break; + case 'B': + case 'b': + sprintf (extname, "%s %d", gname.ident, i); + i += inc; + ptini = lcl_addpaini (ptini, extname, frc[3]); + break; + } + index++; + } + } + } + return (ptini); + } + +/* ###--------------------------------------------------------------### */ +/* function : isevent */ +/* description : detect an event on an input-output and add if needed */ +/* a PAEVT structure at the top of the list */ +/* called func. : tobin, lcl_addpaevt */ +/* ###--------------------------------------------------------------### */ + +static struct paevt *isevent (lastevt, index, compare, value, rank) + +struct paevt *lastevt; +short index ; +char compare; +char value ; +int rank ; + + { + struct paiol *ptiol ; + int i ; + char cmp_val; + char frc_val; + char *frc ; + char *cmp ; + + ptiol = PAT_SEQPNT->PAIOL + index; + if ((value == '*') || (value == '-') || (value == '+')) + compare = 'C'; + + tobin (value, &frc, &cmp); + switch (ptiol->MODE) + { + case 'I': + for (i=rank ; i<4 ; i++) + { + frc_val = frc [i]; + if (VALUE [index] != frc_val) + { + lastevt = lcl_addpaevt (lastevt, index, frc_val); + VALUE [index] = frc_val; + } + index++; + } + break; + case 'O': + case 'B': + case 'Z': + case 'S': + case 'W': + case 'X': + case 'U': + case 'R': + for (i=rank ; i<4 ; i++) + { + cmp_val = cmp[i]; + if ((VALUE[index] != cmp_val) || (cmp_val == '*')) + { + lastevt = lcl_addpaevt (lastevt, index, cmp_val); + VALUE[index] = cmp_val; + } + index++; + } + break; + case 'T': + if (compare == 'F') + { + for (i=rank ; i<4 ; i++) + { + frc_val = frc[i]; + if (VALUE[index] != frc_val) + { + lastevt = lcl_addpaevt (lastevt, index, frc_val); + VALUE[index] = frc_val; + } + index++; + } + } + else + { + for (i=rank ; i<4 ; i++) + { + cmp_val = cmp[i]; + if ((VALUE[index] != cmp_val) || (cmp_val == '*')) + { + lastevt = lcl_addpaevt (lastevt, index, cmp_val); + VALUE[index] = cmp_val; + } + index++; + } + } + break; + } + return (lastevt); + } + +/* ###--------------------------------------------------------------### */ +/* function : islegal */ +/* description : check if a value is legal */ +/* called func. : pat_error */ +/* ###--------------------------------------------------------------### */ + +static void islegal (index, value, flag, status) + +int index; /* ptiol's index */ +char value; /* value (+,-,*,0,...,9,a,...,f)*/ +char flag; /* comparison flag (C,F) */ +int status; /* (0,1,2) (bit,array,inside) */ + + { + int code = -1; + char comp = flag; + struct paiol *ptiol; + + /* ###------------------------------------------------------### */ + /* Giving a code to each group of values */ + /* ###------------------------------------------------------### */ + + switch (value) + { + case '*': + code = 0; comp = 'C'; break; + case '0': + case '1': + code = 1; break; + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + code = 2; break; + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + code = 3; break; + case '+': + case '-': + code = 4; comp = 'C'; break; + } + + /* ###------------------------------------------------------### */ + /* Checking parameters' consistency : */ + /* '+' or '-' preceded by a '?' -> error */ + /* '+' or '-' for an array -> error */ + /* unknown value -> error */ + /* ###------------------------------------------------------### */ + + if ((code == 4) && (flag == 'C')) + ERR_FLG += pat_error (2, NULL, '?', PAT_LINNUM); + + if ((code == 4) && (status != 0)) + ERR_FLG += pat_error (2, NULL, value, PAT_LINNUM); + + if (code == -1) + ERR_FLG += pat_error (2, NULL, value, PAT_LINNUM); + else + { + + /* ###------------------------------------------------------### */ + /* Checking coherence of value and input-output format : */ + /* 2,...,9,a,...,f and binary format -> error */ + /* a,...,f,+,- and octal format -> error */ + /* +,- and hexa. format -> error */ + /* ###------------------------------------------------------### */ + + flag = comp; + ptiol = PAT_SEQPNT->PAIOL + index; + switch (ptiol->FORMAT) + { + case 'b' : + case 'B' : + if ((code == 2) || (code == 3)) + ERR_FLG += pat_error (10, ptiol->NAME, 'B', PAT_LINNUM); + break; + case 'o' : + case 'O' : + if (code >= 3) + ERR_FLG += pat_error (10, ptiol->NAME, 'O', PAT_LINNUM); + break; + case 'x' : + case 'X' : + if (code == 4) + ERR_FLG += pat_error (10, ptiol->NAME, 'X', PAT_LINNUM); + break; + } + + /* ###------------------------------------------------------### */ + /* Checking coherence of value and input-output mode */ + /* compare a value on an input -> error */ + /* put an undefined value on an input -> error */ + /* force a value on an output -> error */ + /* ###------------------------------------------------------### */ + + switch (ptiol->MODE) + { + case 'I' : + if ((flag == 'C') || (code == 4) || (code == 0)) + ERR_FLG += pat_error (5, ptiol->NAME, ' ', PAT_LINNUM); + break; + case 'O' : + case 'R' : + case 'S' : + if (flag != 'C') + ERR_FLG += pat_error (4, ptiol->NAME, ' ', PAT_LINNUM); + break; + } + } + } + +/* ###--------------------------------------------------------------### */ +/* function : pat_descpat */ +/* description : parse a file in pat format and return a PASEQ */ +/* called func. : yyparse, reverse, mbkalloc, mbkfree, pat_error */ +/* ###--------------------------------------------------------------### */ + +struct paseq *pat_descpat (fp, ptseq, maxpat, mode) + +FILE *fp ; +struct paseq *ptseq ; +unsigned int maxpat; +unsigned char mode ; /* the description style */ + + { + struct papat *ptpat ; + struct pacom *ptcom ; + struct paevt *ptevt ; + struct paini *ptini ; + + struct papat *lastpat; + extern FILE *pat_desc_y_in; + int i ; + + if ((ptseq == NULL) || (ptseq->ERRFLG != 0)) + ERR_FLG += pat_error (100, NULL, ' ', 0); + else + { + if (ptseq->SUBSEQ == 0) + { + /* ###------------------------------------------------------### */ + /* for the first subsequence initialize: */ + /* - the parsing style (strict/non strict delays - ignore */ + /* delays) */ + /* - the current date */ + /* - the time unit conversion variables */ + /* - an array for values */ + /* ###------------------------------------------------------### */ + + PAT_MODE = mode; + CURDATE = 0 ; + + switch (PAT_TIMEUNIT) + { + case PAT_TU__FS : + PAT_CNVFS = 1 ; + PAT_CNVPS = 1.0E+3 ; + PAT_CNVNS = 1.0E+6 ; + PAT_CNVUS = 1.0E+9 ; + PAT_CNVMS = 1.0E+12; + break; + + case PAT_TU__PS : + PAT_CNVFS = 1.0E-3 ; + PAT_CNVPS = 1 ; + PAT_CNVNS = 1.0E+3 ; + PAT_CNVUS = 1.0E+6 ; + PAT_CNVMS = 1.0E+9 ; + break; + + case PAT_TU__NS : + PAT_CNVFS = 1.0E-6 ; + PAT_CNVPS = 1.0E-3 ; + PAT_CNVNS = 1 ; + PAT_CNVUS = 1.0E+3 ; + PAT_CNVMS = 1.0E+6 ; + break; + + case PAT_TU__US : + PAT_CNVFS = 1.0E-9 ; + PAT_CNVPS = 1.0E-6 ; + PAT_CNVNS = 1.0E-3 ; + PAT_CNVUS = 1 ; + PAT_CNVMS = 1.0E+3 ; + break; + + case PAT_TU__MS : + PAT_CNVFS = 1.0E-12; + PAT_CNVPS = 1.0E-9 ; + PAT_CNVNS = 1.0E-6 ; + PAT_CNVUS = 1.0E-3 ; + PAT_CNVMS = 1 ; + break; + + default : + PAT_CNVFS = 1 ; + PAT_CNVPS = 1 ; + PAT_CNVNS = 1 ; + PAT_CNVUS = 1 ; + PAT_CNVMS = 1 ; + ERR_FLG += pat_error (200, NULL, 0, 0); + } + + if (ERR_FLG == 0) + { + PAT_CNVFS = PAT_CNVFS / PAT_TIMESTEP; + PAT_CNVPS = PAT_CNVPS / PAT_TIMESTEP; + PAT_CNVNS = PAT_CNVNS / PAT_TIMESTEP; + PAT_CNVUS = PAT_CNVUS / PAT_TIMESTEP; + PAT_CNVMS = PAT_CNVMS / PAT_TIMESTEP; + } + + VALUE = mbkalloc (sizeof (char) * (ptseq->IOLNBR)); + + for (i=0 ; i<(ptseq->IOLNBR) ; i++) + VALUE [i] = '*'; + } + + else + { + /* ###------------------------------------------------------### */ + /* for other subsequences release old PAPAT, PACOM, PAINI */ + /* and PAEVT structures */ + /* ###------------------------------------------------------### */ + + /* ###------------------------------------------------------### */ + /* release PACOM of the old subsequence. Move the comments of */ + /* the previous subsequence to old. */ + /* ###------------------------------------------------------### */ + + ptcom = ptseq->OLDCOM; + + if (ptcom != NULL) + { + while (ptcom->NEXT != NULL) + ptcom = ptcom->NEXT; + } + + if (ptcom != NULL) + { + ptcom->NEXT = FRE_COMPNT; + FRE_COMPNT = ptseq->OLDCOM; + } + + ptseq->OLDCOM = ptseq->CURCOM; + ptseq->CURCOM = NULL; + + /* ###------------------------------------------------------### */ + /* scan the PAPAT list of the old subsequence to release it */ + /* and ... */ + /* ###------------------------------------------------------### */ + + lastpat = NULL; + ptpat = ptseq->OLDPAT; + + while ((ptpat != NULL) && (ptpat != ptseq->CURPAT)) + { + /* ###------------------------------------------------------### */ + /* release PAEVT of the current PAPAT */ + /* ###------------------------------------------------------### */ + + ptevt = ptpat->PAEVT; + + if (ptevt != NULL) + { + while (ptevt->NEXT != NULL) + ptevt = ptevt->NEXT; + } + + if (ptevt != NULL) + { + ptevt->NEXT = FRE_EVTPNT ; + FRE_EVTPNT = ptpat->PAEVT; + } + + /* ###------------------------------------------------------### */ + /* release PAINI of the current PAPAT */ + /* ###------------------------------------------------------### */ + + ptini = ptpat->PAINI; + + if (ptini != NULL) + { + while (ptini->NEXT != NULL) + ptini = ptini->NEXT; + } + + if (ptini != NULL) + { + ptini->NEXT = FRE_INIPNT ; + FRE_INIPNT = ptpat->PAINI; + } + + ptpat->PAINI = NULL; + ptpat->PAEVT = NULL; + + lastpat = ptpat ; + ptpat = ptpat->NEXT; + } + + if (lastpat != NULL) + { + lastpat->NEXT = FRE_PATPNT ; + FRE_PATPNT = ptseq->OLDPAT; + } + + ptseq->OLDPAT = ptseq->CURPAT; + ptseq->CURPAT = ptseq->NXTPAT; + } + + /* ###------------------------------------------------------### */ + /* initialization */ + /* ###------------------------------------------------------### */ + + if (ERR_FLG != 0) + ptseq->ERRFLG = 1; + else + { + if (maxpat == 0) + { + DECVAL = 0; + MAXPAT = 1; + } + else + { + DECVAL = 1 ; + MAXPAT = maxpat; + } + + PAT_SEQPNT = ptseq; + PAT_SEQPNT->PATNBR = 0 ; + + PAT_COMPNT = ptseq->CURCOM; + PAT_PATPNT = ptseq->CURPAT; + PAT_INIPNT = NULL ; + + if (ptseq->NXTPAT == NULL) + STT_NBR = 0; + else + STT_NBR = 1; + + if (ptseq->SUBSEQ == 0) + MAXPAT++; + + PAT_LINNUM = ptseq->LINENO; + NAM_IDX = 0 ; + + pat_desc_y_in = fp; + + /* ###------------------------------------------------------### */ + /* call the parser and, prepare the returned structure */ + /* ###------------------------------------------------------### */ + + pat_desc_y_parse (); + + if (ptseq->SUBSEQ == 0) + PAT_SEQPNT->PATNBR --; + + if (PAT_SEQPNT->ENDFLG == 'Y') + { + PAT_SEQPNT->NXTPAT = NULL; + PAT_SEQPNT->PATNBR ++; + } + else + { + PAT_SEQPNT->NXTPAT = PAT_PATPNT; + } + + PAT_SEQPNT->CURPAT = (struct papat *)reverse ((struct chain *)PAT_PATPNT); + PAT_SEQPNT->CURCOM = (struct pacom *)reverse ((struct chain *)PAT_COMPNT); + PAT_SEQPNT->LINENO = PAT_LINNUM; + + if (ERR_FLG == 0) + PAT_SEQPNT->ERRFLG = 0; + else + PAT_SEQPNT->ERRFLG = 1; + + PAT_SEQPNT->SUBSEQ++; + + /* ###------------------------------------------------------### */ + /* if the end of file has bee reached release the value array */ + /* ###------------------------------------------------------### */ + + if (PAT_SEQPNT->ENDFLG == 'Y') + { + mbkfree (VALUE); + } + + ptseq = PAT_SEQPNT; + } + } + + return (ptseq); + } + +%} + +%union + { + int valu; + float fval; + char immd; + char *text; + struct array arra; + struct label labe; + } + +%token _GTSym +%token _IN +%token _INOUT +%token _LESym +%token _LTSym +%token _OUT +%token AbstractLit +%token BitStringLit +%token BEGIN_ +%token Colon +%token Comma +%token Comment +%token DOWNTO +%token Dot +%token END_ +%token FS +%token Format +%token INSPECT +%token Identifier +%token LeftParen +%token Literal +%token NS +%token MS +%token PS +%token Plus +%token REGISTER +%token RightParen +%token SAVE +%token SIGNAL +%token Semicolons +%token SPY +%token TO +%token TRACE +%token US +%token UnknownChar + +%type name +%type simple_name +%type indexed_name +%type slice_name +%type .label. +%type Identifier...Identifier.. +%type Semicolons_ERR +%type date +%type relative_date +%type absolute_date +%type time_unit +%type .Identifier. + +/* %pure_parser */ +%start pat_format_file + +%% +pat_format_file + : description_block + .save_statement. + END_ERR + Semicolons_ERR + { PAT_SEQPNT->ENDFLG = 'Y'; } + ; + +description_block + : ..description_item.. + ; + +..description_item.. + : /*empty*/ + | ..description_item.. + description_item + ; + +description_item + : pattern_description + | other_statement + | error + Semicolons_ERR + ; + +other_statement + : initialization_statement + | Comment + { + PAT_COMPNT = lcl_addpacom (PAT_COMPNT, $1, STT_NBR); + STT_NBR = 0; + } + ; + +name + : simple_name + { $$ = $1; } + | indexed_name + { $$ = $1; } + | slice_name + { $$ = $1; } + ; + +simple_name + : Identifier...Identifier.. + { + $$.ident = $1; + $$.left = -1; + $$.right = -1; + } + ; + +indexed_name + : Identifier...Identifier.. + LeftParen + AbstractLit + RightParen + { + $$.ident = $1; + $$.left = $3; + $$.right = $3; + } + ; + +slice_name + : Identifier...Identifier.. + LeftParen + AbstractLit + direction + AbstractLit + RightParen + { + $$.ident = $1; + $$.left = $3; + $$.right = $5; + } + ; + +Identifier...Identifier.. + : Identifier + ...Identifier.. + { + char name[256]; + int i; + + strcpy (name, $1); + for (i=0; iSAVFLG = 'Y'; } + ; + +pattern_description + : .label. + unlabeled_pattern + { + if (PAT_INIPNT == NULL) + PAT_PATPNT->ACTFLAG = 'U'; + else + PAT_PATPNT->ACTFLAG = 'I'; + + PAT_PATPNT->TIME = $1.date ; + PAT_PATPNT->LABEL = $1.label; + + PAT_PATPNT->PAINI = (struct paini *) + reverse ((struct chain *) PAT_INIPNT); + PAT_INIPNT = NULL; + + MAXPAT -= DECVAL; + PAT_SEQPNT->PATNBR++; + + if (MAXPAT == 0) + YYACCEPT; + } + ; + +unlabeled_pattern + : Colon + Literal + Semicolons_ERR + { + char c = '\0'; + int i = 0 ; + unsigned short idx = 0 ; + char endfl = 'Y' ; + char cmpfl = 'F' ; + struct pagrp *ptgrp = PAT_SEQPNT->PAGRP; + struct paiol *ptiol = PAT_SEQPNT->PAIOL; + struct paevt *ptevt = NULL; + + while (idx < PAT_SEQPNT->IOLNBR) + { + if (((ptiol + idx)->FLAG & PAT_IOL__TRACE) != 0) + c = '*'; + else + c = $2 [i++]; + + if (c == '\0') + break; + + /* ###----------------------------------------------### */ + /* if the end of the current array is reached go to */ + /* the next group */ + /* ###----------------------------------------------### */ + + if ((ptgrp != NULL ) && + (idx == (ptgrp->LENGTH + ptgrp->FINDEX)) ) + { + ptgrp = ptgrp->NEXT; + endfl = 'Y'; + } + + /* ###----------------------------------------------### */ + /* otherwise, continue scanning the group */ + /* ###----------------------------------------------### */ + + if (endfl == 'N') + { + islegal (idx, c, cmpfl, 2); + switch ((ptiol + idx)->FORMAT) + { + case 'X': + ptevt = isevent (ptevt, idx, cmpfl, c, 0); + idx += 4; + break; + case 'O': + ptevt = isevent (ptevt, idx, cmpfl, c, 1); + idx += 3; + break; + case 'B': + ptevt = isevent (ptevt, idx, cmpfl, c, 3); + idx++; + break; + } + } + + else + { + /* ###----------------------------------------------### */ + /* begining a new array or a new single bit */ + /* ###----------------------------------------------### */ + + if (c == '?') + { + cmpfl = 'C'; + endfl = 'n'; + } + else + { + if (endfl == 'Y') + cmpfl = 'F'; + + /* ###----------------------------------------------### */ + /* if begining a new array */ + /* ###----------------------------------------------### */ + + if ((ptgrp != NULL) && (idx == ptgrp->FINDEX)) + { + islegal (idx, c, cmpfl, 1); + endfl = 'N'; + switch ((ptiol + idx)->FORMAT) + { + case 'X': + switch (ptgrp->LENGTH % 4) + { + case 1: + ptevt = isevent (ptevt, idx, cmpfl, c, 3); + idx++; + break; + case 2: + ptevt = isevent (ptevt, idx, cmpfl, c, 2); + idx += 2; + break; + case 3: + ptevt = isevent (ptevt, idx, cmpfl, c, 1); + idx += 3; + break; + case 0: + ptevt = isevent (ptevt, idx, cmpfl, c, 0); + idx += 4; + break; + } + break; + case 'O': + switch (ptgrp->LENGTH % 3) + { + case 1: + ptevt = isevent (ptevt, idx, cmpfl, c, 3); + idx++; + break; + case 2: + ptevt = isevent (ptevt, idx, cmpfl, c, 2); + idx += 2; + break; + case 0: + ptevt = isevent (ptevt, idx, cmpfl, c, 1); + idx += 3; + break; + } + break; + case 'B': + ptevt = isevent (ptevt, idx, cmpfl, c, 3); + idx++; + break; + } + } + + else + { + /* ###----------------------------------------------### */ + /* Begining a new single bit */ + /* ###----------------------------------------------### */ + + islegal (idx, c, cmpfl, 0); + ptevt = isevent (ptevt, idx, cmpfl, c, 3); + cmpfl = 'F'; + idx++; + } + } + } + } + + if ((c != '\0') && ($2 [i] != '\0')) +{ +printf ("pat : %s < i : %d < index : %d\n", $2, i, idx); + ERR_FLG += pat_error (3, NULL, ' ', PAT_LINNUM); +} + + if (idx < PAT_SEQPNT->IOLNBR) + ERR_FLG += pat_error (15, NULL, ' ', PAT_LINNUM); + + PAT_PATPNT = lcl_addpapat (PAT_PATPNT, NULL, PAT_LINNUM); + + PAT_PATPNT->PAEVT = ptevt; + PAT_PATPNT->BLANK = $3; + STT_NBR++; + } + ; + +.label. + : .Identifier. + { + if ((PAT_MODE & PAT_DLY__STRICT) != 0) + ERR_FLG += pat_error (16, NULL, ' ', PAT_LINNUM); + + $$.label = $1 ; + $$.date = CURDATE; + } + | _LTSym + date + _GTSym + .Identifier. + { + if ((PAT_MODE & PAT_DLY__IGNORE) != 0) + { + $$.label = $4; + $$.date = 0 ; + } + else + { + if ($2 < 0) + ERR_FLG += pat_error (17, NULL, ' ', PAT_LINNUM); + + if ($2 != 0) + PAT_SEQPNT->FLAGS &= ~PAT_SEQ__ZERODELAY; + + $$.label = $4; + $$.date = $2; + } + } + ; + +.Identifier. + : /*empty*/ + { $$ = NULL; } + | Identifier + { $$ = $1 ; } + ; + +date + : absolute_date + { + if ((PAT_MODE & PAT_DLY__STRICT) != 0) + { + if (($1 <= CURDATE) && + (PAT_SEQPNT->SUBSEQ == 0 ) && + (PAT_SEQPNT->CURPAT == NULL ) ) + ERR_FLG += pat_error (16, NULL, ' ', PAT_LINNUM); + } + + CURDATE = $1; + $$ = $1; + } + | relative_date + { + if ((PAT_MODE & PAT_DLY__STRICT) != 0) + { + if (($1 <= CURDATE) && + (PAT_SEQPNT->SUBSEQ == 0 ) && + (PAT_SEQPNT->CURPAT == NULL ) ) + ERR_FLG += pat_error (16, NULL, ' ', PAT_LINNUM); + } + + CURDATE += $1 ; + $$ = CURDATE; + } + ; + +absolute_date + : AbstractLit + time_unit + { $$ = $1 * $2; } + ; + +relative_date + : Plus + AbstractLit + time_unit + { $$ = $2 * $3; } + ; + +time_unit + : FS + { $$ = PAT_CNVFS; } + | PS + { $$ = PAT_CNVPS; } + | NS + { $$ = PAT_CNVNS; } + | US + { $$ = PAT_CNVUS; } + | MS + { $$ = PAT_CNVMS; } + ; + +END_ERR + : END_ + { yyerrok; } + ; + +Semicolons_ERR + : Semicolons + { + if (ERR_FLG > 30) + YYABORT; + else + yyerrok; + } + ; +%% diff --git a/alliance/src/ppt/src/pat_drvpat.c b/alliance/src/ppt/src/pat_drvpat.c new file mode 100644 index 00000000..3bc6beeb --- /dev/null +++ b/alliance/src/ppt/src/pat_drvpat.c @@ -0,0 +1,970 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* ###--------------------------------------------------------------### */ +/* file : pat_drvpat.c */ +/* date : Mar 10 2000 */ +/* version : v109 */ +/* author : Pirouz BAZARGAN SABET */ +/* content : pat format driver from pat structures */ +/* ###--------------------------------------------------------------### */ + +#include +#include +#include "mut.h" +#include "pat.h" + +/* ###--------------------------------------------------------------### */ +/* function : dclini */ +/* description : scan the initialization list, gather all elements of */ +/* an array of register and print a line for each */ +/* register */ +/* called func. : none */ +/* ###--------------------------------------------------------------### */ + +static void dclini (fp, ptpat) + +FILE *fp; +struct papat *ptpat; + + { + struct paini *ptini = ptpat->PAINI; + char buffer [1024] ; /* register's value */ + char name [ 256] ; /* current register's root name */ + int indx ; /* current register's index */ + char oldname [ 256] ; /* previous root name */ + char direction = '?'; /* array's direction */ + int redvar ; /* = 2 if (name + index) */ + int oldred ; /* previous value of redvar */ + int left ; /* the left bound of an array */ + int right ; /* the right bound of an array */ + int i = 0 ; + + /* ###------------------------------------------------------### */ + /* split the register's name into a root name and an index. */ + /* ###------------------------------------------------------### */ + + fprintf (fp,"\n-- modification of registers\n"); + oldred = sscanf (ptini->NAME, "%s %d", oldname, &left); + + strcpy (name, oldname); + redvar = oldred; + right = left; + buffer[i] = ptini->VALUE; + + i++; + ptini = ptini->NEXT; + + while (ptini != NULL) + { + /* ###------------------------------------------------------### */ + /* scan the PAINI list ... */ + /* split the register's name into a root name and an index. */ + /* ###------------------------------------------------------### */ + + redvar = sscanf (ptini->NAME, "%s %d", name, &indx); + + if ( (!strcmp (name, oldname)) && (oldred == 2) && (redvar == 2) && + ( (((direction == '?') || (direction == 'U')) && (indx == right+1)) || + (((direction == '?') || (direction == 'D')) && (indx == right-1)) )) + { + /* ###------------------------------------------------------### */ + /* If the root name is the same as the previous root name */ + /* and indexes are continus (continuing inside an array */ + /* register) : */ + /* consider the current index as the right bound of the array */ + /* continue inspecting the next PAINI. */ + /* ###------------------------------------------------------### */ + + if (direction == '?') + { + if (indx == (right + 1)) + direction = 'U'; + else + direction = 'D'; + } + + right = indx; + } + + else + { + /* ###------------------------------------------------------### */ + /* Otherwies, a new register has been matched. Print the */ + /* initialization statement relative to the previous register: */ + /* */ + /* - if the previous register was a scalar (root), produce a */ + /* one bit initialization statement. */ + /* */ + /* - if the previous register was an array (root + index), */ + /* compare print a line depending on its direction. */ + /* ###------------------------------------------------------### */ + + buffer[i] = '\0'; + if (oldred == 1) + fprintf (fp, "%s <= \'%s\';\n", oldname, buffer); + else + { + switch (direction) + { + case 'U' : + fprintf (fp, "%s (%d to %d) <= B\"%s\";\n", oldname, left, + right , buffer); + break; + case 'D' : + fprintf (fp, "%s (%d downto %d) <= B\"%s\";\n", oldname, left, + right , buffer); + break; + case '?' : + fprintf (fp, "%s (%d) <= \'%s\';\n", oldname, left, buffer); + break; + } + } + + direction = '?'; + i = 0; + left = indx; + right = indx; + oldred = redvar; + strcpy (oldname, name); + } + + buffer[i] = ptini->VALUE; + i++; + ptini = ptini->NEXT; + } + + /* ###------------------------------------------------------### */ + /* make the same actions when the end of the list has been */ + /* reached */ + /* ###------------------------------------------------------### */ + + buffer[i] = '\0'; + if (redvar == 1) + fprintf (fp, "%s <= \'%s\';\n", name, buffer); + else + { + switch (direction) + { + case 'U' : + fprintf (fp, "%s (%d to %d) <= B\"%s\";\n", oldname, left, + right , buffer); + break; + case 'D' : + fprintf (fp, "%s (%d downto %d) <= B\"%s\";\n", oldname, left, + right , buffer); + break; + case '?' : + fprintf (fp, "%s (%d) <= \'%s\';\n", oldname, left, buffer); + break; + } + } + + } + +/* ###--------------------------------------------------------------### */ +/* function : pat_drvpat */ +/* dexcription : produce a text file corresponding to a sequence of */ +/* patterns */ +/* called func. : dclini, mbkalloc, mbkfree, pat_error */ +/* ###--------------------------------------------------------------### */ + +int pat_drvpat (fp, ptseq, labelsiz) + +FILE *fp ; /* result file pointer */ +struct paseq *ptseq ; /* paseq structure to be drived */ +unsigned int labelsiz; /* length of the longest label */ + + { + int tmpc ; + time_t clock ; + + struct papat *ptpat = NULL; /* current pattern */ + struct paevt *ptevt = NULL; /* current event */ + struct pacom *ptcom = NULL; /* current comment */ + struct pacom *svcom = NULL; /* last comment of OLDPACOM */ + struct pagrp *ptgrp = NULL; /* current input-output array */ + struct paiol *ptiol = NULL; /* current input-output element */ + int iol_idx = 0 ; /* index in input-output list */ + int stt_nbr = 0 ; /* # of stm. since last comment */ + int pat_nbr = 0 ; /* # of patterns */ + + int row = 1 ; /* maximum length of I/O names */ + int column = 5 ; /* number of char. in a pattern */ + + int indx ; + int left ; /* left bound of an array */ + int right ; /* right bound of an array */ + int redvar ; + int oldred ; + char name [256]; + char oldname [256]; + char pat_date [ 32]; + char *mode ; /* input-output's mode */ + char *direc ; /* input-output array's direc. */ + char format ; /* input-output format */ + char seprt ; /* name separator left par or , */ + + int i ; + int j ; + int compare ; + char sflag = 'S'; /* processed or unprocessed */ + int length ; /* length of string */ + int ret_val = 0 ; /* value to be returned */ + + unsigned int t_step ; /* time step */ + unsigned char zd_flg ; /* zero delay flag (if != 0) */ + + static char *model = NULL; /* model : " :?1 2 34;" */ + static char *buffer = NULL; /* 1 pattern created from model */ + static char *signam = NULL; /* input-output names (vertical)*/ + static char *value = NULL; + static char *blank = ";;;;;;;;;;;;;;;;;\n"; + static char *line = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"; + static char *t_unit = NULL; + + /* ###------------------------------------------------------### */ + /* check the consistency of the sequence of patterns */ + /* ###------------------------------------------------------### */ + + if ((ptseq == NULL) || (ptseq->ERRFLG != 0)) + ret_val = pat_error (101, NULL, ' ', 0); + else + { + /* ###------------------------------------------------------### */ + /* initialize the time step and check if the description */ + /* is zero delay. */ + /* ###------------------------------------------------------### */ + + zd_flg = ptseq->FLAGS & PAT_SEQ__ZERODELAY; + t_step = ptseq->TIME_STEP ; + + /* ###------------------------------------------------------### */ + /* for an empty structure exit with out making any action. */ + /* Otherwise print the header message. */ + /* ###------------------------------------------------------### */ + + if (ptseq->DRVSEQ == 0) + { + fprintf (fp, "\n-- description generated by Pat driver\n\n"); + time (&clock); + fprintf (fp, "--\t\t\tdate : %s" , ctime(&clock)); + fprintf (fp, "--\t\t\trevision : v109\n\n" ); + + if (ptseq->NAME != NULL) + fprintf (fp, "--\t\t\tsequence : %s\n\n", ptseq->NAME); + + fprintf (fp, "-- input / output list :\n"); + } + + if (ptseq->DRVSEQ == 0) + { + + /* ###------------------------------------------------------### */ + /* if the declaration part has not been drived ... */ + /* scan the input-output list to : */ + /* - print the input-output declaration */ + /* - compute the number of characters in a pattern */ + /* (including pattern labels) : column */ + /* ###------------------------------------------------------### */ + + /* ###------------------------------------------------------### */ + /* initialize a string with the time unit */ + /* ###------------------------------------------------------### */ + + switch (ptseq->TIME_UNIT & PAT_SEQ__TIMEUNIT) + { + case PAT_TU__FS : + t_unit = "fs" ; break; + case PAT_TU__PS : + t_unit = "ps" ; break; + case PAT_TU__NS : + t_unit = "ns" ; break; + case PAT_TU__US : + t_unit = "us" ; break; + case PAT_TU__MS : + t_unit = "ms" ; break; + } + + /* ###------------------------------------------------------### */ + /* if the input-output list is not organized as an array, */ + /* change it into an array */ + /* ###------------------------------------------------------### */ + + if ((ptseq->FLAGS & PAT_SEQ__IOLARRAY) == 0) + { + ptiol = pat_crtpaiol (ptseq->PAIOL); + pat_frepaiol (ptseq->PAIOL); + + ptseq->PAIOL = ptiol; + ptseq->FLAGS = PAT_SEQ__IOLARRAY; + } + + /* ###------------------------------------------------------### */ + /* if a date is necessary (always, exept for old pat format) */ + /* add the length of the date to the length of the pattern */ + /* ###------------------------------------------------------### */ + + if (zd_flg == 0) + column += 16; + + /* ###------------------------------------------------------### */ + /* add the length of the longest pattern's label to the */ + /* length of the pattern. */ + /* ###------------------------------------------------------### */ + + column += labelsiz; + + ptiol = ptseq->PAIOL; + ptgrp = ptseq->PAGRP; + ptcom = ptseq->DECCOM; + + while (ptiol != NULL) + { + + /* ###------------------------------------------------------### */ + /* for each input-output ... */ + /* ###------------------------------------------------------### */ + + /* ###------------------------------------------------------### */ + /* print a comment line if needed */ + /* ###------------------------------------------------------### */ + + if ((ptcom != NULL) && (ptcom->POSITION == stt_nbr)) + fprintf (fp, "\n"); + + while ((ptcom != NULL) && (ptcom->POSITION == stt_nbr)) + { + fprintf (fp, "# %s\n", ptcom->TEXT); + ptcom = ptcom->NEXT; + stt_nbr = 0; + } + + /* ###------------------------------------------------------### */ + /* prepare input-output's format and mode */ + /* ###------------------------------------------------------### */ + + format = ptiol->FORMAT; + switch (ptiol->MODE) + { + case 'I': + mode = "in "; break; + case 'O': + case 'B': + case 'Z': + mode = "out "; break; + case 'R': + mode = "register"; break; + case 'T': + mode = "inout "; break; + case 'S': + case 'W': + case 'X': + case 'U': + mode = "signal "; break; + default : + mode = "signal "; break; + ret_val = pat_error (201, ptiol->NAME, ptiol->MODE, 0); + } + + /* ###------------------------------------------------------### */ + /* increment the length of the pattern for an output ('?') */ + /* ###------------------------------------------------------### */ + + if (ptiol->MODE != 'I') + column ++; + + if ((ptgrp != NULL) && (iol_idx == ptgrp->FINDEX)) + { + /* ###------------------------------------------------------### */ + /* for an actual or virtual array ... */ + /* ###------------------------------------------------------### */ + + switch (ptiol->FORMAT) + { + /* ###------------------------------------------------------### */ + /* increment the length of the pattern by the number of */ + /* characters needed for the value of the array (including */ + /* extra blank characters) */ + /* ###------------------------------------------------------### */ + + case 'X': + column += ((ptgrp->LENGTH - 1) / 4) + 1; + break; + case 'O': + column += ((ptgrp->LENGTH - 1) / 3) + 1; + break; + case 'B': + column += ptgrp->LENGTH; + break; + } + column += ptiol->BLANK; + + /* ###------------------------------------------------------### */ + /* change the maximum length (number of rows) of input- */ + /* outputs if the length of the current array's name is bigger */ + /* ###------------------------------------------------------### */ + + length = strlen (ptgrp->NAME); + if (row < length) + row = length; + + if (ptgrp->FLAG == 0) + { + /* ###------------------------------------------------------### */ + /* print out the declaration of an actual array */ + /* ###------------------------------------------------------### */ + + sscanf (ptiol->NAME, "%s %d", name, &left); + ptiol += ptgrp->LENGTH - 1; + sscanf (ptiol->NAME, "%s %d", name, &right); + + if (left < right) + direc = "to"; + else + direc = "downto"; + + fprintf (fp, "%s %s (%d %s %d) %c", mode , name, left, direc, + right, format); + } + else + { + /* ###------------------------------------------------------### */ + /* print out the declaration of a virtual array : */ + /* - mode and name */ + /* - for each subelement, its name and if it is an array, */ + /* its left and right bound and direction */ + /* ###------------------------------------------------------### */ + + fprintf (fp, "%s %s ", mode, ptgrp->NAME); + seprt = '('; + oldred = sscanf (ptiol->NAME, "%s %d", oldname, &left); + redvar = oldred; + right = left; + strcpy (name, oldname); + + ptiol++; + for (i=1 ; iLENGTH; i++) + { + redvar = sscanf (ptiol->NAME, "%s %d", name, &indx); + + if (!strcmp (name, oldname)) + right = indx; + else + { + if (oldred == 1) + fprintf (fp, "%c %s", seprt, oldname); + else + { + if (left < right) + direc = "to"; + else + direc = "downto"; + fprintf (fp, "%c %s (%d %s %d)", seprt, oldname, left, + direc, right); + } + left = indx; + oldred = redvar; + strcpy (oldname, name); + seprt = ','; + } + ptiol ++; + } + + ptiol --; + if (redvar == 1) + fprintf (fp, "%c %s ) %c", seprt, name, format); + else + { + if (left < right) + direc = "to" ; + else + direc = "downto"; + + fprintf (fp, "%c %s (%d %s %d) ) %c", seprt, name , left, + direc, right, format); + } + } + iol_idx += ptgrp->LENGTH; + ptgrp = ptgrp->NEXT ; + } + + else + { + + /* ###------------------------------------------------------### */ + /* for a scalar input-output : */ + /* - print the declaration */ + /* - change the maximum length of input-outputs' name */ + /* - increment the length of the pattern */ + /* ###------------------------------------------------------### */ + + redvar = sscanf (ptiol->NAME, "%s %d", name, &indx); + if (redvar == 1) + fprintf (fp, "%s %s %c" , mode, name, format); + else + fprintf (fp, "%s %s (%d) %c", mode, name, indx, format); + + length = strlen (ptiol->NAME); + if (row < length) + row = length; + + column += ptiol->BLANK + 1; + iol_idx ++; + } + + /* ###------------------------------------------------------### */ + /* if the input/output is a spied input/output, print the */ + /* spy flag */ + /* ###------------------------------------------------------### */ + + if ((ptiol->FLAG & PAT_IOL__SPY) != 0) + fprintf (fp, " spy "); + + /* ###------------------------------------------------------### */ + /* print semicolons and '\n' */ + /* ###------------------------------------------------------### */ + + fprintf (fp, "%s", &blank [16 - ptiol->BLANK]); + ptiol = ptiol->NEXT; + stt_nbr ++; + } + + /* ###------------------------------------------------------### */ + /* make enough allocation */ + /* for 2 patterns : model, buffer */ + /* for input-output's names : signam */ + /* for : value */ + /* ###------------------------------------------------------### */ + + model = mbkalloc (sizeof(char) * column * 2 ); + signam = mbkalloc (sizeof(char) * column * row ); + value = mbkalloc (sizeof(char) * (ptseq->IOLNBR)); + + /* ###------------------------------------------------------### */ + /* begin initialisation of value, model and signam: */ + /* */ + /* value : unknown value (*) for all inputs-outputs */ + /* model represents the format of the pattern : " : ;" */ + /* signam : "-- \n" * number of rows */ + /* ###------------------------------------------------------### */ + + for (i=0 ; iIOLNBR ; i++) + value [i] = '*'; + + for (i=0 ; iPAGRP; + ptiol = ptseq->PAIOL; + iol_idx = 0; + + while (ptiol != NULL) + { + if (ptiol->MODE != 'I') + model [i++] = '?'; + + if ((ptgrp != NULL) && (iol_idx == ptgrp->FINDEX)) + { + j = 0; + while (ptgrp->NAME[j] != '\0') + { + signam [i + (j * column)] = ptgrp->NAME [j]; + j++; + } + switch (ptiol->FORMAT) + { + case 'X': + model [i++] = ((ptgrp->LENGTH - 1) % 4) + 1; + for (j=0 ; j<((ptgrp->LENGTH - 1) / 4) ; j++) + model [i++] = 4; + break; + case 'O': + model [i++] = ((ptgrp->LENGTH - 1) % 3) + 1; + for (j=0 ; j<((ptgrp->LENGTH - 1) / 3) ; j++) + model [i++] = 3; + break; + case 'B': + for (j=0 ; jLENGTH ; j++) + model [i++] = 1; + break; + } + iol_idx += ptgrp->LENGTH; + ptiol = ptseq->PAIOL + iol_idx - 1; + + ptgrp = ptgrp->NEXT; + } + else + { + j = 0; + while (ptiol->NAME [j] != '\0') + { + signam [i + (j * column)] = ptiol->NAME [j]; + j++; + } + model [i++] = 1; + iol_idx++; + } + + i += ptiol->BLANK; + ptiol = ptiol->NEXT; + } + + /* ###------------------------------------------------------### */ + /* print a comment line if needed */ + /* ###------------------------------------------------------### */ + + if ((ptcom != NULL) && (ptcom->POSITION == stt_nbr)) + fprintf (fp, "\n"); + + while ((ptcom != NULL) && (ptcom->POSITION == stt_nbr)) + { + fprintf (fp, "# %s\n", ptcom->TEXT); + ptcom = ptcom->NEXT; + stt_nbr = 0; + } + + /* ###------------------------------------------------------### */ + /* begin printing the pattern description part */ + /* ###------------------------------------------------------### */ + + fprintf (fp, "\nbegin\n"); + stt_nbr = 0; + + fprintf (fp, "\n-- Pattern description :\n\n"); + fprintf (fp, "%s\n\n", signam); + + } + + /* ###------------------------------------------------------### */ + /* for every sub-sequence ... */ + /* ###------------------------------------------------------### */ + + ptiol = ptseq->PAIOL ; + ptpat = ptseq->CURPAT; + ptcom = ptseq->CURCOM; + pat_nbr = ptseq->PATNBR; + + if (ptseq->DRVSEQ < (ptseq->SUBSEQ - 1)) + { + /* ###------------------------------------------------------### */ + /* if the old sub-sequence has not been drived */ + /* ###------------------------------------------------------### */ + + fprintf (fp, "\n-- Beware : some patterns may be missing\n\n"); + + if (ptseq->OLDPAT != NULL) + { + ptpat = ptseq->OLDPAT; + while (ptpat->NEXT != ptseq->CURPAT) + { + pat_nbr ++; + ptpat = ptpat->NEXT; + } + ptpat = ptseq->OLDPAT; + } + + /* ###------------------------------------------------------### */ + /* if any old comment exists, merge old and current comments */ + /* lists */ + /* ###------------------------------------------------------### */ + + if (ptseq->OLDCOM != NULL) + { + ptcom = ptseq->OLDCOM; + while (ptcom->NEXT != NULL) + ptcom = ptcom->NEXT; + + svcom = ptcom; + ptcom->NEXT = ptseq->CURCOM; + ptcom = ptseq->OLDCOM; + } + } + + while ((ptpat != NULL) && (pat_nbr > 0)) + { + i = 0; + iol_idx = 0; + + /* ###------------------------------------------------------### */ + /* check for processed or unprocessed patterns */ + /* ###------------------------------------------------------### */ + + if ((ptpat->SIMFLAG == 'U') && (sflag == 'S')) + fprintf (fp, "\n-- Beware : unprocessed patterns\n\n"); + + sflag = ptpat->SIMFLAG; + + /* ###------------------------------------------------------### */ + /* print a comment line if needed */ + /* print initialisation if needed */ + /* ###------------------------------------------------------### */ + + if ((ptcom != NULL) && (ptcom->POSITION == stt_nbr)) + fprintf (fp, "\n"); + + while ((ptcom != NULL) && (ptcom->POSITION == stt_nbr)) + { + fprintf (fp, "# %s\n", ptcom->TEXT); + ptcom = ptcom->NEXT; + stt_nbr = 0; + } + + if (ptpat->PAINI != NULL) + { + dclini (fp, ptpat); + fprintf (fp, "\n"); + } + + /* ###------------------------------------------------------### */ + /* for each event of the pattern : */ + /* - print an error message if simulation and user values */ + /* mismatch */ + /* - copy the event in the value string */ + /* ###------------------------------------------------------### */ + + ptevt = ptpat->PAEVT; + while (ptevt != NULL) + { + iol_idx = ptevt->INDEX; + if ((ptevt->USRVAL != '*') && (ptevt->USRVAL != ptevt->SIMVAL)) + { + ptiol = ptseq->PAIOL + iol_idx; + + if (sscanf (ptiol->NAME, "%s %d", name, &indx) == 2) + fprintf (fp, "-- error on `%s (%d)` : ", name, indx ); + else + fprintf (fp, "-- error on `%s` : " , ptiol->NAME); + + fprintf (fp, "expected value: %c\n", ptevt->USRVAL); + } + value [iol_idx] = ptevt->SIMVAL; + ptevt = ptevt->NEXT ; + } + + /* ###------------------------------------------------------### */ + /* print a comment line if the pattern has been produced due */ + /* to an event on a spied signal. */ + /* ###------------------------------------------------------### */ + + if ((ptpat->FLAG & PAT_PAT__SPY) != 0) + { + fprintf (fp, "-- spy pattern : "); + + ptevt = ptpat->PAEVT; + while (ptevt != NULL) + { + ptiol = ptseq->PAIOL + iol_idx; + + if ((ptiol->FLAG & PAT_IOL__SPY) != 0) + { + if (sscanf (ptiol->NAME, "%s %d", name, &indx) == 2) + fprintf (fp, "%s (%d) ", name, indx ); + else + fprintf (fp, "%s " , ptiol->NAME); + } + } + fprintf (fp, "\n"); + } + + /* ###------------------------------------------------------### */ + /* if a date has been specified for the pattern print it */ + /* with the unit specified in the sequence */ + /* ###------------------------------------------------------### */ + + if (zd_flg == 0) + { + sprintf (pat_date, "<%11u %s>", ptpat->TIME * t_step, t_unit); + + for (i=0 ; i<16 ; i++) + buffer [i] = pat_date [i]; + } + + /* ###------------------------------------------------------### */ + /* copy the pattern's label in buffer */ + /* ###------------------------------------------------------### */ + + if (ptpat->LABEL != NULL) + { + j = 0; + while ((ptpat->LABEL [j] != '\0') && (j < labelsiz)) + { + buffer [i] = ptpat->LABEL [j]; + j ++; + i ++; + } + } + + /* ###------------------------------------------------------### */ + /* fill the buffer with the pattern's value : take 1, 2, 3 */ + /* or, 4 paiol structures to form the value in the buffer */ + /* ###------------------------------------------------------### */ + + iol_idx = 0; + ptiol = ptseq->PAIOL; + + while ((buffer [i] = model [i]) != '\0') + { + if ((model [i] >= 1) && (model [i] <= 4)) + { + tmpc = 0; + for (j=0 ; jMODE == 'T') && (buffer [i-1] == '?') && + ( compare == 0 )) + buffer [i-1] = ' '; + } + i++; + } + + fprintf (fp, "%s%s%s", buffer, &blank [17 - ptpat->BLANK], + &line [18 - ptpat->BLANK]); + + stt_nbr ++; + pat_nbr --; + + ptpat = ptpat->NEXT; + } + + /* ###------------------------------------------------------### */ + /* print a comment line if needed */ + /* ###------------------------------------------------------### */ + + if ((ptcom != NULL) && (ptcom->POSITION == stt_nbr)) + fprintf (fp, "\n"); + + while ((ptcom != NULL) && (ptcom->POSITION == stt_nbr)) + { + fprintf (fp, "# %s\n", ptcom->TEXT); + ptcom = ptcom->NEXT; + stt_nbr = 0; + } + + /* ###------------------------------------------------------### */ + /* restore the original old and current comments lists */ + /* ###------------------------------------------------------### */ + + if (svcom != NULL) + svcom->NEXT = NULL; + + /* ###------------------------------------------------------### */ + /* for the last subsequence print a save (if needed) and */ + /* the end statement. Release allocated buffers (model, signam, */ + /* value). */ + /* ###------------------------------------------------------### */ + + if (ptseq->ENDFLG == 'Y') + { + if (ptseq->SAVFLG == 'Y') + fprintf (fp, "\nsave;\n"); + + fprintf (fp, "\nend;\n"); + + mbkfree (model ); + mbkfree (signam); + mbkfree (value ); + } + + /* ###------------------------------------------------------### */ + /* update the drived subsequence number */ + /* ###------------------------------------------------------### */ + + ptseq->DRVSEQ = ptseq->SUBSEQ; + } + + return (ret_val); + } diff --git a/alliance/src/ppt/src/pat_lodpaseq.c b/alliance/src/ppt/src/pat_lodpaseq.c new file mode 100644 index 00000000..611d7e23 --- /dev/null +++ b/alliance/src/ppt/src/pat_lodpaseq.c @@ -0,0 +1,120 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* ###--------------------------------------------------------------### */ +/* file : pat_lodpaseq.c */ +/* date : Mar 10 2000 */ +/* version : v109 */ +/* author : Pirouz BAZARGAN SABET */ +/* content : parser-driver functions */ +/* ###--------------------------------------------------------------### */ + +#include +#include +#include +#include "mut.h" +#include "pat.h" +#include "ppt.h" + +/* ###--------------------------------------------------------------### */ +/* function : pat_lodpaseq */ +/* description : load a sequence of patterns from a pattern file */ +/* called func. : makfopen, pat_error, pat_warning, pat_prspat */ +/* ###--------------------------------------------------------------### */ + +struct paseq *pat_lodpaseq (name, ptseq, maxpat, mode) + +char *name ; /* name of the new sequence */ +struct paseq *ptseq ; /* list of existing sequences */ +unsigned int maxpat; /* # of pattern in a sub-sequence */ +unsigned char mode ; /* compiler mode */ + + { + static FILE *fp = NULL; + static struct chain *sfx_lst = NULL; + struct chain *sfx_pnt ; + char *str ; + char *tok ; + + if ((ptseq == NULL) || (ptseq->ENDFLG == 'Y')) + { + /* ###------------------------------------------------------### */ + /* read the environment variable VH_PATSFX to get the */ + /* pattern file extensions. */ + /* ###------------------------------------------------------### */ + + if (sfx_lst == NULL) + { + if ((str = mbkgetenv ("VH_PATSFX")) != NULL) + { + tok = strtok (str, ":"); + while (tok != NULL) + { + sfx_lst = addchain (sfx_lst, tok); + tok = strtok (NULL, ":"); + } + + sfx_lst = (struct chain *) reverse (sfx_lst); + } + else + sfx_lst = addchain (NULL, "pat"); + } + + /* ###------------------------------------------------------### */ + /* open a new file. If the previous file has not been closed */ + /* produce a warning message. */ + /* ###------------------------------------------------------### */ + + if (fp != NULL) + pat_warning (1, "parser", ' ', 0); + + sfx_pnt = sfx_lst; + while (sfx_pnt != NULL) + { + if ((fp = mbkfopen (name, sfx_pnt->DATA, READ_TEXT)) != NULL) + break; + sfx_pnt = sfx_pnt->NEXT; + } + + if (fp == NULL) + pat_error (102, name, ' ', 0); + } + + if (fp != NULL) + { + /* ###------------------------------------------------------### */ + /* parse the openned file. Close the file when the end is */ + /* reached or if an error has occured. */ + /* ###------------------------------------------------------### */ + + ptseq = pat_prspat (fp, name, ptseq, maxpat, mode); + + if ((ptseq == NULL) || (ptseq->ENDFLG == 'Y') || (ptseq->ERRFLG != 0)) + { + fclose (fp); + fp = NULL; + } + } + + return (ptseq); + } diff --git a/alliance/src/ppt/src/pat_pattostr.c b/alliance/src/ppt/src/pat_pattostr.c new file mode 100644 index 00000000..65b3f903 --- /dev/null +++ b/alliance/src/ppt/src/pat_pattostr.c @@ -0,0 +1,68 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* ###--------------------------------------------------------------### */ +/* file : pat_pattostr.c */ +/* date : Nov 18 1994 */ +/* version : v105 */ +/* author : Pirouz BAZARGAN SABET */ +/* content : pat parser-driver level function */ +/* ###--------------------------------------------------------------### */ + +#include +#include "mut.h" +#include "pat.h" +#include "ppt.h" + +char *pat_pattostr (str, ptpat, mode) + +char *str ; +struct papat *ptpat; +char mode ; + + { + struct paevt *ptevt; + + if (ptpat != NULL) + { + ptevt = ptpat->PAEVT; + if (mode == PAT_SIMU_RESULT) + { + while (ptevt != NULL) + { + str [ptevt->INDEX] = ptevt->SIMVAL; + ptevt = ptevt->NEXT; + } + } + else + { + while (ptevt != NULL) + { + str [ptevt->INDEX] = ptevt->USRVAL; + ptevt = ptevt->NEXT; + } + } + } + + return (str); + } diff --git a/alliance/src/ppt/src/pat_prspat.c b/alliance/src/ppt/src/pat_prspat.c new file mode 100644 index 00000000..aac5158b --- /dev/null +++ b/alliance/src/ppt/src/pat_prspat.c @@ -0,0 +1,80 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* ###--------------------------------------------------------------### */ +/* file : pat_prspat.c */ +/* date : Mar 10 2000 */ +/* version : v109 */ +/* author : Pirouz BAZARGAN SABET */ +/* content : parser-driver functions */ +/* ###--------------------------------------------------------------### */ + +#include +#include "mut.h" +#include "pat.h" +#include "ppt.h" + +/* ###--------------------------------------------------------------### */ +/* function : pat_prspat */ +/* description : parse a file in pat format and return a PASEQ */ +/* called func. : namealloc, pat_declpat, pat_descpat */ +/* ###--------------------------------------------------------------### */ + +struct paseq *pat_prspat (fp, name, ptseq, maxpat, mode) + +FILE *fp ; /* pointer of file to be parsed */ +char *name ; /* name of the new sequence */ +struct paseq *ptseq ; /* list of existing sequences */ +unsigned int maxpat; /* # of pattern in a sub-sequence */ +unsigned char mode ; /* complier mode */ + + { + extern struct paseq *pat_declpat (); + extern struct paseq *pat_descpat (); + + if ((ptseq == NULL) || (ptseq->ENDFLG == 'Y')) + { + /* ###------------------------------------------------------### */ + /* begin parsing a new pattern file */ + /* ###------------------------------------------------------### */ + + ptseq = pat_declpat (fp, ptseq); + + if ((ptseq != NULL) && (ptseq->ERRFLG == 0)) + { + ptseq->NAME = namealloc (name); + ptseq = pat_descpat (fp, ptseq, maxpat, mode); + } + + } + else + { + /* ###------------------------------------------------------### */ + /* continue parsing */ + /* ###------------------------------------------------------### */ + + ptseq = pat_descpat (fp, ptseq, maxpat, mode); + } + + return (ptseq); + } diff --git a/alliance/src/ppt/src/pat_savpaseq.c b/alliance/src/ppt/src/pat_savpaseq.c new file mode 100644 index 00000000..ec92b86c --- /dev/null +++ b/alliance/src/ppt/src/pat_savpaseq.c @@ -0,0 +1,106 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* ###--------------------------------------------------------------### */ +/* file : pat_savpaseq.c */ +/* date : Aug 25 1997 */ +/* version : v107 */ +/* author : Pirouz BAZARGAN SABET */ +/* content : parser-driver functions */ +/* ###--------------------------------------------------------------### */ + +#include +#include +#include +#include "mut.h" +#include "pat.h" +#include "ppt.h" + +/* ###--------------------------------------------------------------### */ +/* function : pat_savpaseq */ +/* description : save a sequence of patterns into a pattern file */ +/* called func. : makfopen , pat_error, pat_warning, pat_drvpat */ +/* ###--------------------------------------------------------------### */ + +int pat_savpaseq (name, ptseq, labelsiz) + +char *name ; /* name of the drived file */ +struct paseq *ptseq ; /* list of existing sequences */ +unsigned int labelsiz; /* length of the longest label */ + + { + static FILE *fp = NULL; + static char *sfx = NULL; + char *str ; + int err_flg = 0 ; + + /* ###------------------------------------------------------### */ + /* read the environment variable VH_PATSFX to get the */ + /* pattern file extension. */ + /* ###------------------------------------------------------### */ + + if (sfx == NULL) + { + if ((str = mbkgetenv ("VH_PATSFX")) != NULL) + sfx = strtok (str, ":"); + else + sfx = "pat"; + } + + if (ptseq != NULL) + { + /* ###------------------------------------------------------### */ + /* if the sequence exist ... */ + /* open a new file if it is the first call for the current */ + /* sequence. Produce a warning message if the previous file */ + /* has not been closed */ + /* ###------------------------------------------------------### */ + + if (ptseq->DRVSEQ == 0) + { + if (fp != NULL) + pat_warning (1, "driver", ' ', 0); + + if ((fp = mbkfopen (name, sfx, WRITE_TEXT)) == NULL) + err_flg = pat_error (102, name, ' ', 0); + } + + if (fp != NULL) + { + /* ###------------------------------------------------------### */ + /* parse the openned file. Close the file when the end is */ + /* reached. */ + /* ###------------------------------------------------------### */ + + err_flg = pat_drvpat (fp, ptseq, labelsiz); + + if (ptseq->ENDFLG == 'Y') + { + fclose (fp); + fp = NULL; + } + } + } + + return (err_flg); + } diff --git a/alliance/src/ppt/src/pat_type.h b/alliance/src/ppt/src/pat_type.h new file mode 100644 index 00000000..21583eaa --- /dev/null +++ b/alliance/src/ppt/src/pat_type.h @@ -0,0 +1,54 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* ###--------------------------------------------------------------### */ +/* file : pat_type.h */ +/* date : Mar 9 2000 */ +/* version : v109 */ +/* author : Pirouz BAZARGAN SABET */ +/* content : parser-driver level library */ +/* ###--------------------------------------------------------------### */ + +struct entry + { + struct entry *next ; + short fd0_val; + short fd1_val; + int pt0_val; + int pt1_val; + char *key ; + }; + +struct label + { + char *label; + unsigned long date; + }; + +struct array + { + char *ident; + short left ; + short right; + }; + diff --git a/alliance/src/ppt/src/ppt.h b/alliance/src/ppt/src/ppt.h new file mode 100644 index 00000000..07dff9cb --- /dev/null +++ b/alliance/src/ppt/src/ppt.h @@ -0,0 +1,38 @@ + +/* ###--------------------------------------------------------------### */ +/* file : ppt109.h */ +/* date : Mar 8 2000 */ +/* version : v109 */ +/* authors : Pirouz BAZARGAN SABET */ +/* description : header for PPT library */ +/* ###--------------------------------------------------------------### */ + +#ifndef PAT_PPTDEF +#define PAT_PPTDEF + + /* ###------------------------------------------------------### */ + /* parser-driver defines */ + /* ###------------------------------------------------------### */ + +#define PAT_SIMU_RESULT 1 +#define PAT_USER_PREDICT 0 + +#define PAT_DLY__STRICT 0x01 /* comp. mode: increasing time */ +#define PAT_DLY__IGNORE 0x02 /* comp. mode: ignore delays */ + + /* ###------------------------------------------------------### */ + /* global variables */ + /* ###------------------------------------------------------### */ + + /* ###------------------------------------------------------### */ + /* parser-driver functions */ + /* ###------------------------------------------------------### */ + +extern struct paseq *pat_lodpaseq (); /* parser */ +extern struct paseq *pat_prspat (); /* pat format parser */ + +extern int pat_savpaseq (); /* driver */ +extern int pat_drvpat (); /* pat format driver */ + +extern char *pat_pattostr (); +#endif diff --git a/alliance/src/scapin/Makefile.am b/alliance/src/scapin/Makefile.am new file mode 100644 index 00000000..5fcaa0d3 --- /dev/null +++ b/alliance/src/scapin/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src man1 diff --git a/alliance/src/scapin/configure.in b/alliance/src/scapin/configure.in new file mode 100644 index 00000000..fa34925b --- /dev/null +++ b/alliance/src/scapin/configure.in @@ -0,0 +1,35 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(src/scan_main.c) + +SCAPIN_MAJOR_VERSION=1 +SCAPIN_MINOR_VERSION=1 +SCAPIN_VERSION=$SCAPIN_MAJOR_VERSION.$SCAPIN_MINOR_VERSION + +AC_SUBST(SCAPIN_MAJOR_VERSION) +AC_SUBST(SCAPIN_MINOR_VERSION) +AC_SUBST(SCAPIN_VERSION) + +# For automake. +VERSION=$SCAPIN_VERSION +PACKAGE=scapin + +dnl Initialize automake stuff +AM_INIT_AUTOMAKE($PACKAGE, $VERSION) + +dnl Checks for programs. +AC_PROG_CC +AM_PROG_LEX +AC_PROG_YACC +AC_PROG_RANLIB +AC_PROG_MAKE_SET + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST + +AM_ALLIANCE + +AC_OUTPUT([ +Makefile +man1/Makefile +src/Makefile +]) diff --git a/alliance/src/scapin/etc/sxlib.scapin b/alliance/src/scapin/etc/sxlib.scapin new file mode 100644 index 00000000..ff9a8586 --- /dev/null +++ b/alliance/src/scapin/etc/sxlib.scapin @@ -0,0 +1,67 @@ +# /*------------------------------------------------------------\ +# | | +# | Tool : Parameter File for Scan Tool | +# | | +# | File : sxlib.scan | +# | | +# | Authors : Jacomme Ludovic | +# | Kazi Tani Ilhem | +# | | +# | Date : 29.06.2000 | +# | | +# \------------------------------------------------------------*/ + +BEGIN_MUX + +MUX_MODEL mx2_x2 +MUX_SEL cmd +MUX_INPUT_SEL i1 +MUX_INPUT_NSEL i0 +MUX_VDD vdd +MUX_VSS vss +MUX_OUTPUT q + +END_MUX + + +BEGIN_REG + +REG_MODEL sff1_x4 +REG_CLK ck +REG_INPUT i +REG_VDD vdd +REG_VSS vss +REG_OUTPUT q +REG_MUX mx2_x2 +REG_REG_MUX sff2_x4 + +END_REG + + +BEGIN_REG_MUX + +REG_MUX_MODEL sff2_x4 +REG_MUX_SEL cmd +REG_MUX_INPUT_SEL i1 +REG_MUX_INPUT_NSEL i0 +REG_MUX_CLK ck +REG_MUX_VDD vdd +REG_MUX_VSS vss +REG_MUX_OUTPUT q +REG_MUX_MUX mx2_x2 +REG_MUX_REG sff1_x4 + +END_REG_MUX + + +BEGIN_BUF + +BUF_MODEL buf_x2 +BUF_INPUT i +BUF_VDD vdd +BUF_VSS vss +BUF_OUTPUT q + +END_BUF + + diff --git a/alliance/src/scapin/man1/Makefile.am b/alliance/src/scapin/man1/Makefile.am new file mode 100644 index 00000000..a1c6c77e --- /dev/null +++ b/alliance/src/scapin/man1/Makefile.am @@ -0,0 +1,2 @@ +man_MANS = scapin.1 +EXTRA_DIST = $(man_MANS) diff --git a/alliance/src/scapin/man1/scapin.1 b/alliance/src/scapin/man1/scapin.1 new file mode 100644 index 00000000..d3975066 --- /dev/null +++ b/alliance/src/scapin/man1/scapin.1 @@ -0,0 +1,156 @@ +.pl -.4 +.TH SCAPIN 1 "Juin 29, 2000" "ASIM/LIP6" "CAO\-VLSI Reference Manual" +.SH NAME +.TP +scapin - Scan path insertion +.so man1/alc_origin.1 +.SH SYNOPSIS +.TP +\f4scapin [\-VRB] [\-P file] Input_name Path_name Output_name +.br +.SH DESCRIPTION +\fBSCAPIN\fP is an automatic scan path generator for gate level netlists. +\fBSCAPIN\fP inserts a scan path in the netlist \fBInput_name\fP and drives +a new netlist \fBOutput_name\fP. +This scan path contains all registers specified in the file \fBPath_name\fP.path +(see below for the exact syntax). +\fBSCAPIN\fP adds also 3 new connectors in the netlist: scan_in, scan_out and +scan_test in order to control the scan path. +Eventually \fBSCAPIN\fP adds an output buffer before the output connector +scan_out (option -B). +.br + +.SH ENVIRONMENT VARIABLES +.br +.TP 10 +\f4MBK_WORK_LIB\fR(1) +indicates the path to the read/write directory for the session. +.br +.TP 10 +\f4MBK_IN_LO\fR(1) +indicates the input netlist file format. +.br +.TP 10 +\f4MBK_OUT_LO\fR(1) +indicates the output netlist file format. +.br +.TP 10 +\f4SCAPIN_PARAM_NAME\fR +indicates the location of a parameter file (with extention .scapin) containing +the properties (ports name, models name etc ...) of all cells needed for the +scan path insertion. (see below for the exact syntax) +.br + +.SH OPTIONS +.TP 10 +\f4\-V\fP +Sets verbose mode on. +Each step is displayed on the standard output. +.TP 10 +\f4\-R\fP +All registers of the scan path are replaced by an equivalent scannable register cell +(called reg-mux). (With the default option a simple multiplexor is added just +before all registers of the scan path). +.TP 10 +\f4\-B\fP +Adds an output buffer before the output connector scan_out. +.TP 10 +\f4\-P file\fP +Specifies a parameter file (with extention .scapin) containing the properties of +all cells needed for the scan path insertion. +(see below for the exact syntax) + +.nf +# Example of .scapin file + +BEGIN_MUX + +MUX_MODEL mx2_x2 +MUX_SEL cmd +MUX_INPUT_SEL i1 +MUX_INPUT_NSEL i0 +MUX_VDD vdd +MUX_VSS vss +MUX_OUTPUT q + +END_MUX + + +BEGIN_REG + +REG_MODEL sff1_x4 +REG_CLK ck +REG_INPUT i +REG_VDD vdd +REG_VSS vss +REG_OUTPUT q +REG_MUX mx2_x2 +REG_REG_MUX sff2_x4 + +END_REG + + +BEGIN_REG_MUX + +REG_MUX_MODEL sff2_x4 +REG_MUX_SEL cmd +REG_MUX_INPUT_SEL i1 +REG_MUX_INPUT_NSEL i0 +REG_MUX_CLK ck +REG_MUX_VDD vdd +REG_MUX_VSS vss +REG_MUX_OUTPUT q +REG_MUX_MUX mx2_x2 +REG_MUX_REG sff1_x4 + +END_REG_MUX + + +BEGIN_BUF + +BUF_MODEL buf_x2 +BUF_INPUT i +BUF_VDD vdd +BUF_VSS vss +BUF_OUTPUT q + +END_BUF +.fi + + +.TP 10 +\f4\Path_name\fP +Specifies a parameter file (with extention .path) containing an ordered list of +all instances (registers) of the scan path. +It contains also the name of the 3 connectors scan_in, scan_out and scan_test. +(see below for the exact syntax) + +.nf +# Example of .path file + +BEGIN_PATH_REG + +cs_0 +cs_1 +cs_2 + +END_PATH_REG + +BEGIN_CONNECTOR + +SCAN_IN scin +SCAN_OUT scout +SCAN_TEST test + +END_CONNECTOR + +.fi +.ti 7 + +.SH SEE ALSO +.BR MBK_IN_LO (1). +.BR MBK_OUT_LO (1). +.BR MBK_WORK_LIB (1). + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/scapin/src/Makefile.am b/alliance/src/scapin/src/Makefile.am new file mode 100644 index 00000000..a6f57af4 --- /dev/null +++ b/alliance/src/scapin/src/Makefile.am @@ -0,0 +1,14 @@ +## Process this file with automake to produce Makefile.in + +bin_PROGRAMS = scapin + +CFLAGS = @CFLAGS@ -DSCAPIN_VERSION=\"@SCAPIN_VERSION@\" \ + -DALLIANCE_TOP=\"${ALLIANCE_TOP}\" \ + -DSCAPIN_DEFAULT_PARAM_NAME=\"etc/sxlib.scapin\" + +scapin_LDADD = @LIBS@ \ +-lMlu -lMcl -lMel -lMhl -lMvl -lMlo -lMut -lMal -lRcn -lMsl -lMgl -lAut + +scapin_SOURCES = \ +scan_insert.c scan_insert.h scan_main.c scan_main.h \ +scan_param.c scan_param.h scan_path.c scan_path.h diff --git a/alliance/src/scapin/src/scan_insert.c b/alliance/src/scapin/src/scan_insert.c new file mode 100644 index 00000000..c32cc900 --- /dev/null +++ b/alliance/src/scapin/src/scan_insert.c @@ -0,0 +1,893 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : SCAN | +| | +| File : scan_insert.c | +| | +| Author : | +| | +| Date : | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "mlu.h" + +# include +# include +# include + +# include "scan_param.h" +# include "scan_path.h" +# include "scan_insert.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static char Buffer[ 512 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| ScanRemoveSignal | +| | +\------------------------------------------------------------*/ + +static void ScanRemoveSignal( LoFigure, LoSig, FlagVerbose ) + + lofig_list *LoFigure; + losig_list *LoSig; + int FlagVerbose; +{ + ptype_list *PType; + chain_list *ScanChain; + chain_list *DelChain; + chain_list **PrevChain; + char *SigName; + locon_list *LoCon; + loins_list *LoIns; + locon_list *LoInsCon; + losig_list *LoInsSig; + int Delete; + int NumberOut; + + PType = getptype( LoSig->USER, (long)LOFIGCHAIN ); + ScanChain = (chain_list *)PType->DATA; + + if ( ScanChain == (chain_list *)0 ) + { +/* +** Zero connector on this net : should delete the signal +*/ + if ( FlagVerbose ) + { + if ( LoSig->NAMECHAIN != (chain_list *)0 ) SigName = (char *)LoSig->NAMECHAIN->DATA; + else SigName = "unamed"; + + fprintf( stdout, "\t > Delete signal %s (%ld)\n", SigName, LoSig->INDEX ); + } + + dellosig( LoFigure, LoSig->INDEX ); + } + else + if ( ScanChain->NEXT == (chain_list *)0 ) + { +/* +** Only one connector on this net +*/ + LoCon = (locon_list *)ScanChain->DATA; + + if ( LoCon->TYPE == INTERNAL ) + { +/* +** Internal connector : may be should delete the instance +*/ + LoIns = (loins_list *)LoCon->ROOT; + NumberOut = 0; + Delete = 1; + + for ( LoInsCon = LoIns->LOCON; + LoInsCon != (locon_list *)0; + LoInsCon = LoInsCon->NEXT ) + { + if ( ( LoInsCon->DIRECTION == OUT ) || + ( LoInsCon->DIRECTION == INOUT ) ) + { + NumberOut++; + + if ( ( LoInsCon->SIG != LoSig ) || + ( NumberOut > 1 ) ) + { + Delete = 0; break; + } + } + } + + if ( Delete ) + { + for ( LoInsCon = LoIns->LOCON; + LoInsCon != (locon_list *)0; + LoInsCon = LoInsCon->NEXT ) + { + LoInsSig = LoInsCon->SIG; + + PType = getptype( LoInsSig->USER, (long)LOFIGCHAIN ); + ScanChain = (chain_list *)PType->DATA; + PrevChain = (chain_list **)&PType->DATA; + + while ( ScanChain != (chain_list *)0 ) + { + if ( ScanChain->DATA == (void *)LoInsCon ) + { + DelChain = ScanChain; + *PrevChain = DelChain->NEXT; + ScanChain = ScanChain->NEXT; + + DelChain->NEXT = (chain_list *)0; + freechain( DelChain ); + } + else + { + PrevChain = &ScanChain->NEXT; + ScanChain = ScanChain->NEXT; + } + } + + if ( LoInsSig == LoSig ) continue; + + ScanRemoveSignal( LoFigure, LoInsSig, FlagVerbose ); + } + + if ( FlagVerbose ) + { + if ( LoSig->NAMECHAIN != (chain_list *)0 ) SigName = (char *)LoSig->NAMECHAIN->DATA; + else SigName = "unamed"; + + fprintf( stdout, "\t > Delete signal %s (%ld)\n", SigName, LoSig->INDEX ); + } + + dellosig( LoFigure, LoSig->INDEX ); + + if ( FlagVerbose ) + { + fprintf( stdout, "\t > Delete instance %s (%s)\n", + LoIns->INSNAME, LoIns->FIGNAME ); + } + + delloins( LoFigure, LoIns->INSNAME ); + } + } + } +} + +/*------------------------------------------------------------\ +| | +| ScanInsertScanPath | +| | +\------------------------------------------------------------*/ + +void ScanInsertScanPath( LoFigure, ScanParam, PathParam, + FlagVerbose, FlagDebug, FlagRegMux, FlagBuffer ) + + lofig_list *LoFigure; + scanparam *ScanParam; + pathparam *PathParam; + int FlagVerbose; + int FlagDebug; + int FlagRegMux; + int FlagBuffer; +{ + lofig_list *LoModel; + lofig_list *LoModel2; + lofig_list *LoModel3; + lofig_list *LoModel4; + loins_list *LoIns; + chain_list *ScanChain; + char *RegName; + char *InsName; + losig_list *LoSig; + losig_list *LoSigMuxOutput; + losig_list *LastLoSig; + losig_list *LoSigScanIn; + losig_list *LoSigScanTest; + losig_list *LoSigScanOut; + losig_list *LoSigScanBuf; + locon_list *LoCon; + locon_list *LoConScanIn; + locon_list *LoConScanOut; + locon_list *LoConScanTest; + locon_list *LoConVdd; + locon_list *LoConVss; + locon_list *LoInsCon; + locon_list *LoInsConClk; + locon_list *LoInsConSel; + locon_list *LoInsConInput; + locon_list *LoInsConOutput; + locon_list *LoInsConVdd; + locon_list *LoInsConVss; + locon_list *LoInsConInputSel; + locon_list *LoInsConInputNsel; + scanreg_list *ScanReg; + scanregmux_list *ScanRegMux; + scanmux_list *ScanMux; + scanmux_list *ScanMux1; + scanbuf_list *ScanBuf; + authtable *InsHashTable; + authtable *RegHashTable; + authtable *RegMuxHashTable; + authtable *MuxHashTable; + authelem *Element; + chain_list *SignalList; + long LoSigIndex; + long LoInsIndex; + int Number; + locon_list *LoInsConOutputMux; + losig_list *LoSigOutputMux; + +/* +** Compute and Initialize max signal index +*/ + LoInsIndex = 0; + LoSigIndex = 0; + + for ( LoSig = LoFigure->LOSIG; + LoSig != (losig_list *)0; + LoSig = LoSig->NEXT ) + { + if ( LoSig->INDEX > LoSigIndex ) LoSigIndex = LoSig->INDEX; + } + + LoSigIndex++; +/* +** Inserer eventuellement les connecteurs ScanIn/ScanOut/ScanTest en fonction de PathParam +*/ + LoConScanIn = (locon_list *)0; + LoConScanOut = (locon_list *)0; + LoConScanTest = (locon_list *)0; + LoConVdd = (locon_list *)0; + LoConVss = (locon_list *)0; + + for ( LoCon = LoFigure->LOCON; + LoCon != (locon_list*)0; + LoCon = LoCon->NEXT ) + { + if ( LoCon->NAME == PathParam->SCAN_IN ) LoConScanIn = LoCon; + else + if ( LoCon->NAME == PathParam->SCAN_OUT ) LoConScanOut = LoCon; + else + if ( LoCon->NAME == PathParam->SCAN_TEST ) LoConScanTest = LoCon; + else + if ( isvdd( LoCon->NAME ) ) LoConVdd = LoCon; + else + if ( isvss( LoCon->NAME ) ) LoConVss = LoCon; + } + + if ( LoConVdd == (locon_list *)0 ) + { + fprintf( stderr, "\t### Error unable to find connector VDD in figure %s\n", + LoFigure->NAME ); + autexit( 1 ); + } + + if ( LoConVss == (locon_list *)0 ) + { + fprintf( stderr, "\t### Error unable to find connector VSS in figure %s\n", + LoFigure->NAME ); + autexit( 1 ); + } + + if ( LoConScanIn == (locon_list *)0 ) + { + LoSigScanIn = addlosig( LoFigure, LoSigIndex++, (chain_list *)0, EXTERNAL ); + LoConScanIn = addlocon( LoFigure, PathParam->SCAN_IN, LoSigScanIn, IN ); + } + else + { + LoSigScanIn = LoConScanIn->SIG; + } + + if ( LoConScanTest == (locon_list *)0 ) + { + LoSigScanTest = addlosig( LoFigure, LoSigIndex++, (chain_list *)0, EXTERNAL ); + LoConScanTest = addlocon( LoFigure, PathParam->SCAN_TEST, LoSigScanTest, IN ); + } + else + { + LoSigScanTest = LoConScanTest->SIG; + } + +/* +** Create all usefull hash tables (Instance/Reg/Reg Mux etc) +*/ + RegHashTable = createauthtable( 100 ); + + for ( ScanReg = ScanParam->REG_LIST; + ScanReg != (scanreg_list *)0; + ScanReg = ScanReg->NEXT ) + { + addauthelem( RegHashTable, ScanReg->MODEL, (long)ScanReg ); + } + + MuxHashTable = createauthtable( 100 ); + + for ( ScanMux = ScanParam->MUX_LIST; + ScanMux != (scanmux_list *)0; + ScanMux = ScanMux->NEXT ) + { + addauthelem( MuxHashTable, ScanMux->MODEL, (long)ScanMux ); + } + + RegMuxHashTable = createauthtable( 100 ); + + for ( ScanRegMux = ScanParam->REG_MUX_LIST; + ScanRegMux != (scanregmux_list *)0; + ScanRegMux = ScanRegMux->NEXT ) + { + addauthelem( RegMuxHashTable, ScanRegMux->MODEL, (long)ScanRegMux ); + } + + InsHashTable = createauthtable( 1000 ); + + for ( LoIns = LoFigure->LOINS; + LoIns != (loins_list *)0; + LoIns = LoIns->NEXT ) + { + addauthelem( InsHashTable, LoIns->INSNAME, (long)LoIns ); + } + + if ( FlagDebug ) + { + fprintf( stdout, "Identify all REG-MUX\n" ); + } +/* +** Identifier dans les LOINS les differents registres-mux de PathParam +*/ + for ( ScanChain = PathParam->REG_LIST; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + RegName = (char *)ScanChain->DATA; +/* +** On recherche le registre RegName +*/ + Element = searchauthelem( InsHashTable, RegName ); + + if ( Element == (authelem *)0 ) + { + fprintf( stderr, "\t### Error unable to find instance %s\n", RegName ); + autexit( 1 ); + } + + LoIns = (loins_list *)Element->VALUE; +/* +** Check register model type : reg_mux or simple reg ? +*/ + Element = searchauthelem( RegMuxHashTable, LoIns->FIGNAME ); + + if ( Element != (authelem *)0 ) + { +/* +** Transformation du REG-MUX en MUX + REG +*/ + ScanRegMux = (scanregmux_list *)Element->VALUE; + + if ( FlagVerbose ) + { + fprintf( stdout, "\t > Replace register %s (%s) by %s + %s models\n", + RegName, LoIns->FIGNAME, ScanRegMux->MUX, ScanRegMux->REG ); + } + + Number = 0; + + for ( LoInsCon = LoIns->LOCON; + LoInsCon != (locon_list *)0; + LoInsCon = LoInsCon->NEXT ) + { + if ( LoInsCon->NAME == ScanRegMux->CLK ) LoInsConClk = LoInsCon; + else + if ( LoInsCon->NAME == ScanRegMux->INPUT_NSEL ) LoInsConInputNsel = LoInsCon; + else + if ( LoInsCon->NAME == ScanRegMux->INPUT_SEL ) LoInsConInputSel = LoInsCon; + else + if ( LoInsCon->NAME == ScanRegMux->SEL ) LoInsConSel = LoInsCon; + else + if ( LoInsCon->NAME == ScanRegMux->OUTPUT ) LoInsConOutput = LoInsCon; + else + if ( LoInsCon->NAME == ScanRegMux->VDD ) LoInsConVdd = LoInsCon; + else + if ( LoInsCon->NAME == ScanRegMux->VSS ) LoInsConVss = LoInsCon; + else + { + fprintf( stderr, "\t### Error unknown port name %s in instance %s\n", + LoInsCon->NAME, LoIns->INSNAME ); + autexit( 1 ); + } + + Number++; + } + + if ( Number != 7 ) + { + fprintf( stderr, "\t### Error missing %d port(s) in instance %s\n", + 7 - Number, LoIns->INSNAME ); + autexit( 1 ); + } +/* +** Creation du multiplexeur +*/ + Element = searchauthelem( MuxHashTable, ScanRegMux->MUX ); + ScanMux = (scanmux_list *)Element->VALUE; + + LoModel = getlofig( ScanMux->MODEL, 'P' ); + + LoSigMuxOutput = addlosig( LoFigure, LoSigIndex++, (chain_list *)0, INTERNAL ); + + SignalList = (chain_list *)0; + + for ( LoInsCon = LoModel->LOCON; + LoInsCon != (locon_list *)0; + LoInsCon = LoInsCon->NEXT ) + { + if ( LoInsCon->NAME == ScanMux->INPUT_NSEL ) LoSig = LoInsConInputNsel->SIG; + else + if ( LoInsCon->NAME == ScanMux->INPUT_SEL ) LoSig = LoInsConInputSel->SIG; + else + if ( LoInsCon->NAME == ScanMux->SEL ) LoSig = LoInsConSel->SIG; + else + if ( LoInsCon->NAME == ScanMux->VDD ) LoSig = LoInsConVdd->SIG; + else + if ( LoInsCon->NAME == ScanMux->VSS ) LoSig = LoInsConVss->SIG; + else + if ( LoInsCon->NAME == ScanMux->OUTPUT ) LoSig = LoSigMuxOutput; + else + { + fprintf( stderr, "\t### Error unknown port name %s in model %s\n", + LoInsCon->NAME, LoModel->NAME ); + autexit( 1 ); + } + + SignalList = addchain( SignalList, (void *)LoSig ); + } + + SignalList = reverse( SignalList ); + + sprintf( Buffer, "%s_scan_%ld", LoIns->INSNAME, LoInsIndex++ ); + addloins( LoFigure, Buffer, LoModel, SignalList ); +/* +** Creation du registre +*/ + Element = searchauthelem( RegHashTable, ScanRegMux->REG ); + ScanReg = (scanreg_list *)Element->VALUE; + + LoModel = getlofig( ScanReg->MODEL, 'P' ); + + SignalList = (chain_list *)0; + + for ( LoInsCon = LoModel->LOCON; + LoInsCon != (locon_list *)0; + LoInsCon = LoInsCon->NEXT ) + { + if ( LoInsCon->NAME == ScanReg->CLK ) LoSig = LoInsConClk->SIG; + else + if ( LoInsCon->NAME == ScanReg->INPUT ) LoSig = LoSigMuxOutput; + else + if ( LoInsCon->NAME == ScanReg->OUTPUT ) LoSig = LoInsConOutput->SIG; + else + if ( LoInsCon->NAME == ScanReg->VDD ) LoSig = LoInsConVdd->SIG; + else + if ( LoInsCon->NAME == ScanReg->VSS ) LoSig = LoInsConVss->SIG; + else + { + fprintf( stderr, "\t### Error unknown port name %s in model %s\n", + LoInsCon->NAME, LoModel->NAME ); + autexit( 1 ); + } + + SignalList = addchain( SignalList, (void *)LoSig ); + } + + SignalList = reverse( SignalList ); + InsName = LoIns->INSNAME; +/* +** Destruction du registre-mux +*/ + for ( LoInsCon = LoIns->LOCON; + LoInsCon != (locon_list *)0; + LoInsCon = LoInsCon->NEXT ) + { + LoInsCon->SIG = (losig_list *)0; + } + + delloins( LoFigure, InsName ); + LoIns = addloins( LoFigure, InsName, LoModel, SignalList ); + + addauthelem( InsHashTable, LoIns->INSNAME, (long)LoIns ); + } + } + +/* +** Identifier dans les LOINS les differents registres a partir de PathParam +** Creation du chemin de test ! +*/ + if ( FlagDebug ) + { + fprintf( stdout, "Scan Path generation\n" ); + } + + LastLoSig = LoConScanIn->SIG; + + for ( ScanChain = PathParam->REG_LIST; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + RegName = (char *)ScanChain->DATA; + + if ( FlagDebug ) + { + fprintf( stdout, "Search %s\n", RegName ); + } +/* +** On recherche le registre RegName +*/ + Element = searchauthelem( InsHashTable, RegName ); + + if ( Element == (authelem *)0 ) + { + fprintf( stderr, "\t### Error unable to find instance %s\n", RegName ); + autexit( 1 ); + } + + LoIns = (loins_list *)Element->VALUE; +/* +** Check register model type : reg_mux or simple reg ? +*/ + Element = searchauthelem( RegHashTable, LoIns->FIGNAME ); + + if ( Element == (authelem *)0 ) + { + fprintf( stderr, "\t### Error unknown register model %s in figure %s\n", + LoIns->FIGNAME, LoFigure->NAME ); + autexit( 1 ); + } + + ScanReg = (scanreg_list *)Element->VALUE; +/* +** Ajout d'un mux en entree du registre +*/ +/*______________________________________________________________________________*/ +/* cas ou on a un registre et on veut relier avec un mux */ +/*_________________________________________________________________________________*/ + if ( ! FlagRegMux ) + { + Element = searchauthelem( MuxHashTable, ScanReg->MUX ); + ScanMux = (scanmux_list *)Element->VALUE; + Number = 0; + + if ( FlagVerbose ) + { + fprintf( stdout, "\t Insert multiplexor (%s) in front of register %s (%s)\n", + ScanMux->MODEL, RegName, LoIns->FIGNAME ); + } + +/*-----------------------------------------------------------------------------*/ +/* on donne des noms pour chaque connecteur du registre */ +/*-----------------------------------------------------------------------------*/ + + for ( LoInsCon = LoIns->LOCON; + LoInsCon != (locon_list *)0; + LoInsCon = LoInsCon->NEXT ) + { + if ( LoInsCon->NAME == ScanReg->CLK ) LoInsConClk = LoInsCon; + else + if ( LoInsCon->NAME == ScanReg->INPUT ) LoInsConInput = LoInsCon; + else + if ( LoInsCon->NAME == ScanReg->OUTPUT ) LoInsConOutput = LoInsCon; + else + if ( LoInsCon->NAME == ScanReg->VDD ) LoInsConVdd = LoInsCon; + else + if ( LoInsCon->NAME == ScanReg->VSS ) LoInsConVss = LoInsCon; + else + { + fprintf( stderr, "\t### Error unknown port name %s in instance %s\n", + LoInsCon->NAME,LoIns->INSNAME); + autexit( 1 ); + } + + Number++; + } + + if ( Number != 5 ) + { + fprintf( stderr, "\t### Error missing %d port(s) in instance %s\n", + 5 - Number, LoIns->INSNAME ); + autexit( 1 ); + } + + LoModel = getlofig( ScanMux->MODEL, 'P' ); +/* +** Build the signal list +*/ + +/*------------------------------------------------------------------------------------------*/ +/* on relie tous les connecteurs du mux avec les signaux correspondant sauf */ +/* le connecteur de sortie */ + /*-----------------------------------------------------------------------------------------*/ +/* +** Creation du signal de sortie du mux : LoSigMuxOutput +*/ + LoSigMuxOutput = addlosig( LoFigure, LoSigIndex++, (chain_list *)0, INTERNAL ); + + SignalList = (chain_list *)0; + + for ( LoInsCon = LoModel->LOCON; + LoInsCon != (locon_list *)0; + LoInsCon = LoInsCon->NEXT ) + { + if ( LoInsCon->NAME == ScanMux->INPUT_NSEL ) LoSig = LoInsConInput->SIG; + else + if ( LoInsCon->NAME == ScanMux->INPUT_SEL ) LoSig = LastLoSig; + else + if ( LoInsCon->NAME == ScanMux->SEL ) LoSig = LoConScanTest->SIG; + else + if ( LoInsCon->NAME == ScanMux->VDD ) LoSig = LoInsConVdd->SIG; + else + if ( LoInsCon->NAME == ScanMux->VSS ) LoSig = LoInsConVss->SIG; + else + if ( LoInsCon->NAME == ScanMux->OUTPUT ) LoSig = LoSigMuxOutput; + else + { + fprintf( stderr, "\t### Error unknown port name %s in model %s\n", + LoInsCon->NAME, LoModel->NAME ); + autexit( 1 ); + } + + SignalList = addchain( SignalList, (void *)LoSig ); + } + + SignalList = reverse( SignalList ); + + sprintf( Buffer, "%s_scan_%ld", LoIns->INSNAME, LoInsIndex++ ); + addloins( LoFigure, Buffer, LoModel, SignalList ); +/* +** Connection : signal de sortie du mux -> connecteur d'entree du registre +*/ + LoInsConInput->SIG = LoSigMuxOutput; + + freechain( LoInsConInput->SIG->NAMECHAIN ); + LoInsConInput->SIG->NAMECHAIN = (chain_list *)0; + + LastLoSig = LoInsConOutput->SIG; + } + else + { +/* +** Substitution d'un registre par un reg-mux +*/ + Element = searchauthelem( RegMuxHashTable, ScanReg->REG_MUX ); + ScanRegMux = (scanregmux_list *)Element->VALUE; + + if ( FlagVerbose ) + { + fprintf( stdout, "\t > Replace register %s (%s) by a reg-mux (%s)\n", + RegName, LoIns->FIGNAME, ScanRegMux->MODEL ); + } + + Number = 0; + + for ( LoInsCon = LoIns->LOCON; + LoInsCon != (locon_list *)0; + LoInsCon = LoInsCon->NEXT ) + { + if ( LoInsCon->NAME == ScanReg->CLK ) LoInsConClk = LoInsCon; + else + if ( LoInsCon->NAME == ScanReg->INPUT ) LoInsConInput = LoInsCon; + else + if ( LoInsCon->NAME == ScanReg->OUTPUT ) LoInsConOutput = LoInsCon; + else + if ( LoInsCon->NAME == ScanReg->VDD ) LoInsConVdd = LoInsCon; + else + if ( LoInsCon->NAME == ScanReg->VSS ) LoInsConVss = LoInsCon; + else + { + fprintf( stderr, "\t### Error unknown port name %s in instance %s\n", + LoInsCon->NAME, LoIns->INSNAME ); + autexit( 1 ); + } + + Number++; + } + + if ( Number != 5 ) + { + fprintf( stderr, "\t### Error missing %d port(s) in instance %s\n", + 5 - Number, LoIns->INSNAME ); + autexit( 1 ); + } + + LoModel = getlofig( ScanRegMux->MODEL, 'P' ); +/* +** Build the signal list +*/ + SignalList = (chain_list *)0; + + for ( LoInsCon = LoModel->LOCON; + LoInsCon != (locon_list *)0; + LoInsCon = LoInsCon->NEXT ) + { + if ( LoInsCon->NAME == ScanRegMux->CLK ) LoSig = LoInsConClk->SIG; + else + if ( LoInsCon->NAME == ScanRegMux->INPUT_NSEL ) LoSig = LoInsConInput->SIG; + else + if ( LoInsCon->NAME == ScanRegMux->INPUT_SEL ) LoSig = LastLoSig; + else + if ( LoInsCon->NAME == ScanRegMux->SEL ) LoSig = LoConScanTest->SIG; + else + if ( LoInsCon->NAME == ScanRegMux->VDD ) LoSig = LoInsConVdd->SIG; + else + if ( LoInsCon->NAME == ScanRegMux->VSS ) LoSig = LoInsConVss->SIG; + else + if ( LoInsCon->NAME == ScanRegMux->OUTPUT ) LoSig = LoInsConOutput->SIG; + else + { + fprintf( stderr, "\t### Error unknown port name %s in model %s\n", + LoInsCon->NAME, LoModel->NAME ); + autexit( 1 ); + } + + SignalList = addchain( SignalList, (void *)LoSig ); + } + + SignalList = reverse( SignalList ); + + sprintf( Buffer, "%s_scan_%ld", LoIns->INSNAME, LoInsIndex++ ); + addloins( LoFigure, Buffer, LoModel, SignalList ); + + LastLoSig = LoInsConOutput->SIG; + + for ( LoInsCon = LoIns->LOCON; + LoInsCon != (locon_list *)0; + LoInsCon = LoInsCon->NEXT ) + { + LoInsCon->SIG = (losig_list *)0; + } + + delloins( LoFigure, LoIns->INSNAME ); + } + } + +/* +** ajout d'un buffer +*/ + if ( FlagBuffer ) + { + ScanBuf = ScanParam->BUF_LIST; + + if ( FlagVerbose ) + { + fprintf( stdout, "\t Insert a buffer (%s) before the port %s\n", + ScanBuf->MODEL, PathParam->SCAN_OUT ); + } + + LoModel = getlofig( ScanBuf->MODEL, 'P' ); + + LoSigScanBuf = addlosig( LoFigure, LoSigIndex++, (chain_list *)0, EXTERNAL ); + SignalList = (chain_list *)0; + + for ( LoInsCon = LoModel->LOCON; + LoInsCon != (locon_list *)0; + LoInsCon = LoInsCon->NEXT ) + { + if ( LoInsCon->NAME == ScanBuf->INPUT ) LoSig = LastLoSig ; + else + if ( LoInsCon->NAME ==ScanBuf->VDD ) LoSig =LoConVdd->SIG; + else + if ( LoInsCon->NAME == ScanBuf->VSS) LoSig = LoConVss->SIG; + else + if ( LoInsCon->NAME == ScanBuf->OUTPUT) LoSig = LoSigScanBuf ; + else + { + fprintf( stderr, "\t### Error unknown port name %s in model %s\n", + LoInsCon->NAME, LoModel->NAME ); + autexit( 1 ); + } + + SignalList = addchain( SignalList, (void *)LoSig ); + } + + SignalList = reverse( SignalList ); + + sprintf( Buffer, "buf_scan_%ld", LoInsIndex++ ); + addloins( LoFigure, Buffer, LoModel, SignalList ); + + LastLoSig = LoSigScanBuf; + } + + if ( LoConScanOut == (locon_list *)0 ) + { + LastLoSig->TYPE = EXTERNAL; + LoConScanOut = addlocon( LoFigure, PathParam->SCAN_OUT, LastLoSig, + FlagBuffer ? OUT : INOUT ); + } + else + { + LoSigScanOut = LoConScanOut->SIG; + LoSigScanOut->TYPE = INTERNAL; + freechain( LoSigScanOut->NAMECHAIN ); + LoSigScanOut->NAMECHAIN = (chain_list *)0; + + LoConScanOut->SIG = LastLoSig; + LastLoSig->TYPE = EXTERNAL; + + LoConScanOut->DIRECTION = FlagBuffer ? OUT : INOUT; + + lofigchain( LoFigure ); + + if ( FlagVerbose ) + { + fprintf( stdout, "\t--> Port %s already exists, should clean the netlist\n", + PathParam->SCAN_OUT ); + } + + ScanRemoveSignal( LoFigure, LoSigScanOut, FlagVerbose ); + } + + destroyauthtable( InsHashTable ); + destroyauthtable( RegHashTable ); + destroyauthtable( MuxHashTable ); + destroyauthtable( RegMuxHashTable ); + + if ( FlagDebug ) + { + fprintf( stdout, "<-- ScanInsertScanPath\n" ); + } +} diff --git a/alliance/src/scapin/src/scan_insert.h b/alliance/src/scapin/src/scan_insert.h new file mode 100644 index 00000000..13f77e6d --- /dev/null +++ b/alliance/src/scapin/src/scan_insert.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : SCAN | +| | +| File : scan_insert.h | +| | +| Author : | +| | +| Date : | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef SCAN_INSERT_H +# define SCAN_INSERT_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void ScanInsertScanPath(); + +# endif diff --git a/alliance/src/scapin/src/scan_main.c b/alliance/src/scapin/src/scan_main.c new file mode 100644 index 00000000..2291dcfc --- /dev/null +++ b/alliance/src/scapin/src/scan_main.c @@ -0,0 +1,230 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : SCAN | +| | +| File : scan_main.c | +| | +| Author : | +| | +| Date : | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "mlu.h" + +# include +# include +# include + +# include "scan_main.h" +# include "scan_param.h" +# include "scan_path.h" +# include "scan_insert.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Scan Usage | +| | +\------------------------------------------------------------*/ + +void ScanUsage() +{ + fprintf( stdout, "\t\tscapin [Options] Input_name Path_name Output_name\n\n" ); + + fprintf( stdout, "\t\tOptions : -V Sets Verbose mode on\n" ); + fprintf( stdout, "\t\t -R Sets multiplexor-register mode on\n" ); + fprintf( stdout, "\t\t -B Sets output buffer mode on\n" ); + fprintf( stdout, "\t\t -P file Parameter file\n" ); + fprintf( stdout, "\n" ); + + exit( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Main | +| | +\------------------------------------------------------------*/ + +int main( argc, argv ) + + int argc; + char *argv[]; +{ + lofig_list *LoFigure; + scanparam *ScanParam; + pathparam *PathParam; + char *InputFileName; + char *OutputFileName; + char *ParamFileName; + char *PathFileName; + char *String; + char Buffer[ 1024 ]; + int Number; + int Index; + char Option; + + int FlagVerbose = 0; + int FlagDebug = 0; + int FlagRegMux = 0; + int FlagBuffer = 0; + + alliancebanner_with_contrib( + "Scapin", SCAPIN_VERSION, "SCAn Path INsertion", "2000", ALLIANCE_VERSION, + "Ludovic Jacomme", "Ilhem Kazi Tani" ); + + mbkenv(); + autenv(); + + if ( argc < 3 ) ScanUsage(); + + OutputFileName = (char *)0; + InputFileName = (char *)0; + ParamFileName = (char *)0; + PathFileName = (char *)0; + + for ( Number = 1; Number < argc; Number++ ) + { + if ( argv[ Number ][ 0 ] == '-' ) + { + for ( Index = 1; argv[ Number ][ Index ] != '\0'; Index++ ) + { + Option = argv[ Number ][ Index ]; + + if ( Option == 'P' ) + { + Number = Number + 1; + + if ( Number < argc ) + { + ParamFileName = argv[ Number ]; + + break; + } + else ScanUsage(); + } + + switch ( Option ) + { + case 'V' : FlagVerbose = 1; + break; + case 'D' : FlagDebug = 1; + break; + case 'R' : FlagRegMux = 1; + break; + case 'B' : FlagBuffer = 1; + break; + default : ScanUsage(); + } + } + } + else + if ( InputFileName == (char *)0 ) InputFileName = argv[ Number ]; + else + if ( PathFileName == (char *)0 ) PathFileName = argv[ Number ]; + else + if ( OutputFileName == (char *)0 ) OutputFileName = argv[ Number ]; + else + ScanUsage(); + } + + if ( ( InputFileName == (char *)0 ) || + ( PathFileName == (char *)0 ) || + ( OutputFileName == (char *)0 ) ) ScanUsage(); + + if ( ParamFileName == (char *)0 ) + { + ParamFileName = mbkgetenv( "SCAPIN_PARAM_NAME" ); + + if ( ParamFileName == (char *)NULL ) + { + String = mbkgetenv( "ALLIANCE_TOP" ); + if ( String == (char *)NULL ) String = ALLIANCE_TOP; + + sprintf( Buffer, "%s/%s", String, SCAPIN_DEFAULT_PARAM_NAME ); + ParamFileName = mbkstrdup( Buffer ); + } + } + + fprintf( stdout, "\t--> Parse parameter file %s\n", ParamFileName ); + + ScanParam = ScanParseParamFile( ParamFileName, FlagDebug ); + + fprintf( stdout, "\t--> Parse path file %s\n", PathFileName ); + + PathParam = ScanParsePathParamFile( PathFileName, FlagDebug ); + + fprintf( stdout, "\t--> Compile Structural file %s\n", InputFileName ); + + LoFigure = getlofig( InputFileName, 'A' ); + + if ( FlagVerbose ) + { + fprintf( stdout, "\t--> Insert Scan Path\n" ); + } + + ScanInsertScanPath( LoFigure, ScanParam, PathParam, FlagVerbose, + FlagDebug, FlagRegMux, FlagBuffer ); + + LoFigure->NAME = namealloc( OutputFileName ); + + fprintf( stdout, "\t--> Save Structural file %s\n\n", OutputFileName ); + + savelofig( LoFigure ); + + return( 0 ); +} diff --git a/alliance/src/scapin/src/scan_main.h b/alliance/src/scapin/src/scan_main.h new file mode 100644 index 00000000..48dc735c --- /dev/null +++ b/alliance/src/scapin/src/scan_main.h @@ -0,0 +1,68 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : SCAN | +| | +| File : scan_main.h | +| | +| Author : | +| | +| Date : | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef SCAN_MAIN_H +# define SCAN_MAIN_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/scapin/src/scan_param.c b/alliance/src/scapin/src/scan_param.c new file mode 100644 index 00000000..940386e2 --- /dev/null +++ b/alliance/src/scapin/src/scan_param.c @@ -0,0 +1,877 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : SCAN | +| | +| File : scan_param.c | +| | +| Author : | +| | +| Date : | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "mlu.h" + +# include +# include +# include + +# include "scan_param.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| ScanParseCheckModel | +| | +\------------------------------------------------------------*/ + +static int ScanParseCheckModel( ModelName ) + + char *ModelName; +{ + FILE *File; + + File = mbkfopen( ModelName, IN_LO, "r" ); + + if ( File == (FILE *)0 ) + { + File = mbkfopen( ModelName, "vbe", "r" ); + } + + if ( File != (FILE *)0 ) + { + fclose( File ); + + return( 1 ); + } + + return( 0 ); +} + +/*------------------------------------------------------------\ +| | +| ScanParseGetWord | +| | +\------------------------------------------------------------*/ + +static char *ScanParseGetWord( Buffer ) + + char *Buffer; +{ + char *String; + + if ( ( String = (char *)strtok( Buffer, " =\t\n" ) ) != (char *)0 ) + { + String = namealloc( String ); + } + + return( String ); +} + +/*------------------------------------------------------------\ +| | +| ScanParseViewParam | +| | +\------------------------------------------------------------*/ + +static void ScanParseViewParam( Param ) + + scanparam *Param; +{ + scanmux_list *ScanMux; + scanreg_list *ScanReg; + scanregmux_list *ScanRegmux; + scanbuf_list *ScanBuffer; + + + for ( ScanMux = Param->MUX_LIST; + ScanMux != (scanmux_list *)0; + ScanMux = ScanMux->NEXT ) + { + fprintf( stdout, "BEGIN_MUX\n" ); + + fprintf( stdout, "MUX_MODEL : %s\n", ScanMux->MODEL ); + fprintf( stdout, "MUX_SEL : %s\n", ScanMux->SEL ); + fprintf( stdout, "MUX_INPUT_SEL : %s\n", ScanMux->INPUT_SEL ); + fprintf( stdout, "MUX_INPUT_NSEL : %s\n", ScanMux->INPUT_NSEL ); + fprintf( stdout, "MUX_VDD : %s\n", ScanMux->VDD ); + fprintf( stdout, "MUX_VSS : %s\n", ScanMux->VSS ); + fprintf( stdout, "MUX_OUTPUT : %s\n", ScanMux->OUTPUT ); + + fprintf( stdout, "END_MUX\n" ); + } + + for ( ScanReg = Param->REG_LIST; + ScanReg != (scanreg_list *)0; + ScanReg = ScanReg->NEXT ) + { + fprintf( stdout, "BEGIN_REG\n" ); + + fprintf( stdout, "REG_MODEL : %s\n", ScanReg->MODEL ); + fprintf( stdout, "REG_CLK : %s\n", ScanReg->CLK ); + fprintf( stdout, "REG_INPUT : %s\n", ScanReg->INPUT ); + fprintf( stdout, "REG_VDD : %s\n", ScanReg->VDD ); + fprintf( stdout, "REG_VSS : %s\n", ScanReg->VSS ); + fprintf( stdout, "REG_OUTPUT : %s\n", ScanReg->OUTPUT ); + fprintf( stdout, "REG_MUX : %s\n", ScanReg->MUX ); + fprintf( stdout, "REG_REG_MUX : %s\n", ScanReg->REG_MUX ); + + fprintf( stdout, "END_REG\n" ); + + } + + for ( ScanRegmux = Param->REG_MUX_LIST; + ScanRegmux != (scanregmux_list *)0; + ScanRegmux = ScanRegmux->NEXT ) + { + fprintf( stdout, "BEGIN_REG_MUX\n" ); + + fprintf( stdout, "REG_MUX_MODEL : %s\n", ScanRegmux->MODEL ); + fprintf( stdout, "REG_MUX_SEL : %s\n", ScanRegmux->SEL ); + fprintf( stdout, "REG_MUX_INPUT_SEL : %s\n", ScanRegmux->INPUT_SEL ); + fprintf( stdout, "REG_MUX_INPUT_NSEL : %s\n", ScanRegmux->INPUT_NSEL ); + fprintf( stdout, "REG_MUX_CLK : %s\n", ScanRegmux->CLK ); + fprintf( stdout, "REG_MUX_VDD : %s\n", ScanRegmux->VSS ); + fprintf( stdout, "REG_MUX_VSS : %s\n", ScanRegmux->VDD ); + fprintf( stdout, "REG_MUX_OUTPUT : %s\n", ScanRegmux->OUTPUT ); + fprintf( stdout, "REG_MUX_MUX : %s\n", ScanRegmux->MUX ); + fprintf( stdout, "REG_MUX_REG : %s\n", ScanRegmux->REG ); + + fprintf( stdout, "END_REG_MUX\n" ); + } + + for ( ScanBuffer = Param->BUF_LIST; + ScanBuffer != (scanbuf_list *)0; + ScanBuffer = ScanBuffer->NEXT ) + { + fprintf( stdout, "BEGIN_BUF\n" ); + + fprintf( stdout, "REG_BUF_MODEL : %s\n", ScanBuffer->MODEL ); + fprintf( stdout, "REG_BUF_INPUT : %s\n", ScanBuffer->INPUT ); + fprintf( stdout, "REG_BUF_VDD : %s\n", ScanBuffer->VSS ); + fprintf( stdout, "REG_BUF_VSS : %s\n", ScanBuffer->VDD ); + fprintf( stdout, "REG_BUF_OUTPUT : %s\n", ScanBuffer->OUTPUT ); + + fprintf( stdout, "END_BUF\n" ); + } +} + +/*------------------------------------------------------------\ +| | +| ScanParseVerify | +| | +\------------------------------------------------------------*/ + +static void ScanParseVerifyParam( ScanParam ) + + scanparam *ScanParam; +{ + scanmux_list *ScanMux; + scanreg_list *ScanReg; + scanregmux_list *ScanRegMux; + scanbuf_list *ScanBuf; + char *Model; + int Error; + authtable *HashMux; + authtable *HashReg; + authtable *HashRegMux; + authelem *Element; + + HashMux = createauthtable( 20 ); + HashReg = createauthtable( 20 ); + HashRegMux = createauthtable( 20 ); + + Error = 0; + +/* +** Hash All definitions +*/ + for ( ScanMux = ScanParam->MUX_LIST; + ScanMux != (scanmux_list *)0; + ScanMux = ScanMux->NEXT ) + { + if ( ScanMux->MODEL != (char *)0 ) addauthelem( HashMux, ScanMux->MODEL, 0 ); + } + + for ( ScanReg = ScanParam->REG_LIST; + ScanReg != (scanreg_list *)0; + ScanReg = ScanReg->NEXT ) + { + if ( ScanReg->MODEL != (char *)0 ) addauthelem( HashReg, ScanReg->MODEL, 0 ); + } + + for ( ScanRegMux = ScanParam->REG_MUX_LIST; + ScanRegMux != (scanregmux_list *)0; + ScanRegMux = ScanRegMux->NEXT ) + { + if ( ScanRegMux->MODEL != (char *)0 ) addauthelem( HashRegMux, ScanRegMux->MODEL, 0 ); + } + +/* +** Verify the correctness of those definitions +*/ + + for ( ScanMux = ScanParam->MUX_LIST; + ScanMux != (scanmux_list *)0; + ScanMux = ScanMux ->NEXT ) + { + Model = ScanMux->MODEL; + + if ( ScanMux->MODEL == NULL ) + { + fprintf( stdout, "\t### Error MODEL field empty in a MUX definition\n" ); + Error++; + Model = ""; + } + else + if ( ! ScanParseCheckModel( Model ) ) + { + fprintf( stdout, "\t### Error unable to find MUX model %s !\n", Model ); + } + + if ( ScanMux->SEL == NULL ) + { + fprintf( stdout, "\t### Error SEL field empty for MUX %s\n", Model ); + Error++; + } + + if ( ScanMux->INPUT_SEL == NULL ) + { + fprintf( stdout, "\t### Error INPUT_SEL field empty for MUX %s\n", Model ); + Error++; + } + + if ( ScanMux->INPUT_NSEL == NULL ) + { + fprintf( stdout, "\t### Error INPUT_NSEL field empty for MUX %s\n", Model ); + Error++; + } + + if ( ScanMux->OUTPUT == NULL ) + { + fprintf( stdout, "\t### Error OUTPUT filed empty for MUX %s\n", Model ); + Error++; + } + + if ( ScanMux->VDD == NULL ) + { + fprintf( stdout, "\t### Error VDD field empty for MUX %s\n", Model ); + Error++; + } + + if ( ScanMux->VSS == NULL ) + { + fprintf( stdout, "\t### Error VSS field empty for MUX %s\n", Model ); + Error++; + } + } + + for ( ScanReg = ScanParam->REG_LIST; + ScanReg != (scanreg_list *)0; + ScanReg = ScanReg ->NEXT ) + { + Model = ScanReg->MODEL; + + if ( ScanReg->MODEL == NULL ) + { + fprintf( stdout, "\t### Error MODEL field empty in a REG definition\n" ); + Error++; + Model = ""; + } + else + if ( ! ScanParseCheckModel( Model ) ) + { + fprintf( stdout, "\t### Error unable to find REG model %s !\n", Model ); + } + + if ( ScanReg->CLK == NULL ) + { + fprintf( stdout, "\t### Error CLK field empty for REG %s\n", Model ); + Error++; + } + + if ( ScanReg->INPUT == NULL ) + { + fprintf( stdout, "\t### Error INPUT field empty for REG %s\n", Model ); + Error++; + } + + if ( ScanReg->OUTPUT == NULL ) + { + fprintf( stdout, "\t### Error OUTPUT filed empty for REG %s\n", Model ); + Error++; + } + + if ( ScanReg->VDD == NULL ) + { + fprintf( stdout, "\t### Error VDD field empty for REG %s\n", Model ); + Error++; + } + + if ( ScanReg->VSS == NULL ) + { + fprintf( stdout, "\t### Error VSS field empty for REG %s\n", Model ); + Error++; + } + + if ( ScanReg->MUX == NULL ) + { + fprintf( stdout, "\t### Error MUX filed empty for REG %s\n", Model ); + Error++; + } + else + { + Element = searchauthelem( HashMux, ScanReg->MUX ); + if ( Element == (authelem *)0 ) + { + fprintf( stdout, "\t### Error unknown MUX model %s for REG %s\n", + ScanReg->MUX, Model ); + Error++; + } + } + + if ( ScanReg->REG_MUX == NULL ) + { + fprintf( stdout, "\t### Error REG_MUX filed empty for REG %s\n", Model ); + Error++; + } + else + { + Element = searchauthelem( HashRegMux, ScanReg->REG_MUX ); + if ( Element == (authelem *)0 ) + { + fprintf( stdout, "\t### Error unknown REG_MUX model %s for REG %s\n", + ScanReg->REG_MUX, Model ); + Error++; + } + } + } + + for ( ScanRegMux = ScanParam->REG_MUX_LIST; + ScanRegMux != (scanregmux_list *)0; + ScanRegMux = ScanRegMux->NEXT ) + { + Model = ScanRegMux->MODEL; + + if ( ScanRegMux->MODEL == NULL ) + { + fprintf( stdout, "\t### Error MODEL field empty in a REG_MUX definition\n" ); + Error++; + Model = ""; + } + else + if ( ! ScanParseCheckModel( Model ) ) + { + fprintf( stdout, "\t### Error unable to find REG_MUX model %s !\n", Model ); + } + + if ( ScanRegMux->CLK == NULL ) + { + fprintf( stdout, "\t### Error CLK field empty for REG_MUX %s\n", Model ); + Error++; + } + + if ( ScanRegMux->SEL == NULL ) + { + fprintf( stdout, "\t### Error SEL field empty for REG_MUX %s\n", Model ); + Error++; + } + + if ( ScanRegMux->INPUT_SEL == NULL ) + { + fprintf( stdout, "\t### Error INPUT_SEL field empty for REG_MUX %s\n", Model ); + Error++; + } + + if ( ScanRegMux->INPUT_NSEL == NULL ) + { + fprintf( stdout, "\t### Error INPUT_NSEL field empty for REG_MUX %s\n", Model ); + Error++; + } + + if ( ScanRegMux->OUTPUT == NULL ) + { + fprintf( stdout, "\t### Error OUTPUT filed empty for REG_MUX %s\n", Model ); + Error++; + } + + if ( ScanRegMux->VDD == NULL ) + { + fprintf( stdout, "\t### Error VDD field empty for REG_MUX %s\n", Model ); + Error++; + } + + if ( ScanRegMux->VSS == NULL ) + { + fprintf( stdout, "\t### Error VSS field empty for REG_MUX %s\n", Model ); + Error++; + } + + if ( ScanRegMux->MUX == NULL ) + { + fprintf( stdout, "\t### Error MUX filed empty for REG_MUX %s\n", Model ); + Error++; + } + else + { + Element = searchauthelem( HashMux, ScanRegMux->MUX ); + if ( Element == (authelem *)0 ) + { + fprintf( stdout, "\t### Error unknown MUX model %s for REG_MUX %s\n", + ScanRegMux->MUX, Model ); + Error++; + } + } + + if ( ScanRegMux->REG == NULL ) + { + fprintf( stdout, "\t### Error REG filed empty for REG_MUX %s\n", Model ); + Error++; + } + else + { + Element = searchauthelem( HashReg, ScanRegMux->REG ); + if ( Element == (authelem *)0 ) + { + fprintf( stdout, "\t### Error unknown REG model %s for REG_MUX %s\n", + ScanRegMux->REG, Model ); + Error++; + } + } + } + + if ( ScanParam->BUF_LIST == (scanbuf_list *)0 ) + { + fprintf( stdout, "\t### Error missing buffer declaration !\n" ); + Error++; + } + + for ( ScanBuf = ScanParam->BUF_LIST; + ScanBuf != (scanbuf_list *)0; + ScanBuf = ScanBuf ->NEXT ) + { + Model = ScanBuf->MODEL; + + if ( ScanBuf->MODEL == NULL ) + { + fprintf( stdout, "\t### Error MODEL field empty in a BUF definition\n" ); + Error++; + Model = ""; + } + else + if ( ! ScanParseCheckModel( Model ) ) + { + fprintf( stdout, "\t### Error unable to find BUF model %s !\n", Model ); + } + + if ( ScanBuf->INPUT == NULL ) + { + fprintf( stdout, "\t### Error INPUT field empty for BUF %s\n", Model ); + Error++; + } + + if ( ScanBuf->OUTPUT == NULL ) + { + fprintf( stdout, "\t### Error OUTPUT filed empty for BUF %s\n", Model ); + Error++; + } + + if ( ScanBuf->VDD == NULL ) + { + fprintf( stdout, "\t### Error VDD field empty for BUF %s\n", Model ); + Error++; + } + + if ( ScanBuf->VSS == NULL ) + { + fprintf( stdout, "\t### Error VSS field empty for BUF %s\n", Model ); + Error++; + } + } + + destroyauthtable( HashMux ); + destroyauthtable( HashReg ); + destroyauthtable( HashRegMux ); + + if ( Error ) + { + fprintf( stdout, "\t### Found %d error(s), exit !\n", Error ); + autexit(1); + } +} + +/*------------------------------------------------------------\ +| | +| ScanParseParamFile | +| | +\------------------------------------------------------------*/ + +scanparam *ScanParseParamFile( FileName, FlagDebug ) + + char *FileName; + int FlagDebug; +{ + scanparam *ScanParam; + scanmux_list *ScanMux; + scanreg_list *ScanReg; + scanregmux_list *ScanRegmux; + scanbuf_list *ScanBuf; + char *FirstWord; + char *SecondWord; + int CurrentDef; + long LineNumber; + FILE *ParamFile; + char ParamBuffer[ 512 ]; + + FileName = autbasename( FileName, "scapin" ); + sprintf( ParamBuffer, "%s.scapin", FileName ); + + ParamFile = fopen( ParamBuffer, "r" ); + + if ( ParamFile == (FILE *)0 ) + { + fprintf( stderr, "\t### Unable to parse parameter file %s.scapin\n", FileName ); + autexit( 1 ); + } + + ScanParam = (scanparam *)autallocblock( sizeof( scanparam ) ); + ScanMux = (scanmux_list *)0; + ScanReg = (scanreg_list *)0; + ScanRegmux = (scanregmux_list *)0; + ScanBuf = (scanbuf_list *)0; + LineNumber = 0; + + CurrentDef = SCAN_PARAM_NONE; + + while ( fgets( ParamBuffer, 512, ParamFile ) != (char *)0 ) + { + LineNumber++; + + if ( ParamBuffer[ 0 ] == '#' ) continue; + + FirstWord = ScanParseGetWord( ParamBuffer ); + + if ( FirstWord == (char *)0 ) continue; + + if ( ! strcmp( FirstWord, "end_mux" ) ) CurrentDef = SCAN_PARAM_NONE; + else + if ( ! strcmp( FirstWord, "end_reg" ) ) CurrentDef = SCAN_PARAM_NONE; + else + if ( ! strcmp( FirstWord, "end_reg_mux" ) ) CurrentDef = SCAN_PARAM_NONE; + else + if ( ! strcmp( FirstWord, "end_buf" ) ) CurrentDef = SCAN_PARAM_BUF; + else + + if ( CurrentDef != SCAN_PARAM_NONE ) + { + SecondWord = ScanParseGetWord( (char *)0 ); + + if ( SecondWord == (char *)0 ) + { + fprintf( stderr, "Syntax error line %ld in parameter file %s.scan\n", + LineNumber, FileName ); + autexit( 1 ); + } + + switch ( CurrentDef ) + { + case SCAN_PARAM_MUX : + + if ( ! strcmp( FirstWord, "mux_model" ) ) + { + ScanMux->MODEL = SecondWord; + } + else + if ( ! strcmp( FirstWord, "mux_sel" ) ) + { + ScanMux->SEL = SecondWord; + } + else + if ( ! strcmp( FirstWord, "mux_input_sel" ) ) + { + ScanMux->INPUT_SEL = SecondWord; + } + else + if ( ! strcmp( FirstWord, "mux_input_nsel" ) ) + { + ScanMux->INPUT_NSEL = SecondWord; + } + else + if ( ! strcmp( FirstWord, "mux_vdd" ) ) + { + ScanMux->VDD = SecondWord; + } + else + if ( ! strcmp( FirstWord, "mux_vss" ) ) + { + ScanMux->VSS = SecondWord; + } + else + if ( ! strcmp( FirstWord, "mux_output" ) ) + { + ScanMux->OUTPUT = SecondWord; + } + else + { + fprintf( stderr, "Syntax error line %ld in parameter file %s.scan\n", + LineNumber, FileName ); + autexit( 1 ); + } + + + break; + + case SCAN_PARAM_REG : + + if ( ! strcmp( FirstWord, "reg_model" ) ) + { + ScanReg->MODEL= SecondWord; + } + else + if ( ! strcmp( FirstWord, "reg_clk" ) ) + { + ScanReg->CLK= SecondWord; + } + else + if ( ! strcmp( FirstWord, "reg_input" ) ) + { + ScanReg->INPUT= SecondWord; + } + else + if ( ! strcmp( FirstWord, "reg_vdd" ) ) + { + ScanReg->VDD= SecondWord; + } + else + if ( ! strcmp( FirstWord, "reg_vss" ) ) + { + ScanReg->VSS= SecondWord; + } + else + if ( ! strcmp( FirstWord, "reg_output" ) ) + { + ScanReg->OUTPUT= SecondWord; + } + else + if ( ! strcmp( FirstWord, "reg_mux" ) ) + { + ScanReg->MUX= SecondWord; + } + else + if ( ! strcmp( FirstWord, "reg_reg_mux" ) ) + { + ScanReg->REG_MUX= SecondWord; + } + else + { + fprintf( stderr, "Syntax error line %ld in parameter file %s.scan\n", + LineNumber, FileName ); + autexit( 1 ); + } + + break; + + case SCAN_PARAM_BUF : + + if ( ! strcmp( FirstWord, "buf_model" ) ) + { + ScanBuf ->MODEL= SecondWord; + } + else + if ( ! strcmp( FirstWord, "buf_input" ) ) + { + ScanBuf->INPUT= SecondWord; + } + else + if ( ! strcmp( FirstWord, "buf_output" ) ) + { + ScanBuf->OUTPUT = SecondWord; + } + else + if ( ! strcmp( FirstWord, "buf_vdd" ) ) + { + ScanBuf->VDD= SecondWord; + } + else + if ( ! strcmp( FirstWord, "buf_vss" ) ) + { + ScanBuf->VSS= SecondWord; + } + else + { + fprintf( stderr, "Syntax error line %ld in parameter file %s.scan\n", + LineNumber, FileName ); + autexit( 1 ); + } + + + break; + + case SCAN_PARAM_REG_MUX : + + if ( ! strcmp( FirstWord, "reg_mux_model" ) ) + { + ScanRegmux->MODEL= SecondWord; + } + else + if ( ! strcmp( FirstWord, "reg_mux_sel" ) ) + { + ScanRegmux->SEL= SecondWord; + } + else + if ( ! strcmp( FirstWord, "reg_mux_input_sel" ) ) + { + ScanRegmux->INPUT_SEL= SecondWord; + } + else + if ( ! strcmp( FirstWord, "reg_mux_input_nsel" ) ) + { + ScanRegmux->INPUT_NSEL= SecondWord; + } + else + if ( ! strcmp( FirstWord, "reg_mux_clk" ) ) + { + ScanRegmux->CLK= SecondWord; + } + else + if ( ! strcmp( FirstWord, "reg_mux_output" ) ) + { + ScanRegmux->OUTPUT = SecondWord; + } + else + if ( ! strcmp( FirstWord, "reg_mux_vdd" ) ) + { + ScanRegmux->VDD= SecondWord; + } + else + if ( ! strcmp( FirstWord, "reg_mux_vss" ) ) + { + ScanRegmux->VSS= SecondWord; + } + else + if ( ! strcmp( FirstWord, "reg_mux_mux" ) ) + { + ScanRegmux->MUX = SecondWord; + } + else + if ( ! strcmp( FirstWord, "reg_mux_reg" ) ) + { + ScanRegmux->REG = SecondWord; + } + else + { + fprintf( stderr, "Syntax error line %ld in parameter file %s.scan\n", + LineNumber, FileName ); + autexit( 1 ); + } + + break; + } + } + else + if ( ! strcmp( FirstWord, "begin_mux" ) ) + { + ScanMux = (scanmux_list *)autallocblock( sizeof( scanmux_list ) ); + + ScanMux->NEXT = ScanParam->MUX_LIST; + ScanParam->MUX_LIST = ScanMux; + + CurrentDef = SCAN_PARAM_MUX; + } + else + if ( ! strcmp( FirstWord, "begin_reg" ) ) + { + ScanReg = (scanreg_list *)autallocblock( sizeof( scanreg_list ) ); + + ScanReg->NEXT = ScanParam->REG_LIST; + ScanParam->REG_LIST = ScanReg; + + CurrentDef = SCAN_PARAM_REG; + } + else + if ( ! strcmp( FirstWord, "begin_reg_mux" ) ) + { + ScanRegmux = (scanregmux_list *)autallocblock( sizeof( scanregmux_list ) ); + + ScanRegmux->NEXT = ScanParam->REG_MUX_LIST; + ScanParam->REG_MUX_LIST = ScanRegmux; + + CurrentDef = SCAN_PARAM_REG_MUX; + } + else + if( ! strcmp( FirstWord, "begin_buf" ) ) + { + ScanBuf = (scanbuf_list *)autallocblock( sizeof(scanbuf_list) ); + + ScanBuf->NEXT = ScanParam->BUF_LIST; + ScanParam->BUF_LIST = ScanBuf; + + CurrentDef = SCAN_PARAM_BUF; + } + } + + fclose( ParamFile ); + + if ( FlagDebug ) + { + ScanParseViewParam( ScanParam ); + } + + ScanParseVerifyParam( ScanParam ); + + return( ScanParam ); +} + diff --git a/alliance/src/scapin/src/scan_param.h b/alliance/src/scapin/src/scan_param.h new file mode 100644 index 00000000..6840adf1 --- /dev/null +++ b/alliance/src/scapin/src/scan_param.h @@ -0,0 +1,141 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : SCAN | +| | +| File : scan_param.h | +| | +| Author : | +| | +| Date : | +| | +\------------------------------------------------------------*/ + +# ifndef SCAN_PARAM_H +# define SCAN_PARAM_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define SCAN_PARAM_NONE 0 +# define SCAN_PARAM_MUX 1 +# define SCAN_PARAM_REG 2 +# define SCAN_PARAM_REG_MUX 3 +# define SCAN_PARAM_BUF 4 + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct scanmux_list + { + struct scanmux_list *NEXT; + char *MODEL; + char *SEL; + char *INPUT_SEL; + char *INPUT_NSEL; + char *OUTPUT; + char *VDD; + char *VSS; + + } scanmux_list; + + typedef struct scanreg_list + { + struct scanreg_list *NEXT; + char *MODEL; + char *CLK; + char *INPUT; + char *OUTPUT; + char *VDD; + char *VSS; + char *MUX; + char *REG_MUX; + + } scanreg_list; + + typedef struct scanregmux_list + { + struct scanregmux_list *NEXT; + char *MODEL; + char *CLK; + char *SEL; + char *INPUT_SEL; + char *INPUT_NSEL; + char *OUTPUT; + char *VDD; + char *VSS; + char *MUX; + char *REG; + + } scanregmux_list; + + typedef struct scanbuf_list + { + struct scanbuf_list *NEXT; + char *MODEL; + char *INPUT; + char *OUTPUT; + char *VDD; + char *VSS; + + } scanbuf_list ; + + typedef struct scanparam + { + scanmux_list *MUX_LIST; + scanreg_list *REG_LIST; + scanregmux_list *REG_MUX_LIST; + scanbuf_list *BUF_LIST; + + } scanparam; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern scanparam *ScanParseParamFile(); + +# endif diff --git a/alliance/src/scapin/src/scan_path.c b/alliance/src/scapin/src/scan_path.c new file mode 100644 index 00000000..fab389a6 --- /dev/null +++ b/alliance/src/scapin/src/scan_path.c @@ -0,0 +1,341 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : SCAN | +| | +| File : scan_path.c | +| | +| Author : | +| | +| Date : | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "mlu.h" + +# include +# include +# include + +# include "scan_path.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| ScanParseGetWord | +| | +\------------------------------------------------------------*/ + +static char *ScanParseGetWord( Buffer ) + + char *Buffer; +{ + char *String; + + if ( ( String = (char *)strtok( Buffer, " =,\t\n" ) ) != (char *)0 ) + { + String = namealloc( String ); + } + + return( String ); +} + + +/*------------------------------------------------------------\ +| | +| ScanParseViewParam | +| | +\------------------------------------------------------------*/ + +static void ScanParseViewParam( Param ) + + pathparam *Param; +{ + chain_list *ScanList; + + fprintf( stdout, "BEGIN_PATH_REG\n" ); + + for ( ScanList = Param->REG_LIST; + ScanList != (chain_list *)0; + ScanList = ScanList->NEXT ) + { + fprintf( stdout, "%s\n", (char *)ScanList->DATA ); + } + + fprintf( stdout, "END_PATH_REG\n" ); + + fprintf( stdout, "BEGIN_CONNECTOR\n" ); + + fprintf( stdout, "SCAN_IN : %s\n", Param->SCAN_IN ); + fprintf( stdout, "SCAN_OUT : %s\n", Param->SCAN_OUT ); + fprintf( stdout, "SCAN_TEST : %s\n", Param->SCAN_TEST ); + + fprintf( stdout, "END_CONNECTOR\n" ); +} + +/*------------------------------------------------------------\ +| | +| ScanParsePathParamFile | +| | +\------------------------------------------------------------*/ + +pathparam *ScanParsePathParamFile( FileName, FlagDebug ) + + char *FileName; + int FlagDebug; +{ + pathparam *PathParam; + char *FirstWord; + char *SecondWord; + int CurrentDef; + long LineNumber; + FILE *ParamFile; + char ParamBuffer[ 512 ]; + char *RegisterName; + char *Pointer; + char *Scan; + int Index; + int Left; + int Right; + int Step; + char Buffer[ 128 ]; + + FileName = autbasename( FileName, "path" ); + sprintf( ParamBuffer, "%s.path", FileName ); + ParamFile = fopen( ParamBuffer, "r" ); + +/* -----------------------------------------------------------------------*/ +/* Dans le cas ou on ne peut pas ouvrir le fichier */ +/*------------------------------------------------------------------------*/ + if ( ParamFile == (FILE *)0 ) + { + fprintf( stderr, "\t### Unable to parse parameter file %s.path\n", FileName ); + autexit( 1 ); + } + + + PathParam = (pathparam *)autallocblock( sizeof( pathparam ) ); + LineNumber = 0; + SecondWord = (char *)0; + + CurrentDef = SCAN_PATH_NONE; + +/* -----------------------------------------------------------------------*/ +/* Ouverture et lecture du fichier .path */ +/*------------------------------------------------------------------------*/ + + while ( fgets( ParamBuffer, 512, ParamFile ) != (char *)0 ) + { + LineNumber++; + + if ( ParamBuffer[ 0 ] == '#' ) continue; + + FirstWord = ScanParseGetWord( ParamBuffer ); + + if ( FirstWord == (char *)0 ) continue; + + if ( ! strcmp( FirstWord, "end_path_reg" ) ) CurrentDef = SCAN_PATH_NONE; + else + if( ! strcmp( FirstWord, "end_connector" ) ) CurrentDef = SCAN_PATH_NONE; + else + if ( CurrentDef != SCAN_PATH_NONE ) + { + if ( CurrentDef != SCAN_PATH_REG ) + { + SecondWord = ScanParseGetWord( (char *)0 ); + + if ( SecondWord == (char *)0 ) + { + fprintf( stderr, "\t### Syntax error line %ld in parameter file %s.path\n", + LineNumber, FileName ); + autexit( 1 ); + } + } + + switch ( CurrentDef ) + + /* -----------------------------------------------------------------------*/ + /* Partie consacrée ŕ la saisie des noms de registres dans les champs */ + /* correspondants */ + /*------------------------------------------------------------------------*/ + { + case SCAN_PATH_REG : + + do + { + Scan = strchr( FirstWord, '[' ); + + if ( Scan != NULL ) + { + strcpy( Buffer, FirstWord ); + Scan = Buffer; + + Pointer = strchr( Scan, '[' ); + *Pointer = '\0'; + + RegisterName = namealloc( Buffer ); + Scan = Pointer + 1; + + Pointer = strchr( Scan, ':' ); + + if ( Pointer == (char *)0 ) + { + fprintf( stderr, "\t### Syntax error line %ld in parameter file %s.path\n", + LineNumber, FileName ); + autexit(1); + } + + *Pointer = '\0'; + Left = atoi( Scan ); + Scan = Pointer + 1; + + Pointer = strchr( Scan, ']' ); + + if ( Pointer == (char *)0 ) + { + fprintf( stderr, "\t### Syntax error line %ld in parameter file %s.path\n", + LineNumber, FileName ); + autexit(1); + } + + *Pointer = '\0'; + Right = atoi( Scan ); + + if ( Left < Right ) Step = 1; + else Step = -1; + + for ( Index = Left; Index != (Right + Step) ; Index += Step ) + { + sprintf( Buffer, "%s%d", RegisterName, Index ); + PathParam->REG_LIST = addchain( PathParam->REG_LIST, namealloc( Buffer ) ); + } + } + else + { + PathParam->REG_LIST = addchain( PathParam->REG_LIST, FirstWord ); + } + + } while ( ( FirstWord = ScanParseGetWord( NULL ) ) != NULL ); + + break; + + /* --------------------------------------- -------------------------------*/ + + /* Partie consacrée ŕ la lecture des noms des connecteurs dans les champs */ + /* correspondants */ + /*------------------------------------------------------------------------*/ + case SCAN_PATH_LOCON : + + if ( ! strcmp( FirstWord, "scan_in" ) ) + { + PathParam->SCAN_IN = SecondWord; + } + else + if ( ! strcmp( FirstWord, "scan_out" ) ) + { + PathParam->SCAN_OUT = SecondWord; + } + else + if ( ! strcmp( FirstWord, "scan_test" ) ) + { + PathParam->SCAN_TEST = SecondWord; + } + else + { + fprintf( stderr, "\t### Syntax error line %ld in parameter file %s.path\n", + LineNumber, FileName ); + autexit( 1 ); + } + + break; + } + } + else + +/* ---------------------------------------------------------------------*/ +/* Partie consacrée ŕ l'allocation de mémoire pour les registres */ +/* ---------------------------------------------------------------------*/ + + if ( ! strcmp( FirstWord, "begin_path_reg")) + { + CurrentDef = SCAN_PATH_REG; + } + else + +/* ----------------------------------------------------------------------*/ +/* Partie consacrée ŕ l'allocation de mémoire pour les connecteurs */ +/* ----------------------------------------------------------------------*/ + + if ( ! strcmp( FirstWord, "begin_connector")) + { + CurrentDef = SCAN_PATH_LOCON; + } + } + +/* ----------------------------------------------------------------------*/ +/* Partie consacrée ŕ la fermeture du fichier chemin.path */ +/* ----------------------------------------------------------------------*/ + + PathParam->REG_LIST = reverse( PathParam->REG_LIST ); + + fclose( ParamFile ); + + if ( FlagDebug ) + { + ScanParseViewParam( PathParam ); + } + + return( PathParam ); +} diff --git a/alliance/src/scapin/src/scan_path.h b/alliance/src/scapin/src/scan_path.h new file mode 100644 index 00000000..d9cca0a9 --- /dev/null +++ b/alliance/src/scapin/src/scan_path.h @@ -0,0 +1,85 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : SCAN | +| | +| File : scan_path.h | +| | +| Author : | +| | +| Date : | +| | +\------------------------------------------------------------*/ + +# ifndef SCAN_PATH_H +# define SCAN_PATH_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define SCAN_PATH_NONE 0 +# define SCAN_PATH_REG 1 +# define SCAN_PATH_LOCON 2 + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct pathparam + { + chain_list *REG_LIST; + char *SCAN_IN; + char *SCAN_OUT; + char *SCAN_TEST; + + } pathparam; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern pathparam *ScanParsePathParamFile(); + +# endif diff --git a/alliance/src/xfsm/Makefile.am b/alliance/src/xfsm/Makefile.am new file mode 100644 index 00000000..af437a64 --- /dev/null +++ b/alliance/src/xfsm/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src diff --git a/alliance/src/xfsm/configure.in b/alliance/src/xfsm/configure.in new file mode 100644 index 00000000..aae25c9d --- /dev/null +++ b/alliance/src/xfsm/configure.in @@ -0,0 +1,35 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(src/xfsm.c) + +XFSM_MAJOR_VERSION=1 +XFSM_MINOR_VERSION=4 +XFSM_VERSION=$XFSM_MAJOR_VERSION.$XFSM_MINOR_VERSION + +AC_SUBST(XFSM_MAJOR_VERSION) +AC_SUBST(XFSM_MINOR_VERSION) +AC_SUBST(XFSM_VERSION) + +# For automake. +VERSION=$XFSM_VERSION +PACKAGE=xfsm + +dnl Initialize automake stuff +AM_INIT_AUTOMAKE($PACKAGE, $VERSION) + +dnl Checks for programs. +AC_PROG_CC +AM_PROG_LEX +AC_PROG_YACC +AC_PROG_RANLIB +AC_PROG_MAKE_SET +AC_FIND_MOTIF + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST + +AM_ALLIANCE + +AC_OUTPUT([ +Makefile +src/Makefile +]) diff --git a/alliance/src/xfsm/etc/xfsm.par b/alliance/src/xfsm/etc/xfsm.par new file mode 100644 index 00000000..0e043a6c --- /dev/null +++ b/alliance/src/xfsm/etc/xfsm.par @@ -0,0 +1,64 @@ +# /*------------------------------------------------------------\ +# | | +# | Title : Parameters File for Xfsm | +# | | +# | Date : 01.01.95 | +# | | +# \------------------------------------------------------------*/ +# /*------------------------------------------------------------\ +# | | +# | Unit | +# | | +# \------------------------------------------------------------*/ + +DEFINE XFSM_UNIT 64 + +# /*------------------------------------------------------------\ +# | | +# | Lower Grid Step in pixel by unit | +# | | +# \------------------------------------------------------------*/ + +DEFINE XFSM_LOWER_GRID_STEP 50 + +# /*------------------------------------------------------------\ +# | | +# | Xfsm Color | +# | | +# \------------------------------------------------------------*/ + +DEFINE XFSM_CURSOR_COLOR_NAME Gray +DEFINE XFSM_BACKGROUND_COLOR_NAME Black +DEFINE XFSM_FOREGROUND_COLOR_NAME White +DEFINE XFSM_ACCEPT_COLOR_NAME magenta +DEFINE XFSM_CONNECT_COLOR_NAME White + +# /*------------------------------------------------------------\ +# | | +# | Xfsm Cursor Size in pixel | +# | | +# \------------------------------------------------------------*/ + +DEFINE XFSM_CURSOR_SIZE 10 + +# /*------------------------------------------------------------\ +# | | +# | Xfsm Layer Color | +# | | +# \------------------------------------------------------------*/ + +TABLE XFSM_LAYER_NAME + + 0 Arc Cyan Black + 1 Reset red Black + 2 Initial yellow Black + 3 Layer_3 pink Black + 4 Layer_4 lawn_green Black + 5 Layer_5 red Black + 6 Layer_6 yellow Black + 7 Layer_7 white Black + 8 Layer_8 pink Black + 9 Layer_9 red Black + + +END diff --git a/alliance/src/xfsm/motif.m4 b/alliance/src/xfsm/motif.m4 new file mode 100644 index 00000000..4a79c31a --- /dev/null +++ b/alliance/src/xfsm/motif.m4 @@ -0,0 +1,196 @@ +dnl +dnl +dnl AC_FIND_MOTIF : find OSF/Motif or LessTif, and provide variables +dnl to easily use them in a Makefile. +dnl +dnl Adapted from a macro by Andreas Zeller. +dnl +dnl The variables provided are : +dnl LINK_MOTIF (e.g. -L/usr/lesstif/lib -lXm) +dnl INCLUDE_MOTIF (e.g. -I/usr/lesstif/lib) +dnl MOTIF_LIBRARIES (e.g. /usr/lesstif/lib) +dnl MOTIF_INCLUDES (e.g. /usr/lesstif/include) +dnl +dnl The LINK_MOTIF and INCLUDE_MOTIF variables should be fit to put on +dnl your application's link line in your Makefile. +dnl +dnl Oleo CVS $Id: motif.m4,v 1.1 2002/03/29 17:41:03 ludo Exp $ +dnl +AC_DEFUN(AC_FIND_MOTIF, +[ + +AC_REQUIRE([AC_PATH_XTRA]) + +MOTIF_INCLUDES= +MOTIF_LIBRARIES= + +dnl AC_ARG_WITH(motif, +dnl [ --without-motif do not use Motif widgets]) +dnl Treat --without-motif like +dnl --without-motif-includes --without-motif-libraries. +dnl if test "$with_motif" = "no" +dnl then +dnl MOTIF_INCLUDES=none +dnl MOTIF_LIBRARIES=none +dnl fi + +AC_ARG_WITH(motif-includes, +[ --with-motif-includes=DIR Motif include files are in DIR], +MOTIF_INCLUDES="$withval") + +AC_ARG_WITH(motif-libraries, +[ --with-motif-libraries=DIR Motif libraries are in DIR], +MOTIF_LIBRARIES="$withval") + +AC_MSG_CHECKING(for Motif) + +# +# +# Search the include files. +# +if test "$MOTIF_INCLUDES" = ""; then +AC_CACHE_VAL(ac_cv_motif_includes, +[ +ac_motif_save_LIBS="$LIBS" +ac_motif_save_CFLAGS="$CFLAGS" +ac_motif_save_CPPFLAGS="$CPPFLAGS" +ac_motif_save_LDFLAGS="$LDFLAGS" +# +LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS" +CFLAGS="$X_CFLAGS $CFLAGS" +CPPFLAGS="$X_CFLAGS $CPPFLAGS" +LDFLAGS="$X_LIBS $LDFLAGS" +# +ac_cv_motif_includes="none" +AC_TRY_COMPILE([#include ],[int a;], +[ +# Xm/Xm.h is in the standard search path. +ac_cv_motif_includes= +], +[ +# Xm/Xm.h is not in the standard search path. +# Locate it and put its directory in `MOTIF_INCLUDES' +# +# /usr/include/Motif* are used on HP-UX (Motif). +# /usr/include/X11* are used on HP-UX (X and Athena). +# /usr/dt is used on Solaris (Motif). +# /usr/openwin is used on Solaris (X and Athena). +# Other directories are just guesses. +for dir in "$x_includes" "${prefix}/include" /usr/include /usr/local/include \ + /usr/include/Motif2.0 /usr/include/Motif1.2 /usr/include/Motif1.1 \ + /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 \ + /usr/dt/include /usr/openwin/include \ + /usr/dt/*/include /opt/*/include /usr/include/Motif* \ + "${prefix}"/*/include /usr/*/include /usr/local/*/include \ + "${prefix}"/include/* /usr/include/* /usr/local/include/*; do +if test -f "$dir/Xm/Xm.h"; then +ac_cv_motif_includes="$dir" +break +fi +done +]) +# +LIBS="$ac_motif_save_LIBS" +CFLAGS="$ac_motif_save_CFLAGS" +CPPFLAGS="$ac_motif_save_CPPFLAGS" +LDFLAGS="$ac_motif_save_LDFLAGS" +]) +MOTIF_INCLUDES="$ac_cv_motif_includes" +fi +# +# +# Now for the libraries. +# +if test "$MOTIF_LIBRARIES" = ""; then +AC_CACHE_VAL(ac_cv_motif_libraries, +[ +ac_motif_save_LIBS="$LIBS" +ac_motif_save_CFLAGS="$CFLAGS" +ac_motif_save_CPPFLAGS="$CPPFLAGS" +ac_motif_save_LDFLAGS="$LDFLAGS" +# +LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS" +CFLAGS="$X_CFLAGS $CFLAGS" +CPPFLAGS="$X_CFLAGS $CPPFLAGS" +LDFLAGS="$X_LIBS $LDFLAGS" +# +ac_cv_motif_libraries="none" +AC_TRY_LINK([#include ],[XtToolkitInitialize();], +[ +# libXm.a is in the standard search path. +ac_cv_motif_libraries= +], +[ +# libXm.a is not in the standard search path. +# Locate it and put its directory in `MOTIF_LIBRARIES' +# +# /usr/lib/Motif* are used on HP-UX (Motif). +# /usr/lib/X11* are used on HP-UX (X and Athena). +# /usr/dt is used on Solaris (Motif). +# /usr/lesstif is used on Linux (Lesstif). +# /usr/openwin is used on Solaris (X and Athena). +# Other directories are just guesses. +for dir in "$x_libraries" "${prefix}/lib" /usr/lib /usr/local/lib \ + /usr/lib/Motif2.0 /usr/lib/Motif1.2 /usr/lib/Motif1.1 \ + /usr/lib/X11R6 /usr/lib/X11R5 /usr/lib/X11R4 /usr/lib/X11 \ + /usr/dt/lib /usr/openwin/lib \ + /usr/dt/*/lib /opt/*/lib /usr/lib/Motif* \ + /usr/lesstif*/lib /usr/lib/Lesstif* \ + "${prefix}"/*/lib /usr/*/lib /usr/local/*/lib \ + "${prefix}"/lib/* /usr/lib/* /usr/local/lib/*; do +if test -d "$dir" && test "`ls $dir/libXm.* 2> /dev/null`" != ""; then +ac_cv_motif_libraries="$dir" +break +fi +done +]) +# +LIBS="$ac_motif_save_LIBS" +CFLAGS="$ac_motif_save_CFLAGS" +CPPFLAGS="$ac_motif_save_CPPFLAGS" +LDFLAGS="$ac_motif_save_LDFLAGS" +]) +# +MOTIF_LIBRARIES="$ac_cv_motif_libraries" +fi +# +# Provide an easier way to link +# +if test "$MOTIF_INCLUDES" = "none" -o "$MOTIF_LIBRARIES" = "none"; then + with_motif="no" +else + with_motif="yes" +fi + +if test "$with_motif" != "no"; then + if test "$MOTIF_LIBRARIES" = ""; then + LINK_MOTIF="-lXm" + MOTIF_LIBS="-lXm" + else + LINK_MOTIF="-L$MOTIF_LIBRARIES -lXm" + MOTIF_LIBS="-L$MOTIF_LIBRARIES -lXm" + fi + if test "$MOTIF_INCLUDES" != ""; then + INCLUDE_MOTIF="-I$MOTIF_INCLUDES" + MOTIF_CFLAGS="-I$MOTIF_INCLUDES" + fi + AC_DEFINE(HAVE_MOTIF) +else + with_motif="no" +fi +# +AC_SUBST(LINK_MOTIF) +AC_SUBST(INCLUDE_MOTIF) +# +# +# +motif_libraries_result="$MOTIF_LIBRARIES" +motif_includes_result="$MOTIF_INCLUDES" +test "$motif_libraries_result" = "" && motif_libraries_result="in default path" +test "$motif_includes_result" = "" && motif_includes_result="in default path" +test "$motif_libraries_result" = "none" && motif_libraries_result="(none)" +test "$motif_includes_result" = "none" && motif_includes_result="(none)" +AC_MSG_RESULT( + [libraries $motif_libraries_result, headers $motif_includes_result]) +])dnl + diff --git a/alliance/src/xfsm/src/LIP6bw.h b/alliance/src/xfsm/src/LIP6bw.h new file mode 100644 index 00000000..cfecd995 --- /dev/null +++ b/alliance/src/xfsm/src/LIP6bw.h @@ -0,0 +1,293 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +#define LIP6bw_width 164 +#define LIP6bw_height 150 +static char LIP6bw_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x70, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, + 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x70, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0xfc, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x01, + 0xe0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x7f, 0x00, 0xc0, 0xff, 0x7f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x3f, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xe0, + 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xe0, 0x01, 0xff, 0xff, + 0x01, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x01, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, + 0x01, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, + 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x03, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0xf0, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, + 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0xf9, 0xff, 0xff, + 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0x20, 0xc0, 0xff, 0xff, 0x07, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0x00, 0x80, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0x00, + 0x00, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, + 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x03, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0xe0, 0x00, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xe0, + 0x01, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, + 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x03, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, + 0x01, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, + 0x01, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x01, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0xe0, 0x01, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x3f, 0xc0, + 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x3f, 0x00, 0x80, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x7f, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x03, + 0xf0, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x1f, 0xff, 0xff, 0x1f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; diff --git a/alliance/src/xfsm/src/Makefile.am b/alliance/src/xfsm/src/Makefile.am new file mode 100644 index 00000000..4b3a1111 --- /dev/null +++ b/alliance/src/xfsm/src/Makefile.am @@ -0,0 +1,41 @@ +## Process this file with automake to produce Makefile.in + +bin_PROGRAMS = xfsm +CFLAGS = @CFLAGS@ @X_CFLAGS@ -DXFSM_VERSION=\"@XFSM_VERSION@\" \ + -DXFSM_TOOL_NAME=\"xfsm\" \ + -DXFSM_DEFAULT_PARAM_NAME=\"${ALLIANCE_TOP}/etc/xfsm.par\" \ + -DXMS_FILE_NAME=\".xfsm.cfg\" + +xfsm_LDADD = @LIBS@ @X_LIBS@ @LINK_MOTIF@ \ + -lFtl -lFks -lFvh -lFsm \ + -lBdd -lAbl -lAut -lMut + +INCLUDES = @INCLUDES@ @INCLUDE_MOTIF@ + + +xfsm_SOURCES = \ +LIP6bw.h XME_search.c XMS_panel.c XMV_panel.h XMX_panel.h \ +XFS.h XME_search.h XMS_panel.h XMV_view.c XMX_view.c \ +XFS_bdd.c XME_select.c XMS_setup.c XMV_view.h XMX_view.h \ +XFS_bdd.h XME_select.h XMS_setup.h XMX.h XSB.h \ +XFS_bound.c XMF.h XMT.h XMX_color.c XSB_error.c \ +XFS_bound.h XMF_dialog.c XMT_dialog.c XMX_color.h XSB_error.h \ +XFS_error.c XMF_dialog.h XMT_dialog.h XMX_cursor.c XSB_parse.c \ +XFS_error.h XMF_file.c XMT_menu.c XMX_cursor.h XSB_parse.h \ +XFS_fsm.c XMF_file.h XMT_menu.h XMX_dialog.c XSB_share.c \ +XFS_fsm.h XMF_menu.c XMT_message.c XMX_dialog.h XSB_share.h \ +XFS_object.c XMF_menu.h XMT_message.h XMX_event.c XTB.h \ +XFS_object.h XMF_panel.c XMT_panel.c XMX_event.h XTB_cursor.c \ +XFS_select.c XMF_panel.h XMT_panel.h XMX_graphic.c XTB_cursor.h \ +XFS_select.h XMH.h XMT_tools.c XMX_graphic.h XTB_dialog.c \ +XME.h XMH_help.c XMT_tools.h XMX_grid.c XTB_dialog.h \ +XME_dialog.c XMH_help.h XMV.h XMX_grid.h XTB_icon.c \ +XME_dialog.h XMH_menu.c XMV_dialog.c XMX_icon.c XTB_icon.h \ +XME_edit.c XMH_menu.h XMV_dialog.h XMX_icon.h XTB_menu.c \ +XME_edit.h XMH_panel.c XMV_map.c XMX_menu.c XTB_menu.h \ +XME_menu.c XMH_panel.h XMV_map.h XMX_menu.h XTB_panel.c \ +XME_menu.h XMS.h XMV_menu.c XMX_message.c XTB_panel.h \ +XME_message.c XMS_dialog.c XMV_menu.h XMX_message.h XTB_pixmap.c \ +XME_message.h XMS_dialog.h XMV_message.c XMX_motif.c XTB_pixmap.h \ +XME_panel.c XMS_menu.c XMV_message.h XMX_motif.h xfsm.c \ +XME_panel.h XMS_menu.h XMV_panel.c XMX_panel.c xfsm.h diff --git a/alliance/src/xfsm/src/XFS.h b/alliance/src/xfsm/src/XFS.h new file mode 100644 index 00000000..365cd29e --- /dev/null +++ b/alliance/src/xfsm/src/XFS.h @@ -0,0 +1,279 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : XFS.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_XFS +# define XFSM_XFS + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XFSM_OBJECT_CIRCLE 0x0000 +# define XFSM_OBJECT_LINE 0x0001 +# define XFSM_OBJECT_RECTANGLE 0x0002 +# define XFSM_OBJECT_ARROW 0x0003 +# define XFSM_OBJECT_TEXT 0x0004 +# define XFSM_OBJECT_TYPE 0x000F + +# define XFSM_OBJECT_STATE 0x0010 +# define XFSM_OBJECT_TRANS 0x0020 + +# define XFSM_OBJECT_LINE_DOWN 0x0100 +# define XFSM_OBJECT_LINE_LEFT 0x0200 + +# define XFSM_OBJECT_SELECT 0x0400 +# define XFSM_OBJECT_ACCEPT 0x0800 +# define XFSM_OBJECT_CONNECT 0x1000 + +/*------------------------------------------------------------\ +| | +| Macros | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Object | +| | +\------------------------------------------------------------*/ + +# define GetXfsmObjectType( X ) ( ( X )->TYPE & XFSM_OBJECT_TYPE ) + +# define IsXfsmLineDown( X ) ( ( X )->TYPE & XFSM_OBJECT_LINE_DOWN ) +# define IsXfsmLineLeft( X ) ( ( X )->TYPE & XFSM_OBJECT_LINE_LEFT ) +# define IsXfsmState( X ) ( ( X )->TYPE & XFSM_OBJECT_STATE ) +# define IsXfsmTrans( X ) ( ( X )->TYPE & XFSM_OBJECT_TRANS ) + +# define SetXfsmLineDown( X ) ( ( X )->TYPE |= XFSM_OBJECT_LINE_DOWN ) +# define SetXfsmLineLeft( X ) ( ( X )->TYPE |= XFSM_OBJECT_LINE_LEFT ) +# define SetXfsmState( X ) ( ( X )->TYPE |= XFSM_OBJECT_STATE ) +# define SetXfsmTrans( X ) ( ( X )->TYPE |= XFSM_OBJECT_TRANS ) + +# define ClearXfsmLineDown( X ) ( ( X )->TYPE &= ~XFSM_OBJECT_LINE_DOWN ) +# define ClearXfsmLineLeft( X ) ( ( X )->TYPE &= ~XFSM_OBJECT_LINE_LEFT ) +# define ClearXfsmState( X ) ( ( X )->TYPE &= ~XFSM_OBJECT_STATE ) +# define ClearXfsmTrans( X ) ( ( X )->TYPE &= ~XFSM_OBJECT_TRANS ) + +/*------------------------------------------------------------\ +| | +| Select | +| | +\------------------------------------------------------------*/ + +# define IsXfsmSelect( X ) ( ( X )->TYPE & XFSM_OBJECT_SELECT ) +# define SetXfsmSelect( X ) ( ( X )->TYPE |= XFSM_OBJECT_SELECT ) +# define ClearXfsmSelect( X ) ( ( X )->TYPE &= ~XFSM_OBJECT_SELECT ) + +/*------------------------------------------------------------\ +| | +| Accept | +| | +\------------------------------------------------------------*/ + +# define IsXfsmAccept( X ) ( ( X )->TYPE & XFSM_OBJECT_ACCEPT ) +# define SetXfsmAccept( X ) ( ( X )->TYPE |= XFSM_OBJECT_ACCEPT ) +# define ClearXfsmAccept( X ) ( ( X )->TYPE &= ~XFSM_OBJECT_ACCEPT ) + +/*------------------------------------------------------------\ +| | +| Connect | +| | +\------------------------------------------------------------*/ + +# define IsXfsmConnect( X ) ( ( X )->TYPE & XFSM_OBJECT_CONNECT ) +# define SetXfsmConnect( X ) ( ( X )->TYPE |= XFSM_OBJECT_CONNECT ) +# define ClearXfsmConnect( X ) ( ( X )->TYPE &= ~XFSM_OBJECT_CONNECT ) + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Object | +| | +\------------------------------------------------------------*/ + + typedef struct xfsmobj_list + { + struct xfsmobj_list *NEXT; + struct xfsmobj_list *LINK; + char *NAME; + short LAYER; + long TYPE; + long X; + long Y; + long DX; + long DY; + void *USER; + + } xfsmobj_list; + + typedef struct xfsmfig_list + { + struct xfsmfig_list *NEXT; + char *NAME; + xfsmobj_list *OBJECT [ XFSM_MAX_LAYER ]; + xfsmobj_list *TEXT [ XFSM_MAX_LAYER ]; + + } xfsmfig_list; + +/*------------------------------------------------------------\ +| | +| Select | +| | +\------------------------------------------------------------*/ + + typedef struct xfsmselect_list + { + struct xfsmselect_list *NEXT; + xfsmobj_list *OBJECT; + + } xfsmselect_list; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern long XfsmBoundXmin; + extern long XfsmBoundYmin; + extern long XfsmBoundXmax; + extern long XfsmBoundYmax; + extern char XfsmRecomputeBound; + + extern xfsmfig_list *XfsmFigure; + extern fsmfig_list *XfsmFigureFsm; + + extern xfsmselect_list *XfsmHeadSelect; + extern xfsmselect_list *XfsmHeadConnect; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Add Functions | +| | +\------------------------------------------------------------*/ + + extern xfsmfig_list *XfsmAddFigure(); + extern xfsmobj_list *XfsmAddCircle(); + extern xfsmobj_list *XfsmAddLine(); + extern xfsmobj_list *XfsmAddText(); + +/*------------------------------------------------------------\ +| | +| Del Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmDelFigure(); + +/*------------------------------------------------------------\ +| | +| Flag Set & Clear Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmSelectObject(); + extern void XfsmUnselectObject(); + extern void XfsmAcceptObject(); + extern void XfsmRejectObject(); + extern void XfsmConnectObject(); + extern void XfsmDisconnectObject(); + +/*------------------------------------------------------------\ +| | +| Select Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmAddSelect(); + extern void XfsmDelSelect(); + extern void XfsmPurgeSelect(); + +/*------------------------------------------------------------\ +| | +| Connect Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmAddConnect(); + extern void XfsmDelConnect(); + +/*------------------------------------------------------------\ +| | +| Bound Compute | +| | +\------------------------------------------------------------*/ + + extern char XfsmComputeBound(); + +/*------------------------------------------------------------\ +| | +| Load Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmLoadFigure(); + +/*------------------------------------------------------------\ +| | +| Error Message Functions | +| | +\------------------------------------------------------------*/ + + extern char *XfsmGetErrorMessage(); + extern void XfsmExitErrorMessage(); + +/*------------------------------------------------------------\ +| | +| Informations Functions | +| | +\------------------------------------------------------------*/ + + extern char *XfsmGetInformations(); + +# endif diff --git a/alliance/src/xfsm/src/XFS_bdd.c b/alliance/src/xfsm/src/XFS_bdd.c new file mode 100644 index 00000000..1d03d783 --- /dev/null +++ b/alliance/src/xfsm/src/XFS_bdd.c @@ -0,0 +1,151 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Bdd.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "ftl.h" +# include "XSB.h" +# include "XFS.h" +# include "XFS_bdd.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmMakeBddCircuit | +| | +\------------------------------------------------------------*/ + +bddcircuit *XfsmMakeBddCircuit( BddSystem, FsmFigure ) + + bddsystem *BddSystem; + fsmfig_list *FsmFigure; +{ + fsmin_list *ScanIn; + fsmout_list *ScanOut; + bddcircuit *BddCircuit; + + BddCircuit = createbddcircuit( FsmFigure->NAME, + FsmFigure->NUMBER_IN + FsmFigure->NUMBER_OUT, + FsmFigure->NUMBER_STATE, BddSystem ); + + for ( ScanIn = FsmFigure->IN; + ScanIn != (fsmin_list *)0; + ScanIn = ScanIn->NEXT ) + { + addbddcircuitin( (bddcircuit *)0, ScanIn->NAME, + (bddindex )0, BDD_IN_MODE_LAST ); + } + + for ( ScanOut = FsmFigure->OUT; + ScanOut != (fsmout_list *)0; + ScanOut = ScanOut->NEXT ) + { + addbddcircuitin( (bddcircuit *)0, ScanOut->NAME, + (bddindex )0, BDD_IN_MODE_LAST ); + } + + addbddcircuitin( (bddcircuit *)0, "'d'", + (bddindex )0, BDD_IN_MODE_LAST ); + + FsmFigure->CIRCUIT = BddCircuit; + + makefsmbddnode( FsmFigure ); + + return( BddCircuit ); +} + +/*------------------------------------------------------------\ +| | +| XfsmSimplifyFigure | +| | +\------------------------------------------------------------*/ + +void XfsmSimplifyFigure( FsmFigure ) + + fsmfig_list *FsmFigure; +{ + bddsystem *BddSystem; + bddcircuit *BddCircuit; + + BddSystem = createbddsystem( XFSM_BDD_VAR_NODE, + XFSM_BDD_OPER_NODE, 1000, XFSM_BDD_MAX_NODE ); + + reorderbddsystemdynamic( BddSystem, XFSM_BDD_REORDER_FUNC, + XFSM_BDD_REORDER_LOW, XFSM_BDD_REORDER_RATIO ); + + BddCircuit = XfsmMakeBddCircuit( BddSystem, FsmFigure ); + convertfsmbddnodeabl( FsmFigure ); + + destroybddcircuit( BddCircuit ); + destroybddsystem( BddSystem ); + + FsmFigure->CIRCUIT = (bddcircuit *)0; +} diff --git a/alliance/src/xfsm/src/XFS_bdd.h b/alliance/src/xfsm/src/XFS_bdd.h new file mode 100644 index 00000000..c08a975c --- /dev/null +++ b/alliance/src/xfsm/src/XFS_bdd.h @@ -0,0 +1,80 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Bdd.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +# ifndef XFS_BDD_H +# define XFS_BDD_H + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XFSM_BDD_MAX_NODE 900000 +# define XFSM_BDD_VAR_NODE 50 +# define XFSM_BDD_OPER_NODE 1000 +# define XFSM_BDD_REORDER_LOW 50000 +# define XFSM_BDD_REORDER_RATIO 50 +# define XFSM_BDD_REORDER_FUNC reorderbddsystemsimple + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmSimplifyFigure(); + extern bddcircuit *XfsmMakeBddCircuit(); + +# endif diff --git a/alliance/src/xfsm/src/XFS_bound.c b/alliance/src/xfsm/src/XFS_bound.c new file mode 100644 index 00000000..0c5dfe14 --- /dev/null +++ b/alliance/src/xfsm/src/XFS_bound.c @@ -0,0 +1,149 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Bound.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XFS.h" +# include "XFS_bound.h" + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + long XfsmBoundXmin = 0; + long XfsmBoundYmin = 0; + long XfsmBoundXmax = 0; + long XfsmBoundYmax = 0; + + char XfsmRecomputeBound = XFSM_TRUE; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmComputeBound | +| | +\------------------------------------------------------------*/ + +char XfsmComputeBound() + +{ + xfsmobj_list *Obj; + short Layer; + short FirstBound; + + if ( XfsmFigure == (xfsmfig_list *)NULL ) + { + return( XFSM_FALSE ); + } + + if ( XfsmRecomputeBound == XFSM_FALSE ) + { + return( XFSM_TRUE ); + } + + autbegin(); + + FirstBound = 1; + + for ( Layer = 0; Layer < XFSM_MAX_LAYER; Layer++ ) + { + for ( Obj = XfsmFigure->OBJECT[ Layer ]; + Obj != (xfsmobj_list *)NULL; + Obj = Obj->NEXT ) + { + if ( FirstBound ) + { + XfsmBoundXmin = Obj->X; + XfsmBoundYmin = Obj->Y; + XfsmBoundXmax = Obj->X + Obj->DX; + XfsmBoundYmax = Obj->Y + Obj->DY; + FirstBound = 0; + } + else + { + if ( Obj->X < XfsmBoundXmin ) + { + XfsmBoundXmin = Obj->X; + } + + if ( Obj->Y < XfsmBoundYmin ) + { + XfsmBoundYmin = Obj->Y; + } + + if ( ( Obj->X + Obj->DX ) > XfsmBoundXmax ) + { + XfsmBoundXmax = Obj->X + Obj->DX; + } + + if ( ( Obj->Y + Obj->DY ) > XfsmBoundYmax ) + { + XfsmBoundYmax = Obj->Y + Obj->DY; + } + } + } + } + + XfsmBoundXmin = XfsmBoundXmin - ( XFSM_UNIT << 1 ); + XfsmBoundYmin = XfsmBoundYmin - ( XFSM_UNIT << 1 ); + XfsmBoundXmax = XfsmBoundXmax + ( XFSM_UNIT << 1 ); + XfsmBoundYmax = XfsmBoundYmax + ( XFSM_UNIT << 1 ); + + XfsmRecomputeBound = XFSM_FALSE; + + autend(); + return( XFSM_TRUE ); +} diff --git a/alliance/src/xfsm/src/XFS_bound.h b/alliance/src/xfsm/src/XFS_bound.h new file mode 100644 index 00000000..c04d8da6 --- /dev/null +++ b/alliance/src/xfsm/src/XFS_bound.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Bound.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFS_BOUND +# define XFS_BOUND + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XFSM_DEFAULT_BOUND_XMIN 0 +# define XFSM_DEFAULT_BOUND_YMIN 0 +# define XFSM_DEFAULT_BOUND_XMAX 100 +# define XFSM_DEFAULT_BOUND_YMAX 100 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xfsm/src/XFS_error.c b/alliance/src/xfsm/src/XFS_error.c new file mode 100644 index 00000000..a5e48e6f --- /dev/null +++ b/alliance/src/xfsm/src/XFS_error.c @@ -0,0 +1,337 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Error.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XFS.h" +# include "XFS_error.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static FILE *XfsmStreamErr; + static FILE *XfsmStreamOut; + static FILE *XfsmStreamAll; + + static char XfsmErrFileName[ 40 ]; + static char XfsmOutFileName[ 40 ]; + static char XfsmAllFileName[ 40 ]; + + static char XfsmNormalMode = 1; + +/*------------------------------------------------------------\ +| | +| Xfsm Error Message | +| | +\------------------------------------------------------------*/ + + static char *XfsmErrorBuffer = (char *)NULL; + +/*------------------------------------------------------------\ +| | +| Xfsm Informations | +| | +\------------------------------------------------------------*/ + + static char XfsmInformationsBuffer[ XFSM_INFORMATIONS_BUFFER_SIZE ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Xfsm Error Message Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmExitErrorMessage | +| | +\------------------------------------------------------------*/ + +void XfsmExitErrorMessage( Error ) + + int Error; +{ + autbegin(); + + if ( XfsmStreamErr != (FILE *)0 ) + { + fclose( XfsmStreamErr ); + unlink( XfsmErrFileName ); + } + + if ( XfsmStreamAll != (FILE *)0 ) + { + fclose( XfsmStreamAll ); + unlink( XfsmAllFileName ); + } + + if ( ( XfsmNormalMode ) && + ( XfsmStreamOut != (FILE *)0 ) ) + { + fclose( XfsmStreamOut ); + unlink( XfsmOutFileName ); + } + + exit( Error ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmInitializeErrorMessage | +| | +\------------------------------------------------------------*/ + +void XfsmInitializeErrorMessage( Debug ) + + char Debug; +{ + autbegin(); + + XfsmNormalMode = ! Debug; + + if ( XfsmNormalMode ) + { + sprintf( XfsmOutFileName, "/tmp/%s_out_%d", XFSM_TOOL_NAME, getpid() ); + } + + sprintf( XfsmErrFileName, "/tmp/%s_err_%d", XFSM_TOOL_NAME, getpid() ); + sprintf( XfsmAllFileName, "/tmp/%s_all_%d", XFSM_TOOL_NAME, getpid() ); + + XfsmStreamErr = freopen( XfsmErrFileName, "w+", stderr); + XfsmStreamAll = fopen ( XfsmAllFileName, "w+" ); + + if ( XfsmNormalMode ) + { + XfsmStreamOut = freopen( XfsmOutFileName, "w+", stdout); + } + else + { + XfsmStreamOut = XfsmStreamErr; + } + + if ( ( XfsmStreamAll == (FILE *)NULL ) || + ( XfsmStreamOut == (FILE *)NULL ) || + ( XfsmStreamErr == (FILE *)NULL ) ) + { + fprintf( stdout, "Grm: Unable to open trace window !\n"); + exit( 1 ); + } + + if ( XfsmNormalMode ) + { + unlink( XfsmOutFileName ); + } + + unlink( XfsmErrFileName ); + + signal( SIGINT, XfsmExitErrorMessage ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmFlushErrorMessage | +| | +\------------------------------------------------------------*/ + +void XfsmFlushErrorMessage() +{ + int Data; + + autbegin(); + + fflush( XfsmStreamErr ); + fseek( XfsmStreamErr, 0L, 0 ); + + while( ( Data = fgetc( XfsmStreamErr ) ) != EOF ) + { + fputc( Data, XfsmStreamAll ); + } + + fclose( XfsmStreamErr ); + + XfsmStreamErr = freopen( XfsmErrFileName, "w+", stderr ); + + if ( XfsmNormalMode ) + { + fflush( XfsmStreamOut ); + fseek( XfsmStreamOut, 0L, 0 ); + + while( ( Data = fgetc( XfsmStreamOut ) ) != EOF ) + { + fputc( Data, XfsmStreamAll ); + } + + fclose( XfsmStreamOut ); + + XfsmStreamOut = freopen( XfsmOutFileName, "w+", stdout ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmGetErrorMessage | +| | +\------------------------------------------------------------*/ + +char *XfsmGetErrorMessage() + +{ + char *Message; + long Length; + long Index; + int Data; + + autbegin(); + + XfsmFlushErrorMessage(); + + fflush( XfsmStreamAll ); + + Length = ftell( XfsmStreamAll ); + + if ( XfsmErrorBuffer != (char *)NULL ) + { + autfreeblock( XfsmErrorBuffer ); + } + + XfsmErrorBuffer = autallocblock( Length + 1 ); + Index = 0; + + while ( ( ( Data = fgetc( XfsmStreamAll ) ) != EOF ) && + ( Index < Length ) ) + { + XfsmErrorBuffer[ Index++ ] = (char)Data; + } + + rewind( XfsmStreamAll ); + + XfsmErrorBuffer[ Index ] = '\0'; + + if ( Index == 0 ) + { + Message = (char *)NULL; + } + else + { + Message = XfsmErrorBuffer; + } + + autend(); + return( Message ); +} + +/*------------------------------------------------------------\ +| | +| XfsmGetInformations | +| | +\------------------------------------------------------------*/ + +char *XfsmGetInformations() + +{ + char *Scan; + + autbegin(); + + XfsmComputeBound(); + + Scan = XfsmInformationsBuffer; + + if ( XfsmFigureFsm != (fsmfig_list *)NULL ) + { + sprintf( Scan, " FIGURE : %s\n\n STATES : %d\n TRANSITIONS : %d\n INPUTS : %d\n OUTPUTS : %d\n\n", XfsmFigureFsm->NAME, + XfsmFigureFsm->NUMBER_STATE, + XfsmFigureFsm->NUMBER_TRANS, + XfsmFigureFsm->NUMBER_IN, + XfsmFigureFsm->NUMBER_OUT ); + } + else + { + sprintf( Scan, " FIGURE : No current figure !\n\n" ); + } + + Scan = Scan + strlen( Scan ); + + sprintf( Scan, " BOUNDING BOX : \n\n XMIN : %d\n YMIN : %d\n XMAX : %d\n YMAX : %d\n\n", + XfsmBoundXmin / XFSM_UNIT, XfsmBoundYmin / XFSM_UNIT, + XfsmBoundXmax / XFSM_UNIT, XfsmBoundYmax / XFSM_UNIT ); + + Scan = Scan + strlen( Scan ); + + sprintf( Scan, " XFSM PARAM : %s\n\n", XFSM_PARAM_NAME ); + + autend(); + return( XfsmInformationsBuffer ); +} diff --git a/alliance/src/xfsm/src/XFS_error.h b/alliance/src/xfsm/src/XFS_error.h new file mode 100644 index 00000000..1dfc0d99 --- /dev/null +++ b/alliance/src/xfsm/src/XFS_error.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Error.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFS_ERROR +# define XFS_ERROR + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XFSM_INFORMATIONS_BUFFER_SIZE 1024 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmFlushErrorMessage(); + +# endif diff --git a/alliance/src/xfsm/src/XFS_fsm.c b/alliance/src/xfsm/src/XFS_fsm.c new file mode 100644 index 00000000..9d25f853 --- /dev/null +++ b/alliance/src/xfsm/src/XFS_fsm.c @@ -0,0 +1,174 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Fsm.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "ftl.h" +# include "XSB.h" +# include "XFS.h" +# include "XFS_fsm.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + fsmfig_list *XfsmFigureFsm = (fsmfig_list *)NULL; + +/*------------------------------------------------------------\ +| | +| For Set Long Jump | +| | +\------------------------------------------------------------*/ + + static jmp_buf XfsmJumpBuffer; + static void (*OldExitHandler)() = NULL; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Xfsm Exit Handler Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmExitHandler | +| | +\------------------------------------------------------------*/ + +void XfsmExitHandler() +{ + XfsmFlushErrorMessage(); + + longjmp( XfsmJumpBuffer, 1); +} + +/*------------------------------------------------------------\ +| | +| XfsmActiveExitHandler | +| | +\------------------------------------------------------------*/ + +void XfsmActiveExitHandler() +{ + MBK_EXIT_FUNCTION = XfsmExitHandler; +} + +/*------------------------------------------------------------\ +| | +| XfsmResetExitHandler | +| | +\------------------------------------------------------------*/ + +void XfsmResetExitHandler() +{ + MBK_EXIT_FUNCTION = NULL; +} + +/*------------------------------------------------------------\ +| | +| Get Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Xfsmgetfsmfig | +| | +\------------------------------------------------------------*/ + +fsmfig_list *Xfsmgetfsmfig( FileName ) + + char *FileName; +{ + fsmfig_list *FigureFsm; + + autbegin(); + + FigureFsm = (fsmfig_list *)NULL; + + XfsmActiveExitHandler(); + + if ( setjmp( XfsmJumpBuffer ) == 0 ) + { + FigureFsm = getfsmfig( FileName ); + + XfsmResetExitHandler(); + + autend(); + return( FigureFsm ); + } + + XfsmResetExitHandler(); + + if ( FigureFsm != (fsmfig_list *)NULL ) + { + delfsmfig( FigureFsm->NAME ); + } + + autend(); + return( (fsmfig_list *)NULL ); +} diff --git a/alliance/src/xfsm/src/XFS_fsm.h b/alliance/src/xfsm/src/XFS_fsm.h new file mode 100644 index 00000000..4fe232d9 --- /dev/null +++ b/alliance/src/xfsm/src/XFS_fsm.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Fsm.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFS_FSM_H +# define XFS_FSM_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern fsmfig_list *Xfsmgetfsmfig(); + +# endif diff --git a/alliance/src/xfsm/src/XFS_object.c b/alliance/src/xfsm/src/XFS_object.c new file mode 100644 index 00000000..84935f02 --- /dev/null +++ b/alliance/src/xfsm/src/XFS_object.c @@ -0,0 +1,732 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Object.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "ftl.h" +# include "XSB.h" +# include "XFS.h" +# include "XFS_object.h" +# include "XFS_bdd.h" +# include "XFS_fsm.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + xfsmfig_list *XfsmFigure = (xfsmfig_list *)0; + + static long XfsmScanStepX1 = 0; + static long XfsmScanStepX2 = 0; + + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Alloc Functions | +| | +\------------------------------------------------------------*/ + +xfsmfig_list *XfsmAllocFigure() +{ + return( (xfsmfig_list *)autallocblock( sizeof( xfsmfig_list ) ) ); +} + +xfsmobj_list *XfsmAllocObject() +{ + return( (xfsmobj_list *)autallocheap( sizeof( xfsmobj_list ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Free Functions | +| | +\------------------------------------------------------------*/ + +void XfsmFreeFigure( Figure ) + + xfsmfig_list *Figure; +{ + autfreeblock( Figure ); +} + +void XfsmFreeObject( Object ) + + xfsmobj_list *Object; +{ + autfreeheap( Object, sizeof( xfsmobj_list ) ); +} + +/*------------------------------------------------------------\ +| | +| Add Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmAddCircle | +| | +\------------------------------------------------------------*/ + +xfsmobj_list *XfsmAddCircle( X, Y, R, Layer ) + + long X; + long Y; + long R; + short Layer; +{ + xfsmobj_list *Object; + + autbegin(); + + Object = XfsmAllocObject(); + Object->TYPE = XFSM_OBJECT_CIRCLE; + Object->LAYER = Layer; + Object->NEXT = XfsmFigure->OBJECT[ Layer ]; + Object->X = X - R; + Object->Y = Y - R; + Object->DX = ( R << 1 ); + Object->DY = ( R << 1 ); + + XfsmFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XfsmAddLine | +| | +\------------------------------------------------------------*/ + +xfsmobj_list *XfsmAddLine( X1, Y1, X2, Y2, LayerFrom, LayerTo ) + + long X1; + long Y1; + long X2; + long Y2; + short LayerFrom; + short LayerTo; +{ + xfsmobj_list *Object; + + autbegin(); + + Object = XfsmAllocObject(); + Object->LAYER = LayerFrom; + Object->TYPE = XFSM_OBJECT_LINE; + Object->NEXT = XfsmFigure->OBJECT[ LayerTo ]; + + if ( X1 > X2 ) + { + SetXfsmLineLeft( Object ); + + Object->X = X2; + Object->DX = X1 - X2; + } + else + { + Object->X = X1; + Object->DX = X2 - X1; + } + + if ( Y1 > Y2 ) + { + SetXfsmLineDown( Object ); + + Object->Y = Y2; + Object->DY = Y1 - Y2; + } + else + { + Object->Y = Y1; + Object->DY = Y2 - Y1; + } + + XfsmFigure->OBJECT[ LayerTo ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XfsmAddArrow | +| | +\------------------------------------------------------------*/ + +xfsmobj_list *XfsmAddArrow( X1, Y1, X2, Y2, LayerFrom, LayerTo ) + + long X1; + long Y1; + long X2; + long Y2; + short LayerFrom; + short LayerTo; +{ + xfsmobj_list *Object; + + autbegin(); + + Object = XfsmAllocObject(); + Object->LAYER = LayerFrom; + Object->TYPE = XFSM_OBJECT_ARROW; + Object->NEXT = XfsmFigure->OBJECT[ LayerTo ]; + + if ( X1 > X2 ) + { + SetXfsmLineLeft( Object ); + + Object->X = X2; + Object->DX = X1 - X2; + } + else + { + Object->X = X1; + Object->DX = X2 - X1; + } + + if ( Y1 > Y2 ) + { + SetXfsmLineDown( Object ); + + Object->Y = Y2; + Object->DY = Y1 - Y2; + } + else + { + Object->Y = Y1; + Object->DY = Y2 - Y1; + } + + XfsmFigure->OBJECT[ LayerTo ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XfsmAddRectangle | +| | +\------------------------------------------------------------*/ + +xfsmobj_list *XfsmAddRectangle( X, Y, DX, DY, Layer ) + + long X; + long Y; + long DX; + long DY; + short Layer; +{ + xfsmobj_list *Object; + + autbegin(); + + Object = XfsmAllocObject(); + Object->TYPE = XFSM_OBJECT_RECTANGLE; + Object->LAYER = Layer; + Object->NEXT = XfsmFigure->OBJECT[ Layer ]; + Object->X = X; + Object->Y = Y; + Object->DX = DX; + Object->DY = DY; + + XfsmFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XfsmAddText | +| | +\------------------------------------------------------------*/ + +xfsmobj_list *XfsmAddText( X, Y, Name, Layer ) + + long X; + long Y; + char *Name; + short Layer; +{ + xfsmobj_list *Object; + + autbegin(); + + Object = XfsmAllocObject(); + Object->LAYER = Layer; + Object->TYPE = XFSM_OBJECT_TEXT; + Object->NEXT = XfsmFigure->TEXT[ Layer ]; + Object->NAME = namealloc( Name ); + Object->X = X; + Object->Y = Y; + + XfsmFigure->TEXT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XfsmAddState | +| | +\------------------------------------------------------------*/ + +xfsmobj_list *XfsmAddState( State, X, Y, Layer ) + + fsmstate_list *State; + long X; + long Y; + short Layer; +{ + xfsmobj_list *Circle; + xfsmobj_list *Text; + xfsmcoord *Coord; + + Coord = XFSM_COORD( State ); + Coord->X = X; + Coord->Y = Y; + + X *= XFSM_UNIT; + Y *= XFSM_UNIT; + + Circle = XfsmAddCircle( X, Y, XFSM_UNIT, Layer ); + Text = XfsmAddText( X, Y - ( ( 3 * XFSM_UNIT ) >> 1 ), + State->NAME, Layer ); + + Text->LINK = Circle; + Circle->LINK = Text; + + SetXfsmState( Circle ); + SetXfsmState( Text ); + + Circle->USER = (void *)State; + Text->USER = (void *)State; + + Coord->OBJECT = Circle; + + autend(); + return( Circle ); +} + +/*------------------------------------------------------------\ +| | +| XfsmAddTrans | +| | +\------------------------------------------------------------*/ + +xfsmobj_list *XfsmAddTrans( Trans ) + + fsmtrans_list *Trans; +{ + xfsmcoord *ToCoord; + xfsmcoord *FromCoord; + xfsmobj_list *FirstLine; + xfsmobj_list *LastLine; + xfsmobj_list *Arrow; + xfsmobj_list *ObjFrom; + xfsmobj_list *ObjTo; + int LayerFrom; + int LayerTo; + long ArrowX1; + long ArrowY1; + long ArrowX2; + long ArrowY2; + long DeltaX; + long DeltaY; + long StepX; + + autbegin(); + + FromCoord = XFSM_COORD( Trans->FROM ); + ToCoord = XFSM_COORD( Trans->TO ); + + ObjFrom = FromCoord->OBJECT; + ObjTo = ToCoord->OBJECT; + + if ( IsFsmStarTrans( Trans ) ) + { + LayerFrom = LayerTo = 0; + } + else + { + LayerTo = ObjTo->LAYER; + LayerFrom = ObjFrom->LAYER; + } + + FirstLine = (xfsmobj_list *)0; + LastLine = (xfsmobj_list *)0; + + ArrowX1 = ( ToCoord->X ) * XFSM_UNIT; + ArrowY1 = ( ToCoord->Y ) * XFSM_UNIT; + ArrowX2 = ( FromCoord->X ) * XFSM_UNIT; + ArrowY2 = ( FromCoord->Y ) * XFSM_UNIT; + + DeltaX = ToCoord->X - FromCoord->X; + DeltaY = ToCoord->Y - FromCoord->Y; + + /* + if ( DeltaY > 0 ) + */ + if ( DeltaY > 0 ) + { + XfsmScanStepX1++ ; + + if ( XfsmScanStepX1 >= 4 ) XfsmScanStepX1 = 0; + + StepX = ( 4 + XfsmScanStepX1 ) * XFSM_UNIT; + + if ( DeltaX > 0 ) DeltaX = StepX; + else DeltaX = - StepX; + + FirstLine = XfsmAddLine( ArrowX2 - XFSM_UNIT, ArrowY2, + ArrowX2 + DeltaX, ArrowY2, + LayerFrom, LayerTo ); + + SetXfsmTrans( FirstLine ); + FirstLine->USER = (void *)Trans; + + ArrowX2 = ArrowX2 + DeltaX; + + LastLine = XfsmAddLine( ArrowX2, ArrowY2, + ArrowX2, ArrowY1, + LayerFrom, LayerTo ); + + SetXfsmTrans( LastLine ); + LastLine->USER = (void *)Trans; + + ArrowY2 = ArrowY1; + + FirstLine->LINK = LastLine; + } + else + if ( ( DeltaX == 0 ) && + ( DeltaY < -16 ) ) + { + XfsmScanStepX2++ ; + + if ( XfsmScanStepX2 >= 4 ) XfsmScanStepX2 = 0; + + StepX = ( 4 + XfsmScanStepX2 ) * XFSM_UNIT; + + if ( DeltaX > 0 ) DeltaX = - StepX; + else DeltaX = StepX; + + FirstLine = XfsmAddLine( ArrowX2 - XFSM_UNIT, ArrowY2, + ArrowX2 + DeltaX, ArrowY2, + LayerFrom, LayerTo ); + + SetXfsmTrans( FirstLine ); + FirstLine->USER = (void *)Trans; + + ArrowX2 = ArrowX2 + DeltaX; + + LastLine = XfsmAddLine( ArrowX2, ArrowY2, + ArrowX2, ArrowY1, + LayerFrom, LayerTo ); + + SetXfsmTrans( LastLine ); + LastLine->USER = (void *)Trans; + + ArrowY2 = ArrowY1; + + FirstLine->LINK = LastLine; + } + + if ( ObjFrom == ObjTo ) + { + ArrowX2 = ArrowX1 - ( XFSM_UNIT << 1 ); + ArrowY2 = ArrowY1 + ( XFSM_UNIT << 1 ); + } + + Arrow = XfsmAddArrow( ArrowX1, ArrowY1, + ArrowX2, ArrowY2, + LayerFrom, LayerTo ); + + SetXfsmTrans( Arrow ); + Arrow->USER = (void *)Trans; + + if ( FirstLine != (xfsmobj_list *)0 ) + { + Arrow->LINK = FirstLine; + LastLine->LINK = Arrow; + } + else + { + Arrow->LINK = Arrow; + } + + Trans->USER = (void *)Arrow; + + autend(); + return( Arrow ); +} + +/*------------------------------------------------------------\ +| | +| XfsmPlaceState | +| | +\------------------------------------------------------------*/ + +long XfsmPlaceState( FsmState, X, Y ) + + fsmstate_list *FsmState; + long X; + long Y; +{ + fsmtrans_list *Trans; + fsmstate_list *State; + chain_list *ScanChain; + int Layer; + int First; + + if ( FsmState->USER == (void *)0 ) + { + if ( IsFsmFirstState( FsmState ) ) Layer = XFSM_FIRST_LAYER; + else + if ( IsFsmStarState( FsmState ) ) Layer = XFSM_STAR_LAYER; + else Layer = XFSM_STATE_LAYER; + + FsmState->USER = (void *)autallocheap( sizeof( xfsmcoord ) ); + XfsmAddState( FsmState, X, Y, Layer ); + + First = 1; + Y = Y - 8; + + for ( ScanChain = FsmState->FROM; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + Trans = (fsmtrans_list *)( ScanChain->DATA ); + State = Trans->TO; + + if ( ( ! First ) && ( State != FsmState ) ) + { + if ( State->USER == (void *)0 ) X += 10; + } + + if ( First ) + { + First = ( ( State == FsmState ) || + ( State->USER != (void *)0 ) ); + } + + X = XfsmPlaceState( State, X, Y - 8 ); + XfsmAddTrans( Trans ); + } + } + + return( X ); +} + +/*------------------------------------------------------------\ +| | +| XfsmAddFigure | +| | +\------------------------------------------------------------*/ + +xfsmfig_list *XfsmAddFigure() +{ + fsmstate_list *ScanState; + void *Pointer; + long X; + + autbegin(); + + XfsmFigure = XfsmAllocFigure(); + XfsmFigure->NAME = XfsmFigureFsm->NAME; + + X = 0; + XfsmScanStepX1 = 0; + XfsmScanStepX2 = 0; + + if ( XfsmFigureFsm->FIRST_STATE != (fsmstate_list *)0 ) + { + X = 15 + XfsmPlaceState( XfsmFigureFsm->FIRST_STATE, X, 0 ); + } + + if ( XfsmFigureFsm->STAR_STATE != (fsmstate_list *)0 ) + { + ScanState = XfsmFigureFsm->STAR_STATE; + if ( ScanState->USER == (void *)0 ) + { + X = 15 + XfsmPlaceState( ScanState, X, 0 ); + } + } + + for ( ScanState = XfsmFigureFsm->STATE; + ScanState != (fsmstate_list *)0; + ScanState = ScanState->NEXT ) + { + if ( ScanState->USER == (void *)0 ) + { + X = 15 + XfsmPlaceState( ScanState, X, 0 ); + } + } + + for ( ScanState = XfsmFigureFsm->STATE; + ScanState != (fsmstate_list *)0; + ScanState = ScanState->NEXT ) + { + Pointer = ScanState->USER; + ScanState->USER = (void *)(((xfsmcoord *)Pointer)->OBJECT); + + autfreeheap( Pointer, sizeof( xfsmcoord ) ); + } + + autend(); + return( XfsmFigure ); +} + +/*------------------------------------------------------------\ +| | +| Load Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmLoadFigure | +| | +\------------------------------------------------------------*/ + +void XfsmLoadFigure( FileName ) + + char *FileName; +{ + autbegin(); + + XfsmFigureFsm = Xfsmgetfsmfig( FileName ); + + if ( XfsmFigureFsm != (fsmfig_list *)0 ) + { + XfsmSimplifyFigure( XfsmFigureFsm ); + + XfsmAddFigure(); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Del Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmDelFigure | +| | +\------------------------------------------------------------*/ + +void XfsmDelFigure() +{ + xfsmobj_list *ScanObject; + xfsmobj_list *DelObject; + short Layer; + + if ( XfsmFigure == (xfsmfig_list *)0 ) return; + + autbegin(); + + for ( Layer = 0; Layer < XFSM_MAX_LAYER; Layer++ ) + { + ScanObject = XfsmFigure->OBJECT[ Layer ]; + + while ( ScanObject != (xfsmobj_list *)0 ) + { + DelObject = ScanObject; + ScanObject = ScanObject->NEXT; + + XfsmFreeObject( DelObject ); + } + + ScanObject = XfsmFigure->TEXT[ Layer ]; + + while ( ScanObject != (xfsmobj_list *)0 ) + { + DelObject = ScanObject; + ScanObject = ScanObject->NEXT; + + XfsmFreeObject( DelObject ); + } + } + + XfsmFreeFigure( XfsmFigure ); + + delfsmfig( XfsmFigureFsm->NAME ); + + XfsmFigure = (xfsmfig_list *)0; + XfsmFigureFsm = (fsmfig_list *)0; + + autend(); +} diff --git a/alliance/src/xfsm/src/XFS_object.h b/alliance/src/xfsm/src/XFS_object.h new file mode 100644 index 00000000..a43ea8a2 --- /dev/null +++ b/alliance/src/xfsm/src/XFS_object.h @@ -0,0 +1,90 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Object.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFS_OBJECT_H +# define XFS_OBJECT_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XFSM_COORD( P ) (((xfsmcoord *)((P)->USER)) ) +# define XFSM_COORD_X( P ) (((xfsmcoord *)((P)->USER))->X ) +# define XFSM_COORD_Y( P ) (((xfsmcoord *)((P)->USER))->Y ) +# define XFSM_COORD_OBJECT( P ) (((xfsmcoord *)((P)->USER))->OBJECT) + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct xfsmcoord + { + xfsmobj_list *OBJECT; + long X; + long Y; + + } xfsmcoord; + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xfsm/src/XFS_select.c b/alliance/src/xfsm/src/XFS_select.c new file mode 100644 index 00000000..ba9a6607 --- /dev/null +++ b/alliance/src/xfsm/src/XFS_select.c @@ -0,0 +1,425 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Select.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XFS.h" +# include "XFS_select.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + xfsmselect_list *XfsmHeadSelect = (xfsmselect_list *)NULL; + xfsmselect_list *XfsmHeadConnect = (xfsmselect_list *)NULL; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Alloc Functions | +| | +\------------------------------------------------------------*/ + +xfsmselect_list *XfsmAllocSelect() +{ + return( (xfsmselect_list *)autallocheap( sizeof( xfsmselect_list ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Free Functions | +| | +\------------------------------------------------------------*/ + +void XfsmFreeSelect( Select ) + + xfsmselect_list *Select; +{ + autfreeheap( Select, sizeof( xfsmselect_list ) ); +} + +/*------------------------------------------------------------\ +| | +| Select Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmSelectObject | +| | +\------------------------------------------------------------*/ + +void XfsmSelectObject( Object ) + + xfsmobj_list *Object; +{ + xfsmobj_list *Scan; + + autbegin(); + + Scan = Object; + + do + { + SetXfsmSelect( Scan ); + + Scan = Scan->LINK; + } + while ( Scan != Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmUnselectObject | +| | +\------------------------------------------------------------*/ + +void XfsmUnselectObject( Object ) + + xfsmobj_list *Object; +{ + xfsmobj_list *Scan; + + autbegin(); + + Scan = Object; + + do + { + ClearXfsmSelect( Scan ); + + Scan = Scan->LINK; + } + while ( Scan != Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmAcceptObject | +| | +\------------------------------------------------------------*/ + +void XfsmAcceptObject( Object ) + + xfsmobj_list *Object; +{ + xfsmobj_list *Scan; + + autbegin(); + + Scan = Object; + + do + { + SetXfsmAccept( Scan ); + + Scan = Scan->LINK; + } + while ( Scan != Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmRejectObject | +| | +\------------------------------------------------------------*/ + +void XfsmRejectObject( Object ) + + xfsmobj_list *Object; +{ + xfsmobj_list *Scan; + + autbegin(); + + Scan = Object; + + do + { + ClearXfsmAccept( Scan ); + + Scan = Scan->LINK; + } + while ( Scan != Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmConnectObject | +| | +\------------------------------------------------------------*/ + +void XfsmConnectObject( Object ) + + xfsmobj_list *Object; +{ + xfsmobj_list *Scan; + + autbegin(); + + Scan = Object; + + do + { + SetXfsmConnect( Scan ); + + Scan = Scan->LINK; + } + while ( Scan != Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmDisconnectObject | +| | +\------------------------------------------------------------*/ + +void XfsmDisconnectObject( Object ) + + xfsmobj_list *Object; +{ + xfsmobj_list *Scan; + + autbegin(); + + Scan = Object; + + do + { + ClearXfsmConnect( Scan ); + + Scan = Scan->LINK; + } + while ( Scan != Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Add Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmAddSelect | +| | +\------------------------------------------------------------*/ + +void XfsmAddSelect( Object ) + + xfsmobj_list *Object; +{ + xfsmselect_list *Select; + + autbegin(); + + Select = XfsmAllocSelect(); + Select->NEXT = XfsmHeadSelect; + Select->OBJECT = Object; + XfsmHeadSelect = Select; + + XfsmSelectObject( Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmAddConnect | +| | +\------------------------------------------------------------*/ + +void XfsmAddConnect( Object ) + + xfsmobj_list *Object; +{ + xfsmselect_list *Connect; + + autbegin(); + + Connect = XfsmAllocSelect(); + Connect->NEXT = XfsmHeadConnect; + Connect->OBJECT = Object; + XfsmHeadConnect = Connect; + + XfsmConnectObject( Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Del Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmDelSelect | +| | +\------------------------------------------------------------*/ + +void XfsmDelSelect() +{ + xfsmselect_list *Select; + xfsmselect_list *DelSelect; + + autbegin(); + + Select = XfsmHeadSelect; + XfsmHeadSelect = (xfsmselect_list *)NULL; + + while ( Select != (xfsmselect_list *)NULL ) + { + XfsmRejectObject( Select->OBJECT ); + + DelSelect = Select; + Select = Select->NEXT; + + XfsmFreeSelect( DelSelect ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmPurgeSelect | +| | +\------------------------------------------------------------*/ + +void XfsmPurgeSelect() +{ + xfsmselect_list *DelSelect; + xfsmselect_list *Select; + xfsmselect_list **Previous; + + autbegin(); + + Previous = &XfsmHeadSelect; + Select = XfsmHeadSelect; + + while( Select != (xfsmselect_list *)NULL ) + { + if ( ! IsXfsmAccept( Select->OBJECT ) ) + { + DelSelect = Select; + Select = Select->NEXT; + *Previous = Select; + + XfsmFreeSelect( DelSelect ); + } + else + { + Previous = &Select->NEXT; + Select = Select->NEXT; + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmDelConnect | +| | +\------------------------------------------------------------*/ + +void XfsmDelConnect() +{ + xfsmselect_list *Connect; + xfsmselect_list *DelConnect; + + autbegin(); + + Connect = XfsmHeadConnect; + XfsmHeadConnect = (xfsmselect_list *)NULL; + + while ( Connect != (xfsmselect_list *)NULL ) + { + XfsmDisconnectObject( Connect->OBJECT ); + + DelConnect = Connect; + Connect = Connect->NEXT; + + XfsmFreeSelect( DelConnect ); + } + + autend(); +} diff --git a/alliance/src/xfsm/src/XFS_select.h b/alliance/src/xfsm/src/XFS_select.h new file mode 100644 index 00000000..fe470b82 --- /dev/null +++ b/alliance/src/xfsm/src/XFS_select.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Select.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFS_SELECT_H +# define XFS_SELECT_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xfsm/src/XME.h b/alliance/src/xfsm/src/XME.h new file mode 100644 index 00000000..9c6d67d7 --- /dev/null +++ b/alliance/src/xfsm/src/XME.h @@ -0,0 +1,85 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : XME.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_XME +# define XFSM_XME + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XfsmMenuItem XfsmEditMenu[]; + + extern XfsmPanelItem XfsmEditSearchViewPanel; + extern XfsmPanelItem XfsmEditSelectPanel; + extern XfsmPanelItem XfsmEditIdentifyPanel; + + extern int XfsmEditSearchViewDefaultValues[ 5 ]; + extern int XfsmEditIdentifyDefaultValues[ 5 ]; + extern int XfsmEditSelectDefaultValues[ 5 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmBuildEditDialog(); + + extern void XfsmEditSearch(); + extern void XfsmEditIdentify(); + extern void XfsmEditConnected(); + extern void XfsmEditUnselectAll(); + + extern void XfsmDisplayEditIdentify(); + +# endif diff --git a/alliance/src/xfsm/src/XME_dialog.c b/alliance/src/xfsm/src/XME_dialog.c new file mode 100644 index 00000000..d14cc076 --- /dev/null +++ b/alliance/src/xfsm/src/XME_dialog.c @@ -0,0 +1,186 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XFS.h" +# include "XMX.h" +# include "XTB.h" +# include "XME.h" + +# include "XME_dialog.h" +# include "XME_edit.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Search Dialog | +| | +\------------------------------------------------------------*/ + + XfsmDialogItem XfsmSearchObjectDialog = + + { + "Object name", + XFSM_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackSearchObjectOk, + (XtPointer)NULL, + (void *)CallbackSearchObjectCancel, + (XtPointer)NULL + }; + + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmBuildEditDialog | +| | +\------------------------------------------------------------*/ + +void XfsmBuildEditDialog() + +{ + autbegin(); + + XfsmBuildDialog( XfsmMainWindow, &XfsmSearchObjectDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Search Callback | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback For Object | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackSearchObjectOk | +| | +\------------------------------------------------------------*/ + +void CallbackSearchObjectOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *NameSet; + + autbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &NameSet ); + + XtUnmanageChild( XfsmSearchObjectDialog.WIDGET ); + + XfsmExitDialog(); + + NameSet = XfsmPostTreatString( NameSet ); + + if ( NameSet != (char *)NULL ) + { + NameSet = namealloc( NameSet ); + + XfsmEditSearchObject( NameSet ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSearchObjectCancel | +| | +\------------------------------------------------------------*/ + +void CallbackSearchObjectCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + autbegin(); + + XtUnmanageChild( XfsmSearchObjectDialog.WIDGET ); + + XfsmExitDialog(); + + autend(); +} diff --git a/alliance/src/xfsm/src/XME_dialog.h b/alliance/src/xfsm/src/XME_dialog.h new file mode 100644 index 00000000..59181454 --- /dev/null +++ b/alliance/src/xfsm/src/XME_dialog.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_EDIT_DIALOG +# define XFSM_EDIT_DIALOG + + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XfsmDialogItem XfsmSearchObjectDialog; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackSearchObjectOk(); + extern void CallbackSearchObjectCancel(); + +# endif diff --git a/alliance/src/xfsm/src/XME_edit.c b/alliance/src/xfsm/src/XME_edit.c new file mode 100644 index 00000000..1a045394 --- /dev/null +++ b/alliance/src/xfsm/src/XME_edit.c @@ -0,0 +1,299 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Edit.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XFS.h" +# include "XME.h" + +# include "XME_edit.h" +# include "XME_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Identify Buffer | +| | +\------------------------------------------------------------*/ + + static char XfsmIdentifyMessage[ XFSM_IDENTIFY_MESSAGE_SIZE ]; + static char XfsmIdentifyBuffer [ XFSM_IDENTIFY_BUFFER_SIZE ]; + static char XfsmIdentifyLocout [ XFSM_IDENTIFY_LOCOUT_SIZE ]; + + static char *XfsmScanIdentify; + static long XfsmIdentifyLength; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmAddIdentify | +| | +\------------------------------------------------------------*/ + +short XfsmAddIdentify( Obj ) + + xfsmobj_list *Obj; +{ + fsmstate_list *State; + fsmtrans_list *Trans; + fsmlocout_list *Locout; + char *ScanString; + char *AblString; + long Length; + + autbegin(); + + XfsmIdentifyBuffer[0] = '\0'; + + if ( IsXfsmState( Obj ) ) + { + State = (fsmstate_list *)( Obj->USER ); + + ScanString = XfsmIdentifyLocout; + strcpy( ScanString, " " ); + ScanString += 2; + + for ( Locout = State->LOCOUT; + Locout != (fsmlocout_list *)NULL; + Locout = Locout->NEXT ) + { + if ( Locout->ABL != (chain_list *)NULL ) + { + strcpy( ScanString, Locout->OUT->NAME ); + ScanString += strlen( ScanString ); + strcpy( ScanString, " <= " ); + ScanString += 4; + AblString = viewablexprstr( Locout->ABL, ABL_VIEW_VHDL ); + Length = strlen( AblString ); + strcpy( ScanString, AblString ); + ScanString += Length; + strcpy( ScanString, "\n " ); + ScanString += 3; + } + } + + sprintf( XfsmIdentifyBuffer, + "STATE :\n\n NAME : %s\n LOCOUT : \n%s\n\n", + State->NAME, + XfsmIdentifyLocout ); + } + else + if ( IsXfsmTrans( Obj ) ) + { + Trans = (fsmtrans_list *)( Obj->USER ); + + if ( Trans->ABL != (chain_list *)NULL ) + { + AblString = viewablexprstr( Trans->ABL, ABL_VIEW_VHDL ); + } + else + { + AblString = ""; + } + + sprintf( XfsmIdentifyBuffer, + "TRANSITION :\n\n FROM : %s TO : %s\n ABL : %s\n\n", + Trans->FROM->NAME, + Trans->TO->NAME, + AblString ); + } + + Length = strlen( XfsmIdentifyBuffer ); + + if ( ( XfsmIdentifyLength + Length ) < ( XFSM_IDENTIFY_MESSAGE_SIZE - 1 ) ) + { + strcpy( XfsmScanIdentify, XfsmIdentifyBuffer ); + + XfsmScanIdentify += Length; + XfsmIdentifyLength += Length; + + autend(); + return( XFSM_TRUE ); + } + +/*\ + strcpy( XfsmScanIdentify, "#" ); +\*/ + + autend(); + return( XFSM_FALSE ); +} + +/*------------------------------------------------------------\ +| | +| XfsmEditIdentify | +| | +\------------------------------------------------------------*/ + +void XfsmEditIdentify( X1, Y1 ) + + long X1; + long Y1; +{ + xfsmselect_list *Select; + xfsmobj_list *Obj; + + strcpy( XfsmIdentifyMessage, "No element found !" ); + + XfsmScanIdentify = XfsmIdentifyMessage; + XfsmIdentifyLength = 0; + + XfsmEditSelectPoint( X1, Y1 ); + + for ( Select = XfsmHeadSelect; + Select != (xfsmselect_list *)NULL; + Select = Select->NEXT ) + { + if ( ! XfsmAddIdentify( Select->OBJECT ) ) break; + } + + XfsmDelSelect(); + + XfsmDisplayEditIdentify( XfsmIdentifyMessage ); + XfsmEnterPanel( &XfsmEditIdentifyPanel ); +} + +/*------------------------------------------------------------\ +| | +| XfsmEditConnected | +| | +\------------------------------------------------------------*/ + +void XfsmEditConnected( X1, Y1 ) + + long X1; + long Y1; +{ + xfsmselect_list *Select; + xfsmselect_list **PrevSelect; + xfsmobj_list *Obj; + + if ( XfsmHeadConnect != (xfsmselect_list *)NULL ) + { + XfsmDelConnect(); + XfsmZoomRefresh(); + } + + XfsmEditSelectPoint( X1, Y1 ); + + XfsmDisplaySelectList( (char *)NULL ); + + for ( Select = XfsmHeadSelect; + Select != (xfsmselect_list *)NULL; + Select = Select->NEXT ) + { + XfsmAddSelectList( Select->OBJECT ); + } + + if ( XfsmHeadSelect == (xfsmselect_list *)NULL ) + { + XfsmWarningMessage( XfsmMainWindow, "No element found !" ); + } + else + { + if ( XfsmHeadSelect->NEXT != (xfsmselect_list *)NULL ) + { + XfsmEnterPanel( &XfsmEditSelectPanel ); + XfsmLimitedLoop( XfsmEditSelectPanel.PANEL ); + } + else + { + XfsmAcceptObject( XfsmHeadSelect->OBJECT ); + XfsmDisplayObject( XfsmHeadSelect->OBJECT ); + } + } + + XfsmPurgeSelect(); + + for ( Select = XfsmHeadSelect; + Select != (xfsmselect_list *)NULL; + Select = Select->NEXT ) + { + XfsmAddConnect( Select->OBJECT ); + } + + if ( XfsmHeadSelect != (xfsmselect_list *)NULL ) + { + if ( XfsmHeadSelect->NEXT == (xfsmselect_list *)NULL ) + { + Obj = XfsmHeadSelect->OBJECT; + XfsmDelSelect(); + XfsmDisplayObject( Obj ); + } + else + { + XfsmDelSelect(); + XfsmZoomRefresh(); + } + } +} diff --git a/alliance/src/xfsm/src/XME_edit.h b/alliance/src/xfsm/src/XME_edit.h new file mode 100644 index 00000000..5608d9a9 --- /dev/null +++ b/alliance/src/xfsm/src/XME_edit.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Edit.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_EDIT +# define XFSM_EDIT + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XFSM_IDENTIFY_BUFFER_SIZE 64000 +# define XFSM_IDENTIFY_LOCOUT_SIZE 64000 +# define XFSM_IDENTIFY_MESSAGE_SIZE 64000 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xfsm/src/XME_menu.c b/alliance/src/xfsm/src/XME_menu.c new file mode 100644 index 00000000..bc87ff10 --- /dev/null +++ b/alliance/src/xfsm/src/XME_menu.c @@ -0,0 +1,197 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XTB.h" +# include "XFS.h" +# include "XMV.h" +# include "XME.h" +# include "XMX.h" + +# include "XME_menu.h" +# include "XME_dialog.h" +# include "XME_edit.h" +# include "XME_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XfsmMenuItem XfsmEditMenu[] = + + { + { + "Identify", + 'I', + "CtrlI", + "Ctrl I", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditIdentify, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XfsmMenuItem *)NULL + } + , + { + "Connected", + 'C', + "CtrlC", + "Ctrl C", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditConnected, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XfsmMenuItem *)NULL + } + , + { + "Search ", + 'S', + "CtrlS", + "Ctrl S", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditSearch, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XfsmMenuItem *)NULL + } + , + NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackEditIdentify | +| | +\------------------------------------------------------------*/ + +void CallbackEditIdentify( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmChangeEditMode( XFSM_EDIT_IDENTIFY, + XfsmPromptEditIdentify ); + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditConnected | +| | +\------------------------------------------------------------*/ + +void CallbackEditConnected( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmChangeEditMode( XFSM_EDIT_CONNECTED, + XfsmPromptEditConnected ); + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditSearch | +| | +\------------------------------------------------------------*/ + +void CallbackEditSearch( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmEnterDialog( &XfsmSearchObjectDialog ); + + autend(); +} diff --git a/alliance/src/xfsm/src/XME_menu.h b/alliance/src/xfsm/src/XME_menu.h new file mode 100644 index 00000000..0fd5a289 --- /dev/null +++ b/alliance/src/xfsm/src/XME_menu.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_MENU +# define XFSM_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackEditIdentify(); + extern void CallbackEditConnected(); + extern void CallbackEditSearch(); + +# endif diff --git a/alliance/src/xfsm/src/XME_message.c b/alliance/src/xfsm/src/XME_message.c new file mode 100644 index 00000000..c8cf52e0 --- /dev/null +++ b/alliance/src/xfsm/src/XME_message.c @@ -0,0 +1,117 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Message.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XFS.h" +# include "XMX.h" +# include "XTB.h" +# include "XME.h" +# include "XME_edit.h" +# include "XME_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmPromptEditIdentify | +| | +\------------------------------------------------------------*/ + +void XfsmPromptEditIdentify() + +{ + autbegin(); + + XfsmDisplayMessage( XFSM_MESSAGE_MODE , "Identify" ); + XfsmDisplayMessage( XFSM_MESSAGE_INFO , "Select object" ); + XfsmDisplayMessage( XFSM_MESSAGE_PROMPT, "Enter select point" ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmPromptEditConnected | +| | +\------------------------------------------------------------*/ + +void XfsmPromptEditConnected() + +{ + autbegin(); + + XfsmDisplayMessage( XFSM_MESSAGE_MODE , "Connected" ); + XfsmDisplayMessage( XFSM_MESSAGE_INFO , "Select object" ); + XfsmDisplayMessage( XFSM_MESSAGE_PROMPT, "Enter select point" ); + + autend(); +} diff --git a/alliance/src/xfsm/src/XME_message.h b/alliance/src/xfsm/src/XME_message.h new file mode 100644 index 00000000..289ef044 --- /dev/null +++ b/alliance/src/xfsm/src/XME_message.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Message.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_MESSAGE +# define XFSM_MESSAGE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmPromptEditIdentify(); + extern void XfsmPromptEditConnected(); + +# endif diff --git a/alliance/src/xfsm/src/XME_panel.c b/alliance/src/xfsm/src/XME_panel.c new file mode 100644 index 00000000..6bd1d149 --- /dev/null +++ b/alliance/src/xfsm/src/XME_panel.c @@ -0,0 +1,497 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XFS.h" +# include "XMX.h" +# include "XTB.h" +# include "XME.h" + +# include "XME_panel.h" +# include "XME_message.h" +# include "XME_dialog.h" +# include "XME_edit.h" +# include "XME_search.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Search View Panel | +| | +\------------------------------------------------------------*/ + + static char *XfsmEditSearchViewButtonName[] = + + { + "Continue", + "Abort" + }; + + static XfsmPanelButtonItem XfsmEditSearchViewButton[] = + + { + { + &XfsmEditSearchViewButtonName[0], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackEditSearchViewContinue, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmEditSearchViewButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 1, + 1, 1, + CallbackEditSearchViewAbort, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XfsmPanelItem XfsmEditSearchViewPanel = + + { + "View search", + 1, + 0, + XFSM_EDIT_VIEW_SEARCH_X, + XFSM_EDIT_VIEW_SEARCH_Y, + 100, + 50, + 1, + 2, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XfsmEditSearchViewButton + }; + + int XfsmEditSearchViewDefaultValues[ 5 ] = + + { + XFSM_EDIT_VIEW_SEARCH_X, + XFSM_EDIT_VIEW_SEARCH_Y, + 100, 50, 0 + }; + +/*------------------------------------------------------------\ +| | +| Panel Identify | +| | +\------------------------------------------------------------*/ + + static char *XfsmPanelIdentifyButtonName[] = + + { + "Text", + "Close" + }; + + XfsmPanelButtonItem XfsmEditIdentifyButton[] = + + { + { + &XfsmPanelIdentifyButtonName[0], + "Nothing", NULL, 0, 0, + NULL, + NULL, + 0, 0, + 8, 9, + NULL, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmPanelIdentifyButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 3, 9, + 2, 1, + CallbackEditCloseIdentify, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XfsmPanelItem XfsmEditIdentifyPanel = + + { + "Identify", + 1, + 0, + XFSM_EDIT_IDENTIFY_X, + XFSM_EDIT_IDENTIFY_Y, + 360, + 250, + 8, + 10, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XfsmEditIdentifyButton + }; + + int XfsmEditIdentifyDefaultValues[ 5 ] = + + { + XFSM_EDIT_IDENTIFY_X, + XFSM_EDIT_IDENTIFY_Y, + 360, 250, 0 + }; + +/*------------------------------------------------------------\ +| | +| Select Panel | +| | +\------------------------------------------------------------*/ + + static char *XfsmEditSelectButtonName[] = + + { + "Select", + "Accept", + "Cancel" + }; + + XfsmPanelButtonItem XfsmEditSelectButton[] = + + { + { + &XfsmEditSelectButtonName[0], + "List", + "List", 0, 0, + NULL, + NULL, + 0, 0, + 8, 9, + CallbackEditSelectList, + (XtPointer)1, + (Widget)NULL + } + , + { + &XfsmEditSelectButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 1, 9, + 2, 1, + CallbackEditSelectAccept, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmEditSelectButtonName[2], + NULL, NULL, 0, 0, + NULL, + NULL, + 5, 9, + 2, 1, + CallbackEditSelectCancel, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XfsmPanelItem XfsmEditSelectPanel = + + { + "Select", + 1, + 0, + XFSM_EDIT_SELECT_X, + XFSM_EDIT_SELECT_Y, + 360, + 250, + 8, + 10, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XfsmEditSelectButton + }; + + int XfsmEditSelectDefaultValues[ 5 ] = + + { + XFSM_EDIT_SELECT_X, + XFSM_EDIT_SELECT_Y, + 360, 250, 0 + }; + +/*------------------------------------------------------------\ +| | +| Callback For View Search | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackEditSearchViewContinue | +| | +\------------------------------------------------------------*/ + +void CallbackEditSearchViewContinue( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditSearchViewAbort | +| | +\------------------------------------------------------------*/ + +void CallbackEditSearchViewAbort( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmSearchAbort = XFSM_TRUE; + + XfsmExitDialog(); + + autbegin(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Identify | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackEditCloseIdentify | +| | +\------------------------------------------------------------*/ + +void CallbackEditCloseIdentify( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmExitPanel( &XfsmEditIdentifyPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmDisplayEditIdentify | +| | +\------------------------------------------------------------*/ + +void XfsmDisplayEditIdentify( Message ) + + char *Message; +{ + autbegin(); + + XmTextSetString( XfsmEditIdentifyButton[0].BUTTON, Message ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Select | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackEditSelectList | +| | +\------------------------------------------------------------*/ + +void CallbackEditSelectList( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmListCallbackStruct *CallData; +{ + autbegin(); + + if ( ClientData == (caddr_t)NULL ) + { + CallbackEditSelectAccept( MyWidget, (caddr_t)NULL, (caddr_t)NULL ); + } + else + { + XfsmEditSelectObject( CallData->item_position - 1 ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditSelectAccept | +| | +\------------------------------------------------------------*/ + +void CallbackEditSelectAccept( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmExitPanel( &XfsmEditSelectPanel ); + + XfsmExitDialog(); + + XfsmEditSelectAccept(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditSelectCancel | +| | +\------------------------------------------------------------*/ + +void CallbackEditSelectCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmExitPanel( &XfsmEditSelectPanel ); + + XfsmExitDialog(); + + XfsmEditSelectCancel(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmDisplaySelectList | +| | +\------------------------------------------------------------*/ + +void XfsmDisplaySelectList( Message ) + + char *Message; +{ + XmString Label; + + autbegin(); + + if ( Message == (char *)NULL ) + { + XmListDeleteAllItems( XfsmEditSelectButton[ 0 ].BUTTON ); + } + else + { + Label = XmStringCreateSimple( Message ); + XmListAddItem( XfsmEditSelectButton[ 0 ].BUTTON , Label , NULL ); + XmStringFree( Label ); + } + + autend(); +} diff --git a/alliance/src/xfsm/src/XME_panel.h b/alliance/src/xfsm/src/XME_panel.h new file mode 100644 index 00000000..1355f6f0 --- /dev/null +++ b/alliance/src/xfsm/src/XME_panel.h @@ -0,0 +1,90 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_EDIT_PANEL +# define XFSM_EDIT_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XFSM_EDIT_VIEW_SEARCH_X 790 +# define XFSM_EDIT_VIEW_SEARCH_Y 450 + +# define XFSM_EDIT_IDENTIFY_X 330 +# define XFSM_EDIT_IDENTIFY_Y 280 + +# define XFSM_EDIT_SELECT_X 330 +# define XFSM_EDIT_SELECT_Y 280 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackEditSearchViewContinue(); + extern void CallbackEditSearchViewAbort(); + + extern void CallbackEditCloseIdentify(); + + extern void CallbackEditSelectList(); + extern void CallbackEditSelectAccept(); + extern void CallbackEditSelectCancel(); + + extern void XfsmDisplaySelectList(); + +# endif diff --git a/alliance/src/xfsm/src/XME_search.c b/alliance/src/xfsm/src/XME_search.c new file mode 100644 index 00000000..2a36287c --- /dev/null +++ b/alliance/src/xfsm/src/XME_search.c @@ -0,0 +1,230 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Search.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XFS.h" +# include "XME.h" + +# include "XME_search.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + char XfsmSearchAbort; + int XfsmSearchNumber; + char *XfsmSearchString; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmEditInitializeSearch | +| | +\------------------------------------------------------------*/ + +void XfsmEditInitializeSearch( Name ) + + char *Name; +{ + char *Star; + + autbegin(); + + Star = strrchr( Name, '*' ); + + if ( Star != (char *)NULL ) + { + XfsmSearchNumber = (int)(Star - Name); + } + else + { + XfsmSearchNumber = 0; + } + + XfsmSearchString = Name; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmEditSearchCompare | +| | +\------------------------------------------------------------*/ + +int XfsmEditSearchCompare( Name ) + + char *Name; +{ + if ( Name != (char *)NULL ) + { + if ( XfsmSearchNumber ) + { + return( ! strncmp( XfsmSearchString, Name, XfsmSearchNumber ) ); + } + else + { + return( Name == XfsmSearchString ); + } + } + + return( 0 ); +} + +/*------------------------------------------------------------\ +| | +| XfsmEditSearchObject | +| | +\------------------------------------------------------------*/ + +void XfsmEditSearchObject( ObjectName ) + + char *ObjectName; +{ + xfsmobj_list *Obj; + xfsmselect_list *Search; + short Layer; + long X1; + long Y1; + + autbegin(); + + if ( XfsmHeadConnect != (xfsmselect_list *)NULL ) + { + XfsmDelConnect(); + XfsmZoomRefresh(); + } + + XfsmEditInitializeSearch( ObjectName ); + + for ( Layer = 0; Layer < XFSM_MAX_LAYER; Layer++ ) + { + if ( XFSM_ACTIVE_LAYER_TABLE[ Layer ] == 0 ) continue; + + for ( Obj = XfsmFigure->TEXT[ Layer ]; + Obj != (xfsmobj_list *)NULL; + Obj = Obj->NEXT ) + { + if ( ! IsXfsmSelect( Obj ) ) + { + if ( XfsmEditSearchCompare( Obj->NAME ) ) + { + XfsmAddSelect( Obj ); + } + } + } + } + + for ( Search = XfsmHeadSelect; + Search != (xfsmselect_list *)NULL; + Search = Search->NEXT ) + { + XfsmUnselectObject( Search->OBJECT ); + } + + if ( XfsmHeadSelect == (xfsmselect_list *)NULL ) + { + XfsmWarningMessage( XfsmMainWindow, "No object found !" ); + } + else + { + XfsmSearchAbort = XFSM_FALSE; + + for ( Search = XfsmHeadSelect; + Search != (xfsmselect_list *)NULL; + Search = Search->NEXT ) + { + Obj = Search->OBJECT; + + XfsmAddConnect( Obj ); + + if ( XfsmSearchAbort ) continue; + + X1 = ( Obj->X + ( Obj->DX >> 1 ) ) / XFSM_UNIT; + Y1 = ( Obj->Y + ( Obj->DY >> 1 ) ) / XFSM_UNIT; + + XfsmZoomCenter( X1, Y1 ); + + if ( Search->NEXT != (xfsmselect_list *)NULL ) + { + XfsmEnterPanel( &XfsmEditSearchViewPanel ); + XfsmLimitedLoop( XfsmEditSearchViewPanel.PANEL ); + } + } + + XfsmDelSelect(); + + XfsmExitPanel( &XfsmEditSearchViewPanel ); + } + + autend(); +} diff --git a/alliance/src/xfsm/src/XME_search.h b/alliance/src/xfsm/src/XME_search.h new file mode 100644 index 00000000..4a3fd839 --- /dev/null +++ b/alliance/src/xfsm/src/XME_search.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Search.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_SEARCH +# define XFSM_SEARCH + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char XfsmSearchAbort; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmEditSearchObject(); + +# endif diff --git a/alliance/src/xfsm/src/XME_select.c b/alliance/src/xfsm/src/XME_select.c new file mode 100644 index 00000000..83972be4 --- /dev/null +++ b/alliance/src/xfsm/src/XME_select.c @@ -0,0 +1,368 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Edit.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XFS.h" +# include "XME.h" + +# include "XME_select.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Select Buffer | +| | +\------------------------------------------------------------*/ + + static char XfsmSelectBuffer [ XFSM_SELECT_BUFFER_SIZE ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmAddSelectList | +| | +\------------------------------------------------------------*/ + +void XfsmAddSelectList( Obj ) + + xfsmobj_list *Obj; +{ + fsmstate_list *State; + fsmtrans_list *Trans; + + autbegin(); + + XfsmSelectBuffer[0] = '\0'; + + if ( IsXfsmState( Obj ) ) + { + State = (fsmstate_list *)( Obj->USER ); + + sprintf( XfsmSelectBuffer, " STATE %s", State->NAME ); + } + else + if ( IsXfsmTrans( Obj ) ) + { + Trans = (fsmtrans_list *)( Obj->USER ); + + sprintf( XfsmSelectBuffer, " TRANSITION %s -> %s", + Trans->FROM->NAME, Trans->TO->NAME ); + } + + XfsmDisplaySelectList( XfsmSelectBuffer ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmEditSelectObject | +| | +\------------------------------------------------------------*/ + +void XfsmEditSelectObject( Number ) + + int Number; +{ + xfsmselect_list *Select; + int Counter; + + autbegin(); + + Select = XfsmHeadSelect; + + for ( Counter = 0; Counter < Number; Counter++ ) + { + Select = Select->NEXT; + } + + if ( IsXfsmAccept( Select->OBJECT ) ) + { + XfsmRejectObject( Select->OBJECT ); + } + else + { + XfsmAcceptObject( Select->OBJECT ); + } + + XfsmDisplayObject( Select->OBJECT ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmEditSelectAccept | +| | +\------------------------------------------------------------*/ + +void XfsmEditSelectAccept() +{ + autbegin(); + + XfsmPurgeSelect(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmEditSelectCancel | +| | +\------------------------------------------------------------*/ + +void XfsmEditSelectCancel() +{ + autbegin(); + + XfsmEditUnselectAll(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Select Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmEditUnselectAll | +| | +\------------------------------------------------------------*/ + +void XfsmEditUnselectAll() +{ + xfsmobj_list *Obj; + + autbegin(); + + if ( XfsmHeadSelect != (xfsmselect_list *)NULL ) + { + if ( XfsmHeadSelect->NEXT == (xfsmselect_list *)NULL ) + { + Obj = XfsmHeadSelect->OBJECT; + XfsmDelSelect(); + XfsmDisplayObject( Obj ); + } + else + { + XfsmDelSelect(); + XfsmZoomRefresh(); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmEditObjectNearPoint | +| | +\------------------------------------------------------------*/ + +char XfsmEditObjectNearPoint( Obj, X1, Y1 ) + + xfsmobj_list *Obj; + long X1; + long Y1; +{ + short Type; + long X1r; + long Y1r; + long X2r; + long Y2r; + float VectorX; + float VectorY; + float LineX; + float LineY; + float Norm; + float Distance; + + Type = GetXfsmObjectType( Obj ); + + if ( ( Obj->X <= X1 ) && + ( Obj->Y <= Y1 ) && + ( Obj->X + Obj->DX >= X1 ) && + ( Obj->Y + Obj->DY >= Y1 ) ) + { + if ( ( Type == XFSM_OBJECT_LINE ) || + ( Type == XFSM_OBJECT_ARROW ) ) + { + if ( ( Obj->DX == 0 ) && + ( Obj->DY == 0 ) ) + { + if ( ( Obj->X == X1 ) && + ( Obj->Y == Y1 ) ) + { + return( XFSM_TRUE ); + } + } + else + { + if ( IsXfsmLineLeft( Obj ) ) + { + X1r = Obj->X + Obj->DX; + X2r = Obj->X; + } + else + { + X1r = Obj->X; + X2r = Obj->X + Obj->DX; + } + + if ( IsXfsmLineDown( Obj ) ) + { + Y1r = Obj->Y + Obj->DY; + Y2r = Obj->Y; + } + else + { + Y1r = Obj->Y; + Y2r = Obj->Y + Obj->DY; + } + + LineX = (float)( X2r - X1r ); + LineY = (float)( Y2r - Y1r ); + Norm = sqrt( ( LineX * LineX ) + ( LineY * LineY ) ); + LineX /= Norm; + LineY /= Norm; + + VectorX = (float)( X2r - X1 ); + VectorY = (float)( Y2r - Y1 ); + + Distance = fabs( ( VectorX * LineY ) - ( VectorY * LineX ) ); + + if ( Distance < (float) XFSM_UNIT ) + { + return( XFSM_TRUE ); + } + } + } + else + { + return( XFSM_TRUE ); + } + } + + return( XFSM_FALSE ); +} + +/*------------------------------------------------------------\ +| | +| XfsmEditSelectPoint | +| | +\------------------------------------------------------------*/ + +void XfsmEditSelectPoint( X1, Y1 ) + + long X1; + long Y1; +{ + xfsmobj_list *Obj; + xfsmselect_list *Select; + int Layer; + + X1 = X1 * XFSM_UNIT; + Y1 = Y1 * XFSM_UNIT; + + for ( Layer = 0; Layer < XFSM_MAX_LAYER; Layer++ ) + { + if ( XFSM_ACTIVE_LAYER_TABLE[ Layer ] == 0 ) continue; + + for ( Obj = XfsmFigure->OBJECT[ Layer ]; + Obj != (xfsmobj_list *)NULL; + Obj = Obj->NEXT ) + { + if ( XFSM_ACTIVE_LAYER_TABLE[ Obj->LAYER ] == 0 ) continue; + + if ( ! IsXfsmSelect( Obj ) ) + { + if ( XfsmEditObjectNearPoint( Obj, X1, Y1 ) ) + { + XfsmAddSelect( Obj ); + } + } + } + } + + for ( Select = XfsmHeadSelect; + Select != (xfsmselect_list *)NULL; + Select = Select->NEXT ) + { + XfsmUnselectObject( Select->OBJECT ); + } +} diff --git a/alliance/src/xfsm/src/XME_select.h b/alliance/src/xfsm/src/XME_select.h new file mode 100644 index 00000000..d0d363f6 --- /dev/null +++ b/alliance/src/xfsm/src/XME_select.h @@ -0,0 +1,69 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Select.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_SELECT +# define XFSM_SELECT + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XFSM_SELECT_BUFFER_SIZE 256 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmEditSelectObject(); + +# endif diff --git a/alliance/src/xfsm/src/XMF.h b/alliance/src/xfsm/src/XMF.h new file mode 100644 index 00000000..e08e29dc --- /dev/null +++ b/alliance/src/xfsm/src/XMF.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : XMF.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_XMF +# define XFSM_XMF + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XfsmMenuItem XfsmFileMenu []; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmBuildFileDialog(); + extern void XfsmBuildPanelLibrary(); + +# endif diff --git a/alliance/src/xfsm/src/XMF_dialog.c b/alliance/src/xfsm/src/XMF_dialog.c new file mode 100644 index 00000000..d7a6abc4 --- /dev/null +++ b/alliance/src/xfsm/src/XMF_dialog.c @@ -0,0 +1,238 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XFS.h" +# include "XMX.h" +# include "XTB.h" +# include "XMF.h" + +# include "XMF_dialog.h" +# include "XMF_file.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| File Dialog | +| | +\------------------------------------------------------------*/ + + XfsmDialogItem XfsmFileOpenDialog = + + { + "Open File", + XFSM_DIALOG_FILE, + (Widget)NULL, + (void *)CallbackFileOpenOk, + (XtPointer)NULL, + (void *)CallbackFileOpenCancel, + (XtPointer)NULL + }; + + XfsmDialogItem XfsmFileQuitDialog = + + { + "Do you really want to quit Xfsm ?", + XFSM_DIALOG_WARNING, + (Widget)NULL, + (void *)CallbackFileQuitOk, + (XtPointer)NULL, + (void *)CallbackFileQuitCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmBuildFileDialog | +| | +\------------------------------------------------------------*/ + +void XfsmBuildFileDialog() + +{ + autbegin(); + + XfsmBuildDialog( XfsmMainWindow, &XfsmFileOpenDialog ); + XfsmBuildDialog( XfsmMainWindow, &XfsmFileQuitDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileQuitOk | +| | +\------------------------------------------------------------*/ + +void CallbackFileQuitOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmExitDialog(); + + XtCloseDisplay( XtDisplay( XtParent( MyWidget ) ) ); + XfsmExitErrorMessage( 0 ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileQuitCancel | +| | +\------------------------------------------------------------*/ + +void CallbackFileQuitCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileOpenOk | +| | +\------------------------------------------------------------*/ + +void CallbackFileOpenOk( MyWidget, ClientData, FileStruct ) + + Widget MyWidget; + caddr_t ClientData; + XmFileSelectionBoxCallbackStruct *FileStruct; +{ + char *FileName; + + autbegin(); + + XtUnmanageChild( XfsmFileOpenDialog.WIDGET ); + + XfsmExitDialog(); + + if ( FileStruct->value != NULL ) + { + XmStringGetLtoR( FileStruct->value, + XmSTRING_DEFAULT_CHARSET, + &FileName + ); + + FileName = XfsmPostTreatString( FileName ); + + if ( FileName != (char *)NULL ) + { + XfsmFileOpen( FileName ); + + XfsmChangeEditMode( XFSM_EDIT_MEASURE, + XfsmPromptEditMeasure ); + } + else + { + XfsmErrorMessage( XfsmMainWindow, "Unable to load this file !" ); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileOpenCancel | +| | +\------------------------------------------------------------*/ + +void CallbackFileOpenCancel( MyWidget, ClientData, FileStruct ) + + Widget MyWidget; + caddr_t ClientData; + XmFileSelectionBoxCallbackStruct *FileStruct; +{ + autbegin(); + + XtUnmanageChild( XfsmFileOpenDialog.WIDGET ); + + XfsmExitDialog(); + + autend(); +} diff --git a/alliance/src/xfsm/src/XMF_dialog.h b/alliance/src/xfsm/src/XMF_dialog.h new file mode 100644 index 00000000..3f78bfcc --- /dev/null +++ b/alliance/src/xfsm/src/XMF_dialog.h @@ -0,0 +1,79 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_FILE_DIALOG +# define XFSM_FILE_DIALOG + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XfsmDialogItem XfsmFileOpenDialog; + extern XfsmDialogItem XfsmFileQuitDialog; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackFileQuitOk(); + extern void CallbackFileQuitCancel(); + extern void CallbackFileOpenOk(); + extern void CallbackFileOpenCancel(); + +# endif diff --git a/alliance/src/xfsm/src/XMF_file.c b/alliance/src/xfsm/src/XMF_file.c new file mode 100644 index 00000000..d8309ac7 --- /dev/null +++ b/alliance/src/xfsm/src/XMF_file.c @@ -0,0 +1,186 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : File.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "ftl.h" +# include "XSB.h" +# include "XFS.h" +# include "XMX.h" +# include "XTB.h" +# include "XMF.h" + +# include "XMF_file.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + char XfsmFileFilter[ 10 ] = "*."; + char XfsmFileExtention[ 10 ] = "."; + + char XfsmFileBuffer[ 128 ]; + char XfsmDirectoryBuffer[ 512 ]; + + char *XFSM_WORK_LIB = (char *)NULL; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmFileOpen | +| | +\------------------------------------------------------------*/ + +void XfsmFileOpen( FileName ) + + char *FileName; +{ + int Index; + char *SWAP_WORK_LIB = WORK_LIB; + + autbegin(); + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_WATCH_CURSOR ); + XfsmUndisplayCursor(); + + XfsmDelConnect(); + XfsmDelFigure(); + + XfsmRecomputeBound = XFSM_TRUE; + + if ( XFSM_WORK_LIB == (char *)NULL ) + { + XFSM_WORK_LIB = WORK_LIB; + } + + if ( XfsmFileFilter[2] == '\0' ) + { + strcat( XfsmFileFilter, FSM_IN ); + strcat( XfsmFileExtention, FSM_IN ); + } + + for ( Index = strlen( FileName ); Index >= 0; Index-- ) + { + if ( FileName[ Index ] == '/' ) break; + } + + if ( Index >= 0 ) + { + strcpy( XfsmDirectoryBuffer, FileName ); + strcpy( XfsmFileBuffer, FileName + Index + 1); + + XfsmDirectoryBuffer[ Index + 1 ] = '\0'; + + WORK_LIB = XfsmDirectoryBuffer; + } + else + { + strcpy( XfsmFileBuffer, FileName ); + + WORK_LIB = XFSM_WORK_LIB; + } + + Index = strlen( XfsmFileBuffer ) - strlen( XfsmFileExtention ); + + if ( Index >= 0 ) + { + if ( ! strcmp( XfsmFileBuffer + Index, XfsmFileExtention ) ) + { + XfsmFileBuffer[ Index ] = '\0'; + } + } + + XfsmLoadFigure( XfsmFileBuffer ); + + if ( XfsmFigure != (xfsmfig_list *)NULL ) + { + XfsmChangeTopLevelTitle( XfsmFileBuffer ); + } + else + { + XfsmChangeTopLevelTitle( (char *)NULL ); + } + + XfsmDisplayToolsMessage(); + + XfsmInitializeZoom(); + XfsmDisplayFigure( 0, 0, XfsmGraphicDx, XfsmGraphicDy ); + + XfsmRefreshGraphicWindow( 0, 0, + XfsmGraphicDx, XfsmGraphicDy ); + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_NORMAL_CURSOR ); + XfsmDisplayCursor(); + + WORK_LIB = SWAP_WORK_LIB; + + autend(); +} diff --git a/alliance/src/xfsm/src/XMF_file.h b/alliance/src/xfsm/src/XMF_file.h new file mode 100644 index 00000000..67f4cc60 --- /dev/null +++ b/alliance/src/xfsm/src/XMF_file.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : File.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_FILE +# define XFSM_FILE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char XfsmFileFilter[ 10 ]; + extern char XfsmFileExtention[ 10 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmFileOpen(); + +# endif diff --git a/alliance/src/xfsm/src/XMF_menu.c b/alliance/src/xfsm/src/XMF_menu.c new file mode 100644 index 00000000..3d357ef0 --- /dev/null +++ b/alliance/src/xfsm/src/XMF_menu.c @@ -0,0 +1,191 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "ftl.h" +# include "XSB.h" +# include "XFS.h" +# include "XMX.h" +# include "XTB.h" +# include "XMF.h" + +# include "XMF_menu.h" +# include "XMF_dialog.h" +# include "XMF_file.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static XfsmFirstFileOpen = 1; + +/*------------------------------------------------------------\ +| | +| Menu | +| | +\------------------------------------------------------------*/ + + XfsmMenuItem XfsmFileMenu[] = + + { + { + "Open", + 'O', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackFileOpen, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XfsmMenuItem *)NULL + } + , + { + "Quit ", + 'Q', + "CtrlQ", + "Ctrl Q", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackFileQuit, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XfsmMenuItem *)NULL + } + , + NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackFileOpen | +| | +\------------------------------------------------------------*/ + +void CallbackFileOpen( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + XmString Filter; + + autbegin(); + + if ( XfsmFirstFileOpen ) + { + XfsmFirstFileOpen = 0; + + if ( XfsmFileFilter[2] == '\0' ) + { + strcat( XfsmFileFilter, FSM_IN ); + strcat( XfsmFileExtention, FSM_IN ); + } + + Filter = XmStringCreateSimple( XfsmFileFilter ); + + XtVaSetValues( XfsmFileOpenDialog.WIDGET, + XmNpattern, Filter, NULL); + + XmStringFree( Filter ); + } + + XfsmEnterDialog( &XfsmFileOpenDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileQuit | +| | +\------------------------------------------------------------*/ + +void CallbackFileQuit( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmEnterDialog( &XfsmFileQuitDialog ); + + autend(); +} diff --git a/alliance/src/xfsm/src/XMF_menu.h b/alliance/src/xfsm/src/XMF_menu.h new file mode 100644 index 00000000..62bacc88 --- /dev/null +++ b/alliance/src/xfsm/src/XMF_menu.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_FILE_MENU +# define XFSM_FILE_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackFileOpen(); + extern void CallbackFileQuit(); + +# endif diff --git a/alliance/src/xfsm/src/XMF_panel.c b/alliance/src/xfsm/src/XMF_panel.c new file mode 100644 index 00000000..c979450f --- /dev/null +++ b/alliance/src/xfsm/src/XMF_panel.c @@ -0,0 +1,826 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XFS.h" +# include "XMX.h" +# include "XTB.h" +# include "XMF.h" + +# include "XMF_panel.h" +# include "XMF_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XfsmPanelItem XfsmLibraryPanel = + + { + "Library", + 1, + 0, + XFSM_LIBRARY_X, + XFSM_LIBRARY_Y, + 250, + 375, + 0, + 0, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (XfsmPanelButtonItem *)NULL + }; + + int XfsmLibraryDefaultValues[ 5 ] = + + { + XFSM_LIBRARY_X, + XFSM_LIBRARY_Y, + 250, 375, 0 + }; + + static char **XFSM_CATA_LIB = (char **)NULL; + static char *XFSM_WORK_LIB = (char *)NULL; + static char *XFSM_DEFAULT_LIB = (char *)NULL; + + static char XfsmFirstLibrary = 1; + +/*------------------------------------------------------------\ +| | +| Buffer | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Widget For Library Panel | +| | +\------------------------------------------------------------*/ + + Widget XfsmLibraryListLabel; + Widget XfsmLibraryList; + + Widget XfsmLibraryButtonOk; + Widget XfsmLibraryButtonUpdate; + Widget XfsmLibraryButtonCancel; + + Widget XfsmLibraryCataLabel; + Widget XfsmLibraryCata; + + Widget XfsmLibraryWorkLabel; + Widget XfsmLibraryWork; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmIsDirectory | +| | +\------------------------------------------------------------*/ + +char XfsmIsDirectory( FileName ) + + char *FileName; +{ + struct stat Buffer; + + autbegin(); + + if ( stat( FileName, &Buffer ) != -1 ) + { + if ( ( Buffer.st_mode & S_IFMT ) == S_IFDIR ) + { + autend(); + return( 1 ); + } + } + + autend(); + return( 0 ); +} + +/*------------------------------------------------------------\ +| | +| XfsmSetLibraryList | +| | +\------------------------------------------------------------*/ + +void XfsmSetLibraryList() +{ + int Index; + XmString Label; + + autbegin(); + + XmListDeleteAllItems( XfsmLibraryList ); + + for ( Index = 0; + XFSM_CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + Label = XmStringCreateSimple( XFSM_CATA_LIB[ Index ] ); + XmListAddItem( XfsmLibraryList , Label , NULL ); + XmStringFree( Label ); + } + + Label = XmStringCreateSimple( XFSM_WORK_LIB ); + XmListAddItem( XfsmLibraryList , Label , NULL ); + XmStringFree( Label ); + + XFSM_DEFAULT_LIB = (char *)NULL; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmSetWorkLibrary | +| | +\------------------------------------------------------------*/ + +void XfsmSetWorkLibrary() +{ + autbegin(); + + XmTextSetString( XfsmLibraryWork, XFSM_WORK_LIB ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmSetCataLibrary | +| | +\------------------------------------------------------------*/ + +void XfsmSetCataLibrary() +{ + int Index; + long Length; + char *Buffer; + char *Scan; + + autbegin(); + + for ( Index = 0, Length = 0; + XFSM_CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + Length = Length + strlen( XFSM_CATA_LIB[ Index ] ) + 1; + } + + Buffer = (char *)autallocblock( Length + 1 ); + Buffer[ 0 ] = '\0'; + Scan = Buffer; + + for ( Index = 0; + XFSM_CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + strcpy( Scan, XFSM_CATA_LIB[ Index ] ); + strcat( Scan, "\n" ); + + Scan = Scan + strlen( Scan ); + } + + XmTextSetString( XfsmLibraryCata, Buffer ); + + autfreeblock( Buffer ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmInitializeLibrary | +| | +\------------------------------------------------------------*/ + +void XfsmInitializeLibrary() +{ + int Index; + + autbegin(); + + for ( Index = 0; CATA_LIB[ Index ] != (char *)NULL; Index++ ); + + XFSM_CATA_LIB = (char **)autallocblock( sizeof(char *) * ( Index + 1 )); + + for ( Index = 0; + CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + XFSM_CATA_LIB[ Index ] = autallocblock( strlen( CATA_LIB[ Index ] ) + 1 ); + strcpy( XFSM_CATA_LIB[ Index ], CATA_LIB[ Index ] ); + } + + XFSM_CATA_LIB[ Index ] = (char *)NULL; + + XFSM_WORK_LIB = autallocblock( strlen( WORK_LIB ) + 1 ); + strcpy( XFSM_WORK_LIB, WORK_LIB ); + + XfsmSetCataLibrary(); + XfsmSetWorkLibrary(); + XfsmSetLibraryList(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmGetCataLibrary | +| | +\------------------------------------------------------------*/ + + void XfsmGetCataLibrary() + { + char *NewCata; + char *Scan; + int Index; + int Count; + int Length; + + autbegin(); + + for ( Index = 0; + XFSM_CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + autfreeblock( XFSM_CATA_LIB[ Index ] ); + } + + autfreeblock( XFSM_CATA_LIB ); + + NewCata = XmTextGetString( XfsmLibraryCata ); + + Count = 1; + + for ( Index = 0; NewCata[ Index ] != '\0'; Index++ ) + { + if ( NewCata[ Index ] == '\n' ) + { + Count = Count + 1; + } + } + + XFSM_CATA_LIB = (char **)autallocblock( sizeof(char *) * ( Count + 1 )); + + Count = 0; + Scan = NewCata; + + for ( Index = 0; NewCata[ Index ] != '\0'; Index++ ) + { + if ( NewCata[ Index ] == '\n' ) + { + NewCata[ Index ] = '\0'; + + Length = strlen( Scan ); + + if ( ( Length > 0 ) && + ( XfsmIsDirectory( Scan ) ) ) + { + XFSM_CATA_LIB[ Count ] = autallocblock( Length + 1 ); + strcpy( XFSM_CATA_LIB[ Count ], Scan ); + Count = Count + 1; + } + + Scan = NewCata + Index + 1; + } + else + if ( NewCata[ Index ] == ' ' ) + { + NewCata[ Index ] = '\0'; + } + } + + Length = strlen( Scan ); + + if ( Length > 0 ) + { + XFSM_CATA_LIB[ Count ] = autallocblock( Length + 1 ); + strcpy( XFSM_CATA_LIB[ Count ], Scan ); + Count = Count + 1; + } + + XFSM_CATA_LIB[ Count ] = (char *)NULL; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmGetWorkLibrary | +| | +\------------------------------------------------------------*/ + +void XfsmGetWorkLibrary() +{ + char *NewWork; + + autbegin(); + + autfreeblock( XFSM_WORK_LIB ); + + NewWork = XmTextGetString( XfsmLibraryWork ); + + if ( XfsmIsDirectory( NewWork ) ) + { + XFSM_WORK_LIB = autallocblock( strlen( NewWork ) + 1 ); + strcpy( XFSM_WORK_LIB, NewWork ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLibraryList | +| | +\------------------------------------------------------------*/ + +void CallbackLibraryList( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmListCallbackStruct *CallData; +{ + autbegin(); + + XFSM_DEFAULT_LIB = XFSM_CATA_LIB[ CallData->item_position - 1 ]; + + if ( XFSM_DEFAULT_LIB == (char *)NULL ) + { + XFSM_DEFAULT_LIB = XFSM_WORK_LIB; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLibraryOk | +| | +\------------------------------------------------------------*/ + +void CallbackLibraryOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + XmString Label; + int Index; + + autbegin(); + + XfsmExitPanel( &XfsmLibraryPanel ); + + XfsmExitDialog(); + + if ( XfsmFirstLibrary == 0 ) + { + for ( Index = 0; + CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + autfreeblock( CATA_LIB[ Index ] ); + } + + autfreeblock( CATA_LIB ); + autfreeblock( WORK_LIB ); + } + + XfsmFirstLibrary = 0; + + CATA_LIB = XFSM_CATA_LIB; + WORK_LIB = XFSM_WORK_LIB; + + if ( XFSM_DEFAULT_LIB != (char *)NULL ) + { + Label = XmStringCreateSimple( XFSM_DEFAULT_LIB ); + + XtVaSetValues( XfsmFileOpenDialog.WIDGET, + XmNdirectory, Label, NULL ); + + XmStringFree( Label ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLibraryUpdate | +| | +\------------------------------------------------------------*/ + +void CallbackLibraryUpdate( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmGetCataLibrary(); + XfsmGetWorkLibrary(); + XfsmSetLibraryList(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLibraryCancel | +| | +\------------------------------------------------------------*/ + +void CallbackLibraryCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + int Index; + + autbegin(); + + for ( Index = 0; + XFSM_CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + autfreeblock( XFSM_CATA_LIB[ Index ] ); + } + + autfreeblock( XFSM_CATA_LIB ); + autfreeblock( XFSM_WORK_LIB ); + + XfsmExitPanel( &XfsmLibraryPanel ); + + XfsmExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEnterLibrary | +| | +\------------------------------------------------------------*/ + +void CallbackEnterLibrary( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmInitializeLibrary(); + + XfsmEnterPanel( &XfsmLibraryPanel ); + XfsmLimitedLoop( XfsmLibraryPanel.PANEL ); + XfsmReEnterDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmBuildPanelLibrary | +| | +\------------------------------------------------------------*/ + +void XfsmBuildPanelLibrary() +{ + Arg Args[15]; + XmString Label; + + autbegin(); + + XtSetArg( Args[0], XmNshadowType , XmSHADOW_ETCHED_IN ); + XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING ); + XtSetArg( Args[2], XmNtitle , XfsmLibraryPanel.TITLE ); + + XfsmLibraryPanel.PANEL = + + XmCreateFormDialog( XfsmMainWindow, "XfsmLibraryPanel", Args, 3); + + XtAddCallback( XfsmLibraryPanel.PANEL, XmNdestroyCallback, + XfsmDestroyDialogCallback, NULL ); + + XfsmLibraryPanel.PANEL_FORM = + + XtVaCreateManagedWidget( "XfsmLibraryPanelForm", + xmFormWidgetClass, + XfsmLibraryPanel.PANEL, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , 10, + NULL + ); + + XfsmLibraryPanel.FRAME = + + XtVaCreateManagedWidget( "XfsmLibraryFrame", + xmFrameWidgetClass, + XfsmLibraryPanel.PANEL_FORM, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + NULL + ); + + XfsmLibraryPanel.FORM = + + XtVaCreateManagedWidget( "XfsmLibraryForm", + xmFormWidgetClass, + XfsmLibraryPanel.FRAME, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , 120, + NULL + ); + + XfsmLibraryButtonUpdate = + + XtVaCreateManagedWidget( "Update", + xmPushButtonWidgetClass, + XfsmLibraryPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 10, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 40, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 105, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 115, + NULL + ); + + XfsmLibraryButtonOk = + + XtVaCreateManagedWidget( "Ok", + xmPushButtonWidgetClass, + XfsmLibraryPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 50, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 70, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 105, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 115, + NULL + ); + + XfsmLibraryButtonCancel = + + XtVaCreateManagedWidget( "Cancel", + xmPushButtonWidgetClass, + XfsmLibraryPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 80, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 110, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 105, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 115, + NULL + ); + + Label = XmStringCreateSimple( "Directories" ); + + XfsmLibraryListLabel = + + XtVaCreateManagedWidget( "XfsmLibraryListLabel", + xmLabelGadgetClass , + XfsmLibraryPanel.FORM, + XmNlabelString , Label, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 5, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 5, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 10, + NULL ); + + XmStringFree( Label ); + + XtSetArg( Args[0] , XmNtopAttachment , XmATTACH_POSITION ); + XtSetArg( Args[1] , XmNtopPosition , 10 ); + XtSetArg( Args[2] , XmNbottomAttachment , XmATTACH_POSITION ); + XtSetArg( Args[3] , XmNbottomPosition , 40 ); + XtSetArg( Args[4] , XmNrightAttachment , XmATTACH_POSITION ); + XtSetArg( Args[5] , XmNrightPosition , 115 ); + XtSetArg( Args[6] , XmNleftAttachment , XmATTACH_POSITION ); + XtSetArg( Args[7] , XmNleftPosition , 5 ); + XtSetArg( Args[8] , XmNscrollBarDisplayPolicy, XmSTATIC ); + XtSetArg( Args[9] , XmNscrollHorizontal , True ); + XtSetArg( Args[10] , XmNscrollVertical , True ); + XtSetArg( Args[11] , XmNlistSizePolicy , XmCONSTANT ); + + XfsmLibraryList = + + XmCreateScrolledList( XfsmLibraryPanel.FORM, + "XfsmLibraryList", Args, 12 ); + + Label = XmStringCreateSimple( "Catalog libraries" ); + + XfsmLibraryCataLabel = + + XtVaCreateManagedWidget( "XfsmLibraryCataLabel", + xmLabelGadgetClass , + XfsmLibraryPanel.FORM, + XmNlabelString , Label, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 5, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 45, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 50, + NULL ); + + XmStringFree( Label ); + + XtSetArg( Args[0] , XmNrows , 4 ); + XtSetArg( Args[1] , XmNeditable , True ); + XtSetArg( Args[2] , XmNcursorPositionVisible , True ); + XtSetArg( Args[3] , XmNscrollHorizontal , True ); + XtSetArg( Args[4] , XmNscrollVertical , True ); + XtSetArg( Args[5] , XmNeditMode , XmMULTI_LINE_EDIT ); + XtSetArg( Args[6] , XmNtopAttachment , XmATTACH_POSITION ); + XtSetArg( Args[7] , XmNtopPosition , 50 ); + XtSetArg( Args[8] , XmNleftAttachment , XmATTACH_POSITION ); + XtSetArg( Args[9] , XmNleftPosition , 5 ); + XtSetArg( Args[10] , XmNrightAttachment , XmATTACH_POSITION ); + XtSetArg( Args[11] , XmNrightPosition , 115 ); + XtSetArg( Args[12] , XmNbottomAttachment , XmATTACH_POSITION ); + XtSetArg( Args[13] , XmNbottomPosition , 80 ); + + XfsmLibraryCata = + + XmCreateScrolledText( XfsmLibraryPanel.FORM, + "XfsmLibraryCata", Args, 14 ); + + Label = XmStringCreateSimple( "Work library" ); + + XfsmLibraryWorkLabel = + + XtVaCreateManagedWidget( "XfsmLibraryWorkLabel", + xmLabelGadgetClass , + XfsmLibraryPanel.FORM, + XmNlabelString , Label, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 5, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 85, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 90, + NULL ); + XmStringFree( Label ); + + XtSetArg( Args[0] , XmNrows , 1 ); + XtSetArg( Args[1] , XmNeditable , True ); + XtSetArg( Args[2] , XmNeditMode , XmSINGLE_LINE_EDIT ); + XtSetArg( Args[3] , XmNscrollHorizontal , False ); + XtSetArg( Args[4] , XmNscrollVertical , False ); + XtSetArg( Args[5] , XmNcursorPositionVisible , True ); + XtSetArg( Args[6] , XmNtopAttachment , XmATTACH_POSITION ); + XtSetArg( Args[7] , XmNtopPosition , 90 ); + XtSetArg( Args[8] , XmNleftAttachment , XmATTACH_POSITION ); + XtSetArg( Args[9] , XmNleftPosition , 5 ); + XtSetArg( Args[10] , XmNrightAttachment , XmATTACH_POSITION ); + XtSetArg( Args[11] , XmNrightPosition , 115 ); + XtSetArg( Args[12] , XmNbottomAttachment , XmATTACH_POSITION ); + XtSetArg( Args[13] , XmNbottomPosition , 100 ); + + XfsmLibraryWork = + + XmCreateText( XfsmLibraryPanel.FORM, + "XfsmLibraryWork", Args, 14 ); + + XtManageChild( XfsmLibraryWork ); + XtManageChild( XfsmLibraryList ); + XtManageChild( XfsmLibraryCata ); + + XtAddCallback( XfsmLibraryList, + XmNdefaultActionCallback, + CallbackLibraryList, NULL ); + + XtAddCallback( XfsmLibraryButtonOk, + XmNactivateCallback, + CallbackLibraryOk, NULL ); + + XtAddCallback( XfsmLibraryButtonCancel, + XmNactivateCallback, + CallbackLibraryCancel, NULL ); + + XtAddCallback( XfsmLibraryButtonUpdate, + XmNactivateCallback, + CallbackLibraryUpdate, NULL ); + + XtVaSetValues( XfsmLibraryPanel.PANEL, + XmNheight, XfsmLibraryPanel.HEIGHT, + XmNwidth , XfsmLibraryPanel.WIDTH, + XmNx , XfsmLibraryPanel.X, + XmNy , XfsmLibraryPanel.Y, + NULL ); + + Label = XmStringCreateSimple( "Library" ); + + XtVaSetValues( XmFileSelectionBoxGetChild( XfsmFileOpenDialog.WIDGET, + XmDIALOG_HELP_BUTTON ), + XmNlabelString, Label, NULL ); + + XmStringFree( Label ); + + XtAddCallback( XmFileSelectionBoxGetChild( XfsmFileOpenDialog.WIDGET, + XmDIALOG_HELP_BUTTON ), + XmNactivateCallback, + CallbackEnterLibrary, NULL ); + + autend(); +} diff --git a/alliance/src/xfsm/src/XMF_panel.h b/alliance/src/xfsm/src/XMF_panel.h new file mode 100644 index 00000000..83446db1 --- /dev/null +++ b/alliance/src/xfsm/src/XMF_panel.h @@ -0,0 +1,79 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_FILE_PANEL +# define XFSM_FILE_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XFSM_LIBRARY_X 100 +# define XFSM_LIBRARY_Y 230 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackLibraryList(); + extern void CallbackLibraryOk(); + extern void CallbackLibraryUpdate(); + extern void CallbackLibraryCancel(); + extern void CallbackEnterLibrary(); + +# endif diff --git a/alliance/src/xfsm/src/XMH.h b/alliance/src/xfsm/src/XMH.h new file mode 100644 index 00000000..f14e4ab1 --- /dev/null +++ b/alliance/src/xfsm/src/XMH.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : XMH101.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_XMH +# define XFSM_XMH + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XfsmMenuItem XfsmHelpMenu[]; + extern XfsmPanelItem XfsmHelpPresentPanel; + + extern int XfsmHelpPresentDefaultValues[5]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmBuildPresentPanel(); + extern void XfsmEnterPresentPanel(); + +# endif diff --git a/alliance/src/xfsm/src/XMH_help.c b/alliance/src/xfsm/src/XMH_help.c new file mode 100644 index 00000000..900c1afc --- /dev/null +++ b/alliance/src/xfsm/src/XMH_help.c @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Help.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "XSB.h" +# include "XTB.h" +# include "XMH.h" +# include "XMX.h" + +# include "XMH_help.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ diff --git a/alliance/src/xfsm/src/XMH_help.h b/alliance/src/xfsm/src/XMH_help.h new file mode 100644 index 00000000..b0bbfb6d --- /dev/null +++ b/alliance/src/xfsm/src/XMH_help.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Help.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_HELP +# define XFSM_HELP + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xfsm/src/XMH_menu.c b/alliance/src/xfsm/src/XMH_menu.c new file mode 100644 index 00000000..bcc56ca0 --- /dev/null +++ b/alliance/src/xfsm/src/XMH_menu.c @@ -0,0 +1,127 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XTB.h" +# include "XSB.h" +# include "XMH.h" +# include "XMX.h" + +# include "XMH_menu.h" +# include "XMH_panel.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Help Menu | +| | +\------------------------------------------------------------*/ + + XfsmMenuItem XfsmHelpMenu[] = + + { + { + "About Xfsm", + 'G', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackHelpAbout, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XfsmMenuItem *)NULL + } + , + NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackHelpAbout | +| | +\------------------------------------------------------------*/ + +void CallbackHelpAbout( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmEnterPresentPanel(); + + autend(); +} diff --git a/alliance/src/xfsm/src/XMH_menu.h b/alliance/src/xfsm/src/XMH_menu.h new file mode 100644 index 00000000..f1bb6215 --- /dev/null +++ b/alliance/src/xfsm/src/XMH_menu.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_HELP_MENU +# define XFSM_HELP_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackHelpAbout(); + +# endif diff --git a/alliance/src/xfsm/src/XMH_panel.c b/alliance/src/xfsm/src/XMH_panel.c new file mode 100644 index 00000000..013d87ae --- /dev/null +++ b/alliance/src/xfsm/src/XMH_panel.c @@ -0,0 +1,324 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XMH.h" + +# include "XMH_panel.h" +# include "LIP6bw.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XfsmPanelItem XfsmHelpPresentPanel = + + { + "Xfsm present", + 1, + 0, + XFSM_HELP_PRESENT_X, + XFSM_HELP_PRESENT_Y, + 700, + 360, + 0, + 0, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (XfsmPanelButtonItem *)NULL + }; + + int XfsmHelpPresentDefaultValues[ 5 ] = + + { + XFSM_HELP_PRESENT_X, + XFSM_HELP_PRESENT_Y, + 700, 360, 0 + }; + + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmBuildPresentPanel | +| | +\------------------------------------------------------------*/ + +void XfsmBuildPresentPanel() + +{ + Widget PanelLabel; + Widget PanelButton; + Pixmap PanelPixmap; + XmString PanelString; + XmString PanelString1; + XmString PanelString2; + XmFontList PanelFontList; + XFontStruct *PanelFont; + Display *PanelDisplay; + char Buffer[ 64 ]; + Arg Args[3]; + + autbegin(); + + PanelDisplay = XtDisplay( XfsmMainWindow ); + PanelFont = XLoadQueryFont( PanelDisplay, "-*-helvetica-bold-o-*--24-*" ); + PanelFontList = XmFontListCreate( PanelFont, "Panel_charset1" ); + PanelFont = XLoadQueryFont( PanelDisplay, "-*-helvetica-bold-r-*--18-*" ); + PanelFontList = XmFontListAdd( PanelFontList, PanelFont, "Panel_charset2" ); + PanelFont = XLoadQueryFont( PanelDisplay, "-*-helvetica-bold-r-*--12-*" ); + PanelFontList = XmFontListAdd( PanelFontList, PanelFont, "Panel_charset4" ); + + XtSetArg( Args[0], XmNshadowType , XmSHADOW_ETCHED_IN ); + XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING ); + XtSetArg( Args[2], XmNtitle , "Xfsm present" ); + + XfsmHelpPresentPanel.PANEL = + + XmCreateFormDialog( XfsmMainWindow, XfsmHelpPresentPanel.TITLE, Args, 3); + + XtAddCallback( XfsmHelpPresentPanel.PANEL, XmNdestroyCallback, + XfsmDestroyDialogCallback, NULL ); + + XfsmHelpPresentPanel.PANEL_FORM = + + XtVaCreateManagedWidget( "", + xmFormWidgetClass, + XfsmHelpPresentPanel.PANEL, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + NULL + ); + + XfsmHelpPresentPanel.FRAME = + + XtVaCreateManagedWidget( "", + xmFrameWidgetClass, + XfsmHelpPresentPanel.PANEL_FORM, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 05, + XmNbottomAttachment, XmATTACH_POSITION, + XmNbottomPosition , 95, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 05, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 95, + NULL + ); + + XfsmHelpPresentPanel.FORM = + + XtVaCreateManagedWidget( "", + xmFormWidgetClass, + XfsmHelpPresentPanel.FRAME, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 05, + XmNbottomAttachment, XmATTACH_POSITION, + XmNbottomPosition , 95, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 05, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 95, + NULL + ); + + PanelPixmap = XfsmCreatePixmap( XfsmMainWindow, + LIP6bw_bits, + LIP6bw_width, + LIP6bw_height); + + PanelLabel = XtVaCreateManagedWidget( "", + xmLabelGadgetClass, + XfsmHelpPresentPanel.FORM, + XmNlabelType , XmPIXMAP, + XmNlabelPixmap , PanelPixmap, + NULL + ); + + sprintf( Buffer, "ALLIANCE CAD SYSTEM %s\n", ALLIANCE_VERSION ); + + PanelString = XmStringCreateLtoR( Buffer, "Panel_charset2" ); + + PanelLabel = XtVaCreateManagedWidget( "", + xmLabelWidgetClass, + XfsmHelpPresentPanel.FORM, + XmNfontList , PanelFontList, + XmNlabelString , PanelString, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 15, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 75, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 25, + NULL + ); + XmStringFree( PanelString ); + + PanelString1 = XmStringCreateLtoR( "Xfsm" , "Panel_charset1" ); + PanelString2 = XmStringCreateLtoR( "\n( Touch Me )", "Panel_charset4" ); + PanelString = XmStringConcat( PanelString1, PanelString2 ); + + PanelButton = XtVaCreateManagedWidget( "", + xmPushButtonWidgetClass, + XfsmHelpPresentPanel.FORM, + XmNfontList , PanelFontList, + XmNlabelString , PanelString, + XmNshadowThickness , 3, + XmNtopAttachment , XmATTACH_WIDGET, + XmNtopWidget , PanelLabel, + XmNtopOffset , 5, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 60, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 40, + NULL + ); + XmStringFree( PanelString ); + XmStringFree( PanelString1 ); + XmStringFree( PanelString2 ); + + XtAddCallback( PanelButton, + XmNactivateCallback, + XfsmExitDialogCallback, NULL ); + + sprintf( Buffer, "\nGraphic FSM Viewer\nVersion %s", XFSM_VERSION ); + + PanelString = XmStringCreateLtoR( Buffer, "Panel_charset2" ); + + PanelLabel = XtVaCreateManagedWidget( "", + xmLabelWidgetClass, + XfsmHelpPresentPanel.FORM, + XmNfontList , PanelFontList, + XmNlabelString , PanelString, + XmNtopAttachment , XmATTACH_WIDGET, + XmNtopWidget , PanelButton, + XmNtopOffset , 5, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 75, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 25, + NULL + ); + XmStringFree( PanelString ); + + PanelString = XmStringCreateLtoR( "copyright \251 1995-2000 ASIM, \ +CAO-VLSI Team\nWritten by Ludovic Jacomme\nE-mail support: alliance-support@asim.lip6.fr", "Panel_charset4" ); + + PanelLabel = XtVaCreateManagedWidget( "", + xmLabelWidgetClass, + XfsmHelpPresentPanel.FORM, + XmNfontList , PanelFontList, + XmNlabelString , PanelString, + XmNtopAttachment , XmATTACH_WIDGET, + XmNtopWidget , PanelLabel, + XmNtopOffset , 5, + XmNrightAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + NULL + ); + XmStringFree( PanelString ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmEnterPresentPanel | +| | +\------------------------------------------------------------*/ + +void XfsmEnterPresentPanel() + +{ + autbegin(); + + XfsmEnterPanel( &XfsmHelpPresentPanel ); + + XfsmLimitedLoop( XfsmHelpPresentPanel.PANEL ); + + XfsmExitPanel( &XfsmHelpPresentPanel ); + + autend(); +} diff --git a/alliance/src/xfsm/src/XMH_panel.h b/alliance/src/xfsm/src/XMH_panel.h new file mode 100644 index 00000000..4d82fb7e --- /dev/null +++ b/alliance/src/xfsm/src/XMH_panel.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_HELP_PANEL +# define XFSM_HELP_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XFSM_HELP_PRESENT_X 180 +# define XFSM_HELP_PRESENT_Y 200 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xfsm/src/XMS.h b/alliance/src/xfsm/src/XMS.h new file mode 100644 index 00000000..15ecb51c --- /dev/null +++ b/alliance/src/xfsm/src/XMS.h @@ -0,0 +1,79 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : XMS.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_XMS +# define XFSM_XMS + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XfsmMenuItem XfsmSetupMenu[]; + extern XfsmPanelItem XfsmSetupInformationsPanel; + + extern int XfsmSetupInformationsDefaultValues[ 5 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackSetupLoadConfig(); + extern void CallbackSetupSaveConfig(); + extern void CallbackSetupDefaultConfig(); + extern void CallbackSetupInformations(); + + extern void XfsmLoadConfig(); + extern void XfsmLoadTopLevelConfig(); + +# endif diff --git a/alliance/src/xfsm/src/XMS_dialog.c b/alliance/src/xfsm/src/XMS_dialog.c new file mode 100644 index 00000000..75c83aa0 --- /dev/null +++ b/alliance/src/xfsm/src/XMS_dialog.c @@ -0,0 +1,84 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XFS.h" +# include "XMX.h" +# include "XTB.h" +# include "XMS.h" + +# include "XMS_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ diff --git a/alliance/src/xfsm/src/XMS_dialog.h b/alliance/src/xfsm/src/XMS_dialog.h new file mode 100644 index 00000000..d5072b94 --- /dev/null +++ b/alliance/src/xfsm/src/XMS_dialog.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_SETUP_DIALOG +# define XFSM_SETUP_DIALOG + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xfsm/src/XMS_menu.c b/alliance/src/xfsm/src/XMS_menu.c new file mode 100644 index 00000000..9790cf0c --- /dev/null +++ b/alliance/src/xfsm/src/XMS_menu.c @@ -0,0 +1,234 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XTB.h" +# include "XMS.h" + +# include "XMS_menu.h" +# include "XMS_panel.h" +# include "XMS_setup.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XfsmMenuItem XfsmSetupMenu[] = + + { + { + "Default Config", + 'D', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackSetupDefaultConfig, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XfsmMenuItem *)NULL + } + , + { + "Load Config", + 'L', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackSetupLoadConfig, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XfsmMenuItem *)NULL + } + , + { + "Save Config", + 'S', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackSetupSaveConfig, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XfsmMenuItem *)NULL + } + , + { + "Informations", + 'I', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackSetupInformations, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XfsmMenuItem *)NULL + } + , + NULL + }; + + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackSetupLoadConfig | +| | +\------------------------------------------------------------*/ + +void CallbackSetupLoadConfig( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmLoadConfig( XFSM_TRUE ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSetupSaveConfig | +| | +\------------------------------------------------------------*/ + +void CallbackSetupSaveConfig( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmSaveConfig(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSetupDefaultConfig | +| | +\------------------------------------------------------------*/ + +void CallbackSetupDefaultConfig( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmDefaultConfig(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSetupInformations | +| | +\------------------------------------------------------------*/ + +void CallbackSetupInformations( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmDisplayInformations(); + + autend(); +} + diff --git a/alliance/src/xfsm/src/XMS_menu.h b/alliance/src/xfsm/src/XMS_menu.h new file mode 100644 index 00000000..0652e268 --- /dev/null +++ b/alliance/src/xfsm/src/XMS_menu.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_SETUP_MENU +# define XFSM_SETUP_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xfsm/src/XMS_panel.c b/alliance/src/xfsm/src/XMS_panel.c new file mode 100644 index 00000000..2bd0dc97 --- /dev/null +++ b/alliance/src/xfsm/src/XMS_panel.c @@ -0,0 +1,183 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XTB.h" +# include "XFS.h" +# include "XMS.h" + +# include "XMS_panel.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Panel | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Panel Informations | +| | +\------------------------------------------------------------*/ + + static char *XfsmPanelInformationsButtonName[] = + + { + "Text", + "Close" + }; + + XfsmPanelButtonItem XfsmSetupInformationsButton[] = + + { + { + &XfsmPanelInformationsButtonName[0], + "Nothing", NULL, 0, 0, + NULL, + NULL, + 0, 0, + 8, 9, + NULL, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmPanelInformationsButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 3, 9, + 2, 1, + XfsmExitDialogCallback, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XfsmPanelItem XfsmSetupInformationsPanel = + + { + "Informations", + 1, + 0, + XFSM_SETUP_INFORMATIONS_X, + XFSM_SETUP_INFORMATIONS_Y, + 360, + 250, + 8, + 10, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XfsmSetupInformationsButton + }; + + int XfsmSetupInformationsDefaultValues[ 5 ] = + + { + XFSM_SETUP_INFORMATIONS_X, + XFSM_SETUP_INFORMATIONS_Y, + 360, 250, 0 + }; + +/*------------------------------------------------------------\ +| | +| Callback For Informations | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmDisplayInformations | +| | +\------------------------------------------------------------*/ + +void XfsmDisplayInformations() + +{ + char *Message; + + autbegin(); + + Message = XfsmGetInformations(); + + XmTextSetString( XfsmSetupInformationsButton[0].BUTTON, Message ); + + XfsmEnterPanel( &XfsmSetupInformationsPanel ); + + XfsmLimitedLoop( XfsmSetupInformationsPanel.PANEL ); + + XfsmExitPanel( &XfsmSetupInformationsPanel ); + + autend(); +} diff --git a/alliance/src/xfsm/src/XMS_panel.h b/alliance/src/xfsm/src/XMS_panel.h new file mode 100644 index 00000000..5e8de90f --- /dev/null +++ b/alliance/src/xfsm/src/XMS_panel.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_SETUP_PANEL +# define XFSM_SETUP_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XFSM_SETUP_INFORMATIONS_X 330 +# define XFSM_SETUP_INFORMATIONS_Y 280 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmDisplayInformations(); + +# endif diff --git a/alliance/src/xfsm/src/XMS_setup.c b/alliance/src/xfsm/src/XMS_setup.c new file mode 100644 index 00000000..e89bc259 --- /dev/null +++ b/alliance/src/xfsm/src/XMS_setup.c @@ -0,0 +1,520 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Setup.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XMF.h" +# include "XME.h" +# include "XMV.h" +# include "XMT.h" +# include "XMS.h" +# include "XMH.h" + +# include "XMS_setup.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static FILE *FileConfig; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Set Panel New Values | +| | +\------------------------------------------------------------*/ + +void XfsmSetPanelValues( Panel, Values ) + + XfsmPanelItem *Panel; + int *Values; +{ + autbegin(); + + Panel->COMPUTE = 1; + Panel->X = Values[0]; + Panel->Y = Values[1]; + Panel->WIDTH = Values[2]; + Panel->HEIGHT = Values[3]; + Panel->MANAGED = Values[4]; + + XtVaSetValues( Panel->PANEL, + XmNx , Values[0], + XmNy , Values[1], + XmNwidth , Values[2], + XmNheight , Values[3], + NULL ); + + if ( Panel->MANAGED ) + { + XfsmEnterPanel( Panel ); + } + else + { + XtUnmanageChild( Panel->PANEL ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Write TopLevel Values | +| | +\------------------------------------------------------------*/ + +void XfsmWriteTopLevelValues() + +{ + Dimension Values[5]; + + autbegin(); + + XtVaGetValues( XfsmTopLevel, + XmNx , &Values[0], + XmNy , &Values[1], + XmNwidth , &Values[2], + XmNheight , &Values[3], + NULL ); + + Values[0] = Values[0] - XFSM_TOPLEVEL_TRANSLATE_X; + Values[1] = Values[1] - XFSM_TOPLEVEL_TRANSLATE_Y; + Values[4] = 1; + + fprintf( FileConfig, "VERSION: %s\n", XFSM_VERSION ); + fprintf( FileConfig, "X: %d, Y: %d, WIDTH: %d, HEIGHT: %d, MANAGED: %d\n", + Values[0], Values[1], Values[2], Values[3], Values[4] ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Write Panel Values | +| | +\------------------------------------------------------------*/ + +void XfsmWritePanelValues( Panel ) + + XfsmPanelItem *Panel; +{ + Dimension Values[5]; + + autbegin(); + + if ( Panel->COMPUTE == 0 ) + { + XtVaGetValues( Panel->PANEL, + XmNx , &Values[0], + XmNy , &Values[1], + XmNwidth , &Values[2], + XmNheight , &Values[3], + NULL ); + + Values[0] = Values[0] - XFSM_PANEL_TRANSLATE_X; + Values[1] = Values[1] - XFSM_PANEL_TRANSLATE_Y; + } + else + { + Values[0] = Panel->X; + Values[1] = Panel->Y; + Values[2] = Panel->WIDTH; + Values[3] = Panel->HEIGHT; + } + + Values[4] = Panel->MANAGED; + + fprintf( FileConfig, "X: %d, Y: %d, WIDTH: %d, HEIGHT: %d, MANAGED: %d\n", + Values[0], Values[1], Values[2], Values[3], Values[4] ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Read Panel Values | +| | +\------------------------------------------------------------*/ + +void XfsmReadPanelValues( Panel ) + + XfsmPanelItem *Panel; +{ + int Values[5]; + + autbegin(); + + fscanf( FileConfig, "X: %d, Y: %d, WIDTH: %d, HEIGHT: %d, MANAGED: %d\n", + &Values[0], &Values[1], &Values[2], &Values[3], &Values[4] ); + + XfsmSetPanelValues( Panel, Values ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Read Panel Values | +| | +\------------------------------------------------------------*/ + +char XfsmReadTopLevelValues() + +{ + int Values[5]; + char Version[64]; + + autbegin(); + + fscanf( FileConfig, "VERSION: %s\n", Version ); + + if ( strcmp( Version, XFSM_VERSION ) ) + { + autend(); + return( 0 ); + } + + fscanf( FileConfig, "X: %d, Y: %d, WIDTH: %d, HEIGHT: %d, MANAGED: %d\n", + &Values[0], &Values[1], &Values[2], &Values[3], &Values[4] ); + + XtVaSetValues( XfsmTopLevel, + XmNx , Values[0], + XmNy , Values[1], + XmNwidth , Values[2], + XmNheight , Values[3], + NULL ); + autend(); + return( 1 ); +} + +/*------------------------------------------------------------\ +| | +| ReadActiveLayers | +| | +\------------------------------------------------------------*/ + +void XfsmReadActiveLayers() + +{ + short Layer; + int Value; + + autbegin(); + + for ( Layer = 0; Layer < XFSM_MAX_LAYER; Layer++ ) + { + fscanf( FileConfig, "ACTIVE: %d\n", &Value ); + + XFSM_ACTIVE_LAYER_TABLE[ Layer ] = Value; + } + + for ( Layer = 0; Layer < XFSM_MAX_ACTIVE_NAME; Layer++ ) + { + fscanf( FileConfig, "ACTIVE: %d\n", &Value ); + + XFSM_ACTIVE_NAME_TABLE[ Layer ] = Value; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| WriteActiveLayers | +| | +\------------------------------------------------------------*/ + +void XfsmWriteActiveLayers() + +{ + char Layer; + + autbegin(); + + for ( Layer = 0; Layer < XFSM_MAX_LAYER; Layer++ ) + { + fprintf( FileConfig, "ACTIVE: %d\n", + XFSM_ACTIVE_LAYER_TABLE[ Layer ] ); + } + + for ( Layer = 0; Layer < XFSM_MAX_ACTIVE_NAME; Layer++ ) + { + fprintf( FileConfig, "ACTIVE: %d\n", + XFSM_ACTIVE_NAME_TABLE[ Layer ] ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmDefaultTopLevelValues | +| | +\------------------------------------------------------------*/ + +void XfsmDefaultTopLevelValues() + +{ + autbegin(); + + XtVaSetValues( XfsmTopLevel, + XmNheight , XFSM_TOPLEVEL_HEIGHT, + XmNwidth , XFSM_TOPLEVEL_WIDTH, + XmNx , XFSM_TOPLEVEL_X, + XmNy , XFSM_TOPLEVEL_Y, + NULL + ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmDefaultConfig | +| | +\------------------------------------------------------------*/ + +void XfsmDefaultConfig() + +{ + short Layer; + + autbegin(); + + XfsmDefaultTopLevelValues(); + + XfsmSetPanelValues( &XfsmViewArrowsPanel, + XfsmViewArrowsDefaultValues ); + XfsmSetPanelValues( &XfsmViewZoomPanel, + XfsmViewZoomDefaultValues ); + XfsmSetPanelValues( &XfsmViewGridPanel, + XfsmViewGridDefaultValues ); + XfsmSetPanelValues( &XfsmViewLayerPanel, + XfsmViewLayerDefaultValues ); + XfsmSetPanelValues( &XfsmViewMapPanel, + XfsmViewMapDefaultValues ); + XfsmSetPanelValues( &XfsmEditSearchViewPanel, + XfsmEditSearchViewDefaultValues ); + XfsmSetPanelValues( &XfsmEditSelectPanel, + XfsmEditSelectDefaultValues ); + XfsmSetPanelValues( &XfsmEditIdentifyPanel, + XfsmEditIdentifyDefaultValues ); + XfsmSetPanelValues( &XfsmToolsMessagePanel, + XfsmToolsMessageDefaultValues ); + XfsmSetPanelValues( &XfsmSetupInformationsPanel, + XfsmSetupInformationsDefaultValues ); + XfsmSetPanelValues( &XfsmHelpPresentPanel, + XfsmHelpPresentDefaultValues ); + + for ( Layer = 0; Layer < XFSM_MAX_LAYER; Layer++ ) + { + XFSM_ACTIVE_LAYER_TABLE[ Layer ] = 1; + } + + for ( Layer = 0; Layer < XFSM_MAX_ACTIVE_NAME; Layer++ ) + { + XFSM_ACTIVE_NAME_TABLE[ Layer ] = 1; + } + + XfsmInitializeLayer(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmLoadTopLevelConfig | +| | +\------------------------------------------------------------*/ + +void XfsmLoadTopLevelConfig() + +{ + autbegin(); + + FileConfig = fopen( XFSM_XMS_FILE_NAME, "r" ); + + if ( FileConfig == (FILE *)NULL ) + { + XfsmDefaultTopLevelValues(); + } + else + { + if ( ! XfsmReadTopLevelValues() ) + { + XfsmDefaultTopLevelValues(); + } + + fclose( FileConfig ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmLoadConfig | +| | +\------------------------------------------------------------*/ + +void XfsmLoadConfig( Message ) + + char Message; +{ + autbegin(); + + FileConfig = fopen( XFSM_XMS_FILE_NAME, "r" ); + + if ( FileConfig == (FILE *)NULL ) + { + if ( Message ) + { + XfsmErrorMessage( XfsmMainWindow, + "Unable to open config file !" ); + } + else + { + XfsmDefaultConfig(); + } + } + else + { + if ( XfsmReadTopLevelValues() ) + { + XfsmReadPanelValues( &XfsmViewArrowsPanel ); + XfsmReadPanelValues( &XfsmViewZoomPanel ); + XfsmReadPanelValues( &XfsmViewGridPanel ); + XfsmReadPanelValues( &XfsmViewLayerPanel ); + XfsmReadPanelValues( &XfsmViewMapPanel ); + XfsmReadPanelValues( &XfsmEditSearchViewPanel ); + XfsmReadPanelValues( &XfsmEditSelectPanel ); + XfsmReadPanelValues( &XfsmEditIdentifyPanel ); + XfsmReadPanelValues( &XfsmToolsMessagePanel ); + XfsmReadPanelValues( &XfsmSetupInformationsPanel ); + XfsmReadPanelValues( &XfsmHelpPresentPanel ); + + XfsmReadActiveLayers(); + XfsmInitializeLayer(); + } + else + if ( Message ) + { + XfsmErrorMessage( XfsmMainWindow, + "Bad version, unable to open config file !" ); + } + + fclose( FileConfig ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmSaveConfig | +| | +\------------------------------------------------------------*/ + +void XfsmSaveConfig() + +{ + autbegin(); + + FileConfig = fopen( XFSM_XMS_FILE_NAME, "w" ); + + if ( FileConfig == (FILE *)NULL ) + { + XfsmErrorMessage( XfsmMainWindow, + "Unable to open config file !" ); + } + else + { + XfsmWriteTopLevelValues(); + + XfsmWritePanelValues( &XfsmViewArrowsPanel ); + XfsmWritePanelValues( &XfsmViewZoomPanel ); + XfsmWritePanelValues( &XfsmViewGridPanel ); + XfsmWritePanelValues( &XfsmViewLayerPanel ); + XfsmWritePanelValues( &XfsmViewMapPanel ); + XfsmWritePanelValues( &XfsmEditSearchViewPanel ); + XfsmWritePanelValues( &XfsmEditSelectPanel ); + XfsmWritePanelValues( &XfsmEditIdentifyPanel ); + XfsmWritePanelValues( &XfsmToolsMessagePanel ); + XfsmWritePanelValues( &XfsmSetupInformationsPanel ); + XfsmWritePanelValues( &XfsmHelpPresentPanel ); + + XfsmWriteActiveLayers(); + + fclose( FileConfig ); + } + + autend(); +} diff --git a/alliance/src/xfsm/src/XMS_setup.h b/alliance/src/xfsm/src/XMS_setup.h new file mode 100644 index 00000000..9258cfe1 --- /dev/null +++ b/alliance/src/xfsm/src/XMS_setup.h @@ -0,0 +1,85 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Setup.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_SETUP +# define XFSM_SETUP + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XFSM_TOPLEVEL_TRANSLATE_X 8 +# define XFSM_TOPLEVEL_TRANSLATE_Y 25 +# define XFSM_PANEL_TRANSLATE_X 0 +# define XFSM_PANEL_TRANSLATE_Y 0 + +# define XFSM_TOPLEVEL_X 10 +# define XFSM_TOPLEVEL_Y 10 +# define XFSM_TOPLEVEL_WIDTH 1024 +# define XFSM_TOPLEVEL_HEIGHT 768 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmDefaultConfig(); + extern void XfsmSaveConfig(); + extern void XfsmLoadConfig(); + +# endif diff --git a/alliance/src/xfsm/src/XMT.h b/alliance/src/xfsm/src/XMT.h new file mode 100644 index 00000000..942ff56a --- /dev/null +++ b/alliance/src/xfsm/src/XMT.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : XMT.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_XMT +# define XFSM_XMT + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XfsmMenuItem XfsmToolsMenu[]; + extern XfsmPanelItem XfsmToolsMessagePanel; + + extern int XfsmToolsMessageDefaultValues[ 5 ]; + + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmDisplayToolsMessage(); + +# endif diff --git a/alliance/src/xfsm/src/XMT_dialog.c b/alliance/src/xfsm/src/XMT_dialog.c new file mode 100644 index 00000000..2979f53a --- /dev/null +++ b/alliance/src/xfsm/src/XMT_dialog.c @@ -0,0 +1,80 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XFS.h" +# include "XMX.h" +# include "XTB.h" +# include "XMT.h" + +# include "XMT_dialog.h" +# include "XMT_tools.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ diff --git a/alliance/src/xfsm/src/XMT_dialog.h b/alliance/src/xfsm/src/XMT_dialog.h new file mode 100644 index 00000000..587240de --- /dev/null +++ b/alliance/src/xfsm/src/XMT_dialog.h @@ -0,0 +1,71 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_TOOLS_DIALOG +# define XFSM_TOOLS_DIALOG + + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xfsm/src/XMT_menu.c b/alliance/src/xfsm/src/XMT_menu.c new file mode 100644 index 00000000..3310912f --- /dev/null +++ b/alliance/src/xfsm/src/XMT_menu.c @@ -0,0 +1,126 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XTB.h" +# include "XFS.h" +# include "XMV.h" +# include "XMT.h" +# include "XMX.h" + +# include "XMT_menu.h" +# include "XMT_tools.h" +# include "XMT_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XfsmMenuItem XfsmToolsMenu[] = + + { + { + "Message", + 'M', + "CtrlM", + "Ctrl M", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackToolsMessage, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XfsmMenuItem *)NULL + } + , + NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackToolsMessage | +| | +\------------------------------------------------------------*/ + +void CallbackToolsMessage( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmEnterPanel( &XfsmToolsMessagePanel ); + + autend(); +} diff --git a/alliance/src/xfsm/src/XMT_menu.h b/alliance/src/xfsm/src/XMT_menu.h new file mode 100644 index 00000000..bccc1adb --- /dev/null +++ b/alliance/src/xfsm/src/XMT_menu.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_MENU +# define XFSM_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackToolsMessage(); + +# endif diff --git a/alliance/src/xfsm/src/XMT_message.c b/alliance/src/xfsm/src/XMT_message.c new file mode 100644 index 00000000..413eb723 --- /dev/null +++ b/alliance/src/xfsm/src/XMT_message.c @@ -0,0 +1,82 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Message.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XFS.h" +# include "XMX.h" +# include "XTB.h" +# include "XMT.h" +# include "XMT_tools.h" +# include "XMT_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ diff --git a/alliance/src/xfsm/src/XMT_message.h b/alliance/src/xfsm/src/XMT_message.h new file mode 100644 index 00000000..13d7f3a5 --- /dev/null +++ b/alliance/src/xfsm/src/XMT_message.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Message.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_MESSAGE +# define XFSM_MESSAGE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xfsm/src/XMT_panel.c b/alliance/src/xfsm/src/XMT_panel.c new file mode 100644 index 00000000..feec30b3 --- /dev/null +++ b/alliance/src/xfsm/src/XMT_panel.c @@ -0,0 +1,203 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XFS.h" +# include "XMX.h" +# include "XTB.h" +# include "XMT.h" + +# include "XMT_panel.h" +# include "XMT_message.h" +# include "XMT_dialog.h" +# include "XMT_tools.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Panel Message | +| | +\------------------------------------------------------------*/ + + static char *XfsmPanelMessageButtonName[] = + + { + "Text", + "Close" + }; + + XfsmPanelButtonItem XfsmToolsMessageButton[] = + + { + { + &XfsmPanelMessageButtonName[0], + "Nothing", NULL, 0, 0, + NULL, + NULL, + 0, 0, + 8, 9, + NULL, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmPanelMessageButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 3, 9, + 2, 1, + CallbackToolsCloseMessage, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XfsmPanelItem XfsmToolsMessagePanel = + + { + "Message", + 1, + 0, + XFSM_TOOLS_MESSAGE_X, + XFSM_TOOLS_MESSAGE_Y, + 360, + 250, + 8, + 10, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XfsmToolsMessageButton + }; + + int XfsmToolsMessageDefaultValues[ 5 ] = + + { + XFSM_TOOLS_MESSAGE_X, + XFSM_TOOLS_MESSAGE_Y, + 360, 250, 0 + }; + +/*------------------------------------------------------------\ +| | +| Callback For Message | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackToolsCloseMessage | +| | +\------------------------------------------------------------*/ + +void CallbackToolsCloseMessage( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmExitPanel( &XfsmToolsMessagePanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmDisplayToolsMessage | +| | +\------------------------------------------------------------*/ + +void XfsmDisplayToolsMessage() +{ + char *Message; + + autbegin(); + + Message = XfsmGetErrorMessage(); + + if ( Message != (char *)NULL ) + { + XmTextSetString( XfsmToolsMessageButton[0].BUTTON, Message ); + + XfsmEnterPanel( &XfsmToolsMessagePanel ); + } + else + { + XmTextSetString( XfsmToolsMessageButton[0].BUTTON, "" ); + } + + autend(); +} diff --git a/alliance/src/xfsm/src/XMT_panel.h b/alliance/src/xfsm/src/XMT_panel.h new file mode 100644 index 00000000..1f084bf7 --- /dev/null +++ b/alliance/src/xfsm/src/XMT_panel.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_TOOLS_PANEL +# define XFSM_TOOLS_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XFSM_TOOLS_MESSAGE_X 330 +# define XFSM_TOOLS_MESSAGE_Y 280 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackToolsCloseMessage(); + +# endif diff --git a/alliance/src/xfsm/src/XMT_tools.c b/alliance/src/xfsm/src/XMT_tools.c new file mode 100644 index 00000000..6ea4ff43 --- /dev/null +++ b/alliance/src/xfsm/src/XMT_tools.c @@ -0,0 +1,82 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Tools.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XFS.h" +# include "XMT.h" + +# include "XMT_tools.h" +# include "XMT_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ diff --git a/alliance/src/xfsm/src/XMT_tools.h b/alliance/src/xfsm/src/XMT_tools.h new file mode 100644 index 00000000..4d5c4e8d --- /dev/null +++ b/alliance/src/xfsm/src/XMT_tools.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Tools.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_TOOLS +# define XFSM_TOOLS + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xfsm/src/XMV.h b/alliance/src/xfsm/src/XMV.h new file mode 100644 index 00000000..18953c84 --- /dev/null +++ b/alliance/src/xfsm/src/XMV.h @@ -0,0 +1,121 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : XMV.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_XMV +# define XFSM_XMV + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char XfsmFirstViewLayer; + +/*------------------------------------------------------------\ +| | +| Panel And Menu | +| | +\------------------------------------------------------------*/ + + extern XfsmMenuItem XfsmViewMenu[]; + extern XfsmPanelItem XfsmViewArrowsPanel; + extern XfsmPanelItem XfsmViewZoomPanel; + extern XfsmPanelItem XfsmViewGridPanel; + extern XfsmPanelItem XfsmViewLayerPanel; + extern XfsmPanelItem XfsmViewMapPanel; + + extern int XfsmPercentZoom; + extern int XfsmPercentMoveX; + extern int XfsmPercentMoveY; + + extern int XfsmViewArrowsDefaultValues[5]; + extern int XfsmViewZoomDefaultValues[5]; + extern int XfsmViewLayerDefaultValues[5]; + extern int XfsmViewGridDefaultValues[5]; + extern int XfsmViewMapDefaultValues[5]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Values | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Zoom | +| | +\------------------------------------------------------------*/ + + extern void XfsmComputeAndDisplayMap(); + extern void XfsmInitializeZoom(); + extern void XfsmBuildViewDialog(); + extern void XfsmBuildPanelMap(); + extern void XfsmInitializeMapEvent(); + + extern void XfsmZoomCenter(); + extern void XfsmZoomRefresh(); + extern void XfsmZoomIn(); + extern void XfsmZoomPan(); + + extern void XfsmPromptZoomIn(); + extern void XfsmPromptZoomPan(); + extern void XfsmPromptZoomCenter(); + +# endif diff --git a/alliance/src/xfsm/src/XMV_dialog.c b/alliance/src/xfsm/src/XMV_dialog.c new file mode 100644 index 00000000..346e9d8c --- /dev/null +++ b/alliance/src/xfsm/src/XMV_dialog.c @@ -0,0 +1,541 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XMV.h" + +# include "XMV_dialog.h" +# include "XMV_view.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Dialog Box | +| | +\------------------------------------------------------------*/ + + XfsmDialogItem XfsmViewZoomSetDialog = + + { + "Zoom set", + XFSM_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackViewZoomSetOk, + (XtPointer)NULL, + (void *)CallbackViewZoomSetCancel, + (XtPointer)NULL + }; + + XfsmDialogItem XfsmViewZoomGotoDialog = + + { + "Goto X,Y", + XFSM_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackViewZoomGotoOk, + (XtPointer)NULL, + (void *)CallbackViewZoomGotoCancel, + (XtPointer)NULL + }; + + XfsmDialogItem XfsmViewMoveSetDialog = + + { + "Move set dx,dy", + XFSM_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackViewMoveSetOk, + (XtPointer)NULL, + (void *)CallbackViewMoveSetCancel, + (XtPointer)NULL + }; + + XfsmDialogItem XfsmViewGridXDialog = + + { + "Grid X", + XFSM_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackViewGridXOk, + (XtPointer)NULL, + (void *)CallbackViewGridXCancel, + (XtPointer)NULL + }; + + XfsmDialogItem XfsmViewGridYDialog = + + { + "Grid Y", + XFSM_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackViewGridYOk, + (XtPointer)NULL, + (void *)CallbackViewGridYCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Build Dialog Box | +| | +\------------------------------------------------------------*/ + +void XfsmBuildViewDialog() + +{ + autbegin(); + + XfsmBuildDialog( XfsmMainWindow, &XfsmViewZoomSetDialog ); + XfsmBuildDialog( XfsmMainWindow, &XfsmViewZoomGotoDialog ); + XfsmBuildDialog( XfsmMainWindow, &XfsmViewMoveSetDialog ); + XfsmBuildDialog( XfsmMainWindow, &XfsmViewGridXDialog ); + XfsmBuildDialog( XfsmMainWindow, &XfsmViewGridYDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Dialog | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackViewZoomSetOk | +| | +\------------------------------------------------------------*/ + +void CallbackViewZoomSetOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *ZoomSet; + int ZoomPercent; + + autbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &ZoomSet ); + + XtUnmanageChild( XfsmViewZoomSetDialog.WIDGET ); + + XfsmExitDialog(); + + if ( ZoomSet != (char *)NULL ) + { + ZoomPercent = atoi( ZoomSet ); + + if ( ( ZoomPercent < XFSM_PERCENT_ZOOM_MIN ) || + ( ZoomPercent > XFSM_PERCENT_ZOOM_MAX ) ) + { + XfsmErrorMessage( XfsmMainWindow, "The value must be between 5% and 95% !" ); + } + else + { + XfsmPercentZoom = ZoomPercent; + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewZoomSetCancel | +| | +\------------------------------------------------------------*/ + +void CallbackViewZoomSetCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + autbegin(); + + XtUnmanageChild( XfsmViewZoomSetDialog.WIDGET ); + + XfsmExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewZoomGotoOk | +| | +\------------------------------------------------------------*/ + +void CallbackViewZoomGotoOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *ZoomGoto; + int Index; + long GotoX; + long GotoY; + + autbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &ZoomGoto ); + + XtUnmanageChild( XfsmViewZoomGotoDialog.WIDGET ); + + XfsmExitDialog(); + + if ( ZoomGoto != (char *)NULL ) + { + for ( Index = 0; ZoomGoto[ Index ]; Index++ ) + { + if ( ZoomGoto[ Index ] == ',' ) + { + ZoomGoto[ Index ] = '\0'; + + if ( Index == 0 ) + { + GotoX = XfsmUnitGridX + ( XfsmUnitGridDx >> 1 ); + } + else + { + GotoX = atoi( ZoomGoto ); + } + + if ( ZoomGoto[ Index + 1 ] == '\0' ) + { + GotoY = XfsmUnitGridY + ( XfsmUnitGridDy >> 1 ); + } + else + { + GotoY = atoi( ZoomGoto + Index + 1 ); + } + + ZoomGoto = (char *)NULL; + + XfsmZoomCenter( GotoX, GotoY ); + + break; + } + } + + if ( ZoomGoto != (char *)NULL ) + { + XfsmErrorMessage( XfsmMainWindow, "A coordinate must be specified !" ); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewZoomGotoCancel | +| | +\------------------------------------------------------------*/ + +void CallbackViewZoomGotoCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + autbegin(); + + XtUnmanageChild( XfsmViewZoomGotoDialog.WIDGET ); + + XfsmExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewMoveSetOk | +| | +\------------------------------------------------------------*/ + +void CallbackViewMoveSetOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *MoveSet; + int MovePercentX; + int MovePercentY; + int Index; + + autbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &MoveSet ); + + XtUnmanageChild( XfsmViewMoveSetDialog.WIDGET ); + + XfsmExitDialog(); + + if ( MoveSet != (char *)NULL ) + { + for ( Index = 0; MoveSet[ Index ]; Index++ ) + { + if ( MoveSet[ Index ] == ',' ) + { + MoveSet[ Index ] = '\0'; + + MovePercentX = atoi( MoveSet ); + MovePercentY = atoi( MoveSet + Index + 1 ); + MoveSet = (char *)NULL; + + break; + } + } + + if ( MoveSet != (char *)NULL ) + { + MovePercentY = MovePercentX = atoi( MoveSet ); + } + + if ( ( MovePercentX < XFSM_PERCENT_MOVE_MIN ) || + ( MovePercentX > XFSM_PERCENT_MOVE_MAX ) || + ( MovePercentY < XFSM_PERCENT_MOVE_MIN ) || + ( MovePercentY > XFSM_PERCENT_MOVE_MAX ) ) + { + XfsmErrorMessage( XfsmMainWindow, "The values must be between 5% and 95% !" ); + } + else + { + XfsmPercentMoveX = MovePercentX; + XfsmPercentMoveY = MovePercentY; + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewMoveSetCancel | +| | +\------------------------------------------------------------*/ + +void CallbackViewMoveSetCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + autbegin(); + + XtUnmanageChild( XfsmViewMoveSetDialog.WIDGET ); + + XfsmExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewGridXOk | +| | +\------------------------------------------------------------*/ + +void CallbackViewGridXOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *GridSet; + int GridPercent; + + autbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &GridSet ); + + XtUnmanageChild( XfsmViewGridXDialog.WIDGET ); + + XfsmExitDialog(); + + if ( GridSet != (char *)NULL ) + { + GridPercent = atoi( GridSet ); + + if ( GridPercent < 2 ) + { + XfsmErrorMessage( XfsmMainWindow, "The value must be greater than one !" ); + } + else + { + XfsmUnitUserGridDx = GridPercent; + XfsmZoomRefresh(); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewGridXCancel | +| | +\------------------------------------------------------------*/ + +void CallbackViewGridXCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + autbegin(); + + XtUnmanageChild( XfsmViewGridXDialog.WIDGET ); + + XfsmExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewGridYOk | +| | +\------------------------------------------------------------*/ + +void CallbackViewGridYOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *GridSet; + int GridPercent; + + autbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &GridSet ); + + XtUnmanageChild( XfsmViewGridYDialog.WIDGET ); + + XfsmExitDialog(); + + if ( GridSet != (char *)NULL ) + { + GridPercent = atoi( GridSet ); + + if ( GridPercent < 2 ) + { + XfsmErrorMessage( XfsmMainWindow, "The value must be greater than one !" ); + } + else + { + XfsmUnitUserGridDy = GridPercent; + XfsmZoomRefresh(); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewGridYCancel | +| | +\------------------------------------------------------------*/ + +void CallbackViewGridYCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + autbegin(); + + XtUnmanageChild( XfsmViewGridYDialog.WIDGET ); + + XfsmExitDialog(); + + autend(); +} diff --git a/alliance/src/xfsm/src/XMV_dialog.h b/alliance/src/xfsm/src/XMV_dialog.h new file mode 100644 index 00000000..ce1ca4eb --- /dev/null +++ b/alliance/src/xfsm/src/XMV_dialog.h @@ -0,0 +1,93 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_VIEW_DIALOG +# define XFSM_VIEW_DIALOG + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XfsmDialogItem XfsmViewZoomSetDialog; + extern XfsmDialogItem XfsmViewZoomGotoDialog; + extern XfsmDialogItem XfsmViewMoveSetDialog; + extern XfsmDialogItem XfsmViewGridXDialog; + extern XfsmDialogItem XfsmViewGridYDialog; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback View Dialog | +| | +\------------------------------------------------------------*/ + + extern void CallbackViewZoomGotoOk(); + extern void CallbackViewZoomGotoCancel(); + extern void CallbackViewZoomSetOk(); + extern void CallbackViewZoomSetCancel(); + extern void CallbackViewMoveSetOk(); + extern void CallbackViewMoveSetCancel(); + extern void CallbackViewGridXOk(); + extern void CallbackViewGridXCancel(); + extern void CallbackViewGridYOk(); + extern void CallbackViewGridYCancel(); + +# endif diff --git a/alliance/src/xfsm/src/XMV_map.c b/alliance/src/xfsm/src/XMV_map.c new file mode 100644 index 00000000..bd4ff48d --- /dev/null +++ b/alliance/src/xfsm/src/XMV_map.c @@ -0,0 +1,757 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Map.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XFS.h" +# include "XTB.h" +# include "XMX.h" +# include "XMV.h" + +# include "XMV_map.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XfsmPanelItem XfsmViewMapPanel = + + { + "Map", + 1, + 0, + XFSM_VIEW_MAP_X, + XFSM_VIEW_MAP_Y, + 190, + 200, + 0, + 0, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (XfsmPanelButtonItem *)NULL + }; + + int XfsmViewMapDefaultValues[ 5 ] = + + { + XFSM_VIEW_MAP_X, + XFSM_VIEW_MAP_Y, + 190, 200, 0 + }; + +/*------------------------------------------------------------\ +| | +| Graphic Map Window | +| | +\------------------------------------------------------------*/ + + Widget XfsmMapWindow; + Widget XfsmMapButtonCompute; + Widget XfsmMapButtonClose; + + Dimension XfsmMapDx = 0; + Dimension XfsmMapDy = 0; + + static char XfsmFirstEnterMap = XFSM_TRUE; + static char XfsmFirstExpose = XFSM_TRUE; + +/*------------------------------------------------------------\ +| | +| Unit Map | +| | +\------------------------------------------------------------*/ + + float XfsmUnitMapStep; + + long XfsmUnitMapX; + long XfsmUnitMapY; + long XfsmUnitMapDx; + long XfsmUnitMapDy; + + long XfsmBoundMapX; + long XfsmBoundMapY; + long XfsmBoundMapDx; + long XfsmBoundMapDy; + + long XfsmPixelMapX; + long XfsmPixelMapY; + +/*------------------------------------------------------------\ +| | +| Expose | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Translation | +| | +\------------------------------------------------------------*/ + + static String XfsmMapEventTranslation = + + ": CallbackMapEvent( 0 )\n\ + : CallbackMapEvent( 1 )\n\ + : CallbackMapEvent( 2 )"; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Event Callback | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackCloseMap | +| | +\------------------------------------------------------------*/ + +void CallbackCloseMap( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmExitPanel( &XfsmViewMapPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackMapCompute | +| | +\------------------------------------------------------------*/ + +void CallbackMapCompute( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmComputeAndDisplayMap(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackMapEvent | +| | +\------------------------------------------------------------*/ + +void CallbackMapEvent ( MyWidget, Event, Args, Argc ) + + Widget MyWidget; + XButtonEvent *Event; + String *Args; + int *Argc; +{ + Display *EventDisplay; + char MouseEvent; + long X; + long Y; + + autbegin(); + + EventDisplay = Event->display; + MouseEvent = Args[ 0 ][ 0 ] - '0'; + + X = Event->x; + Y = XfsmMapDy - Event->y; + + X = X + XfsmPixelMapX; + Y = Y + XfsmPixelMapY; + + if ( X < 0 ) + { + X = ((float)(X) / XfsmUnitMapStep) - 0.5 ; + } + else + { + X = ((float)(X) / XfsmUnitMapStep) + 0.5 ; + } + + if ( Y < 0 ) + { + Y = ((float)(Y) / XfsmUnitMapStep) - 0.5 ; + } + else + { + Y = ((float)(Y) / XfsmUnitMapStep) + 0.5 ; + } + + switch ( MouseEvent ) + { + case XFSM_B1UP : + case XFSM_B2UP : + case XFSM_B3UP : + + XfsmZoomCenter( X, Y ); + + break; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackMapResize | +| | +\------------------------------------------------------------*/ + +void CallbackMapResize( MyWidget, ClientData, CallData ) + + Widget MyWidget; + XtPointer ClientData; + XmDrawingAreaCallbackStruct *CallData; +{ + if ( ! XfsmFirstExpose ) + { + autbegin(); + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_WATCH_CURSOR ); + XfsmResizeMapWindow(); + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_NORMAL_CURSOR ); + + autend(); + } +} + +/*------------------------------------------------------------\ +| | +| CallbackMapExpose | +| | +\------------------------------------------------------------*/ + +void CallbackMapExpose( MyWidget, ClientData, CallData ) + + Widget MyWidget; + XtPointer ClientData; + XmDrawingAreaCallbackStruct *CallData; +{ + XExposeEvent *ExposeEvent; + + autbegin(); + + ExposeEvent = (XExposeEvent *)CallData->event; + + if ( XfsmFirstExpose ) + { + XfsmFirstExpose = XFSM_FALSE; + + XfsmInitializeMapWindow(); + } + + XfsmRefreshMapWindow(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Initialize Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmsnitializeMapWindow | +| | +\------------------------------------------------------------*/ + +void XfsmInitializeMapWindow() + +{ + autbegin(); + + XtVaGetValues( XfsmMapWindow, + XmNwidth , &XfsmMapDx, + XmNheight, &XfsmMapDy, + NULL + ); + + XfsmInitializeUnitMap(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Graphic Window Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmRefreshMapWindow | +| | +\------------------------------------------------------------*/ + +void XfsmRefreshMapWindow() +{ + autbegin(); + + XfsmClearMapWindow(); + XfsmDisplayUnitMap(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmClearMapWindow | +| | +\------------------------------------------------------------*/ + +void XfsmClearMapWindow() + +{ + XFillRectangle( XtDisplay( XfsmMapWindow ), + XtWindow( XfsmMapWindow ), + XfsmBackgroundGC, + 0, 0, XfsmMapDx, XfsmMapDy ); +} + +/*------------------------------------------------------------\ +| | +| XfsmResizeMapWindow | +| | +\------------------------------------------------------------*/ + +void XfsmResizeMapWindow() + +{ + autbegin(); + + XtVaGetValues( XfsmMapWindow, + XmNwidth, &XfsmMapDx, + XmNheight, &XfsmMapDy, + NULL + ); + + XfsmComputeAndDisplayMap(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmInitializeMapEvent | +| | +\------------------------------------------------------------*/ + +void XfsmInitializeMapEvent() + +{ + XtActionsRec NewActions; + + autbegin(); + + XtVaSetValues( XfsmMapWindow, + XmNtranslations, + XtParseTranslationTable( XfsmMapEventTranslation ), + NULL + ); + + NewActions.string = "CallbackMapEvent"; + NewActions.proc = CallbackMapEvent; + + XtAppAddActions( XfsmApplication, &NewActions, 1 ); + + XtAddCallback( XfsmMapWindow, + XmNresizeCallback, + CallbackMapResize, NULL ); + + XtAddCallback( XfsmMapWindow, + XmNexposeCallback, + CallbackMapExpose, NULL ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Unit Map Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmInitializeUnitMap | +| | +\------------------------------------------------------------*/ + +void XfsmInitializeUnitMap() + +{ + autbegin(); + + if ( ! XfsmComputeBound() ) + { + XfsmBoundMapX = XFSM_DEFAULT_MAP_X; + XfsmBoundMapY = XFSM_DEFAULT_MAP_Y; + XfsmBoundMapDx = XFSM_DEFAULT_MAP_DX; + XfsmBoundMapDy = XFSM_DEFAULT_MAP_DY; + } + else + { + XfsmBoundMapX = XfsmBoundXmin / XFSM_UNIT; + XfsmBoundMapY = XfsmBoundYmin / XFSM_UNIT; + XfsmBoundMapDx = XfsmBoundXmax / XFSM_UNIT; + XfsmBoundMapDy = XfsmBoundYmax / XFSM_UNIT; + XfsmBoundMapDx = XfsmBoundMapDx - XfsmBoundMapX; + XfsmBoundMapDy = XfsmBoundMapDy - XfsmBoundMapY; + } + + XfsmUnitMapX = XfsmBoundMapX - 2; + XfsmUnitMapY = XfsmBoundMapY - 2; + XfsmUnitMapDx = XfsmBoundMapDx + 4; + XfsmUnitMapDy = XfsmBoundMapDy + 4; + + XfsmComputeUnitMap(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmComputeUnitMap | +| | +\------------------------------------------------------------*/ + +void XfsmComputeUnitMap() + +{ + long Delta; + float StepX; + float StepY; + + autbegin(); + + StepX = (float)(XfsmMapDx) / (float)(XfsmUnitMapDx); + StepY = (float)(XfsmMapDy) / (float)(XfsmUnitMapDy); + + if ( StepX < StepY ) + { + XfsmUnitMapStep = StepX; + Delta = XfsmUnitMapDy; + XfsmUnitMapDy = 1 + ( XfsmMapDy / StepX ); + Delta = ( XfsmUnitMapDy - Delta ) >> 1; + XfsmUnitMapY = XfsmUnitMapY - Delta; + } + else + { + XfsmUnitMapStep = StepY; + Delta = XfsmUnitMapDx; + XfsmUnitMapDx = 1 + ( XfsmMapDx / StepY ); + Delta = ( XfsmUnitMapDx - Delta ) >> 1; + XfsmUnitMapX = XfsmUnitMapX - Delta; + } + + XfsmPixelMapX = (float)(XfsmUnitMapX) * XfsmUnitMapStep; + XfsmPixelMapY = (float)(XfsmUnitMapY) * XfsmUnitMapStep; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmDisplayUnitMap | +| | +\------------------------------------------------------------*/ + +void XfsmDisplayUnitMap() +{ + long X1; + long Y1; + long X2; + long Y2; + + autbegin(); + + X1 = (float)( XfsmBoundMapX ) * XfsmUnitMapStep; + Y1 = (float)( XfsmBoundMapY ) * XfsmUnitMapStep; + X2 = (float)( XfsmBoundMapX + XfsmBoundMapDx ) * XfsmUnitMapStep; + Y2 = (float)( XfsmBoundMapY + XfsmBoundMapDy ) * XfsmUnitMapStep; + + X1 = X1 - XfsmPixelMapX; + X2 = X2 - XfsmPixelMapX; + Y1 = Y1 - XfsmPixelMapY; + Y2 = Y2 - XfsmPixelMapY; + + XDrawRectangle( XtDisplay( XfsmMapWindow ), + XtWindow( XfsmMapWindow ), + XfsmLargeTextGC, + X1, XfsmMapDy - Y2, + X2 - X1, Y2 - Y1 ); + + X1 = XfsmUnitGridX + ( XfsmUnitGridDx >> 1 ); + Y1 = XfsmUnitGridY + ( XfsmUnitGridDy >> 1 ); + X1 = (float)( X1 ) * XfsmUnitMapStep; + Y1 = (float)( Y1 ) * XfsmUnitMapStep; + + X1 = X1 - XfsmPixelMapX; + Y1 = Y1 - XfsmPixelMapY; + Y1 = XfsmMapDy - Y1; + + if ( ( X1 > 0 ) && + ( Y1 > 0 ) && + ( X1 < XfsmMapDx ) && + ( Y1 < XfsmMapDy ) ) + { + XDrawLine( XtDisplay( XfsmMapWindow ), + XtWindow( XfsmMapWindow ), + XfsmLargeTextGC, + X1 - 2, Y1, + X1 + 2, Y1 ); + + XDrawLine( XtDisplay( XfsmMapWindow ), + XtWindow( XfsmMapWindow ), + XfsmLargeTextGC, + X1, Y1 - 2, + X1, Y1 + 2 ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmBuildPanelMap | +| | +\------------------------------------------------------------*/ + +void XfsmBuildPanelMap() +{ + Arg Args[3]; + + autbegin(); + + XtSetArg( Args[0], XmNshadowType , XmSHADOW_ETCHED_IN ); + XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING ); + XtSetArg( Args[2], XmNtitle , XfsmViewMapPanel.TITLE ); + + XfsmViewMapPanel.PANEL = + + XmCreateFormDialog( XfsmMainWindow, "XfsmViewMapPanel", Args, 3); + + XtAddCallback( XfsmViewMapPanel.PANEL, XmNdestroyCallback, + XfsmDestroyDialogCallback, NULL ); + + XfsmViewMapPanel.PANEL_FORM = + + XtVaCreateManagedWidget( "XfsmViewMapPanelForm", + xmFormWidgetClass, + XfsmViewMapPanel.PANEL, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , 100, + NULL + ); + + XfsmViewMapPanel.FRAME = + + XtVaCreateManagedWidget( "XfsmViewMapFrame", + xmFrameWidgetClass, + XfsmViewMapPanel.PANEL_FORM, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + NULL + ); + + XfsmViewMapPanel.FORM = + + XtVaCreateManagedWidget( "XfsmViewMapForm", + xmFormWidgetClass, + XfsmViewMapPanel.FRAME, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , 100, + NULL + ); + + XfsmMapButtonCompute = + + XtVaCreateManagedWidget( "Compute", + xmPushButtonWidgetClass, + XfsmViewMapPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 1, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 44, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 89, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 99, + NULL + ); + XfsmMapButtonClose = + + XtVaCreateManagedWidget( "Close", + xmPushButtonWidgetClass, + XfsmViewMapPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 45, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 99, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 89, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 99, + NULL + ); + + XfsmMapWindow = + + XtVaCreateManagedWidget( "XfsmMapWindow", + xmDrawingAreaWidgetClass, + XfsmViewMapPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 1, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 99, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 1, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 88, + XmNbackground , 1, + XmNforeground , 0, + NULL + ); + + XtAddCallback( XfsmMapButtonCompute, + XmNactivateCallback, + CallbackMapCompute, NULL ); + + XtAddCallback( XfsmMapButtonClose, + XmNactivateCallback, + CallbackCloseMap, NULL ); + + XtVaSetValues( XfsmViewMapPanel.PANEL, + XmNheight, XfsmViewMapPanel.HEIGHT, + XmNwidth , XfsmViewMapPanel.WIDTH, + XmNx , XfsmViewMapPanel.X, + XmNy , XfsmViewMapPanel.Y, + NULL ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmEnterMapPanel | +| | +\------------------------------------------------------------*/ + +void XfsmEnterMapPanel() + +{ + autbegin(); + + XfsmFirstEnterMap = XFSM_FALSE; + + XfsmEnterPanel( &XfsmViewMapPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmComputeAndDisplayMap | +| | +\------------------------------------------------------------*/ + +void XfsmComputeAndDisplayMap() + +{ + + if ( ! XfsmFirstEnterMap ) + { + autbegin(); + + XfsmInitializeUnitMap(); + XfsmClearMapWindow(); + XfsmDisplayUnitMap(); + + autend(); + } +} diff --git a/alliance/src/xfsm/src/XMV_map.h b/alliance/src/xfsm/src/XMV_map.h new file mode 100644 index 00000000..dc38c9f2 --- /dev/null +++ b/alliance/src/xfsm/src/XMV_map.h @@ -0,0 +1,102 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Map.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_MAP +# define XFSM_MAP + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XFSM_B1UP 0 +# define XFSM_B2UP 1 +# define XFSM_B3UP 2 + +# define XFSM_VIEW_MAP_X 25 +# define XFSM_VIEW_MAP_Y 520 + +# define XFSM_DEFAULT_MAP_X 0 +# define XFSM_DEFAULT_MAP_Y 0 +# define XFSM_DEFAULT_MAP_DX 40 +# define XFSM_DEFAULT_MAP_DY 40 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern Widget XfsmMapPanel; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmComputeUnitMap(); + extern void XfsmInitializeUnitMap(); + extern void XfsmDisplayUnitMap(); + + extern void XfsmEnterMapPanel(); + extern void XfsmClearMapWindow(); + extern void XfsmResizeMapWindow(); + extern void XfsmRefreshMapWindow(); + extern void XfsmInitializeMapWindow(); + + extern void CallbackCloseMap(); + extern void CallbackMapCompute(); + extern void CallbackMapResize(); + extern void CallbackMapExpose(); + extern void CallbackMapEvent(); + +# endif diff --git a/alliance/src/xfsm/src/XMV_menu.c b/alliance/src/xfsm/src/XMV_menu.c new file mode 100644 index 00000000..2194b61d --- /dev/null +++ b/alliance/src/xfsm/src/XMV_menu.c @@ -0,0 +1,285 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XMV.h" + +# include "XMV_menu.h" +# include "XMV_dialog.h" +# include "XMV_view.h" +# include "XMV_map.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + char XfsmFirstViewLayer = 1; + +/*------------------------------------------------------------\ +| | +| Menu | +| | +\------------------------------------------------------------*/ + + XfsmMenuItem XfsmViewMenu[] = + + { + { + "Zoom", + 'Z', + "MetaZ", + "Meta Z", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackViewZoom, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XfsmMenuItem *)NULL + } + , + { + "Layers ", + 'L', + "MetaL", + "Meta L", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackViewLayer, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XfsmMenuItem *)NULL + } + , + { + "Map", + 'M', + "MetaP", + "Meta P", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackViewMap, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XfsmMenuItem *)NULL + } + , + { + "Arrows ", + 'A', + "MetaA", + "Meta A", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackViewArrows, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XfsmMenuItem *)NULL + } + , + { + "Grid ", + 'G', + "MetaG", + "Meta G", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackViewGrid, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XfsmMenuItem *)NULL + } + , + NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback For Menu | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackViewLayer | +| | +\------------------------------------------------------------*/ + +void CallbackViewLayer( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + if ( XfsmFirstViewLayer ) + { + XfsmFirstViewLayer = 0; + + XfsmInitializeLayer(); + } + + XfsmEnterPanel( &XfsmViewLayerPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewGrid | +| | +\------------------------------------------------------------*/ + +void CallbackViewGrid( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmEnterPanel( &XfsmViewGridPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewArrows | +| | +\------------------------------------------------------------*/ + +void CallbackViewArrows( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmEnterPanel( &XfsmViewArrowsPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewZoom | +| | +\------------------------------------------------------------*/ + +void CallbackViewZoom( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmEnterPanel( &XfsmViewZoomPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewMap | +| | +\------------------------------------------------------------*/ + +void CallbackViewMap( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmEnterMapPanel(); + + autend(); +} diff --git a/alliance/src/xfsm/src/XMV_menu.h b/alliance/src/xfsm/src/XMV_menu.h new file mode 100644 index 00000000..ad79ae21 --- /dev/null +++ b/alliance/src/xfsm/src/XMV_menu.h @@ -0,0 +1,82 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_VIEW_MENU +# define XFSM_VIEW_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback View Menu | +| | +\------------------------------------------------------------*/ + + + extern void CallbackViewZoom(); + extern void CallbackViewGrid(); + extern void CallbackViewLayer(); + extern void CallbackViewMap(); + extern void CallbackViewArrows(); + +# endif diff --git a/alliance/src/xfsm/src/XMV_message.c b/alliance/src/xfsm/src/XMV_message.c new file mode 100644 index 00000000..d7e5a2ce --- /dev/null +++ b/alliance/src/xfsm/src/XMV_message.c @@ -0,0 +1,159 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Message.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XFS.h" +# include "XMX.h" +# include "XTB.h" +# include "XMV.h" +# include "XMV_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmPromptZoomIn | +| | +\------------------------------------------------------------*/ + +void XfsmPromptZoomIn() + +{ + autbegin(); + + XfsmDisplayMessage( XFSM_MESSAGE_MODE, "Zoom In" ); + XfsmDisplayMessage( XFSM_MESSAGE_INFO, "Select window" ); + + switch ( XfsmCountEventZoom ) + { + case 0 : + + XfsmDisplayMessage( XFSM_MESSAGE_PROMPT, "Enter first corner" ); + + break; + + case 1 : + + XfsmDisplayMessage( XFSM_MESSAGE_PROMPT, "Enter second corner" ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmPromptZoomPan | +| | +\------------------------------------------------------------*/ + +void XfsmPromptZoomPan() + +{ + autbegin(); + + XfsmDisplayMessage( XFSM_MESSAGE_MODE, "Zoom Pan" ); + XfsmDisplayMessage( XFSM_MESSAGE_INFO, "Select line" ); + + switch ( XfsmCountEventZoom ) + { + case 0 : + + XfsmDisplayMessage( XFSM_MESSAGE_PROMPT, "Enter source point" ); + + break; + + case 1 : + + XfsmDisplayMessage( XFSM_MESSAGE_PROMPT, "Enter target point" ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmPromptZoomCenter | +| | +\------------------------------------------------------------*/ + +void XfsmPromptZoomCenter() + +{ + autbegin(); + + XfsmDisplayMessage( XFSM_MESSAGE_MODE, "Zoom Center" ); + XfsmDisplayMessage( XFSM_MESSAGE_INFO, "Select point" ); + XfsmDisplayMessage( XFSM_MESSAGE_PROMPT, "Enter center point" ); + + autend(); +} + diff --git a/alliance/src/xfsm/src/XMV_message.h b/alliance/src/xfsm/src/XMV_message.h new file mode 100644 index 00000000..3fe7cb5f --- /dev/null +++ b/alliance/src/xfsm/src/XMV_message.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Message.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_MESSAGE +# define XFSM_MESSAGE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmPromptZoomIn(); + extern void XfsmPromptZoomCenter(); + extern void XfsmPromptZoomPan(); + +# endif diff --git a/alliance/src/xfsm/src/XMV_panel.c b/alliance/src/xfsm/src/XMV_panel.c new file mode 100644 index 00000000..52d0b93f --- /dev/null +++ b/alliance/src/xfsm/src/XMV_panel.c @@ -0,0 +1,2044 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XMV.h" + +# include "XMV_panel.h" +# include "XMV_dialog.h" +# include "XMV_view.h" +# include "XMV_message.h" +# include "XMX_color.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Panel Pixmap | +| | +\------------------------------------------------------------*/ + + static char XfsmPixmapDownArrow[] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xfe, 0xff, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, + 0x00, 0x02, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, + 0x00, 0x02, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, + 0xf0, 0x03, 0x80, 0x1f, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, + 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x20, 0x00, 0x00, 0x08, + 0x40, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, + 0x00, 0x02, 0x80, 0x00, 0x00, 0x04, 0x40, 0x00, 0x00, 0x08, 0x20, 0x00, + 0x00, 0x10, 0x10, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x40, 0x04, 0x00, + 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + static char XfsmPixmapLeftArrow[] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x0f, 0x00, 0x00, 0x40, 0x08, 0x00, 0x00, 0x20, 0x08, 0x00, + 0x00, 0x10, 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x04, 0xf8, 0x1f, + 0x00, 0x02, 0x00, 0x10, 0x00, 0x01, 0x00, 0x10, 0x80, 0x00, 0x00, 0x10, + 0x40, 0x00, 0x00, 0x10, 0x20, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, + 0x08, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x20, 0x00, 0x00, 0x10, + 0x40, 0x00, 0x00, 0x10, 0x80, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00, 0x10, + 0x00, 0x02, 0x00, 0x10, 0x00, 0x04, 0xf8, 0x1f, 0x00, 0x08, 0x08, 0x00, + 0x00, 0x10, 0x08, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x40, 0x08, 0x00, + 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + static char XfsmPixmapRightArrow[] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xf0, 0x01, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x10, 0x04, 0x00, + 0x00, 0x10, 0x08, 0x00, 0x00, 0x10, 0x10, 0x00, 0xf8, 0x1f, 0x20, 0x00, + 0x08, 0x00, 0x40, 0x00, 0x08, 0x00, 0x80, 0x00, 0x08, 0x00, 0x00, 0x01, + 0x08, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x04, 0x08, 0x00, 0x00, 0x08, + 0x08, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x04, + 0x08, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x01, 0x08, 0x00, 0x80, 0x00, + 0x08, 0x00, 0x40, 0x00, 0xf8, 0x1f, 0x20, 0x00, 0x00, 0x10, 0x10, 0x00, + 0x00, 0x10, 0x08, 0x00, 0x00, 0x10, 0x04, 0x00, 0x00, 0x10, 0x02, 0x00, + 0x00, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + static char XfsmPixmapUpArrow[] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x20, 0x02, 0x00, + 0x00, 0x10, 0x04, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x04, 0x10, 0x00, + 0x00, 0x02, 0x20, 0x00, 0x00, 0x01, 0x40, 0x00, 0x80, 0x00, 0x80, 0x00, + 0x40, 0x00, 0x00, 0x01, 0x20, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x04, + 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x08, + 0x08, 0x00, 0x00, 0x08, 0xf8, 0x01, 0xc0, 0x0f, 0x00, 0x01, 0x40, 0x00, + 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x40, 0x00, + 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x40, 0x00, + 0x00, 0x01, 0x40, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + +/*------------------------------------------------------------\ +| | +| Panel Arrows | +| | +\------------------------------------------------------------*/ + + static char *XfsmPanelArrowsButtonName[] = + + { + "Left", + "Up", + "Down", + "Right", + "Move Set", + "Close" + }; + + static XfsmPanelButtonItem XfsmViewArrowsButton[] = + + { + { + &XfsmPanelArrowsButtonName[0], + NULL, XfsmPixmapLeftArrow, 32, 32, + NULL, + NULL, + 0, 0, + 1, 2, + CallbackLeftArrow, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmPanelArrowsButtonName[1], + NULL, XfsmPixmapUpArrow, 32, 32, + NULL, + NULL, + 1, 0, + 1, 2, + CallbackUpArrow, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmPanelArrowsButtonName[2], + NULL, XfsmPixmapDownArrow, 32, 32, + NULL, + NULL, + 0, 2, + 1, 2, + CallbackDownArrow, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmPanelArrowsButtonName[3], + NULL, XfsmPixmapRightArrow, 32, 32, + NULL, + NULL, + 1, 2, + 1, 2, + CallbackRightArrow, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmPanelArrowsButtonName[4], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 4, + 2, 1, + CallbackMoveSet, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmPanelArrowsButtonName[5], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 5, + 2, 1, + CallbackCloseArrows, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XfsmPanelItem XfsmViewArrowsPanel = + + { + "Arrows", + 1, + 0, + XFSM_VIEW_ARROWS_X, + XFSM_VIEW_ARROWS_Y, + 100, + 125, + 2, + 6, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XfsmViewArrowsButton + }; + + int XfsmViewArrowsDefaultValues[ 5 ] = + + { + XFSM_VIEW_ARROWS_X, + XFSM_VIEW_ARROWS_Y, + 100, 125 , 1 + }; + +/*------------------------------------------------------------\ +| | +| Panel Zoom | +| | +\------------------------------------------------------------*/ + + static char *XfsmPanelZoomButtonName[] = + + { + "Refresh", + "UnZoom", + "Zoom", + "Mooz", + "Zoom Set", + "Zoom In", + "Center", + "Goto", + "Pan", + "Fit", + "Close" + }; + + + XfsmPanelButtonItem XfsmViewZoomButton[] = + + { + { + &XfsmPanelZoomButtonName[0], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackZoomRefresh, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmPanelZoomButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 1, + 1, 1, + CallbackZoomPrevious, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmPanelZoomButtonName[2], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 2, + 1, 1, + CallbackZoomMore, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmPanelZoomButtonName[3], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 3, + 1, 1, + CallbackZoomLess, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmPanelZoomButtonName[4], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 4, + 1, 1, + CallbackZoomSet, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmPanelZoomButtonName[5], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 5, + 1, 1, + CallbackZoomIn, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmPanelZoomButtonName[6], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 6, + 1, 1, + CallbackZoomCenter, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmPanelZoomButtonName[7], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 7, + 1, 1, + CallbackZoomGoto, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmPanelZoomButtonName[8], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 8, + 1, 1, + CallbackZoomPan, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmPanelZoomButtonName[9], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 9, + 1, 1, + CallbackZoomFit, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmPanelZoomButtonName[10], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 10, + 1, 1, + CallbackCloseZoom, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XfsmPanelItem XfsmViewZoomPanel = + + { + "Zoom", + 1, + 0, + XFSM_VIEW_ZOOM_X, + XFSM_VIEW_ZOOM_Y, + 100, + 275, + 1, + 11, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XfsmViewZoomButton + }; + + int XfsmViewZoomDefaultValues[ 5 ] = + + { + XFSM_VIEW_ZOOM_X, + XFSM_VIEW_ZOOM_Y, + 100, 275, 1 + }; + +/*------------------------------------------------------------\ +| | +| Panel Grid | +| | +\------------------------------------------------------------*/ + + static char *XfsmPanelGridButtonName[] = + + { + "Grid X", + "Grid Y", + "Grid Off", + "Close" + }; + + + XfsmPanelButtonItem XfsmViewGridButton[] = + + { + { + &XfsmPanelGridButtonName[0], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackSetGridX, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmPanelGridButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 1, + 1, 1, + CallbackSetGridY, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmPanelGridButtonName[2], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 2, + 1, 1, + CallbackGridOnOff, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmPanelGridButtonName[3], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 3, + 1, 1, + CallbackCloseGrid, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XfsmPanelItem XfsmViewGridPanel = + + { + "Grid", + 1, + 0, + XFSM_VIEW_GRID_X, + XFSM_VIEW_GRID_Y, + 100, + 100, + 1, + 4, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XfsmViewGridButton + }; + + int XfsmViewGridDefaultValues[ 5 ] = + + { + XFSM_VIEW_GRID_X, + XFSM_VIEW_GRID_Y, + 100, 100, 0 + }; + +/*------------------------------------------------------------\ +| | +| Panel Layer | +| | +\------------------------------------------------------------*/ + + static char *XfsmViewLayerButtonBackground = "Black"; + static char *XfsmViewLayerButtonForeground = "White"; + + static char *XfsmPanelLayerButtonName[] = + + { + "All visible", + "All invisible", + "State Text", + "Trans Text", + "Apply", + "Close" + }; + + static char *XfsmViewLayerCursorType[] = + + { + "Invert", + "Xor" + }; + + static char *XfsmViewLayerForceDisplay[] = + + { + "Quick display", + "Force display" + }; + + XfsmPanelButtonItem XfsmViewLayerButton[] = + + { + { + &XfsmPanelLayerButtonName[0], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerAllVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmPanelLayerButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 1, 0, + 1, 1, + CallbackLayerAllInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XFSM_LAYER_NAME_TABLE[ 0 ][ 0 ], + NULL, NULL, 0, 0, + &XFSM_LAYER_NAME_TABLE[ 0 ][ 1 ], + &XFSM_LAYER_NAME_TABLE[ 0 ][ 2 ], + 0, 1, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + &XFSM_LAYER_NAME_TABLE[ 0 ][ 0 ], + NULL, NULL, 0, 0, + &XFSM_LAYER_NAME_TABLE[ 0 ][ 1 ], + &XFSM_LAYER_NAME_TABLE[ 0 ][ 2 ], + 1, 1, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + &XFSM_LAYER_NAME_TABLE[ 1 ][ 0 ], + NULL, NULL, 0, 0, + &XFSM_LAYER_NAME_TABLE[ 1 ][ 1 ], + &XFSM_LAYER_NAME_TABLE[ 1 ][ 2 ], + 0, 2, + 1, 1, + CallbackLayerVisible, + (XtPointer)1, + (Widget)NULL + } + , + { + &XFSM_LAYER_NAME_TABLE[ 1 ][ 0 ], + NULL, NULL, 0, 0, + &XFSM_LAYER_NAME_TABLE[ 1 ][ 1 ], + &XFSM_LAYER_NAME_TABLE[ 1 ][ 2 ], + 1, 2, + 1, 1, + CallbackLayerInvisible, + (XtPointer)1, + (Widget)NULL + } + , + { + &XFSM_LAYER_NAME_TABLE[ 2 ][ 0 ], + NULL, NULL, 0, 0, + &XFSM_LAYER_NAME_TABLE[ 2 ][ 1 ], + &XFSM_LAYER_NAME_TABLE[ 2 ][ 2 ], + 0, 3, + 1, 1, + CallbackLayerVisible, + (XtPointer)2, + (Widget)NULL + } + , + { + &XFSM_LAYER_NAME_TABLE[ 2 ][ 0 ], + NULL, NULL, 0, 0, + &XFSM_LAYER_NAME_TABLE[ 2 ][ 1 ], + &XFSM_LAYER_NAME_TABLE[ 2 ][ 2 ], + 1, 3, + 1, 1, + CallbackLayerInvisible, + (XtPointer)2, + (Widget)NULL + } + , + { + &XFSM_LAYER_NAME_TABLE[ 3 ][ 0 ], + NULL, NULL, 0, 0, + &XFSM_LAYER_NAME_TABLE[ 3 ][ 1 ], + &XFSM_LAYER_NAME_TABLE[ 3 ][ 2 ], + 0, 4, + 1, 1, + CallbackLayerVisible, + (XtPointer)3, + (Widget)NULL + } + , + { + &XFSM_LAYER_NAME_TABLE[ 3 ][ 0 ], + NULL, NULL, 0, 0, + &XFSM_LAYER_NAME_TABLE[ 3 ][ 1 ], + &XFSM_LAYER_NAME_TABLE[ 3 ][ 2 ], + 1, 4, + 1, 1, + CallbackLayerInvisible, + (XtPointer)3, + (Widget)NULL + } + , + { + &XFSM_LAYER_NAME_TABLE[ 4 ][ 0 ], + NULL, NULL, 0, 0, + &XFSM_LAYER_NAME_TABLE[ 4 ][ 1 ], + &XFSM_LAYER_NAME_TABLE[ 4 ][ 2 ], + 0, 5, + 1, 1, + CallbackLayerVisible, + (XtPointer)4, + (Widget)NULL + } + , + { + &XFSM_LAYER_NAME_TABLE[ 4 ][ 0 ], + NULL, NULL, 0, 0, + &XFSM_LAYER_NAME_TABLE[ 4 ][ 1 ], + &XFSM_LAYER_NAME_TABLE[ 4 ][ 2 ], + 1, 5, + 1, 1, + CallbackLayerInvisible, + (XtPointer)4, + (Widget)NULL + } + , + { + &XFSM_LAYER_NAME_TABLE[ 5 ][ 0 ], + NULL, NULL, 0, 0, + &XFSM_LAYER_NAME_TABLE[ 5 ][ 1 ], + &XFSM_LAYER_NAME_TABLE[ 5 ][ 2 ], + 0, 6, + 1, 1, + CallbackLayerVisible, + (XtPointer)5, + (Widget)NULL + } + , + { + &XFSM_LAYER_NAME_TABLE[ 5 ][ 0 ], + NULL, NULL, 0, 0, + &XFSM_LAYER_NAME_TABLE[ 5 ][ 1 ], + &XFSM_LAYER_NAME_TABLE[ 5 ][ 2 ], + 1, 6, + 1, 1, + CallbackLayerInvisible, + (XtPointer)5, + (Widget)NULL + } + , + { + &XFSM_LAYER_NAME_TABLE[ 6 ][ 0 ], + NULL, NULL, 0, 0, + &XFSM_LAYER_NAME_TABLE[ 6 ][ 1 ], + &XFSM_LAYER_NAME_TABLE[ 6 ][ 2 ], + 0, 7, + 1, 1, + CallbackLayerVisible, + (XtPointer)6, + (Widget)NULL + } + , + { + &XFSM_LAYER_NAME_TABLE[ 6 ][ 0 ], + NULL, NULL, 0, 0, + &XFSM_LAYER_NAME_TABLE[ 6 ][ 1 ], + &XFSM_LAYER_NAME_TABLE[ 6 ][ 2 ], + 1, 7, + 1, 1, + CallbackLayerInvisible, + (XtPointer)6, + (Widget)NULL + } + , + { + &XFSM_LAYER_NAME_TABLE[ 7 ][ 0 ], + NULL, NULL, 0, 0, + &XFSM_LAYER_NAME_TABLE[ 7 ][ 1 ], + &XFSM_LAYER_NAME_TABLE[ 7 ][ 2 ], + 0, 8, + 1, 1, + CallbackLayerVisible, + (XtPointer)7, + (Widget)NULL + } + , + { + &XFSM_LAYER_NAME_TABLE[ 7 ][ 0 ], + NULL, NULL, 0, 0, + &XFSM_LAYER_NAME_TABLE[ 7 ][ 1 ], + &XFSM_LAYER_NAME_TABLE[ 7 ][ 2 ], + 1, 8, + 1, 1, + CallbackLayerInvisible, + (XtPointer)7, + (Widget)NULL + } + , + { + &XFSM_LAYER_NAME_TABLE[ 8 ][ 0 ], + NULL, NULL, 0, 0, + &XFSM_LAYER_NAME_TABLE[ 8 ][ 1 ], + &XFSM_LAYER_NAME_TABLE[ 8 ][ 2 ], + 0, 9, + 1, 1, + CallbackLayerVisible, + (XtPointer)8, + (Widget)NULL + } + , + { + &XFSM_LAYER_NAME_TABLE[ 8 ][ 0 ], + NULL, NULL, 0, 0, + &XFSM_LAYER_NAME_TABLE[ 8 ][ 1 ], + &XFSM_LAYER_NAME_TABLE[ 8 ][ 2 ], + 1, 9, + 1, 1, + CallbackLayerInvisible, + (XtPointer)8, + (Widget)NULL + } + , + { + &XFSM_LAYER_NAME_TABLE[ 9 ][ 0 ], + NULL, NULL, 0, 0, + &XFSM_LAYER_NAME_TABLE[ 9 ][ 1 ], + &XFSM_LAYER_NAME_TABLE[ 9 ][ 2 ], + 0, 10, + 1, 1, + CallbackLayerVisible, + (XtPointer)9, + (Widget)NULL + } + , + { + &XFSM_LAYER_NAME_TABLE[ 9 ][ 0 ], + NULL, NULL, 0, 0, + &XFSM_LAYER_NAME_TABLE[ 9 ][ 1 ], + &XFSM_LAYER_NAME_TABLE[ 9 ][ 2 ], + 1, 10, + 1, 1, + CallbackLayerInvisible, + (XtPointer)9, + (Widget)NULL + } + , + { + &XfsmPanelLayerButtonName[2], + NULL, NULL, 0, 0, + &XfsmViewLayerButtonForeground, + &XfsmViewLayerButtonBackground, + 0, 11, + 1, 1, + CallbackNameVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + &XfsmPanelLayerButtonName[2], + NULL, NULL, 0, 0, + &XfsmViewLayerButtonForeground, + &XfsmViewLayerButtonBackground, + 1, 11, + 1, 1, + CallbackNameInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + &XfsmPanelLayerButtonName[3], + NULL, NULL, 0, 0, + &XfsmViewLayerButtonForeground, + &XfsmViewLayerButtonBackground, + 0, 12, + 1, 1, + CallbackNameVisible, + (XtPointer)1, + (Widget)NULL + } + , + { + &XfsmPanelLayerButtonName[3], + NULL, NULL, 0, 0, + &XfsmViewLayerButtonForeground, + &XfsmViewLayerButtonBackground, + 1, 12, + 1, 1, + CallbackNameInvisible, + (XtPointer)1, + (Widget)NULL + } + , + { + &XfsmViewLayerCursorType[0], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 13, + 1, 1, + CallbackLayerCursor, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmViewLayerForceDisplay[0], + NULL, NULL, 0, 0, + NULL, + NULL, + 1, 13, + 1, 1, + CallbackLayerForceDisplay, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmPanelLayerButtonName[4], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 14, + 1, 1, + CallbackLayerApply, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XfsmPanelLayerButtonName[5], + NULL, NULL, 0, 0, + NULL, + NULL, + 1, 14, + 1, 1, + CallbackCloseLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XfsmPanelItem XfsmViewLayerPanel = + + { + "Layer", + 1, + 0, + XFSM_VIEW_LAYER_X, + XFSM_VIEW_LAYER_Y, + 200, + 375, + 2, + 15, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XfsmViewLayerButton + }; + + int XfsmViewLayerDefaultValues[ 5 ] = + + { + XFSM_VIEW_LAYER_X, + XFSM_VIEW_LAYER_Y, + 200, 375, 0 + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback For Arrows | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackLeftArrow | +| | +\------------------------------------------------------------*/ + +void CallbackLeftArrow( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmZoomLeft(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackRightArrow | +| | +\------------------------------------------------------------*/ + +void CallbackRightArrow( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmZoomRight(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackUpArrow | +| | +\------------------------------------------------------------*/ + +void CallbackUpArrow( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmZoomUp(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackDownArrow | +| | +\------------------------------------------------------------*/ + +void CallbackDownArrow( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmZoomDown(); + + autend(); +} + + +/*------------------------------------------------------------\ +| | +| CallbackMoveSet | +| | +\------------------------------------------------------------*/ + +void CallbackMoveSet( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmEnterDialog( &XfsmViewMoveSetDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCloseArrows | +| | +\------------------------------------------------------------*/ + +void CallbackCloseArrows( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmExitPanel( &XfsmViewArrowsPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Zoom Callback | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackZoomRefresh | +| | +\------------------------------------------------------------*/ + +void CallbackZoomRefresh( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmZoomRefresh(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomPrevious | +| | +\------------------------------------------------------------*/ + +void CallbackZoomPrevious( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmZoomUndo(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomLess | +| | +\------------------------------------------------------------*/ + +void CallbackZoomLess( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmZoomLess(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomMore | +| | +\------------------------------------------------------------*/ + +void CallbackZoomMore( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmZoomMore(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomSet | +| | +\------------------------------------------------------------*/ + +void CallbackZoomSet( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmEnterDialog( &XfsmViewZoomSetDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCloseZoom | +| | +\------------------------------------------------------------*/ + +void CallbackCloseZoom( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmExitPanel( &XfsmViewZoomPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomIn | +| | +\------------------------------------------------------------*/ + +void CallbackZoomIn( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmChangeEditMode( XFSM_ZOOM_IN, + XfsmPromptZoomIn ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomCenter | +| | +\------------------------------------------------------------*/ + +void CallbackZoomCenter( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmChangeEditMode( XFSM_ZOOM_CENTER, + XfsmPromptZoomCenter ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomGoto | +| | +\------------------------------------------------------------*/ + +void CallbackZoomGoto( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmEnterDialog( &XfsmViewZoomGotoDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomPan | +| | +\------------------------------------------------------------*/ + +void CallbackZoomPan( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmChangeEditMode( XFSM_ZOOM_PAN, + XfsmPromptZoomPan ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomFit | +| | +\------------------------------------------------------------*/ + +void CallbackZoomFit( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmZoomFit(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Grid | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackSetGridX | +| | +\------------------------------------------------------------*/ + +void CallbackSetGridX( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmEnterDialog( &XfsmViewGridXDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSetGridY | +| | +\------------------------------------------------------------*/ + +void CallbackSetGridY( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmEnterDialog( &XfsmViewGridYDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackGridOnOff | +| | +\------------------------------------------------------------*/ + +void CallbackGridOnOff( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + XmString Label; + + autbegin(); + + XfsmUnitUserGrid = ! XfsmUnitUserGrid; + + if ( XfsmUnitUserGrid == XFSM_FALSE ) + { + Label = XmStringCreateSimple( "Grid Off" ); + } + else + { + Label = XmStringCreateSimple( "Grid On" ); + } + + XtVaSetValues( MyWidget, XmNlabelString, Label, + XmNresizable , False, + NULL ); + XmStringFree( Label ); + + XfsmZoomRefresh(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCloseGrid | +| | +\------------------------------------------------------------*/ + +void CallbackCloseGrid( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmExitPanel( &XfsmViewGridPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Layer | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackLayerAllVisible | +| | +\------------------------------------------------------------*/ + +void CallbackLayerAllVisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmLayerAllVisible(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerAllInvisible | +| | +\------------------------------------------------------------*/ + +void CallbackLayerAllInvisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmLayerAllInvisible(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerVisible | +| | +\------------------------------------------------------------*/ + +void CallbackLayerVisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + if ( XFSM_ACTIVE_LAYER_TABLE[ (int)ClientData ] == 0 ) + { + XfsmSetLayerVisible( (int)ClientData ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerInvisible | +| | +\------------------------------------------------------------*/ + +void CallbackLayerInvisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + if ( XFSM_ACTIVE_LAYER_TABLE[ (int)ClientData ] ) + { + XfsmSetLayerInvisible( (int)ClientData ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackNameVisible | +| | +\------------------------------------------------------------*/ + +void CallbackNameVisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + if ( XFSM_ACTIVE_NAME_TABLE[ (int)ClientData ] == 0 ) + { + XfsmSetNameVisible( ClientData ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackNameInvisible | +| | +\------------------------------------------------------------*/ + +void CallbackNameInvisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + if ( XFSM_ACTIVE_NAME_TABLE[ (int)ClientData ] ) + { + XfsmSetNameInvisible( ClientData ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerCursor | +| | +\------------------------------------------------------------*/ + +void CallbackLayerCursor( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XFSM_XOR_CURSOR = ! XFSM_XOR_CURSOR; + XfsmChangeCursor( XFSM_XOR_CURSOR ); + + XfsmChangeCursorContext(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerForceDisplay | +| | +\------------------------------------------------------------*/ + +void CallbackLayerForceDisplay( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XFSM_FORCE_DISPLAY = ! XFSM_FORCE_DISPLAY; + XfsmChangeForceDisplay( XFSM_FORCE_DISPLAY ); + + autend(); +} + + +/*------------------------------------------------------------\ +| | +| XfsmChangeCursor | +| | +\------------------------------------------------------------*/ + +void XfsmChangeCursor( Type ) + + char Type; +{ + int Pos; + XmString Label; + + autbegin(); + + Pos = 2 + ( ( XFSM_MAX_LAYER + XFSM_MAX_ACTIVE_NAME ) << 1 ); + Label = XmStringCreateSimple( XfsmViewLayerCursorType[ Type ] ); + + XtVaSetValues( XfsmViewLayerButton[ Pos ].BUTTON, + XmNlabelString, Label, + XmNresizable , False, + NULL ); + + XmStringFree( Label ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmChangeForceDisplay | +| | +\------------------------------------------------------------*/ + +void XfsmChangeForceDisplay( Index ) + + char Index; +{ + int Pos; + XmString Label; + + autbegin(); + + Pos = 3 + ( ( XFSM_MAX_LAYER + XFSM_MAX_ACTIVE_NAME ) << 1 ); + Label = XmStringCreateSimple( XfsmViewLayerForceDisplay[ Index ] ); + + XtVaSetValues( XfsmViewLayerButton[ Pos ].BUTTON, + XmNlabelString, Label, + XmNresizable , False, + NULL ); + + XmStringFree( Label ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerApply | +| | +\------------------------------------------------------------*/ + +void CallbackLayerApply( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmZoomRefresh(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCloseLayer | +| | +\------------------------------------------------------------*/ + +void CallbackCloseLayer( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XfsmExitPanel( &XfsmViewLayerPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmSetLayerVisible | +| | +\------------------------------------------------------------*/ + +void XfsmSetLayerVisible( Layer ) + + int Layer; +{ + int Index; + char *Background; + char *Foreground; + + autbegin(); + + Index = ( Layer << 1 ) + 2; + + if ( XfsmViewLayerButton[ Index ].BUTTON != NULL ) + { + XFSM_ACTIVE_LAYER_TABLE[ Layer ] = 1; + + XtVaSetValues( XfsmViewLayerButton[ Index + 1 ].BUTTON, + XtVaTypedArg , + XmNbackground , + XmRString , + XFSM_BLACK_COLOR_NAME , + strlen( XFSM_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + XtVaSetValues( XfsmViewLayerButton[ Index + 1 ].BUTTON, + XtVaTypedArg , + XmNforeground , + XmRString , + XFSM_BLACK_COLOR_NAME , + strlen( XFSM_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + Background = *XfsmViewLayerButton[ Index ].BACKGROUND; + Foreground = *XfsmViewLayerButton[ Index ].FOREGROUND; + + XtVaSetValues( XfsmViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNbackground , + XmRString , + Background , + strlen( Background ) + 1, + NULL + ); + + XtVaSetValues( XfsmViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNforeground , + XmRString , + Foreground , + strlen( Foreground ) + 1, + NULL + ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmSetNameVisible | +| | +\------------------------------------------------------------*/ + +void XfsmSetNameVisible( Name ) + + int Name; +{ + int Index; + char *Background; + char *Foreground; + + autbegin(); + + Index = 2 + ( ( XFSM_MAX_LAYER + Name ) << 1 ); + + if ( XfsmViewLayerButton[ Index ].BUTTON != NULL ) + { + XFSM_ACTIVE_NAME_TABLE[ Name ] = 1; + + XtVaSetValues( XfsmViewLayerButton[ Index + 1 ].BUTTON, + XtVaTypedArg , + XmNbackground , + XmRString , + XFSM_BLACK_COLOR_NAME , + strlen( XFSM_BLACK_COLOR_NAME ) + 1, + NULL + ); + + XtVaSetValues( XfsmViewLayerButton[ Index + 1 ].BUTTON, + XtVaTypedArg , + XmNforeground , + XmRString , + XFSM_BLACK_COLOR_NAME , + strlen( XFSM_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + Background = *XfsmViewLayerButton[ Index ].BACKGROUND; + Foreground = *XfsmViewLayerButton[ Index ].FOREGROUND; + + XtVaSetValues( XfsmViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNbackground , + XmRString , + Background , + strlen( Background ) + 1, + NULL + ); + + XtVaSetValues( XfsmViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNforeground , + XmRString , + Foreground , + strlen( Foreground ) + 1, + NULL + ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmSetLayerInvisible | +| | +\------------------------------------------------------------*/ + +void XfsmSetLayerInvisible( Layer ) + + int Layer; +{ + int Index; + char *Background; + char *Foreground; + + autbegin(); + + Index = 3 + ( Layer << 1 ); + + if ( XfsmViewLayerButton[ Index ].BUTTON != NULL ) + { + XFSM_ACTIVE_LAYER_TABLE[ Layer ] = 0; + + XtVaSetValues( XfsmViewLayerButton[ Index - 1 ].BUTTON, + XtVaTypedArg , + XmNbackground , + XmRString , + XFSM_BLACK_COLOR_NAME , + strlen( XFSM_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + XtVaSetValues( XfsmViewLayerButton[ Index - 1 ].BUTTON, + XtVaTypedArg , + XmNforeground , + XmRString , + XFSM_BLACK_COLOR_NAME , + strlen( XFSM_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + Background = *XfsmViewLayerButton[ Index ].BACKGROUND; + Foreground = *XfsmViewLayerButton[ Index ].FOREGROUND; + + XtVaSetValues( XfsmViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNbackground , + XmRString , + Background , + strlen( Background ) + 1 , + NULL + ); + + XtVaSetValues( XfsmViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNforeground , + XmRString , + Foreground , + strlen( Foreground ) + 1 , + NULL + ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmSetNameInvisible | +| | +\------------------------------------------------------------*/ + +void XfsmSetNameInvisible( Name ) + + int Name; +{ + int Index; + char *Background; + char *Foreground; + + autbegin(); + + Index = 3 + ( ( XFSM_MAX_LAYER + Name ) << 1 ); + + if ( XfsmViewLayerButton[ Index ].BUTTON != NULL ) + { + XFSM_ACTIVE_NAME_TABLE[ Name ] = 0; + + XtVaSetValues( XfsmViewLayerButton[ Index - 1 ].BUTTON, + XtVaTypedArg , + XmNbackground , + XmRString , + XFSM_BLACK_COLOR_NAME , + strlen( XFSM_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + XtVaSetValues( XfsmViewLayerButton[ Index - 1 ].BUTTON, + XtVaTypedArg , + XmNforeground , + XmRString , + XFSM_BLACK_COLOR_NAME , + strlen( XFSM_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + Background = *XfsmViewLayerButton[ Index ].BACKGROUND; + Foreground = *XfsmViewLayerButton[ Index ].FOREGROUND; + + XtVaSetValues( XfsmViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNbackground , + XmRString , + Background , + strlen( Background ) + 1 , + NULL + ); + + XtVaSetValues( XfsmViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNforeground , + XmRString , + Foreground , + strlen( Foreground ) + 1 , + NULL + ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmLayerAllVisible | +| | +\------------------------------------------------------------*/ + +void XfsmLayerAllVisible() + +{ + int Index; + + autbegin(); + + for ( Index = 0; Index < XFSM_MAX_LAYER; Index++ ) + { + XfsmSetLayerVisible( Index ); + } + + for ( Index = 0; Index < XFSM_MAX_ACTIVE_NAME; Index++ ) + { + XfsmSetNameVisible( Index ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmInitializeLayer | +| | +\------------------------------------------------------------*/ + +void XfsmInitializeLayer() + +{ + int Index; + + autbegin(); + + for ( Index = 0; Index < XFSM_MAX_LAYER; Index++ ) + { + if ( XFSM_ACTIVE_LAYER_TABLE[ Index ] == 0 ) + { + XfsmSetLayerInvisible( Index ); + } + else + { + XfsmSetLayerVisible( Index ); + } + } + + for ( Index = 0; Index < XFSM_MAX_ACTIVE_NAME; Index++ ) + { + if ( XFSM_ACTIVE_NAME_TABLE[ Index ] == 0 ) + { + XfsmSetNameInvisible( Index ); + } + else + { + XfsmSetNameVisible( Index ); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmLayerAllInvisible | +| | +\------------------------------------------------------------*/ + +void XfsmLayerAllInvisible() + +{ + int Index; + + autbegin(); + + for ( Index = 0; Index < XFSM_MAX_LAYER; Index++ ) + { + XfsmSetLayerInvisible( Index ); + } + + for ( Index = 0; Index < XFSM_MAX_ACTIVE_NAME; Index++ ) + { + XfsmSetNameInvisible( Index ); + } + + autend(); +} diff --git a/alliance/src/xfsm/src/XMV_panel.h b/alliance/src/xfsm/src/XMV_panel.h new file mode 100644 index 00000000..0a3afdc7 --- /dev/null +++ b/alliance/src/xfsm/src/XMV_panel.h @@ -0,0 +1,130 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_VIEW_PANEL +# define XFSM_VIEW_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XFSM_VIEW_ARROWS_X 990 +# define XFSM_VIEW_ARROWS_Y 80 +# define XFSM_VIEW_ZOOM_X 990 +# define XFSM_VIEW_ZOOM_Y 230 +# define XFSM_VIEW_GRID_X 470 +# define XFSM_VIEW_GRID_Y 330 +# define XFSM_VIEW_LAYER_X 430 +# define XFSM_VIEW_LAYER_Y 190 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback View Panel | +| | +\------------------------------------------------------------*/ + + extern void CallbackLeftArrow(); + extern void CallbackRightArrow(); + extern void CallbackUpArrow(); + extern void CallbackDownArrow(); + extern void CallbackMoveSet(); + extern void CallbackCloseArrows(); + + extern void CallbackZoomRefresh(); + extern void CallbackZoomPrevious(); + extern void CallbackZoomLess(); + extern void CallbackZoomMore(); + extern void CallbackZoomSet(); + extern void CallbackZoomIn(); + extern void CallbackZoomFit(); + extern void CallbackZoomCenter(); + extern void CallbackZoomGoto(); + extern void CallbackZoomPan(); + extern void CallbackCloseZoom(); + + extern void CallbackSetGridX(); + extern void CallbackSetGridY(); + extern void CallbackGridOnOff(); + extern void CallbackCloseGrid(); + + extern void CallbackLayerAllVisible(); + extern void CallbackLayerAllInvisible(); + extern void CallbackLayerVisible(); + extern void CallbackLayerInvisible(); + extern void CallbackNameVisible(); + extern void CallbackNameInvisible(); + extern void CallbackLayerCursor(); + extern void CallbackLayerForceDisplay(); + extern void CallbackLayerApply(); + extern void CallbackCloseLayer(); + + extern void XfsmChangeForceDisplay(); + extern void XfsmChangeCursor(); + + extern void XfsmSetLayerVisible(); + extern void XfsmSetLayerInvisible(); + extern void XfsmSetNameVisible(); + extern void XfsmSetNameInvisible(); + extern void XfsmLayerAllVisible(); + extern void XfsmLayerAllInvisible(); + +# endif diff --git a/alliance/src/xfsm/src/XMV_view.c b/alliance/src/xfsm/src/XMV_view.c new file mode 100644 index 00000000..c1d7b598 --- /dev/null +++ b/alliance/src/xfsm/src/XMV_view.c @@ -0,0 +1,673 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : View.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XFS.h" +# include "XTB.h" +# include "XMX.h" +# include "XMV.h" + +# include "XMV_view.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + xfsmzoom *XfsmHeadZoom = (xfsmzoom *)NULL; + + int XfsmPercentZoom = XFSM_PERCENT_ZOOM; + int XfsmPercentMoveX = XFSM_PERCENT_MOVE; + int XfsmPercentMoveY = XFSM_PERCENT_MOVE; + +/*------------------------------------------------------------\ +| | +| Menu | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmAllocZoom | +| | +\------------------------------------------------------------*/ + +xfsmzoom *XfsmAllocZoom () + +{ + return ( (xfsmzoom *) autalloc( sizeof ( xfsmzoom ), 1)); +} + +/*------------------------------------------------------------\ +| | +| XfsmFreeZoom | +| | +\------------------------------------------------------------*/ + +void XfsmFreeZoom ( FreeZoom ) + + xfsmzoom *FreeZoom; + +{ + autfree( (char *)FreeZoom, sizeof(FreeZoom) ); +} + +/*------------------------------------------------------------\ +| | +| XfsmAddZoom | +| | +\------------------------------------------------------------*/ + +void XfsmAddZoom () + +{ + xfsmzoom *XfsmZoom; + + autbegin(); + + XfsmZoom = XfsmAllocZoom (); + XfsmZoom->X = XfsmUnitGridX; + XfsmZoom->Y = XfsmUnitGridY; + XfsmZoom->DX = XfsmUnitGridDx; + XfsmZoom->DY = XfsmUnitGridDy; + XfsmZoom->NEXT = XfsmHeadZoom; + XfsmHeadZoom = XfsmZoom; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmDelZoom | +| | +\------------------------------------------------------------*/ + +char XfsmDelZoom() + +{ + xfsmzoom *XfsmZoom; + + if ( XfsmHeadZoom != (xfsmzoom *) NULL ) + { + autbegin(); + + XfsmZoom = XfsmHeadZoom; + XfsmHeadZoom = XfsmHeadZoom->NEXT; + XfsmFreeZoom( XfsmZoom ); + + autend(); + return( XFSM_TRUE ); + } + + return( XFSM_FALSE ); +} + +/*------------------------------------------------------------\ +| | +| XfsmInitializeZoom | +| | +\------------------------------------------------------------*/ + +void XfsmInitializeZoom() + +{ + autbegin(); + + while( XfsmDelZoom() != XFSM_FALSE ); + + if ( XfsmComputeBound() == XFSM_FALSE ) + { + XfsmInitializeUnitGrid(); + } + else + { + XfsmUnitGridX = ( XfsmBoundXmin / XFSM_UNIT ) - 1; + XfsmUnitGridY = ( XfsmBoundYmin / XFSM_UNIT ) - 1; + XfsmUnitGridDx = ( XfsmBoundXmax / XFSM_UNIT ); + XfsmUnitGridDy = ( XfsmBoundYmax / XFSM_UNIT ); + XfsmUnitGridDx = XfsmUnitGridDx - XfsmUnitGridX + 1; + XfsmUnitGridDy = XfsmUnitGridDy - XfsmUnitGridY + 1; + + XfsmComputeUnitGrid(); + } + + XfsmComputeAndDisplayMap(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmZoomUndo | +| | +\------------------------------------------------------------*/ + +void XfsmZoomUndo() + +{ + autbegin(); + + if ( XfsmHeadZoom == (xfsmzoom *)NULL ) + { + XfsmErrorMessage( XfsmMainWindow, "No previous zoom !" ); + } + else + { + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_WATCH_CURSOR ); + + XfsmUnitGridX = XfsmHeadZoom->X; + XfsmUnitGridY = XfsmHeadZoom->Y; + XfsmUnitGridDx = XfsmHeadZoom->DX; + XfsmUnitGridDy = XfsmHeadZoom->DY; + + XfsmComputeUnitGrid(); + XfsmComputeAndDisplayMap(); + + XfsmDisplayFigure( 0, 0, + XfsmGraphicDx, XfsmGraphicDy ); + + XfsmRefreshGraphicWindow( 0, 0, + XfsmGraphicDx, XfsmGraphicDy); + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_NORMAL_CURSOR ); + + XfsmDelZoom(); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmZoomRight | +| | +\------------------------------------------------------------*/ + +void XfsmZoomRight() + +{ + long Delta; + long Offset; + long XfsmOldPixelGridX; + + autbegin(); + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_WATCH_CURSOR ); + + Delta = ( XfsmPercentMoveX * XfsmUnitGridDx ) / 100; + + if ( Delta == 0 ) Delta = 1; + + XfsmUnitGridX = XfsmUnitGridX + Delta; + XfsmOldPixelGridX = XfsmPixelGridX; + XfsmPixelGridX = (float)(XfsmUnitGridX) * XfsmUnitGridStep; + Offset = XfsmPixelGridX - XfsmOldPixelGridX; + + XCopyArea( XfsmGraphicDisplay, + XfsmGraphicPixmap, + XfsmGraphicPixmap, + XfsmBackgroundGC, + Offset, 0, + XfsmGraphicDx - Offset, + XfsmGraphicDy, + 0, 0 + ); + + XfsmComputeAndDisplayMap(); + XfsmDisplayFigure( XfsmGraphicDx - Offset, 0, + XfsmGraphicDx, XfsmGraphicDy ); + XfsmRefreshGraphicWindow( 0, 0, + XfsmGraphicDx, XfsmGraphicDy); + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmZoomLeft | +| | +\------------------------------------------------------------*/ + +void XfsmZoomLeft() + +{ + long Delta; + long Offset; + long XfsmOldPixelGridX; + + autbegin(); + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_WATCH_CURSOR ); + + Delta = ( XfsmPercentMoveX * XfsmUnitGridDx ) / 100; + + if ( Delta == 0 ) Delta = 1; + + XfsmUnitGridX = XfsmUnitGridX - Delta; + XfsmOldPixelGridX = XfsmPixelGridX; + XfsmPixelGridX = (float)(XfsmUnitGridX) * XfsmUnitGridStep; + Offset = XfsmOldPixelGridX - XfsmPixelGridX; + + XCopyArea( XfsmGraphicDisplay, + XfsmGraphicPixmap, + XfsmGraphicPixmap, + XfsmBackgroundGC, + 0, 0, + XfsmGraphicDx - Offset, + XfsmGraphicDy, + Offset, 0 + ); + + XfsmComputeAndDisplayMap(); + XfsmDisplayFigure( 0, 0, Offset, XfsmGraphicDy ); + XfsmRefreshGraphicWindow( 0, 0, XfsmGraphicDx, XfsmGraphicDy); + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmZoomDown | +| | +\------------------------------------------------------------*/ + +void XfsmZoomDown() + +{ + long Delta; + long Offset; + long XfsmOldPixelGridY; + + autbegin(); + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_WATCH_CURSOR ); + + Delta = ( XfsmPercentMoveY * XfsmUnitGridDy ) / 100; + + if ( Delta == 0 ) Delta = 1; + + XfsmUnitGridY = XfsmUnitGridY - Delta; + XfsmOldPixelGridY = XfsmPixelGridY; + XfsmPixelGridY = (float)(XfsmUnitGridY) * XfsmUnitGridStep; + Offset = XfsmOldPixelGridY - XfsmPixelGridY; + + XCopyArea( XfsmGraphicDisplay, + XfsmGraphicPixmap, + XfsmGraphicPixmap, + XfsmBackgroundGC, + 0, Offset, + XfsmGraphicDx, + XfsmGraphicDy - Offset, + 0, 0 + ); + + XfsmComputeAndDisplayMap(); + XfsmDisplayFigure( 0, 0, XfsmGraphicDx, Offset ); + XfsmRefreshGraphicWindow( 0, 0, XfsmGraphicDx, XfsmGraphicDy); + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmZoomUp | +| | +\------------------------------------------------------------*/ + +void XfsmZoomUp() + +{ + long Delta; + long Offset; + long XfsmOldPixelGridY; + + autbegin(); + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_WATCH_CURSOR ); + + Delta = ( XfsmPercentMoveY * XfsmUnitGridDy ) / 100; + + if ( Delta == 0 ) Delta = 1; + + XfsmUnitGridY = XfsmUnitGridY + Delta; + XfsmOldPixelGridY = XfsmPixelGridY; + XfsmPixelGridY = (float)(XfsmUnitGridY) * XfsmUnitGridStep; + Offset = XfsmPixelGridY - XfsmOldPixelGridY; + + XCopyArea( XfsmGraphicDisplay, + XfsmGraphicPixmap, + XfsmGraphicPixmap, + XfsmBackgroundGC, + 0, 0, + XfsmGraphicDx, + XfsmGraphicDy - Offset, + 0, Offset + ); + + XfsmComputeAndDisplayMap(); + XfsmDisplayFigure( 0, XfsmGraphicDy - Offset, + XfsmGraphicDx, XfsmGraphicDy ); + XfsmRefreshGraphicWindow( 0, 0, XfsmGraphicDx, XfsmGraphicDy); + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmZoomMore | +| | +\------------------------------------------------------------*/ + +void XfsmZoomMore() + +{ + long DeltaX; + long DeltaY; + + autbegin(); + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_WATCH_CURSOR ); + + DeltaX = ( XfsmPercentZoom * XfsmUnitGridDx ) / 100; + DeltaY = ( XfsmPercentZoom * XfsmUnitGridDy ) / 100; + + if ( ( DeltaX >= 2 ) && + ( DeltaY >= 2 ) ) + { + XfsmAddZoom(); + + XfsmUnitGridX = XfsmUnitGridX + (DeltaX >> 1); + XfsmUnitGridY = XfsmUnitGridY + (DeltaY >> 1); + XfsmUnitGridDx = XfsmUnitGridDx - DeltaX; + XfsmUnitGridDy = XfsmUnitGridDy - DeltaY; + + XfsmComputeUnitGrid(); + XfsmComputeAndDisplayMap(); + XfsmDisplayFigure( 0, 0, XfsmGraphicDx, XfsmGraphicDy ); + XfsmRefreshGraphicWindow( 0, 0, XfsmGraphicDx, XfsmGraphicDy ); + } + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmZoomLess | +| | +\------------------------------------------------------------*/ + +void XfsmZoomLess() + +{ + long DeltaX; + long DeltaY; + + autbegin(); + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_WATCH_CURSOR ); + + DeltaX = 100 * XfsmUnitGridDx / ( 100 - XfsmPercentZoom ); + DeltaY = 100 * XfsmUnitGridDy / ( 100 - XfsmPercentZoom ); + + XfsmAddZoom(); + + XfsmUnitGridX = XfsmUnitGridX - ((DeltaX - XfsmUnitGridDx) >> 1); + XfsmUnitGridY = XfsmUnitGridY - ((DeltaY - XfsmUnitGridDy) >> 1); + XfsmUnitGridDx = DeltaX; + XfsmUnitGridDy = DeltaY; + + XfsmComputeUnitGrid(); + XfsmComputeAndDisplayMap(); + XfsmDisplayFigure( 0, 0, XfsmGraphicDx, XfsmGraphicDy ); + XfsmRefreshGraphicWindow( 0, 0, XfsmGraphicDx, XfsmGraphicDy ); + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmZoomFit | +| | +\------------------------------------------------------------*/ + +void XfsmZoomFit() + +{ + autbegin(); + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_WATCH_CURSOR ); + + if ( XfsmComputeBound() == XFSM_FALSE ) + { + XfsmErrorMessage( XfsmMainWindow, "No element to display !" ); + } + else + { + XfsmAddZoom(); + + XfsmUnitGridX = ( XfsmBoundXmin / XFSM_UNIT ) - 1; + XfsmUnitGridY = ( XfsmBoundYmin / XFSM_UNIT ) - 1; + XfsmUnitGridDx = XfsmBoundXmax / XFSM_UNIT; + XfsmUnitGridDy = XfsmBoundYmax / XFSM_UNIT; + XfsmUnitGridDx = XfsmUnitGridDx - XfsmUnitGridX + 1; + XfsmUnitGridDy = XfsmUnitGridDy - XfsmUnitGridY + 1; + + XfsmComputeUnitGrid(); + XfsmComputeAndDisplayMap(); + XfsmDisplayFigure( 0, 0, XfsmGraphicDx, XfsmGraphicDy ); + XfsmRefreshGraphicWindow( 0, 0, XfsmGraphicDx, XfsmGraphicDy ); + } + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmZoomCenter | +| | +\------------------------------------------------------------*/ + +void XfsmZoomCenter( UnitX, UnitY ) + + long UnitX; + long UnitY; +{ + autbegin(); + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_WATCH_CURSOR ); + + XfsmUnitGridX = UnitX - ( XfsmUnitGridDx >> 1 ); + XfsmUnitGridY = UnitY - ( XfsmUnitGridDy >> 1 ); + + XfsmComputeUnitGrid(); + XfsmComputeAndDisplayMap(); + XfsmDisplayFigure( 0, 0, XfsmGraphicDx, XfsmGraphicDy ); + XfsmRefreshGraphicWindow( 0, 0, XfsmGraphicDx, XfsmGraphicDy ); + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmZoomIn | +| | +\------------------------------------------------------------*/ + +void XfsmZoomIn( UnitX1, UnitY1, UnitX2, UnitY2 ) + + long UnitX1; + long UnitY1; + long UnitX2; + long UnitY2; +{ + long Swap; + + autbegin(); + + if ( ( UnitX1 != UnitX2 ) && + ( UnitY1 != UnitY2 ) ) + { + if ( UnitX1 > UnitX2 ) + { + Swap = UnitX1; UnitX1 = UnitX2; UnitX2 = Swap; + } + + if ( UnitY1 > UnitY2 ) + { + Swap = UnitY1; UnitY1 = UnitY2; UnitY2 = Swap; + } + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_WATCH_CURSOR ); + + XfsmAddZoom(); + + XfsmUnitGridX = UnitX1; + XfsmUnitGridY = UnitY1; + XfsmUnitGridDx = UnitX2 - UnitX1; + XfsmUnitGridDy = UnitY2 - UnitY1; + + XfsmComputeUnitGrid(); + XfsmComputeAndDisplayMap(); + XfsmDisplayFigure( 0, 0, XfsmGraphicDx, XfsmGraphicDy ); + XfsmRefreshGraphicWindow( 0, 0, XfsmGraphicDx, XfsmGraphicDy ); + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_NORMAL_CURSOR ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmZoomPan | +| | +\------------------------------------------------------------*/ + +void XfsmZoomPan( UnitX1, UnitY1, UnitX2, UnitY2 ) + + long UnitX1; + long UnitY1; + long UnitX2; + long UnitY2; +{ + if ( ( UnitX1 != UnitX2 ) || + ( UnitY1 != UnitY2 ) ) + { + autbegin(); + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_WATCH_CURSOR ); + + XfsmUnitGridX = XfsmUnitGridX + ( UnitX1 - UnitX2 ); + XfsmUnitGridY = XfsmUnitGridY + ( UnitY1 - UnitY2 ); + + XfsmComputeUnitGrid(); + XfsmComputeAndDisplayMap(); + XfsmDisplayFigure( 0, 0, XfsmGraphicDx, XfsmGraphicDy ); + XfsmRefreshGraphicWindow( 0, 0, XfsmGraphicDx, XfsmGraphicDy ); + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_NORMAL_CURSOR ); + + autend(); + } +} + +/*------------------------------------------------------------\ +| | +| XfsmZoomRefresh | +| | +\------------------------------------------------------------*/ + +void XfsmZoomRefresh() + +{ + autbegin(); + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_WATCH_CURSOR ); + + XfsmDisplayFigure( 0, 0, XfsmGraphicDx, XfsmGraphicDy ); + XfsmRefreshGraphicWindow( 0, 0, XfsmGraphicDx, XfsmGraphicDy ); + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_NORMAL_CURSOR ); + + autend(); +} diff --git a/alliance/src/xfsm/src/XMV_view.h b/alliance/src/xfsm/src/XMV_view.h new file mode 100644 index 00000000..11dae9b5 --- /dev/null +++ b/alliance/src/xfsm/src/XMV_view.h @@ -0,0 +1,108 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : View.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_VIEW +# define XFSM_VIEW + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XFSM_PERCENT_ZOOM 30 +# define XFSM_PERCENT_ZOOM_MIN 5 +# define XFSM_PERCENT_ZOOM_MAX 95 + +# define XFSM_PERCENT_MOVE 30 +# define XFSM_PERCENT_MOVE_MIN 5 +# define XFSM_PERCENT_MOVE_MAX 95 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct xfsmzoom + { + struct xfsmzoom *NEXT; + + long X; + long Y; + long DX; + long DY; + + } xfsmzoom; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern int XfsmPercentZoom; + extern int XfsmPercentMove; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmZoomUndo(); + extern void XfsmZoomRefresh(); + + extern void XfsmZoomLeft(); + extern void XfsmZoomRight(); + extern void XfsmZoomUp(); + extern void XfsmZoomDown(); + + extern void XfsmZoomMore(); + extern void XfsmZoomLess(); + + extern void XfsmZoomFit(); + +# endif diff --git a/alliance/src/xfsm/src/XMX.h b/alliance/src/xfsm/src/XMX.h new file mode 100644 index 00000000..470f992f --- /dev/null +++ b/alliance/src/xfsm/src/XMX.h @@ -0,0 +1,274 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : XMX.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_XMX +# define XFSM_XMX + +/*------------------------------------------------------------\ +| | +| Graphic Context | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Colors Define | +| | +\------------------------------------------------------------*/ + +# define XFSM_BLACK_COLOR_NAME "Black" + +/*------------------------------------------------------------\ +| | +| Xfsm Message | +| | +\------------------------------------------------------------*/ + +# define XFSM_MAX_MESSAGE 7 + +# define XFSM_MESSAGE_X 0 +# define XFSM_MESSAGE_Y 1 +# define XFSM_MESSAGE_DX 2 +# define XFSM_MESSAGE_DY 3 +# define XFSM_MESSAGE_MODE 4 +# define XFSM_MESSAGE_INFO 5 +# define XFSM_MESSAGE_PROMPT 6 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Xfsm Widget | +| | +\------------------------------------------------------------*/ + + extern XtAppContext XfsmApplication; + extern Widget XfsmTopLevel; + extern Widget XfsmMainWindow; + extern Widget XfsmMainForm; + + extern Widget XfsmMenuBar; + + extern Widget XfsmGraphicFrame; + extern Widget XfsmGraphicWindow; + extern Display *XfsmGraphicDisplay; + + extern Widget XfsmMessageMainPaned; + extern Widget XfsmMessageMainForm; + extern Widget XfsmMessageForm [ XFSM_MAX_MESSAGE ]; + extern Widget XfsmMessageText [ XFSM_MAX_MESSAGE ]; + extern Widget XfsmMessageLabel [ XFSM_MAX_MESSAGE ]; + extern Widget XfsmMessageFrame [ XFSM_MAX_MESSAGE ]; + +/*------------------------------------------------------------\ +| | +| Xfsm Graphic Context | +| | +\------------------------------------------------------------*/ + + extern GC XfsmBackgroundGC; + extern GC XfsmGridGC; + extern GC XfsmXorGC; + extern GC XfsmAcceptDrawGC; + extern GC XfsmConnectDrawGC; + extern GC XfsmLayerDrawGC[ XFSM_MAX_LAYER ]; + extern GC XfsmSmallTextGC; + extern GC XfsmMediumTextGC; + extern GC XfsmLargeTextGC; + + extern XFontStruct *XfsmSmallTextFont; + extern XFontStruct *XfsmLargeTextFont; + extern XFontStruct *XfsmMediumTextFont; + +/*------------------------------------------------------------\ +| | +| Xfsm Graphic Pixmap | +| | +\------------------------------------------------------------*/ + + extern Pixmap XfsmGraphicPixmap; + +/*------------------------------------------------------------\ +| | +| Xfsm Graphic Size | +| | +\------------------------------------------------------------*/ + + extern Dimension XfsmOldGraphicDx; + extern Dimension XfsmOldGraphicDy; + extern Dimension XfsmGraphicDx; + extern Dimension XfsmGraphicDy; + +/*------------------------------------------------------------\ +| | +| Xfsm Unit Grid | +| | +\------------------------------------------------------------*/ + + extern float XfsmUnitGridStep; + extern long XfsmUnitGridX; + extern long XfsmUnitGridY; + extern long XfsmUnitGridDx; + extern long XfsmUnitGridDy; + extern long XfsmPixelGridX; + extern long XfsmPixelGridY; + +/*------------------------------------------------------------\ +| | +| User Unit Grid | +| | +\------------------------------------------------------------*/ + + extern long XfsmUnitUserGridDx; + extern long XfsmUnitUserGridDy; + extern char XfsmUnitUserGrid; + +/*------------------------------------------------------------\ +| | +| Xfsm Cursor | +| | +\------------------------------------------------------------*/ + + extern long XfsmUnitCursorX; + extern long XfsmUnitCursorY; + +/*------------------------------------------------------------\ +| | +| Xfsm Event | +| | +\------------------------------------------------------------*/ + + extern char XfsmCountEventZoom; + extern char XfsmCountEventEdit; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmInitializeRessources | +| | +\------------------------------------------------------------*/ + + extern void XfsmInitializeRessources(); + +/*------------------------------------------------------------\ +| | +| Xfsm Change Title | +| | +\------------------------------------------------------------*/ + + extern void XfsmChangeTopLevelTitle(); + +/*------------------------------------------------------------\ +| | +| Xfsm Edit Mode | +| | +\------------------------------------------------------------*/ + + extern void XfsmChangeEditMode(); + extern void XfsmContinueEditMode(); + +/*------------------------------------------------------------\ +| | +| XfsmDisplayMessage | +| | +\------------------------------------------------------------*/ + + extern void XfsmDisplayMessage(); + extern void XfsmPromptEditMeasure(); + +/*------------------------------------------------------------\ +| | +| Xfsm Graphic Window | +| | +\------------------------------------------------------------*/ + + extern void XfsmClearGraphicWindow(); + extern void XfsmResizeGraphicWindow(); + extern void XfsmRefreshGraphicWindow(); + +/*------------------------------------------------------------\ +| | +| Xfsm Unit Grid | +| | +\------------------------------------------------------------*/ + + extern void XfsmComputeUnitGrid(); + extern void XfsmResizeUnitGrid(); + +/*------------------------------------------------------------\ +| | +| Xfsm Display Figure | +| | +\------------------------------------------------------------*/ + + extern void XfsmDisplayFigure(); + extern void XfsmDisplayObject(); + +/*------------------------------------------------------------\ +| | +| Xfsm Cursor | +| | +\------------------------------------------------------------*/ + + extern void XfsmDisplayCursor(); + extern void XfsmUndisplayCursor(); + +# endif diff --git a/alliance/src/xfsm/src/XMX_color.c b/alliance/src/xfsm/src/XMX_color.c new file mode 100644 index 00000000..88c20710 --- /dev/null +++ b/alliance/src/xfsm/src/XMX_color.c @@ -0,0 +1,349 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Colors.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XMX.h" +# include "XMX_color.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + GC XfsmBackgroundGC; + GC XfsmGridGC; + GC XfsmAcceptDrawGC; + GC XfsmConnectDrawGC; + GC XfsmLayerDrawGC[ XFSM_MAX_LAYER ]; + + GC XfsmSmallTextGC; + GC XfsmMediumTextGC; + GC XfsmLargeTextGC; + GC XfsmXorGC; + GC XfsmXorGCXor; + GC XfsmXorGCInvert; + + XFontStruct *XfsmLargeTextFont; + XFontStruct *XfsmMediumTextFont; + XFontStruct *XfsmSmallTextFont; + + Colormap XfsmColorMap; + +/*------------------------------------------------------------\ +| | +| Layer Color Define | +| | +\------------------------------------------------------------*/ + + static char **XfsmColorName[ 5 ] = + + { + &XFSM_BACKGROUND_COLOR_NAME, + &XFSM_FOREGROUND_COLOR_NAME, + &XFSM_CURSOR_COLOR_NAME, + &XFSM_ACCEPT_COLOR_NAME, + &XFSM_CONNECT_COLOR_NAME + }; + + static int XfsmColor[ XFSM_MAX_COLOR ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmSwitchColormap | +| | +\------------------------------------------------------------*/ + +void XfsmInitializeColorMap() +{ + Display *ADisplay; + Screen *AScreen; + + ADisplay = XtDisplay( XfsmTopLevel ); + AScreen = XtScreen( XfsmTopLevel ); + XfsmColorMap = DefaultColormapOfScreen( AScreen ); + + if ( XFSM_SWITCH_COLOR_MAP ) + { + XfsmColorMap = XCopyColormapAndFree( ADisplay, XfsmColorMap ); + XInstallColormap( ADisplay, XfsmColorMap ); + XtVaSetValues( XfsmTopLevel, XmNcolormap, XfsmColorMap, NULL ); + } +} + +/*------------------------------------------------------------\ +| | +| XfsmInitializeColors | +| | +\------------------------------------------------------------*/ + +void XfsmInitializeColors() + +{ + XColor ForgetIt; + XColor GetIt; + Window Root; + int Counter; + char Error; + char *ColorName; + + autbegin(); + + Error = False; + + for ( Counter = 0; Counter < XFSM_MAX_COLOR; Counter++ ) + { + if ( Counter < 5 ) + { + ColorName = *XfsmColorName[ Counter ]; + } + else + { + ColorName = XFSM_LAYER_NAME_TABLE[ Counter - 5 ][ 1 ]; + } + + if ( ColorName != (char *)NULL ) + { + if ( ! XAllocNamedColor( XfsmGraphicDisplay, + XfsmColorMap, ColorName, + &GetIt, &ForgetIt ) ) + { + fprintf ( stderr, "\nXmx: Unable to allocate color '%s' !\n", + ColorName ); + + Error = True; + } + + XfsmColor[ Counter ] = GetIt.pixel; + } + else + { + XfsmColor[ Counter ] = XfsmColor[ 0 ]; + } + } + + if ( Error == True ) exit( 1 ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmChangeCursorContext | +| | +\------------------------------------------------------------*/ + +void XfsmChangeCursorContext() +{ + XGCValues GraphicValue; + + if ( XFSM_XOR_CURSOR == XFSM_TRUE ) + { + XfsmXorGC = XfsmXorGCXor; + } + else + { + XfsmXorGC = XfsmXorGCInvert; + } +} + +/*------------------------------------------------------------\ +| | +| XfsmInitializeGraphicContext | +| | +\------------------------------------------------------------*/ + +void XfsmInitializeGraphicContext() + +{ + XGCValues GraphicValue; + int Counter; + Window Root; + + autbegin(); + + XfsmLargeTextFont = XLoadQueryFont( XfsmGraphicDisplay, + XFSM_LARGE_TEXT_FONT_NAME ); + + XfsmMediumTextFont = XLoadQueryFont( XfsmGraphicDisplay, + XFSM_MEDIUM_TEXT_FONT_NAME ); + + XfsmSmallTextFont = XLoadQueryFont( XfsmGraphicDisplay, + XFSM_SMALL_TEXT_FONT_NAME ); + + GraphicValue.foreground = XfsmColor[ 0 ]; /* Black */ + GraphicValue.background = XfsmColor[ 0 ]; + GraphicValue.plane_mask = AllPlanes; + + Root = RootWindowOfScreen ( XtScreen ( XfsmGraphicWindow ) ), + + XfsmBackgroundGC = XCreateGC ( XfsmGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + GraphicValue.foreground = XfsmColor[ 1 ]; /* White */ + + XfsmGridGC = XCreateGC ( XfsmGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + GraphicValue.foreground = XfsmColor[ 1 ]; /* Text */ + + XfsmSmallTextGC = XCreateGC ( XfsmGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + XfsmMediumTextGC = XCreateGC ( XfsmGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + XfsmLargeTextGC = XCreateGC ( XfsmGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + XSetFont( XfsmGraphicDisplay, + XfsmSmallTextGC, XfsmSmallTextFont->fid ); + + XSetFont( XfsmGraphicDisplay, + XfsmMediumTextGC, XfsmMediumTextFont->fid ); + + XSetFont( XfsmGraphicDisplay, + XfsmLargeTextGC, XfsmLargeTextFont->fid ); + + GraphicValue.background = XfsmColor[ 2 ]; + GraphicValue.foreground = XfsmColor[ 2 ]; + GraphicValue.function = GXxor; + + XfsmXorGCXor = XCreateGC ( XfsmGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCFunction | + GCPlaneMask ), + &GraphicValue ); + + GraphicValue.function = GXinvert; + + XfsmXorGCInvert = XCreateGC ( XfsmGraphicDisplay, + Root, + ( GCFunction | + GCPlaneMask ), + &GraphicValue ); + + XfsmChangeCursorContext(); + + GraphicValue.background = XfsmColor[ 0 ]; /* Black */ + GraphicValue.foreground = XfsmColor[ 3 ]; /* Accept Color */ + + XfsmAcceptDrawGC = XCreateGC ( XfsmGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + GraphicValue.foreground = XfsmColor[ 4 ]; /* Connect Color */ + + XfsmConnectDrawGC = XCreateGC ( XfsmGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + for ( Counter = 0; Counter < XFSM_MAX_LAYER; Counter++ ) + { + GraphicValue.foreground = XfsmColor[ Counter + 5 ]; + + XfsmLayerDrawGC[ Counter ] = + + XCreateGC ( XfsmGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + } + + autend(); +} diff --git a/alliance/src/xfsm/src/XMX_color.h b/alliance/src/xfsm/src/XMX_color.h new file mode 100644 index 00000000..5ce9a139 --- /dev/null +++ b/alliance/src/xfsm/src/XMX_color.h @@ -0,0 +1,88 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Color.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_COLOR +# define XFSM_COLOR + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Pattern | +| | +\------------------------------------------------------------*/ + +# define XFSM_MAX_COLOR ( 5 + XFSM_MAX_LAYER ) + +# define XFSM_LARGE_TEXT_FONT_NAME "9x15" +# define XFSM_MEDIUM_TEXT_FONT_NAME "7x13" +# define XFSM_SMALL_TEXT_FONT_NAME "5x8" + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmInitializeGraphicContext(); + extern void XfsmInitializeColors(); + extern void XpatChangeCursorContext(); + extern void XpatInitializeColorMap(); + + +# endif diff --git a/alliance/src/xfsm/src/XMX_cursor.c b/alliance/src/xfsm/src/XMX_cursor.c new file mode 100644 index 00000000..3ce04052 --- /dev/null +++ b/alliance/src/xfsm/src/XMX_cursor.c @@ -0,0 +1,517 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Cursor.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XMX.h" +# include "XMX_grid.h" +# include "XMX_cursor.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Buffer | +| | +\------------------------------------------------------------*/ + + static char XfsmCursorBuffer[ XFSM_MAX_CURSOR_BUFFER ]; + +/*------------------------------------------------------------\ +| | +| Coordinates | +| | +\------------------------------------------------------------*/ + + Position XfsmCursorX = 0; + Position XfsmCursorY = 0; + Position XfsmCursorSaveX = 0; + Position XfsmCursorSaveY = 0; + char XfsmCursorSaved = XFSM_FALSE; + char XfsmCursorInside = XFSM_FALSE; + char XfsmCursorType = XFSM_INPUT_HALF_BOX; + + long XfsmUnitCursorX = 0; + long XfsmUnitCursorY = 0; + long XfsmPixelCursorX = 0; + long XfsmPixelCursorY = 0; + + long XfsmUnitCursorSaveX[ 2 ] = { 0, 0 }; + long XfsmUnitCursorSaveY[ 2 ] = { 0, 0 }; + char XfsmCursorIndex = 0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmComputeCursor | +| | +\------------------------------------------------------------*/ + +void XfsmComputeCursor( X, Y ) + + Position X; + Position Y; +{ + autbegin(); + + Y = XfsmGraphicDy - Y; + + XfsmUnitCursorX = X + XfsmPixelGridX; + XfsmUnitCursorY = Y + XfsmPixelGridY; + + if ( XfsmUnitCursorX < 0 ) + { + XfsmUnitCursorX = ((float)(XfsmUnitCursorX) / XfsmUnitGridStep) - 0.5 ; + } + else + { + XfsmUnitCursorX = ((float)(XfsmUnitCursorX) / XfsmUnitGridStep) + 0.5 ; + } + + if ( XfsmUnitCursorY < 0 ) + { + XfsmUnitCursorY = ((float)(XfsmUnitCursorY) / XfsmUnitGridStep) - 0.5 ; + } + else + { + XfsmUnitCursorY = ((float)(XfsmUnitCursorY) / XfsmUnitGridStep) + 0.5 ; + } + + XfsmPixelCursorX = ((float)(XfsmUnitCursorX) * XfsmUnitGridStep); + XfsmPixelCursorY = ((float)(XfsmUnitCursorY) * XfsmUnitGridStep); + + XfsmCursorX = XfsmPixelCursorX - XfsmPixelGridX; + XfsmCursorY = XfsmPixelCursorY - XfsmPixelGridY; + XfsmCursorY = XfsmGraphicDy - XfsmCursorY; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmDisplayCoordinates | +| | +\------------------------------------------------------------*/ + +void XfsmDisplayCoordinates() + +{ + autbegin(); + + sprintf( XfsmCursorBuffer, "%d", XfsmUnitCursorX ); + XfsmDisplayMessage( XFSM_MESSAGE_X, XfsmCursorBuffer ); + + sprintf( XfsmCursorBuffer, "%d", XfsmUnitCursorY ); + XfsmDisplayMessage( XFSM_MESSAGE_Y, XfsmCursorBuffer ); + + sprintf( XfsmCursorBuffer, "%d", XfsmUnitCursorX - XfsmUnitCursorSaveX[0] ); + XfsmDisplayMessage( XFSM_MESSAGE_DX, XfsmCursorBuffer ); + + sprintf( XfsmCursorBuffer, "%d", XfsmUnitCursorY - XfsmUnitCursorSaveY[0] ); + XfsmDisplayMessage( XFSM_MESSAGE_DY, XfsmCursorBuffer ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmPointCursor | +| | +\------------------------------------------------------------*/ + +void XfsmPointCursor() + +{ + autbegin(); + + XfsmUndisplayCursor(); + + XfsmUnitCursorSaveX[ XfsmCursorIndex ] = XfsmUnitCursorX; + XfsmUnitCursorSaveY[ XfsmCursorIndex ] = XfsmUnitCursorY; + + XfsmCursorIndex = XfsmCursorIndex + 1; + + XfsmDisplayCursor(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmResetCursor | +| | +\------------------------------------------------------------*/ + +void XfsmResetCursor() + +{ + autbegin(); + + XfsmUndisplayCursor(); + + XfsmCursorIndex = XfsmCursorIndex - 1; + + XfsmDisplayCursor(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmChangeCursor | +| | +\------------------------------------------------------------*/ + +void XfsmChangeCursorType( ArrayX, ArrayY, Index, Type ) + + long *ArrayX; + long *ArrayY; + char Index; + char Type; +{ + autbegin(); + + XfsmUndisplayCursor(); + + XfsmCursorType = Type; + XfsmCursorIndex = Index; + + if ( Index != 0 ) + { + XfsmUnitCursorSaveX[ 0 ] = ArrayX[0]; + XfsmUnitCursorSaveY[ 0 ] = ArrayY[0]; + XfsmUnitCursorSaveX[ 1 ] = ArrayX[1]; + XfsmUnitCursorSaveY[ 1 ] = ArrayY[1]; + } + + XfsmDisplayCursor(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmDrawCursor | +| | +\------------------------------------------------------------*/ + +void XfsmDrawCursor() + +{ + long X1; + long Y1; + long X2; + long Y2; + long DeltaX; + long DeltaY; + long Swap; + char DrawLine; + + autbegin(); + + XDrawLine( XfsmGraphicDisplay, + XtWindow( XfsmGraphicWindow ), + XfsmXorGC, + XfsmCursorSaveX - XFSM_CURSOR_SIZE, + XfsmCursorSaveY - XFSM_CURSOR_SIZE, + XfsmCursorSaveX + XFSM_CURSOR_SIZE, + XfsmCursorSaveY + XFSM_CURSOR_SIZE ); + + XDrawLine( XfsmGraphicDisplay, + XtWindow( XfsmGraphicWindow ), + XfsmXorGC, + XfsmCursorSaveX - XFSM_CURSOR_SIZE, + XfsmCursorSaveY + XFSM_CURSOR_SIZE, + XfsmCursorSaveX + XFSM_CURSOR_SIZE, + XfsmCursorSaveY - XFSM_CURSOR_SIZE ); + + if ( XfsmCursorIndex > 0 ) + { + X1 = (float)(XfsmUnitCursorSaveX[0]) * XfsmUnitGridStep; + Y1 = (float)(XfsmUnitCursorSaveY[0]) * XfsmUnitGridStep; + X1 = X1 - XfsmPixelGridX; + Y1 = Y1 - XfsmPixelGridY; + Y1 = XfsmGraphicDy - Y1; + + if ( XfsmCursorIndex == 1 ) + { + X2 = XfsmCursorSaveX; + Y2 = XfsmCursorSaveY; + } + else + { + X2 = (float)(XfsmUnitCursorSaveX[1]) * XfsmUnitGridStep; + Y2 = (float)(XfsmUnitCursorSaveY[1]) * XfsmUnitGridStep; + X2 = X2 - XfsmPixelGridX; + Y2 = Y2 - XfsmPixelGridY; + Y2 = XfsmGraphicDy - Y2; + } + + switch( XfsmCursorType ) + { + case XFSM_INPUT_POINT : + + break; + + case XFSM_INPUT_LINE : + + XDrawLine( XfsmGraphicDisplay, + XtWindow( XfsmGraphicWindow ), + XfsmXorGC, + X1, Y1, X2, Y2 ); + break; + + case XFSM_INPUT_HALF_BOX : + + XDrawLine( XfsmGraphicDisplay, + XtWindow( XfsmGraphicWindow ), + XfsmXorGC, + X1, Y1, X2, Y1 ); + + XDrawLine( XfsmGraphicDisplay, + XtWindow( XfsmGraphicWindow ), + XfsmXorGC, + X2, Y1, X2, Y2 ); + break; + + case XFSM_INPUT_ORTHO : + case XFSM_INPUT_SORTHO : + case XFSM_INPUT_LSTRING : + + DeltaX = X2 - X1; if ( DeltaX < 0 ) DeltaX = - DeltaX; + DeltaY = Y2 - Y1; if ( DeltaY < 0 ) DeltaY = - DeltaY; + + if ( DeltaX > DeltaY ) + { + Y2 = Y1; + + if ( X1 > X2 ) { Swap = X1; X1 = X2; X2 = Swap; } + + if ( X1 < 0 ) X1 = 0; + if ( X2 > XfsmGraphicDx ) X2 = XfsmGraphicDx; + + if ( ( X1 < X2 ) && + ( Y1 >= 0 ) && + ( Y1 <= XfsmGraphicDy ) ) + { + XDrawLine( XfsmGraphicDisplay, + XtWindow( XfsmGraphicWindow ), + XfsmXorGC, + X1, Y1, X2, Y2 ); + } + } + else + { + X2 = X1; + + if ( Y1 > Y2 ) { Swap = Y1; Y1 = Y2; Y2 = Swap; } + + if ( Y1 < 0 ) Y1 = 0; + if ( Y2 > XfsmGraphicDy ) Y2 = XfsmGraphicDy; + + if ( ( Y1 < Y2 ) && + ( X1 >= 0 ) && + ( X1 <= XfsmGraphicDx ) ) + { + XDrawLine( XfsmGraphicDisplay, + XtWindow( XfsmGraphicWindow ), + XfsmXorGC, + X1, Y1, X2, Y2 ); + } + } + + break; + + case XFSM_INPUT_BOX : + + if ( X1 > X2 ) { Swap = X1; X1 = X2; X2 = Swap; } + if ( Y1 > Y2 ) { Swap = Y1; Y1 = Y2; Y2 = Swap; } + + DrawLine = 0; + + if ( X1 < 0 ) { X1 = 0; DrawLine |= XFSM_WEST; } + if ( X2 > XfsmGraphicDx ) { X2 = XfsmGraphicDx; DrawLine |= XFSM_EAST; } + if ( Y1 < 0 ) { Y1 = 0; DrawLine |= XFSM_SOUTH; } + if ( Y2 > XfsmGraphicDy ) { Y2 = XfsmGraphicDy; DrawLine |= XFSM_NORTH; } + + if ( DrawLine == 0 ) + { + XDrawRectangle( XfsmGraphicDisplay, + XtWindow( XfsmGraphicWindow ), + XfsmXorGC, + X1, Y1, + X2 - X1, Y2 - Y1 ); + } + else + { + if ( ( DrawLine & XFSM_WEST ) == 0 ) + { + XDrawLine( XfsmGraphicDisplay, + XtWindow( XfsmGraphicWindow ), + XfsmXorGC, + X1, Y2, + X1, Y1 ); + } + + if ( ( DrawLine & XFSM_EAST ) == 0 ) + { + XDrawLine( XfsmGraphicDisplay, + XtWindow( XfsmGraphicWindow ), + XfsmXorGC, + X2, Y2, + X2, Y1 ); + } + + if ( ( DrawLine & XFSM_SOUTH ) == 0 ) + { + XDrawLine( XfsmGraphicDisplay, + XtWindow( XfsmGraphicWindow ), + XfsmXorGC, + X1, Y1, + X2, Y1 ); + } + + if ( ( DrawLine & XFSM_NORTH ) == 0 ) + { + XDrawLine( XfsmGraphicDisplay, + XtWindow( XfsmGraphicWindow ), + XfsmXorGC, + X1, Y2, + X2, Y2 ); + } + } + + break; + + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmUndisplayCursor | +| | +\------------------------------------------------------------*/ + +void XfsmUndisplayCursor() + +{ + autbegin(); + + if ( XfsmCursorInside == XFSM_TRUE ) + { + if ( XfsmCursorSaved == XFSM_TRUE ) + { + XfsmDrawCursor(); + } + + XfsmCursorSaved = XFSM_FALSE; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmDisplayCursor | +| | +\------------------------------------------------------------*/ + +void XfsmDisplayCursor() + +{ + autbegin(); + + if ( XfsmCursorInside == XFSM_TRUE ) + { + if ( XfsmCursorSaved == XFSM_TRUE ) + { + XfsmDrawCursor(); + + XfsmCursorSaved = XFSM_FALSE; + } + + if ( ( XfsmCursorY >= 0 ) && + ( XfsmCursorX <= XfsmGraphicDx ) ) + { + XfsmCursorSaveX = XfsmCursorX; + XfsmCursorSaveY = XfsmCursorY; + + XfsmDrawCursor(); + + XfsmCursorSaved = XFSM_TRUE; + } + } + + autend(); +} diff --git a/alliance/src/xfsm/src/XMX_cursor.h b/alliance/src/xfsm/src/XMX_cursor.h new file mode 100644 index 00000000..8e30ca64 --- /dev/null +++ b/alliance/src/xfsm/src/XMX_cursor.h @@ -0,0 +1,95 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Cursor.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_CURSOR +# define XFSM_CURSOR + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XFSM_MAX_CURSOR_BUFFER 128 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern Position XfsmCursorX; + extern Position XfsmCursorY; + extern Position XfsmCursorSaveX; + extern Position XfsmCursorSaveY; + extern char XfsmCursorSaved; + extern char XfsmCursorInside; + extern long XfsmLambdaCursorX; + extern long XfsmLambdaCursorY; + + extern long XfsmPixelCursorX; + extern long XfsmPixelCursorY; + + extern long XfsmPixelCursorX1; + extern long XfsmPixelCursorY1; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmComputeCursor(); + extern void XfsmChangeCursorType(); + extern void XfsmPointCursor(); + extern void XfsmResetCursor(); + extern void XfsmDisplayCoordinates(); + +# endif diff --git a/alliance/src/xfsm/src/XMX_dialog.c b/alliance/src/xfsm/src/XMX_dialog.c new file mode 100644 index 00000000..c807f9f4 --- /dev/null +++ b/alliance/src/xfsm/src/XMX_dialog.c @@ -0,0 +1,104 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XTB.h" +# include "XMF.h" +# include "XMV.h" +# include "XMT.h" +# include "XMS.h" +# include "XMH.h" +# include "XMX.h" + +# include "XMX_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmInitializeDialog | +| | +\------------------------------------------------------------*/ + +void XfsmInitializeDialog() + +{ + autbegin(); + + XfsmBuildFileDialog(); + XfsmBuildEditDialog(); + XfsmBuildViewDialog(); + + autend(); +} diff --git a/alliance/src/xfsm/src/XMX_dialog.h b/alliance/src/xfsm/src/XMX_dialog.h new file mode 100644 index 00000000..19867e37 --- /dev/null +++ b/alliance/src/xfsm/src/XMX_dialog.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_DIALOG +# define XFSM_DIALOG + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmInitializeDialog(); + +# endif diff --git a/alliance/src/xfsm/src/XMX_event.c b/alliance/src/xfsm/src/XMX_event.c new file mode 100644 index 00000000..f8ac666b --- /dev/null +++ b/alliance/src/xfsm/src/XMX_event.c @@ -0,0 +1,782 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Event.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XFS.h" +# include "XMX.h" +# include "XTB.h" +# include "XME.h" +# include "XMV.h" +# include "XMS.h" +# include "XMH.h" +# include "XMX_motif.h" +# include "XMX_grid.h" +# include "XMX_cursor.h" +# include "XMX_event.h" +# include "XMX_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Translation | +| | +\------------------------------------------------------------*/ + + static String XfsmEventTranslation = + + ": CallbackEvent( 0 )\n\ + : CallbackEvent( 1 )\n\ + : CallbackEvent( 2 )\n\ + : CallbackEvent( 3 )\n\ + : CallbackEvent( 4 )\n\ + osfUp: CallbackEvent( 5 )\n\ + osfDown: CallbackEvent( 6 )\n\ + osfLeft: CallbackEvent( 7 )\n\ + osfRight: CallbackEvent( 8 )\n\ + Z: CallbackEvent( 9 )\n\ + M: CallbackEvent( 10 )\n\ + F: CallbackEvent( 11 )\n\ + R: CallbackEvent( 12 )\n\ + U: CallbackEvent( 13 )\n\ + I: CallbackEvent( 14 )\n\ + C: CallbackEvent( 15 )\n\ + P: CallbackEvent( 16 )\n"; + + +/*------------------------------------------------------------\ +| | +| Event Count | +| | +\------------------------------------------------------------*/ + + static char XfsmMaxEventEditTable[] = + + { + 2, /* XFSM_EDIT_MEASURE */ + 1, /* XFSM_EDIT_IDENTIFY */ + 1 /* XFSM_EDIT_CONNECTED */ + }; + + static char XfsmInputEventEditTable[] = + + { + XFSM_INPUT_HALF_BOX, /* XFSM_EDIT_MEASURE */ + XFSM_INPUT_POINT, /* XFSM_EDIT_IDENTIFY */ + XFSM_INPUT_POINT /* XFSM_EDIT_CONNECTED */ + }; + + static char XfsmMaxEventZoomTable[] = + + { + 1, /* XFSM_ZOOM_CENTER */ + 2, /* XFSM_ZOOM_IN */ + 2 /* XFSM_ZOOM_PAN */ + }; + + static char XfsmInputEventZoomTable[] = + + { + XFSM_INPUT_POINT, /* XFSM_ZOOM_CENTER */ + XFSM_INPUT_BOX, /* XFSM_ZOOM_IN */ + XFSM_INPUT_LINE /* XFSM_ZOOM_PAN */ + }; + +/*------------------------------------------------------------\ +| | +| Translation | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Expose Edit Zoom | +| | +\------------------------------------------------------------*/ + + static long XfsmUnitEventZoomX[ 2 ] = { 0, 0 }; + static long XfsmUnitEventZoomY[ 2 ] = { 0, 0 }; + static char XfsmMaxEventZoom = 0; + char XfsmCountEventZoom = 0; + + static long XfsmUnitEventEditX[ 2 ] = { 0, 0 }; + static long XfsmUnitEventEditY[ 2 ] = { 0, 0 }; + static char XfsmMaxEventEdit = 2; + char XfsmCountEventEdit = 0; + + static char XfsmFirstExpose = XFSM_TRUE; + +/*------------------------------------------------------------\ +| | +| Input | +| | +\------------------------------------------------------------*/ + + static char XfsmInputMode = XFSM_INPUT_HALF_BOX; + static char XfsmSaveInputMode = XFSM_INPUT_HALF_BOX; + static char XfsmEditMode = XFSM_EDIT_MEASURE; + static char XfsmSaveEditMode = XFSM_EDIT_MEASURE; + +/*------------------------------------------------------------\ +| | +| Edit Message | +| | +\------------------------------------------------------------*/ + + static void (*XfsmPromptMessage)() = XfsmPromptEditMeasure; + static void (*XfsmSavePromptMessage)() = XfsmPromptEditMeasure; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmChangeEditMode | +| | +\------------------------------------------------------------*/ + +void XfsmChangeEditMode( EditMode , PromptMessage ) + + char EditMode; + void (*PromptMessage)(); +{ + autbegin(); + + if ( EditMode & XFSM_ZOOM_MARK ) + { + EditMode = EditMode & ~XFSM_ZOOM_MARK; + + XfsmCountEventZoom = 0; + XfsmMaxEventZoom = XfsmMaxEventZoomTable[ EditMode ]; + + if ( ! ( XfsmEditMode & XFSM_ZOOM_MARK ) ) + { + XfsmSaveEditMode = XfsmEditMode; + XfsmSaveInputMode = XfsmInputMode; + XfsmSavePromptMessage = XfsmPromptMessage; + } + + XfsmInputMode = XfsmInputEventZoomTable[ EditMode ]; + XfsmPromptMessage = PromptMessage; + XfsmEditMode = EditMode | XFSM_ZOOM_MARK; + + XfsmChangeCursorType( NULL, NULL, 0, XfsmInputMode ); + } + else + { + if ( XfsmEditMode & XFSM_ZOOM_MARK ) + { + XfsmSaveEditMode = EditMode; + XfsmSaveInputMode = XfsmInputEventEditTable[ EditMode ]; + XfsmSavePromptMessage = PromptMessage; + XfsmCountEventEdit = 0; + XfsmMaxEventEdit = XfsmMaxEventEditTable[ EditMode ]; + } + else + { + if ( XfsmEditMode != EditMode ) + { + XfsmCountEventEdit = 0; + XfsmMaxEventEdit = XfsmMaxEventEditTable[ EditMode ]; + XfsmEditMode = EditMode; + XfsmInputMode = XfsmInputEventEditTable[ EditMode ]; + XfsmPromptMessage = PromptMessage; + + XfsmChangeCursorType( NULL, NULL, 0, XfsmInputMode ); + } + } + + XfsmEditUnselectAll(); + } + + XfsmPromptMessage(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmContinueEditMode | +| | +\------------------------------------------------------------*/ + +void XfsmContinueEditMode( EditMode , PromptMessage, CountEvent ) + + char EditMode; + void (*PromptMessage)(); + char CountEvent; +{ + autbegin(); + + if ( XfsmEditMode & XFSM_ZOOM_MARK ) + { + XfsmSaveEditMode = EditMode; + XfsmSaveInputMode = XfsmInputEventEditTable[ EditMode ]; + XfsmSavePromptMessage = PromptMessage; + XfsmCountEventEdit = CountEvent; + XfsmMaxEventEdit = XfsmMaxEventEditTable[ EditMode ]; + } + else + { + XfsmCountEventEdit = CountEvent; + XfsmMaxEventEdit = XfsmMaxEventEditTable[ EditMode ]; + XfsmEditMode = EditMode; + XfsmInputMode = XfsmInputEventEditTable[ EditMode ]; + XfsmPromptMessage = PromptMessage; + + XfsmChangeCursorType( XfsmUnitEventEditX, + XfsmUnitEventEditY, + XfsmCountEventEdit, + XfsmInputMode ); + + } + + XfsmPromptMessage(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmTreatEventZoom | +| | +\------------------------------------------------------------*/ + +void XfsmTreatEventZoom() + +{ + autbegin(); + + XfsmChangeCursorType( XfsmUnitEventEditX, + XfsmUnitEventEditY, + XfsmCountEventEdit, + XfsmSaveInputMode ); + + switch ( XfsmEditMode ) + { + case XFSM_ZOOM_CENTER : + + XfsmZoomCenter( XfsmUnitEventZoomX[ 0 ], + XfsmUnitEventZoomY[ 0 ] ); + break; + + case XFSM_ZOOM_IN : + + XfsmZoomIn( XfsmUnitEventZoomX[ 0 ], + XfsmUnitEventZoomY[ 0 ], + XfsmUnitEventZoomX[ 1 ], + XfsmUnitEventZoomY[ 1 ] ); + break; + + case XFSM_ZOOM_PAN : + + XfsmZoomPan( XfsmUnitEventZoomX[ 0 ], + XfsmUnitEventZoomY[ 0 ], + XfsmUnitEventZoomX[ 1 ], + XfsmUnitEventZoomY[ 1 ] ); + break; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmTreatEventEdit | +| | +\------------------------------------------------------------*/ + +void XfsmTreatEventEdit() + +{ + long DeltaX; + long DeltaY; + long X1; + long X2; + long Y1; + long Y2; + + autbegin(); + + X1 = XfsmUnitEventEditX[0]; + X2 = XfsmUnitEventEditX[1]; + Y1 = XfsmUnitEventEditY[0]; + Y2 = XfsmUnitEventEditY[1]; + + if ( ( XfsmInputMode == XFSM_INPUT_LSTRING ) || + ( XfsmInputMode == XFSM_INPUT_ORTHO ) || + ( XfsmInputMode == XFSM_INPUT_SORTHO ) ) + { + DeltaX = X1 - X2; + DeltaY = Y1 - Y2; + + if ( DeltaX < 0 ) DeltaX = - DeltaX; + if ( DeltaY < 0 ) DeltaY = - DeltaY; + + if ( DeltaX > DeltaY ) + { + Y2 = Y1; + + XfsmUnitEventEditX[0] = X2; + XfsmUnitEventEditY[0] = Y2; + } + else + { + X2 = X1; + + XfsmUnitEventEditX[0] = X2; + XfsmUnitEventEditY[0] = Y2; + } + } + + if ( XfsmInputMode == XFSM_INPUT_LSTRING ) + { + XfsmChangeCursorType( XfsmUnitEventEditX, + XfsmUnitEventEditY, + 1, XfsmInputMode ); + + XfsmCountEventEdit = 1; + } + else + { + XfsmChangeCursorType( NULL, NULL, 0, + XfsmInputMode ); + + XfsmCountEventEdit = 0; + } + + switch ( XfsmEditMode ) + { + case XFSM_EDIT_MEASURE : + + break; + + case XFSM_EDIT_IDENTIFY : + + XfsmEditIdentify( X1, Y1 ); + + break; + + case XFSM_EDIT_CONNECTED : + + XfsmEditConnected( X1, Y1 ); + + break; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEvent | +| | +\------------------------------------------------------------*/ + +void CallbackEvent ( MyWidget, Event, Args, Argc ) + + Widget MyWidget; + XButtonEvent *Event; + String *Args; + int *Argc; +{ + Display *EventDisplay; + char MouseEvent; + Position OldUnitCursorX; + Position OldUnitCursorY; + + autbegin(); + + EventDisplay = Event->display; + + MouseEvent = atoi( Args[ 0 ] ); + + if ( MouseEvent == XFSM_LEAVE ) + { + XfsmUndisplayCursor(); + XfsmCursorInside = XFSM_FALSE; + } + else + { + OldUnitCursorX = XfsmUnitCursorX; + OldUnitCursorY = XfsmUnitCursorY; + + XfsmComputeCursor( Event->x, Event->y ); + + switch ( MouseEvent ) + { + case XFSM_B1DN : + + if ( XfsmEditMode & XFSM_ZOOM_MARK ) + { + if ( XfsmCountEventZoom < XfsmMaxEventZoom ) + { + XfsmUnitEventZoomX[ XfsmCountEventZoom ] = XfsmUnitCursorX; + XfsmUnitEventZoomY[ XfsmCountEventZoom ] = XfsmUnitCursorY; + + XfsmCountEventZoom = XfsmCountEventZoom + 1; + + XfsmPointCursor(); + + if ( XfsmCountEventZoom == XfsmMaxEventZoom ) + { + XfsmChangeCursorType( NULL, NULL, 0, XfsmInputMode ); + + XfsmTreatEventZoom(); + + XfsmInputMode = XfsmSaveInputMode; + XfsmEditMode = XfsmSaveEditMode; + XfsmPromptMessage = XfsmSavePromptMessage; + XfsmSaveEditMode = XFSM_EDIT_MEASURE; + XfsmSaveInputMode = XFSM_INPUT_HALF_BOX; + XfsmCountEventZoom = 0; + XfsmMaxEventZoom = 0; + + XfsmChangeCursorType( XfsmUnitEventEditX, + XfsmUnitEventEditY, + XfsmCountEventEdit, + XfsmInputMode ); + + XfsmComputeCursor( Event->x, Event->y ); + XfsmDisplayCursor(); + } + } + } + else + { + if ( XfsmCountEventEdit < XfsmMaxEventEdit ) + { + XfsmUnitEventEditX[ XfsmCountEventEdit ] = XfsmUnitCursorX; + XfsmUnitEventEditY[ XfsmCountEventEdit ] = XfsmUnitCursorY; + + XfsmCountEventEdit = XfsmCountEventEdit + 1; + + XfsmPointCursor(); + + if ( XfsmCountEventEdit == XfsmMaxEventEdit ) + { + XfsmTreatEventEdit(); + + XfsmDisplayCursor(); + } + } + } + + XfsmPromptMessage(); + + break; + + case XFSM_B3DN : + + if ( XfsmEditMode & XFSM_ZOOM_MARK ) + { + if ( XfsmCountEventZoom != 0 ) + { + XfsmCountEventZoom = XfsmCountEventZoom - 1; + + XfsmResetCursor(); + } + else + { + XfsmChangeCursorType( XfsmUnitEventEditX, + XfsmUnitEventEditY, + XfsmCountEventEdit, + XfsmSaveInputMode ); + + XfsmInputMode = XfsmSaveInputMode; + XfsmEditMode = XfsmSaveEditMode; + XfsmPromptMessage = XfsmSavePromptMessage; + XfsmSaveEditMode = XFSM_EDIT_MEASURE; + XfsmSaveInputMode = XFSM_INPUT_HALF_BOX; + XfsmSavePromptMessage = XfsmPromptEditMeasure; + XfsmCountEventZoom = 0; + XfsmMaxEventZoom = 0; + } + } + else + { + if ( XfsmCountEventEdit != 0 ) + { + XfsmCountEventEdit = XfsmCountEventEdit - 1; + + XfsmResetCursor(); + } + else + { + XfsmEditUnselectAll(); + + XfsmChangeCursorType( NULL, NULL, 0, + XFSM_INPUT_HALF_BOX ); + + XfsmInputMode = XFSM_INPUT_HALF_BOX; + XfsmEditMode = XFSM_EDIT_MEASURE; + XfsmPromptMessage = XfsmPromptEditMeasure; + XfsmCountEventEdit = 0; + XfsmMaxEventEdit = 2; + } + } + + XfsmPromptMessage(); + + break; + + case XFSM_MOTION : + + break; + + case XFSM_ENTER : XfsmCursorInside = XFSM_TRUE; + XfsmDisplayCursor(); + break; + + case XFSM_KEY_UP : XfsmZoomUp(); + + break; + + case XFSM_KEY_DN : XfsmZoomDown(); + + break; + + case XFSM_KEY_LEFT : XfsmZoomLeft(); + + break; + + case XFSM_KEY_RIGHT : XfsmZoomRight(); + + break; + + case XFSM_KEY_MORE : XfsmZoomMore(); + + break; + + case XFSM_KEY_LESS : XfsmZoomLess(); + + break; + + case XFSM_KEY_FIT : XfsmZoomFit(); + + break; + + case XFSM_KEY_REFRESH : XfsmZoomRefresh(); + + break; + + case XFSM_KEY_UNZOOM : XfsmZoomUndo(); + + break; + + case XFSM_KEY_ZOOM_IN : + + XfsmChangeEditMode( XFSM_ZOOM_IN, XfsmPromptZoomIn ); + + break; + + case XFSM_KEY_CENTER : + + XfsmChangeEditMode( XFSM_ZOOM_CENTER, XfsmPromptZoomCenter ); + + break; + + case XFSM_KEY_PAN : + + XfsmChangeEditMode( XFSM_ZOOM_PAN, XfsmPromptZoomPan ); + + break; + } + + if ( ( OldUnitCursorX != XfsmUnitCursorX ) || + ( OldUnitCursorY != XfsmUnitCursorY ) ) + { + XfsmDisplayCoordinates(); + XfsmDisplayCursor(); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackResize | +| | +\------------------------------------------------------------*/ + +void CallbackResize( MyWidget, ClientData, CallData ) + + Widget MyWidget; + XtPointer ClientData; + XmDrawingAreaCallbackStruct *CallData; +{ + if ( XfsmFirstExpose == XFSM_FALSE ) + { + autbegin(); + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_WATCH_CURSOR ); + XfsmUndisplayCursor(); + + XfsmResizeGraphicWindow(); + XfsmRefreshGraphicWindow( 0, 0, + XfsmGraphicDx, XfsmGraphicDy ); + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_NORMAL_CURSOR ); + XfsmDisplayCursor(); + + autend(); + } +} + +/*------------------------------------------------------------\ +| | +| CallbackExpose | +| | +\------------------------------------------------------------*/ + +void CallbackExpose( MyWidget, ClientData, CallData ) + + Widget MyWidget; + XtPointer ClientData; + XmDrawingAreaCallbackStruct *CallData; +{ + XExposeEvent *ExposeEvent; + + ExposeEvent = (XExposeEvent *)CallData->event; + + autbegin(); + + if ( XfsmFirstExpose == XFSM_TRUE ) + { + XfsmFirstExpose = XFSM_FALSE; + + XfsmInitializeGraphicWindow(); + XfsmUndisplayCursor(); + + XfsmLoadConfig( XFSM_FALSE ); + + if ( XfsmFirstFileName != (char *)NULL ) + { + XfsmDisplayCursor(); + XfsmFileOpen( XfsmFirstFileName ); + + XfsmFirstFileName = (char *)NULL; + } + else + { + XfsmChangeTopLevelTitle( (char *)NULL ); + + XfsmRefreshGraphicWindow( 0, 0, XfsmGraphicDx, XfsmGraphicDy ); + XfsmDisplayCursor(); + } + + XfsmEnterPresentPanel(); + } + else + { + XfsmUndisplayCursor(); + XfsmRefreshGraphicWindow( ExposeEvent->x, ExposeEvent->y, + ExposeEvent->width, ExposeEvent->height ); + XfsmDisplayCursor(); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmInitializeEvent | +| | +\------------------------------------------------------------*/ + +void XfsmInitializeEvent() + +{ + XtActionsRec NewActions; + + autbegin(); + + XtVaSetValues( XfsmGraphicWindow, + XmNtranslations, + XtParseTranslationTable( XfsmEventTranslation ), + NULL + ); + + NewActions.string = "CallbackEvent"; + NewActions.proc = CallbackEvent; + + XtAppAddActions( XfsmApplication, &NewActions, 1 ); + + XtAddCallback( XfsmGraphicWindow, + XmNresizeCallback, + CallbackResize, NULL ); + + XtAddCallback( XfsmGraphicWindow, + XmNexposeCallback, + CallbackExpose, NULL ); + + autend(); +} diff --git a/alliance/src/xfsm/src/XMX_event.h b/alliance/src/xfsm/src/XMX_event.h new file mode 100644 index 00000000..38a8e138 --- /dev/null +++ b/alliance/src/xfsm/src/XMX_event.h @@ -0,0 +1,98 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Event.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_EVENT +# define XFSM_EVENT + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XFSM_B1DN 0 +# define XFSM_B3DN 1 +# define XFSM_MOTION 2 +# define XFSM_ENTER 3 +# define XFSM_LEAVE 4 + +# define XFSM_KEY_UP 5 +# define XFSM_KEY_DN 6 +# define XFSM_KEY_LEFT 7 +# define XFSM_KEY_RIGHT 8 + +# define XFSM_KEY_MORE 9 +# define XFSM_KEY_LESS 10 + +# define XFSM_KEY_FIT 11 +# define XFSM_KEY_REFRESH 12 +# define XFSM_KEY_UNZOOM 13 + +# define XFSM_KEY_ZOOM_IN 14 +# define XFSM_KEY_CENTER 15 +# define XFSM_KEY_PAN 16 + +# define XFSM_MAX_EVENT_BUFFER 128 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmInitializeEvent(); + extern void XfsmDisplayEditMeasure(); + +# endif diff --git a/alliance/src/xfsm/src/XMX_graphic.c b/alliance/src/xfsm/src/XMX_graphic.c new file mode 100644 index 00000000..94136474 --- /dev/null +++ b/alliance/src/xfsm/src/XMX_graphic.c @@ -0,0 +1,317 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Graphic.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" + +# include "XMX_graphic.h" +# include "XMX_grid.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + Widget XfsmGraphicFrame; + Widget XfsmGraphicWindow; + Display *XfsmGraphicDisplay = (Display *)NULL; + + Dimension XfsmGraphicDx = 0; + Dimension XfsmGraphicDy = 0; + Dimension XfsmOldGraphicDx = 0; + Dimension XfsmOldGraphicDy = 0; + + Pixmap XfsmGraphicPixmap = (Pixmap)NULL; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmInitializeGraphicWindow | +| | +\------------------------------------------------------------*/ + +void XfsmInitializeGraphicWindow() + +{ + autbegin(); + + XtVaGetValues( XfsmGraphicWindow, + XmNwidth, &XfsmGraphicDx, + XmNheight, &XfsmGraphicDy, + NULL + ); + + XfsmOldGraphicDx = XfsmGraphicDx; + XfsmOldGraphicDy = XfsmGraphicDy; + + XfsmGraphicPixmap = + + XCreatePixmap ( XfsmGraphicDisplay, + RootWindowOfScreen( XtScreen ( XfsmGraphicWindow ) ), + XfsmGraphicDx, + XfsmGraphicDy, + DefaultDepthOfScreen ( XtScreen ( XfsmGraphicWindow ) ) + ); + + XfsmClearGraphicWindow( 0, 0, XfsmGraphicDx, XfsmGraphicDy ); + XfsmInitializeUnitGrid(); + + XfsmSetMouseCursor( XfsmGraphicWindow, XFSM_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmClearGraphicWindow | +| | +\------------------------------------------------------------*/ + +void XfsmClearGraphicWindow( GraphicX, GraphicY, GraphicDx, GraphicDy ) + + long GraphicX; + long GraphicY; + long GraphicDx; + long GraphicDy; +{ + XFillRectangle( XfsmGraphicDisplay, + XfsmGraphicPixmap, + XfsmBackgroundGC, + GraphicX, GraphicY, + GraphicDx, + GraphicDy ); +} + +/*------------------------------------------------------------\ +| | +| XfsmRefreshGraphicWindow | +| | +\------------------------------------------------------------*/ + +void XfsmRefreshGraphicWindow( GraphicX, GraphicY, GraphicDx, GraphicDy ) + + Dimension GraphicX; + Dimension GraphicY; + Dimension GraphicDx; + Dimension GraphicDy; +{ + autbegin(); + + XfsmUndisplayCursor(); + + XCopyArea( XfsmGraphicDisplay, + XfsmGraphicPixmap, + XtWindow ( XfsmGraphicWindow ), + XfsmBackgroundGC, + GraphicX, GraphicY, + GraphicDx, GraphicDy, + GraphicX, GraphicY + ); + + XfsmDisplayUnitGrid( GraphicX, GraphicY, + GraphicX + GraphicDx, + GraphicY + GraphicDy ); + XfsmUndisplayCursor(); + + autend(); +} + + +/*------------------------------------------------------------\ +| | +| XfsmResizeGraphicWindow | +| | +\------------------------------------------------------------*/ + +void XfsmResizeGraphicWindow() + +{ + Pixmap OldPixmap; + Dimension SourceY; + Dimension TargetY; + Dimension TargetDx; + Dimension TargetDy; + + autbegin(); + + XfsmOldGraphicDx = XfsmGraphicDx; + XfsmOldGraphicDy = XfsmGraphicDy; + + XtVaGetValues( XfsmGraphicWindow, + XmNwidth, &XfsmGraphicDx, + XmNheight, &XfsmGraphicDy, + NULL + ); + + if ( ( XfsmOldGraphicDx != XfsmGraphicDx ) || + ( XfsmOldGraphicDy != XfsmGraphicDy ) ) + { + OldPixmap = XfsmGraphicPixmap; + + XfsmGraphicPixmap = + + XCreatePixmap ( XfsmGraphicDisplay, + RootWindowOfScreen( XtScreen ( XfsmGraphicWindow ) ), + XfsmGraphicDx, + XfsmGraphicDy, + DefaultDepthOfScreen ( XtScreen ( XfsmGraphicWindow ) ) + ); + + XfsmClearGraphicWindow( 0, 0, XfsmGraphicDx, XfsmGraphicDy ); + + XfsmResizeUnitGrid(); + + if ( XfsmOldGraphicDx < XfsmGraphicDx ) + { + TargetDx = XfsmOldGraphicDx; + + XfsmDisplayFigure( TargetDx, 0, + XfsmGraphicDx, XfsmGraphicDy ); + } + else + { + TargetDx = XfsmGraphicDx; + } + + if ( XfsmOldGraphicDy < XfsmGraphicDy ) + { + SourceY = 0; + TargetDy = XfsmOldGraphicDy; + TargetY = XfsmGraphicDy - XfsmOldGraphicDy; + + XfsmDisplayFigure( 0, TargetDy, + TargetDx, XfsmGraphicDy ); + } + else + { + TargetDy = XfsmGraphicDy; + TargetY = 0; + SourceY = XfsmOldGraphicDy - XfsmGraphicDy; + } + + XCopyArea( XfsmGraphicDisplay, + OldPixmap, + XfsmGraphicPixmap, + XfsmBackgroundGC, + 0, SourceY, + TargetDx, TargetDy, + 0, TargetY + ); + + XFreePixmap( XfsmGraphicDisplay, OldPixmap ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmInitializeGraphic | +| | +\------------------------------------------------------------*/ + +void XfsmInitializeGraphic() + +{ + autbegin(); + + XfsmGraphicFrame = XtVaCreateManagedWidget( "XfsmGraphicFrame", + xmFrameWidgetClass, + XfsmMainForm, + XmNshadowType , XmSHADOW_ETCHED_IN, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 1, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 191, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 1, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 199, + NULL ); + + XfsmGraphicWindow = XtVaCreateManagedWidget( + "XfsmGraphicWindow", + xmDrawingAreaWidgetClass, + XfsmGraphicFrame, + XmNtopAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNbackground, 1, + XmNforeground, 0, + NULL + ); + + XfsmGraphicDisplay = XtDisplay( XfsmGraphicWindow ); + + autend(); +} diff --git a/alliance/src/xfsm/src/XMX_graphic.h b/alliance/src/xfsm/src/XMX_graphic.h new file mode 100644 index 00000000..8e242509 --- /dev/null +++ b/alliance/src/xfsm/src/XMX_graphic.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Graphic.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_GRAPHIC +# define XFSM_GRAPHIC + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmInitializeGraphic(); + +# endif diff --git a/alliance/src/xfsm/src/XMX_grid.c b/alliance/src/xfsm/src/XMX_grid.c new file mode 100644 index 00000000..1b3b633a --- /dev/null +++ b/alliance/src/xfsm/src/XMX_grid.c @@ -0,0 +1,314 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Grid.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XFS.h" +# include "XMX.h" + +# include "XMX_grid.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Unit Grid | +| | +\------------------------------------------------------------*/ + + float XfsmUnitGridStep; + + long XfsmUnitGridX; + long XfsmUnitGridY; + long XfsmUnitGridDx; + long XfsmUnitGridDy; + + long XfsmPixelGridX; + long XfsmPixelGridY; + +/*------------------------------------------------------------\ +| | +| User Unit Grid | +| | +\------------------------------------------------------------*/ + + long XfsmUnitUserGridDx; + long XfsmUnitUserGridDy; + char XfsmUnitUserGrid; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmInitializeUnitGrid | +| | +\------------------------------------------------------------*/ + +void XfsmInitializeUnitGrid() + +{ + autbegin(); + + XfsmUnitGridX = XFSM_DEFAULT_GRID_X; + XfsmUnitGridY = XFSM_DEFAULT_GRID_Y; + XfsmUnitGridDx = XFSM_DEFAULT_GRID_DX; + XfsmUnitGridDy = XFSM_DEFAULT_GRID_DY; + XfsmUnitUserGridDx = 4; + XfsmUnitUserGridDy = 4; + XfsmUnitUserGrid = XFSM_FALSE; + + XfsmComputeUnitGrid(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmComputeUnitGrid | +| | +\------------------------------------------------------------*/ + +void XfsmComputeUnitGrid() + +{ + float StepX; + float StepY; + + autbegin(); + + StepX = (float)(XfsmGraphicDx) / (float)(XfsmUnitGridDx); + StepY = (float)(XfsmGraphicDy) / (float)(XfsmUnitGridDy); + + if ( StepX < StepY ) + { + XfsmUnitGridStep = StepX; + XfsmUnitGridDy = 1 + ( XfsmGraphicDy / StepX ); + } + else + { + XfsmUnitGridStep = StepY; + XfsmUnitGridDx = 1 + ( XfsmGraphicDx / StepY ); + } + + XfsmPixelGridX = (float)(XfsmUnitGridX) * XfsmUnitGridStep; + XfsmPixelGridY = (float)(XfsmUnitGridY) * XfsmUnitGridStep; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmResizeUnitGrid | +| | +\------------------------------------------------------------*/ + +void XfsmResizeUnitGrid() + +{ + autbegin(); + + XfsmUnitGridDx = 1 + ( XfsmGraphicDx / XfsmUnitGridStep ); + XfsmUnitGridDy = 1 + ( XfsmGraphicDy / XfsmUnitGridStep ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmDisplayUnitGrid | +| | +\------------------------------------------------------------*/ + +char XfsmDisplayUnitGrid( GraphicX1, GraphicY1, GraphicX2, GraphicY2 ) + + Dimension GraphicX1; + Dimension GraphicY1; + Dimension GraphicX2; + Dimension GraphicY2; +{ + long X; + long Y; + long MaxGridX; + long MaxGridY; + long PixelX; + long PixelY; + long Xmin; + long Ymin; + char UserGrid; + char UnitGrid; + float Check; + + autbegin(); + + if ( XfsmUnitGridStep < XFSM_LOWER_GRID_STEP ) + { + UnitGrid = 0; + } + else + { + UnitGrid = 1; + } + + if ( XfsmUnitUserGrid == 1 ) + { + if ( XfsmUnitUserGridDx > XfsmUnitUserGridDy ) + { + Check = ( XFSM_LOWER_GRID_STEP * 2 / XfsmUnitUserGridDy ); + } + else + { + Check = ( XFSM_LOWER_GRID_STEP * 2 / XfsmUnitUserGridDy ); + } + + if ( XfsmUnitGridStep < Check ) UserGrid = 0; + else UserGrid = 1; + } + else + { + UserGrid = 0; + } + + if ( ( UserGrid == 0 ) && + ( UnitGrid == 0 ) ) + { + autend(); + return( XFSM_FALSE ); + } + + MaxGridX = XfsmUnitGridX + XfsmUnitGridDx; + MaxGridY = XfsmUnitGridY + XfsmUnitGridDy; + + if ( UnitGrid ) + { + for ( X = XfsmUnitGridX; X < MaxGridX; X = X + 1 ) + { + PixelX = ((float)(X) * XfsmUnitGridStep); + PixelX = PixelX - XfsmPixelGridX; + + if ( ( PixelX <= GraphicX2 ) && + ( PixelX >= GraphicX1 ) ) + + for ( Y = XfsmUnitGridY; Y < MaxGridY; Y = Y + 1 ) + { + PixelY = ((float)(Y) * XfsmUnitGridStep); + PixelY = PixelY - XfsmPixelGridY; + PixelY = XfsmGraphicDy - PixelY; + + if ( ( PixelY <= GraphicY2 ) && + ( PixelY >= GraphicY1 ) ) + { + XDrawPoint( XfsmGraphicDisplay, + XtWindow( XfsmGraphicWindow ), + XfsmGridGC, + PixelX, PixelY ); + } + } + } + } + + if ( UserGrid ) + { + Xmin = ( XfsmUnitGridX / XfsmUnitUserGridDx ) * XfsmUnitUserGridDx; + Ymin = ( XfsmUnitGridY / XfsmUnitUserGridDy ) * XfsmUnitUserGridDy; + + for ( X = Xmin; X < MaxGridX ; X = X + XfsmUnitUserGridDx ) + { + PixelX = ((float)(X) * XfsmUnitGridStep); + PixelX = PixelX - XfsmPixelGridX; + + if ( ( PixelX <= GraphicX2 ) && + ( PixelX >= GraphicX1 ) ) + + for ( Y = Ymin; Y < MaxGridY; Y = Y + XfsmUnitUserGridDy ) + { + PixelY = ((float)(Y) * XfsmUnitGridStep); + PixelY = PixelY - XfsmPixelGridY; + PixelY = XfsmGraphicDy - PixelY; + + if ( ( PixelY <= GraphicY2 ) && + ( PixelY >= GraphicY1 ) ) + { + XDrawLine( XfsmGraphicDisplay, + XtWindow( XfsmGraphicWindow ), + XfsmGridGC, + PixelX - 2, PixelY, + PixelX + 2, PixelY ); + + XDrawLine( XfsmGraphicDisplay, + XtWindow( XfsmGraphicWindow ), + XfsmGridGC, + PixelX, PixelY + 2, + PixelX, PixelY - 2 ); + } + } + } + } + + autend(); + return( XFSM_TRUE ); +} diff --git a/alliance/src/xfsm/src/XMX_grid.h b/alliance/src/xfsm/src/XMX_grid.h new file mode 100644 index 00000000..e1631ab7 --- /dev/null +++ b/alliance/src/xfsm/src/XMX_grid.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Grid.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_GRID +# define XFSM_GRID + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XFSM_DEFAULT_GRID_X 0 +# define XFSM_DEFAULT_GRID_Y 0 +# define XFSM_DEFAULT_GRID_DX 40 +# define XFSM_DEFAULT_GRID_DY 40 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xfsm/src/XMX_icon.c b/alliance/src/xfsm/src/XMX_icon.c new file mode 100644 index 00000000..496cd53a --- /dev/null +++ b/alliance/src/xfsm/src/XMX_icon.c @@ -0,0 +1,133 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Icon.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" + +# include "XMX_icon.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static char IconBits[] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x40, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x16, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x11, 0x40, 0x04, 0x00, 0x00, + 0x00, 0x80, 0x60, 0x30, 0x08, 0x00, 0x00, 0x00, 0x40, 0x80, 0x0f, 0x10, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, + 0x07, 0x20, 0x00, 0x00, 0x00, 0x10, 0x80, 0x0f, 0x40, 0x00, 0x00, 0x00, + 0x10, 0x40, 0x12, 0x40, 0x00, 0x00, 0x00, 0x10, 0x00, 0x02, 0x40, 0x00, + 0x00, 0x00, 0x08, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, + 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x08, + 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x80, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x04, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x80, 0x24, 0x80, 0x00, 0x20, 0x09, 0x00, 0x00, + 0x1f, 0x80, 0x00, 0xc0, 0x07, 0x00, 0x00, 0x0e, 0x40, 0x00, 0x80, 0x03, + 0x00, 0x00, 0x04, 0x20, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1f, 0x18, 0x00, + 0xc0, 0x07, 0x00, 0xc0, 0x60, 0x07, 0x00, 0x30, 0x18, 0x00, 0x20, 0x80, + 0x00, 0x00, 0x08, 0x20, 0x00, 0x20, 0x80, 0x10, 0x40, 0x08, 0x20, 0x00, + 0x10, 0x00, 0x09, 0x80, 0x04, 0x40, 0x00, 0x10, 0x00, 0x0d, 0x80, 0x05, + 0x40, 0x00, 0x10, 0x00, 0xff, 0xff, 0x07, 0x40, 0x00, 0x10, 0x00, 0x0d, + 0x80, 0x05, 0x40, 0x00, 0x10, 0x00, 0x09, 0x80, 0x04, 0x40, 0x00, 0x20, + 0x80, 0x10, 0x40, 0x08, 0x20, 0x00, 0x20, 0x80, 0x00, 0x00, 0x08, 0x20, + 0x00, 0xc0, 0x60, 0x00, 0x00, 0x30, 0x18, 0x00, 0x00, 0x1f, 0x00, 0x00, + 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmInitializeIcon | +| | +\------------------------------------------------------------*/ + +void XfsmInitializeIcon() + +{ + autbegin(); + + XfsmSetIcon( XfsmTopLevel, + IconBits, IconWidth, IconHeight ); + + autend(); +} diff --git a/alliance/src/xfsm/src/XMX_icon.h b/alliance/src/xfsm/src/XMX_icon.h new file mode 100644 index 00000000..0860dc54 --- /dev/null +++ b/alliance/src/xfsm/src/XMX_icon.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Icon.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_ICON +# define XFSM_ICON + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define IconWidth 50 +# define IconHeight 50 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmInitializeIcon(); + +# endif diff --git a/alliance/src/xfsm/src/XMX_menu.c b/alliance/src/xfsm/src/XMX_menu.c new file mode 100644 index 00000000..e649a993 --- /dev/null +++ b/alliance/src/xfsm/src/XMX_menu.c @@ -0,0 +1,204 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XTB.h" +# include "XMF.h" +# include "XME.h" +# include "XMV.h" +# include "XMT.h" +# include "XMS.h" +# include "XMH.h" +# include "XMX.h" + +# include "XMX_menu.h" + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + Widget XfsmMenuBar; + + XfsmMenuItem XfsmMainMenu[] = + + { + { + "File", + 'F', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + XfsmFileMenu + } + , + { + "Edit", + 'E', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + XfsmEditMenu + } + , + { + "View", + 'V', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + XfsmViewMenu + } + , + { + "Tools", + 'T', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + XfsmToolsMenu + } + , + { + "Setup", + 'S', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + XfsmSetupMenu + } + , + { + "Help", + 'H', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + True, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + XfsmHelpMenu + } + , + NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmInitializeMenu | +| | +\------------------------------------------------------------*/ + +void XfsmInitializeMenu() + +{ + autbegin(); + + XfsmMenuBar = XmCreateMenuBar( XfsmMainWindow, + "XfsmMenuBar", NULL, 0 ); + + XfsmBuildMenus( XfsmMenuBar, XfsmMainMenu ); + + XtManageChild( XfsmMenuBar ); + + autend(); +} + diff --git a/alliance/src/xfsm/src/XMX_menu.h b/alliance/src/xfsm/src/XMX_menu.h new file mode 100644 index 00000000..59e9f2f6 --- /dev/null +++ b/alliance/src/xfsm/src/XMX_menu.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_MENU +# define XFSM_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XfsmMenuItem XfsmMainMenu[]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmInitializeMenu(); + +# endif diff --git a/alliance/src/xfsm/src/XMX_message.c b/alliance/src/xfsm/src/XMX_message.c new file mode 100644 index 00000000..5607f9a4 --- /dev/null +++ b/alliance/src/xfsm/src/XMX_message.c @@ -0,0 +1,291 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Message.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XMX_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + Widget XfsmMessageMainForm; + Widget XfsmMessageText [ XFSM_MAX_MESSAGE ]; + Widget XfsmMessageLabel [ XFSM_MAX_MESSAGE ]; + Widget XfsmMessageFrame [ XFSM_MAX_MESSAGE ]; + Widget XfsmMessageForm [ XFSM_MAX_MESSAGE ]; + + static char *XfsmMessageLabelName [ XFSM_MAX_MESSAGE ] = + + { + "X :", + "Y :", + "Dx :", + "Dy :", + NULL, + NULL, + NULL + }; + + static char *XfsmMessageTextName [ XFSM_MAX_MESSAGE ] = + + { + "0", + "0", + "0", + "0", + "Measure", + "Select point", + "Enter base point" + }; + + static char *XfsmMessageFormName [ XFSM_MAX_MESSAGE ] = + + { + "XfsmMessageFormX", + "XfsmMessageFormY", + "XfsmMessageFormDx", + "XfsmMessageFormDy", + "XfsmMessageFormMode", + "XfsmMessageFormInfo", + "XfsmMessageFormPrompt" + }; + + static char *XfsmMessageFrameName [ XFSM_MAX_MESSAGE ] = + + { + "XfsmMessageFrameX", + "XfsmMessageFrameY", + "XfsmMessageFrameDx", + "XfsmMessageFrameDy", + "XfsmMessageFrameMode", + "XfsmMessageFrameInfo", + "XfsmMessageFramePrompt" + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmDisplayMessage | +| | +\------------------------------------------------------------*/ + +void XfsmDisplayMessage( Where, Text ) + + char Where; + char *Text; +{ + XmString TextString; + + autbegin(); + + TextString = XmStringCreateSimple( Text ); + + XtVaSetValues( XfsmMessageText[ Where ], XmNlabelString, TextString, NULL ); + + XmStringFree( TextString ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmPromptEditMeasure | +| | +\------------------------------------------------------------*/ + +void XfsmPromptEditMeasure() + +{ + autbegin(); + + XfsmDisplayMessage( XFSM_MESSAGE_MODE , "Measure" ); + XfsmDisplayMessage( XFSM_MESSAGE_PROMPT, "Enter base point" ); + XfsmDisplayMessage( XFSM_MESSAGE_INFO , "Select point" ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmInitializeMessage | +| | +\------------------------------------------------------------*/ + +void XfsmInitializeMessage() + +{ + int Counter; + int Column; + int Left; + int Width; + + autbegin(); + + XfsmMessageMainForm = + + XtVaCreateManagedWidget( "XfsmMessageMainForm", + xmFormWidgetClass , + XfsmMainForm , + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 193, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 199, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 0, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 200, + XmNfractionBase , 200, + NULL ); + + Column = 1; + Width = 17; + + for ( Counter = 0; Counter < XFSM_MAX_MESSAGE; Counter++ ) + { + if ( Counter == 4 ) Width = 22; + if ( Counter == 5 ) Width = 68; + if ( Counter == 6 ) Width = 40; + + XfsmMessageFrame[ Counter ] = + + XtVaCreateManagedWidget( XfsmMessageFrameName[ Counter ], + xmFrameWidgetClass, + XfsmMessageMainForm, + XmNshadowType , XmSHADOW_ETCHED_IN, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , Column, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , Column + Width, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + NULL + ); + + XfsmMessageForm[ Counter ] = + + XtVaCreateManagedWidget( XfsmMessageFormName[ Counter ], + xmFormWidgetClass , + XfsmMessageFrame[ Counter ], + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNfractionBase , 18, + NULL + ); + + if ( XfsmMessageLabelName[ Counter ] != (char *)NULL ) + { + XfsmMessageLabel [ Counter ] = + + XtVaCreateManagedWidget( XfsmMessageLabelName[ Counter ], + xmLabelWidgetClass, + XfsmMessageForm [ Counter ], + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 6, + XmNbottomAttachment , XmATTACH_FORM, + XmNtopAttachment , XmATTACH_FORM, + XmNrecomputeSize , False, + NULL + ); + Left = 6; + } + else + { + Left = 0; + } + + XfsmMessageText [ Counter ] = + + XtVaCreateManagedWidget( XfsmMessageTextName[ Counter ], + xmLabelWidgetClass, + XfsmMessageForm [ Counter ], + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , Left, + XmNrecomputeSize , False, + NULL + ); + + Column = Column + Width; + } + + autend(); +} diff --git a/alliance/src/xfsm/src/XMX_message.h b/alliance/src/xfsm/src/XMX_message.h new file mode 100644 index 00000000..60e6b37d --- /dev/null +++ b/alliance/src/xfsm/src/XMX_message.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Message.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_MESSAGE +# define XFSM_MESSAGE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmInitializeMessage(); + extern void XfsmPromptEditMeasure(); + +# endif diff --git a/alliance/src/xfsm/src/XMX_motif.c b/alliance/src/xfsm/src/XMX_motif.c new file mode 100644 index 00000000..a140857d --- /dev/null +++ b/alliance/src/xfsm/src/XMX_motif.c @@ -0,0 +1,199 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Motif.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XMS.h" + +# include "XMX_motif.h" +# include "XMX_graphic.h" +# include "XMX_event.h" +# include "XMX_message.h" +# include "XMX_menu.h" +# include "XMX_color.h" +# include "XMX_panel.h" +# include "XMX_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XtAppContext XfsmApplication; + Widget XfsmTopLevel; + Widget XfsmMainWindow; + Widget XfsmMainForm; + + static String XfsmFallBacks [] = + + { + "*.XfsmMainWindow.iconName : Xfsm", + "*XfsmMenuBar*fontList : -*-helvetica-bold-r-*--14-*", + "*foreground : black", + "*background : gray", + "*fontList : -*-helvetica-medium-r-*--12-*", + NULL + }; + + static char XfsmTopLevelTitle[ 128 ] = "Xfsm : "; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmChangeTopLevelTitle | +| | +\------------------------------------------------------------*/ + +void XfsmChangeTopLevelTitle( Title ) + + char *Title; +{ + autbegin(); + + if ( Title != (char *)NULL ) + { + strcpy( XfsmTopLevelTitle + 7, Title ); + } + else + { + XfsmTopLevelTitle[ 7 ] = '\0'; + } + + XtVaSetValues( XfsmTopLevel, XmNtitle, XfsmTopLevelTitle, NULL ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmInitializeRessources | +| | +\------------------------------------------------------------*/ + +void XfsmInitializeRessources( argc, argv ) + + int *argc; + char *argv[]; +{ + Arg Args[ 2 ]; + + autbegin(); + + XfsmTopLevel = XtVaAppInitialize( + &XfsmApplication, + "xfsm.xrdb", + NULL, + 0, + argc, + argv, + XfsmFallBacks, + NULL + ); + + XfsmLoadTopLevelConfig(); + + XfsmInitializeColorMap(); + + XfsmMainWindow = XtVaCreateManagedWidget( "XfsmMainWindow", + xmMainWindowWidgetClass, + XfsmTopLevel, + NULL); + + XfsmMainForm = XtVaCreateManagedWidget( "XfsmMainForm", + xmFormWidgetClass, + XfsmMainWindow, + XmNfractionBase, + 200, + NULL ); + + XfsmInitializeIcon(); + XfsmInitializeMenu(); + XfsmInitializeMessage(); + XfsmInitializePanel(); + XfsmInitializeGraphic(); + XfsmInitializeEvent(); + XfsmBuildPanelMap(); + XfsmInitializeMapEvent(); + XfsmInitializeColors(); + XfsmInitializeGraphicContext(); + XfsmInitializeDialog(); + XfsmBuildPanelLibrary(); + + XtSetArg( Args[0], XmNallowShellResize, True ); + XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING ); + + XtSetValues( XfsmTopLevel, Args, 2 ); + + XtRealizeWidget( XfsmTopLevel ); + + autend(); +} diff --git a/alliance/src/xfsm/src/XMX_motif.h b/alliance/src/xfsm/src/XMX_motif.h new file mode 100644 index 00000000..c54c9c6b --- /dev/null +++ b/alliance/src/xfsm/src/XMX_motif.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Motif.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_MOTIF +# define XFSM_MOTIF + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xfsm/src/XMX_panel.c b/alliance/src/xfsm/src/XMX_panel.c new file mode 100644 index 00000000..ecc8c0ad --- /dev/null +++ b/alliance/src/xfsm/src/XMX_panel.c @@ -0,0 +1,113 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XTB.h" +# include "XMF.h" +# include "XME.h" +# include "XMV.h" +# include "XMT.h" +# include "XMS.h" +# include "XMH.h" +# include "XMX.h" + +# include "XMX_panel.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmInitializePanel | +| | +\------------------------------------------------------------*/ + +void XfsmInitializePanel() + +{ + autbegin(); + + XfsmBuildPanel( XfsmMainWindow, &XfsmViewArrowsPanel ); + XfsmBuildPanel( XfsmMainWindow, &XfsmViewZoomPanel ); + XfsmBuildPanel( XfsmMainWindow, &XfsmViewGridPanel ); + XfsmBuildPanel( XfsmMainWindow, &XfsmViewLayerPanel ); + XfsmBuildPanel( XfsmMainWindow, &XfsmEditSearchViewPanel ); + XfsmBuildPanel( XfsmMainWindow, &XfsmEditSelectPanel ); + XfsmBuildPanel( XfsmMainWindow, &XfsmEditIdentifyPanel ); + XfsmBuildPanel( XfsmMainWindow, &XfsmToolsMessagePanel ); + XfsmBuildPanel( XfsmMainWindow, &XfsmSetupInformationsPanel ); + + XfsmBuildPresentPanel(); + + autend(); +} diff --git a/alliance/src/xfsm/src/XMX_panel.h b/alliance/src/xfsm/src/XMX_panel.h new file mode 100644 index 00000000..46327af6 --- /dev/null +++ b/alliance/src/xfsm/src/XMX_panel.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_PANEL +# define XFSM_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmInitializePanel(); + +# endif diff --git a/alliance/src/xfsm/src/XMX_view.c b/alliance/src/xfsm/src/XMX_view.c new file mode 100644 index 00000000..6f445d33 --- /dev/null +++ b/alliance/src/xfsm/src/XMX_view.c @@ -0,0 +1,677 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : View.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 28.01.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XFS.h" +# include "XMX.h" + +# include "XMX_view.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static long XfsmGraphicX1; + static long XfsmGraphicX2; + static long XfsmGraphicY1; + static long XfsmGraphicY2; + static XFontStruct *XfsmTextFont; + static GC XfsmTextGC; + static GC XfsmDrawGC; + static char XfsmInterrupt = 0; + + static xfsmview_list *XfsmHeadView = (xfsmview_list *)NULL; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Alloc Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmAllocView | +| | +\------------------------------------------------------------*/ + +xfsmview_list *XfsmAllocView() +{ + return( (xfsmview_list *)autallocheap( sizeof( xfsmview_list ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Free Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmFreeView | +| | +\------------------------------------------------------------*/ + +void XfsmFreeView( FreeView ) + + xfsmview_list *FreeView; +{ + autfreeheap( (char *)FreeView, sizeof( xfsmview_list ) ); +} + +/*------------------------------------------------------------\ +| | +| XfsmAddViewLater | +| | +\------------------------------------------------------------*/ + +void XfsmAddViewLater( Obj ) + + xfsmobj_list *Obj; +{ + xfsmview_list *View; + + autbegin(); + + View = XfsmAllocView(); + + View->OBJECT = Obj; + View->NEXT = XfsmHeadView; + XfsmHeadView = View; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmDelView | +| | +\------------------------------------------------------------*/ + +void XfsmDelView() +{ + xfsmview_list *DelView; + xfsmview_list *View; + + autbegin(); + + View = XfsmHeadView; + XfsmHeadView = (xfsmview_list *)NULL; + + while( View != (xfsmview_list *)NULL ) + { + DelView = View; + View = View->NEXT; + + XfsmFreeView( DelView ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmInterruptDisplay | +| | +\------------------------------------------------------------*/ + +void XfsmInterruptDisplay() +{ + XEvent Event; + KeySym Key; + char Text; + + autbegin(); + +# ifdef XFSM_CTRL_C + if ( XCheckTypedEvent( XfsmGraphicDisplay, KeyPress, &Event ) ) + { + XLookupString( &Event.xkey, &Text, 1, &Key, 0 ); + + if ( Text == '\003' ) + { + XfsmInterrupt = 1; + + XBell( XfsmGraphicDisplay, 0 ); + } + } +# endif + + signal( SIGALRM, XfsmInterruptDisplay ); + alarm( 1 ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmFlushEventDisplay | +| | +\------------------------------------------------------------*/ + +void XfsmFlushEventDisplay() +{ + XEvent Event; + + autbegin(); + +# ifdef XFSM_CTRL_C + while ( XCheckTypedEvent( XfsmGraphicDisplay, KeyPress, &Event ) ); +# endif + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmDisplayArrow | +| | +\------------------------------------------------------------*/ + +char XfsmComputeArrow( X1, Y1, X2, Y2, Points ) + + long X1; + long Y1; + long X2; + long Y2; + XPoint *Points; +{ + float LineX; + float LineY; + float HalfX; + float HalfY; + float CrossX; + float CrossY; + float Norm; + + LineX = (float)( X2 - X1 ); + LineY = (float)( Y2 - Y1 ); + + if ( ( LineX != 0.0 ) || + ( LineY != 0.0 ) ) + { + Norm = sqrt( ( LineX * LineX ) + ( LineY * LineY ) ); + Norm = Norm / XfsmUnitGridStep; + LineX = LineX / Norm; + LineY = LineY / Norm; + HalfX = LineX / 2; + HalfY = LineY / 2; + CrossX = - HalfY; + CrossY = HalfX; + + Points[ 0 ].x = X1 + LineX; + Points[ 0 ].y = Y1 + LineY; + Points[ 1 ].x = Points[ 0 ].x + LineX + HalfX + CrossX; + Points[ 1 ].y = Points[ 0 ].y + LineY + HalfY + CrossY; + Points[ 2 ].x = Points[ 0 ].x + LineX + HalfX - CrossX; + Points[ 2 ].y = Points[ 0 ].y + LineY + HalfY - CrossY; + + return( XFSM_TRUE ); + } + + return( XFSM_FALSE ); +} + +/*------------------------------------------------------------\ +| | +| XfsmDisplayOneObject | +| | +\------------------------------------------------------------*/ + +void XfsmDisplayOneObject( Obj ) + + xfsmobj_list *Obj; +{ + XPoint Arrow[ 3 ]; + long X1r; + long X2r; + long Y1r; + long Y2r; + long DeltaX; + long DeltaY; + long WidthText; + long HeightText; + int Length; + + if ( IsXfsmLineLeft( Obj ) ) + { + X1r = Obj->X + Obj->DX; + X2r = Obj->X; + } + else + { + X1r = Obj->X; + X2r = Obj->X + Obj->DX; + } + + if ( IsXfsmLineDown( Obj ) ) + { + Y1r = Obj->Y + Obj->DY; + Y2r = Obj->Y; + } + else + { + Y1r = Obj->Y; + Y2r = Obj->Y + Obj->DY; + } + + X1r = (float)( X1r ) * XfsmUnitGridStep; + Y1r = (float)( Y1r ) * XfsmUnitGridStep; + X2r = (float)( X2r ) * XfsmUnitGridStep; + Y2r = (float)( Y2r ) * XfsmUnitGridStep; + + X1r = ( X1r / XFSM_UNIT ) - XfsmPixelGridX; + X2r = ( X2r / XFSM_UNIT ) - XfsmPixelGridX; + Y1r = ( Y1r / XFSM_UNIT ) - XfsmPixelGridY; + Y2r = ( Y2r / XFSM_UNIT ) - XfsmPixelGridY; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + + switch ( GetXfsmObjectType( Obj ) ) + { + case XFSM_OBJECT_LINE : + + XDrawLine( XfsmGraphicDisplay, + XfsmGraphicPixmap, + XfsmDrawGC, + X1r, XfsmGraphicDy - Y1r, + X2r, XfsmGraphicDy - Y2r ); + break; + + case XFSM_OBJECT_ARROW : + + XDrawLine( XfsmGraphicDisplay, + XfsmGraphicPixmap, + XfsmDrawGC, + X1r, XfsmGraphicDy - Y1r, + X2r, XfsmGraphicDy - Y2r ); + + if ( XfsmComputeArrow( X1r, Y1r, X2r, Y2r, Arrow ) ) + { + Arrow[ 0 ].y = XfsmGraphicDy - Arrow[ 0 ].y; + Arrow[ 1 ].y = XfsmGraphicDy - Arrow[ 1 ].y; + Arrow[ 2 ].y = XfsmGraphicDy - Arrow[ 2 ].y; + + XFillPolygon( XfsmGraphicDisplay, + XfsmGraphicPixmap, + XfsmDrawGC, Arrow, 3, + Convex, + CoordModeOrigin ); + } + + break; + + case XFSM_OBJECT_CIRCLE : + + XFillArc( XfsmGraphicDisplay, + XfsmGraphicPixmap, + XfsmDrawGC, + X1r, XfsmGraphicDy - Y2r, + DeltaX, DeltaY, 0, 23040 ); + break; + + case XFSM_OBJECT_RECTANGLE : + + XFillRectangle( XfsmGraphicDisplay, + XfsmGraphicPixmap, + XfsmDrawGC, + X1r, XfsmGraphicDy - Y2r, + DeltaX, DeltaY ); + + break; + + case XFSM_OBJECT_TEXT : + + Length = strlen( Obj->NAME ); + HeightText = XfsmTextFont->ascent; + + if ( IsXfsmTrans( Obj ) ) + { + XDrawString( XfsmGraphicDisplay, + XfsmGraphicPixmap, + XfsmTextGC, + X1r, + XfsmGraphicDy - (( Y1r + Y2r - HeightText ) >> 1), + Obj->NAME, Length ); + } + else + { + WidthText = XTextWidth( XfsmTextFont, Obj->NAME, Length ); + + XDrawString( XfsmGraphicDisplay, + XfsmGraphicPixmap, + XfsmTextGC, + (( X1r + X2r - WidthText ) >> 1), + XfsmGraphicDy - (( Y1r + Y2r - HeightText ) >> 1), + Obj->NAME, Length ); + } + + break; + } +} + +/*------------------------------------------------------------\ +| | +| XfsmDisplayFigure | +| | +\------------------------------------------------------------*/ + +void XfsmDisplayFigure( GraphicX1, GraphicY1, GraphicX2, GraphicY2 ) + + long GraphicX1; + long GraphicY1; + long GraphicX2; + long GraphicY2; +{ + xfsmview_list *View; + xfsmobj_list *Obj; + long X1; + long Y1; + long X2; + long Y2; + int Layer; + char DisplayTextTrans; + char DisplayTextState; + + autbegin(); + + DisplayTextTrans = XFSM_ACTIVE_NAME_TABLE[ XFSM_ACTIVE_NAME_TRANS ]; + DisplayTextState = XFSM_ACTIVE_NAME_TABLE[ XFSM_ACTIVE_NAME_STATE ]; + + XfsmGraphicX1 = GraphicX1; + XfsmGraphicX2 = GraphicX2; + XfsmGraphicY1 = GraphicY1; + XfsmGraphicY2 = GraphicY2; + + if ( XfsmUnitGridStep > 10.0 ) + { + XfsmTextGC = XfsmLargeTextGC; + XfsmTextFont = XfsmLargeTextFont; + } + else + if ( XfsmUnitGridStep > 6.0 ) + { + XfsmTextGC = XfsmMediumTextGC; + XfsmTextFont = XfsmMediumTextFont; + } + else + if ( ( XfsmUnitGridStep > 3.0 ) || + ( XFSM_FORCE_DISPLAY ) ) + { + XfsmTextGC = XfsmSmallTextGC; + XfsmTextFont = XfsmSmallTextFont; + } + else + { + DisplayTextTrans = 0; + DisplayTextState = 0; + } + + XfsmClearGraphicWindow( GraphicX1, + XfsmGraphicDy - GraphicY2, + GraphicX2 - GraphicX1, + GraphicY2 - GraphicY1 ); + + if ( XfsmFigure == (xfsmfig_list *)NULL ) return; + + X1 = GraphicX1 + XfsmPixelGridX; + X2 = GraphicX2 + XfsmPixelGridX; + Y1 = GraphicY1 + XfsmPixelGridY; + Y2 = GraphicY2 + XfsmPixelGridY; + + X1 = ( X1 / XfsmUnitGridStep ); + Y1 = ( Y1 / XfsmUnitGridStep ); + X2 = ( X2 / XfsmUnitGridStep ); + Y2 = ( Y2 / XfsmUnitGridStep ); + + if ( X2 >= 0 ) { X2 = X2 + 1; } + if ( Y2 >= 0 ) { Y2 = Y2 + 1; } + if ( X1 <= 0 ) { X1 = X1 - 1; } + if ( Y1 <= 0 ) { Y1 = Y1 - 1; } + + X1 = X1 * XFSM_UNIT; + X2 = X2 * XFSM_UNIT; + Y1 = Y1 * XFSM_UNIT; + Y2 = Y2 * XFSM_UNIT; + + XfsmInterrupt = 0; + + signal( SIGALRM, XfsmInterruptDisplay ); + alarm( 1 ); + + for ( Layer = 0; Layer < XFSM_MAX_LAYER; Layer++ ) + { + if ( XfsmInterrupt ) break; + + if ( XFSM_ACTIVE_LAYER_TABLE[ Layer ] == 0 ) continue; + + XfsmDrawGC = XfsmLayerDrawGC[ Layer ]; + + for ( Obj = XfsmFigure->OBJECT[ Layer ]; + Obj != (xfsmobj_list *)NULL; + Obj = Obj->NEXT ) + { + if ( XfsmInterrupt ) break; + + if ( XFSM_ACTIVE_LAYER_TABLE[ Obj->LAYER ] == 0 ) continue; + + if ( ( Obj->X <= X2 ) && + ( Obj->Y <= Y2 ) && + ( Obj->X + Obj->DX >= X1 ) && + ( Obj->Y + Obj->DY >= Y1 ) ) + { + if ( ( IsXfsmAccept( Obj ) ) || + ( IsXfsmConnect( Obj ) ) ) + { + XfsmAddViewLater( Obj ); + } + else + { + XfsmDisplayOneObject( Obj ); + } + } + } + } + + for ( View = XfsmHeadView; + View != (xfsmview_list *)NULL; + View = View->NEXT ) + { + Obj = View->OBJECT; + + if ( IsXfsmAccept( Obj ) ) + { + XfsmDrawGC = XfsmAcceptDrawGC; + } + else + { + XfsmDrawGC = XfsmConnectDrawGC; + } + + XfsmDisplayOneObject( Obj ); + } + + XfsmDelView(); + + for ( Layer = 0; Layer < XFSM_MAX_LAYER; Layer++ ) + { + if ( XfsmInterrupt ) break; + + if ( XFSM_ACTIVE_LAYER_TABLE[ Layer ] == 0 ) continue; + + for ( Obj = XfsmFigure->TEXT[ Layer ]; + Obj != (xfsmobj_list *)NULL; + Obj = Obj->NEXT ) + { + if ( XfsmInterrupt ) break; + + if ( XFSM_ACTIVE_LAYER_TABLE[ Obj->LAYER ] == 0 ) continue; + + if ( ( Obj->X <= X2 ) && + ( Obj->Y <= Y2 ) && + ( Obj->X + Obj->DX >= X1 ) && + ( Obj->Y + Obj->DY >= Y1 ) ) + { + if ( ( IsXfsmTrans( Obj ) && DisplayTextTrans ) || + ( IsXfsmState( Obj ) && DisplayTextState ) ) + { + XfsmDisplayOneObject( Obj ); + } + } + } + } + + alarm( 0 ); + XfsmFlushEventDisplay(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmDisplayObject | +| | +\------------------------------------------------------------*/ + +void XfsmDisplayObject( Obj ) + + xfsmobj_list *Obj; +{ + xfsmobj_list *ScanObj; + long Xmin; + long Ymin; + long Xmax; + long Ymax; + + autbegin(); + + Xmin = Obj->X; + Ymin = Obj->Y; + Xmax = Xmin + Obj->DX; + Ymax = Ymin + Obj->DY; + + ScanObj = Obj->LINK; + + while ( ScanObj != Obj ) + { + if ( Xmin > ScanObj->X ) + { + Xmin = ScanObj->X; + } + + if ( Xmax < ( ScanObj->X + ScanObj->DX ) ) + { + Xmax = ScanObj->X + ScanObj->DX; + } + + if ( Ymin > ScanObj->Y ) + { + Ymin = ScanObj->Y; + } + + if ( Ymax < ( ScanObj->Y + ScanObj->DY ) ) + { + Ymax = ScanObj->Y + ScanObj->DY; + } + + ScanObj = ScanObj->LINK; + } + + Xmin = (float)( Xmin - XFSM_UNIT ) * XfsmUnitGridStep; + Ymin = (float)( Ymin - XFSM_UNIT ) * XfsmUnitGridStep; + Xmax = (float)( Xmax + XFSM_UNIT ) * XfsmUnitGridStep; + Ymax = (float)( Ymax + XFSM_UNIT ) * XfsmUnitGridStep; + + Xmin = ( Xmin / XFSM_UNIT ) - XfsmPixelGridX - 1; + Xmax = ( Xmax / XFSM_UNIT ) - XfsmPixelGridX + 1; + Ymin = ( Ymin / XFSM_UNIT ) - XfsmPixelGridY - 1; + Ymax = ( Ymax / XFSM_UNIT ) - XfsmPixelGridY + 1; + + if ( Xmin < 0 ) Xmin = 0; + if ( Ymin < 0 ) Ymin = 0; + + if ( Xmax > XfsmGraphicDx ) Xmax = XfsmGraphicDx; + if ( Ymax > XfsmGraphicDy ) Ymax = XfsmGraphicDy; + + if ( ( Xmax > 0 ) && + ( Ymax > 0 ) && + ( Xmin < XfsmGraphicDx ) && + ( Ymin < XfsmGraphicDy ) ) + { + XfsmDisplayFigure( Xmin, Ymin , Xmax, Ymax ); + + XfsmRefreshGraphicWindow( Xmin, XfsmGraphicDy - Ymax, + Xmax - Xmin, Ymax - Ymin ); + } + + autend(); +} diff --git a/alliance/src/xfsm/src/XMX_view.h b/alliance/src/xfsm/src/XMX_view.h new file mode 100644 index 00000000..61a0f3f5 --- /dev/null +++ b/alliance/src/xfsm/src/XMX_view.h @@ -0,0 +1,78 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : View.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_VIEW +# define XFSM_VIEW + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct xfsmview_list + { + struct xfsmview_list *NEXT; + xfsmobj_list *OBJECT; + + } xfsmview_list; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xfsm/src/XSB.h b/alliance/src/xfsm/src/XSB.h new file mode 100644 index 00000000..f15c214d --- /dev/null +++ b/alliance/src/xfsm/src/XSB.h @@ -0,0 +1,169 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : XSB.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_XSB +# define XFSM_XSB + +/*------------------------------------------------------\ +| | +| Others | +| | +\------------------------------------------------------*/ + +# define XFSM_TRUE 1 +# define XFSM_FALSE 0 + +# define XFSM_ERROR 1 +# define XFSM_OK 0 + +# define XFSM_NORTH 0 +# define XFSM_SOUTH 1 +# define XFSM_EAST 2 +# define XFSM_WEST 3 + +# define XFSM_NORTH_MASK 1 +# define XFSM_SOUTH_MASK 2 +# define XFSM_WEST_MASK 4 +# define XFSM_EAST_MASK 8 + +# define XFSM_DEFAULT_FIGURE_NAME "NONAME" + +/*------------------------------------------------------\ +| | +| Layer | +| | +\------------------------------------------------------*/ + +# define XFSM_STATE_LAYER 0 +# define XFSM_STAR_LAYER 1 +# define XFSM_FIRST_LAYER 2 +# define XFSM_STACK_LAYER 3 + +# define XFSM_MAX_LAYER 10 + +/*------------------------------------------------------\ +| | +| Active Name | +| | +\------------------------------------------------------*/ + +# define XFSM_ACTIVE_NAME_STATE 0 +# define XFSM_ACTIVE_NAME_TRANS 1 +# define XFSM_MAX_ACTIVE_NAME 2 + +/*------------------------------------------------------------\ +| | +| Edit Mode | +| | +\------------------------------------------------------------*/ + +# define XFSM_EDIT_MEASURE (char)0x00 +# define XFSM_EDIT_IDENTIFY (char)0x01 +# define XFSM_EDIT_CONNECTED (char)0x02 + +# define XFSM_ZOOM_CENTER (char)0x80 +# define XFSM_ZOOM_IN (char)0x81 +# define XFSM_ZOOM_PAN (char)0x82 + +# define XFSM_ZOOM_MARK (char)0x80 + +/*------------------------------------------------------------\ +| | +| Input Mode | +| | +\------------------------------------------------------------*/ + +# define XFSM_INPUT_POINT 0 +# define XFSM_INPUT_ORTHO 1 +# define XFSM_INPUT_LINE 2 +# define XFSM_INPUT_LSTRING 3 +# define XFSM_INPUT_BOX 4 +# define XFSM_INPUT_SORTHO 5 +# define XFSM_INPUT_HALF_BOX 6 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char XFSM_ACTIVE_LAYER_TABLE[ XFSM_MAX_LAYER ]; + extern char XFSM_ACTIVE_NAME_TABLE[ XFSM_MAX_ACTIVE_NAME ]; + + extern char *XFSM_CURSOR_COLOR_NAME; + extern char *XFSM_BACKGROUND_COLOR_NAME; + extern char *XFSM_FOREGROUND_COLOR_NAME; + extern char *XFSM_ACCEPT_COLOR_NAME; + extern char *XFSM_CONNECT_COLOR_NAME; + + extern long XFSM_CURSOR_SIZE; + extern float XFSM_LOWER_GRID_STEP; + extern long XFSM_UNIT; + extern char *XFSM_LAYER_NAME_TABLE[ XFSM_MAX_LAYER ][ 3 ]; + extern char *XFSM_PARAM_NAME; + + extern char *XFSM_XMS_FILE_NAME; + extern char *XfsmFirstFileName; + + extern char XFSM_FORCE_DISPLAY; + extern char XFSM_XOR_CURSOR; + extern char XFSM_SWITCH_COLOR_MAP; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern char *XfsmPostTreatString(); + extern void XfsmLoadParameters(); + extern void Xfsmgetenv(); + +# endif diff --git a/alliance/src/xfsm/src/XSB_error.c b/alliance/src/xfsm/src/XSB_error.c new file mode 100644 index 00000000..c92b3aad --- /dev/null +++ b/alliance/src/xfsm/src/XSB_error.c @@ -0,0 +1,181 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Xsb Errors | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XSB_error.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +void XsbError( ErrorType, Message, Data ) + + char ErrorType; + char *Message; + long Data; +{ + fflush(stdout); + + switch ( ErrorType ) + { + case DEFINE_MISSING : + + fprintf( stderr, "Xsb: Some defines missing\n"); + break; + + case TABLE_MISSING : + + fprintf( stderr, "Xsb: Some tables missing\n"); + break; + + case LINE_EXPECTED : + + fprintf( stderr, "Xsb: %s expected line %lu\n", + Message, Data ); + break; + + case UNKNOWN_DEFINE : + + fprintf( stderr, "Xsb: Unknown define %s line %lu\n", + Message, Data ); + break; + + case NOT_DEFINED : + + fprintf( stderr, "Xsb: %s not defined line %lu\n", + Message, Data ); + break; + + case TOO_SMAL : + + fprintf( stderr, "Xsb: %s too smal line %lu\n", + Message, Data ); + break; + + case MISSING_VALUE : + + fprintf( stderr, "Xsb: Missing value at line %lu\n", + Data ); + break; + + case MISSING_NAME : + + fprintf( stderr, "Xsb: Missing name of %s line %lu\n", + Message, Data ); + break; + + case UNEXPECTED_LINE : + + fprintf( stderr, "Xsb: %s unexpected line %lu\n", + Message, Data ); + break; + + case UNEXPECTED_EOF : + + fprintf( stderr, "Xsb: Unexpected end of file, missing definitions\n"); + break; + + case TOO_MANY_WORDS : + + fprintf( stderr, "Xsb: Too many words %s unexpected line %lu\n", + Message, Data ); + break; + + case MISSING_TABLE : + + fprintf( stderr, "Xsb: Missing value in %s table line %lu\n", + Message, Data ); + break; + + case OPEN_FILE : + + fprintf( stderr, "Xsb: Parameters file %s can't be opened\n", + Message ); + break; + + case UNKNOWN_TABLE : + + fprintf( stderr, "Xsb: Unknown table %s line %lu\n", + Message , Data ); + break; + + case SYNTAX_ERROR : + + fprintf( stderr, "Xsb: Syntax Error %s at line %lu\n", + Message , Data ); + break; + + case ILLEGAL_FLOAT : + + fprintf( stderr, "Xsb: Illegal floating point number %s line %lu\n", + Message , Data ); + break; + } + + exit( 1 ); +} diff --git a/alliance/src/xfsm/src/XSB_error.h b/alliance/src/xfsm/src/XSB_error.h new file mode 100644 index 00000000..cb9b038e --- /dev/null +++ b/alliance/src/xfsm/src/XSB_error.h @@ -0,0 +1,88 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Xsb Errors | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSB_ERROR +# define XSB_ERROR + +/*------------------------------------------------------------\ +| | +| Rpr Error Constants | +| | +\------------------------------------------------------------*/ + +# define DEFINE_MISSING 0 +# define TABLE_MISSING 1 +# define LINE_EXPECTED 2 +# define UNKNOWN_DEFINE 3 +# define NOT_DEFINED 4 +# define TOO_SMAL 5 +# define MISSING_VALUE 6 +# define MISSING_NAME 7 +# define UNEXPECTED_LINE 8 +# define UNEXPECTED_EOF 9 +# define TOO_MANY_WORDS 10 +# define MISSING_TABLE 11 +# define OPEN_FILE 12 +# define UNKNOWN_TABLE 13 +# define SYNTAX_ERROR 14 +# define ILLEGAL_FLOAT 15 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xfsm/src/XSB_parse.c b/alliance/src/xfsm/src/XSB_parse.c new file mode 100644 index 00000000..5abcc373 --- /dev/null +++ b/alliance/src/xfsm/src/XSB_parse.c @@ -0,0 +1,714 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : XsbParse.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XSB_error.h" +# include "XSB_parse.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Global Variables | +| | +\------------------------------------------------------------*/ + + char *XFSM_PARAM_NAME = (char *)NULL; + char *XFSM_LAYER_NAME_TABLE[ XFSM_MAX_LAYER ][ 3 ]; + +/*------------------------------------------------------------\ +| | +| Private Variables | +| | +\------------------------------------------------------------*/ + + static char *XfsmDefaultTechnoName = XFSM_DEFAULT_PARAM_NAME; + +/*------------------------------------------------------------\ +| | +| Table variables | +| | +\------------------------------------------------------------*/ + + char *XFSM_CURSOR_COLOR_NAME; + char *XFSM_BACKGROUND_COLOR_NAME; + char *XFSM_FOREGROUND_COLOR_NAME; + char *XFSM_ACCEPT_COLOR_NAME; + char *XFSM_CONNECT_COLOR_NAME; + + long XFSM_CURSOR_SIZE; + float XFSM_LOWER_GRID_STEP; + long XFSM_UNIT; + + char *XFSM_NOT_DEFINE = ""; + +/*------------------------------------------------------------\ +| | +| Keywords variables | +| | +\------------------------------------------------------------*/ + + static char KeywordDefined = 0; + + static char *DefineKeyword; + static char *TableKeyword; + static char *EndTableKeyword; + static char *EndRecordKeyword; + static char *LowerGridStepKeyword; + static char *CursorColorNameKeyword; + static char *BackgroundColorNameKeyword; + static char *ForegroundColorNameKeyword; + static char *AcceptColorNameKeyword; + static char *ConnectColorNameKeyword; + static char *CursorSizeKeyword; + static char *UnitKeyword; + static char *LayerNameKeyword; + + static keyword KeywordDefine[ XSB_MAX_KEYWORD ] = + + { + "None", 0 + }; + +/*------------------------------------------------------------\ +| | +| File variables | +| | +\------------------------------------------------------------*/ + + static FILE *XsbFile; + static char XsbBuffer[ XSB_MAX_BUFFER ]; + static long XsbCurrentLine; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Xsb File Get String | +| | +\------------------------------------------------------------*/ + +char *XsbFileGetString( String, Size ) + + char *String; + int Size; +{ + register char *RegisterString; + register Register; + + autbegin(); + + RegisterString = String; + + while (--Size > 0 && (Register = getc( XsbFile )) != EOF ) + { + if ((*RegisterString++ = Register) == '\\') + { + if ((Register = getc( XsbFile )) == '\n') + { + *(RegisterString - 1) = ' '; + } + else + { + ungetc( Register, XsbFile ); + } + } + else + { + if ( Register == '\n') break; + } + } + + *RegisterString = '\0'; + + autend(); + return ( ( Register == EOF ) && + ( RegisterString == String ) ) ? (char *)NULL : String; +} + +/*------------------------------------------------------------\ +| | +| Xsb File Get Line | +| | +\------------------------------------------------------------*/ + +void XsbGetLine( Buffer ) + + char *Buffer; +{ + char *Check; + char *String; + char OneComment; + + autbegin(); + + do + { + OneComment = 0; + + Check = XsbFileGetString( Buffer, XSB_MAX_BUFFER ); + + if ( Check != (char *)NULL ) + { + XsbCurrentLine++; + } + else + { + XsbError( UNEXPECTED_EOF, (char *)NULL, XsbCurrentLine ); + } + + if ( String = strchr( Buffer, XSB_COMMENT_CHAR )) + { + if ( String == Buffer ) + { + OneComment = 1; + } + else + { + *(String - 1) = '\0'; + } + } + + while (*Buffer != '\0' && strchr( XSB_SEPARATORS_STRING, *Buffer)) + { + Buffer = Buffer + 1;; + } + + if (*Buffer == '\0') OneComment = 1; + + } + while ( OneComment == 1); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Xsb Check Keyword | +| | +\------------------------------------------------------------*/ + +char XsbCheckKeyword( Word ) + + char *Word; +{ + if ( ( Word == DefineKeyword ) || + ( Word == TableKeyword ) ) + { + return 1; + } + else + { + return 0; + } +} + +/*------------------------------------------------------------\ +| | +| Xsb Get First word | +| | +\------------------------------------------------------------*/ + +char *XsbGetFirstWord( Buffer, IsKeyword, Hash ) + + char *Buffer; + char IsKeyword; + char Hash; +{ + char *String; + char *Text; + int Index; + + autbegin(); + + if ( String = (char *)strtok( Buffer, XSB_SEPARATORS_STRING )) + { + if ( Hash ) + { + String = namealloc( String ); + } + else + { + Text = autallocblock( strlen( String ) + 1 ); + strcpy( Text, String ); + String = Text; + + for ( Index = 0; Text[ Index ]; Index++ ) + { + if ( Text[ Index ] == '_' ) Text[ Index ] = ' '; + } + } + + if ( ( IsKeyword ) && XsbCheckKeyword( String ) ) + { + XsbError( UNEXPECTED_LINE, String, XsbCurrentLine ); + } + } + + autend(); + return( String ); +} + +/*------------------------------------------------------------\ +| | +| Xsb Get Next word | +| | +\------------------------------------------------------------*/ + +char *XsbGetNextWord( IsKeyword, Hash ) + + char IsKeyword; + char Hash; +{ + char *String; + char *Text; + int Index; + + autbegin(); + + if ( String = (char *)strtok( (char *)NULL, XSB_SEPARATORS_STRING )) + { + if ( Hash ) + { + String = namealloc( String ); + } + else + { + Text = autallocblock( strlen( String ) + 1 ); + strcpy( Text, String ); + String = Text; + + for ( Index = 0; Text[ Index ]; Index++ ) + { + if ( Text[ Index ] == '_' ) Text[ Index ] = ' '; + } + } + + if ( ( IsKeyword ) && XsbCheckKeyword( String ) ) + { + XsbError( UNEXPECTED_LINE, String, XsbCurrentLine ); + } + } + + autend(); + return( String ); +} + +/*------------------------------------------------------------\ +| | +| Xsb Keyword Compare | +| | +\------------------------------------------------------------*/ + +int XsbKeywordCompare( FirstKey, SecondKey ) + + keyword *FirstKey; + keyword *SecondKey; +{ + return strcmp( FirstKey->NAME, SecondKey->NAME ); +} + +/*------------------------------------------------------------\ +| | +| Xsb Get String Value | +| | +\------------------------------------------------------------*/ + +long XsbGetStringValue( String ) + + char *String; +{ + long Value; + keyword *Keyword; + keyword Entry; + + autbegin(); + + if ( sscanf( String, "%d", &Value) ) + { + autend(); + return ( Value ); + } + + Entry.NAME = String; + + Keyword = (keyword *)bsearch( (char *)(&Entry), + (char *)KeywordDefine, + XSB_MAX_KEYWORD, sizeof( keyword ), + XsbKeywordCompare ); + + if ( Keyword == (keyword *)NULL ) + { + XsbError( UNEXPECTED_LINE, String, XsbCurrentLine ); + } + + autend(); + return( Keyword->VALUE ); +} + +/*------------------------------------------------------------\ +| | +| Xsb Get String Float | +| | +\------------------------------------------------------------*/ + +float XsbGetStringFloat( String ) + + char *String; +{ + float Value; + + autbegin(); + + if ( ! sscanf( String, "%g", &Value) ) + { + XsbError( ILLEGAL_FLOAT, String, XsbCurrentLine ); + } + + autend(); + return ( Value ); +} + +/*------------------------------------------------------------\ +| | +| Xsb Get Number | +| | +\------------------------------------------------------------*/ + +long XsbGetNumber( String ) + + char *String; +{ + long Value; + + autbegin(); + + if ( ! sscanf( String, "%d", &Value )) + { + XsbError( UNEXPECTED_LINE, "number", XsbCurrentLine ); + } + + autend(); + return Value; +} + + +/*------------------------------------------------------------\ +| | +| Xsb Read Layer Name | +| | +\------------------------------------------------------------*/ + +void XsbReadLayerName() + +{ + char Layer; + char LayerCount; + char EndTable; + char Field; + char *FirstWord; + + autbegin(); + + EndTable = 0; + LayerCount = 0; + + while ( ( EndTable != 1 ) && + ( LayerCount <= XFSM_MAX_LAYER ) ) + { + XsbGetLine( XsbBuffer ); + + FirstWord = XsbGetFirstWord( XsbBuffer, 1, 1 ); + + if ( FirstWord == EndTableKeyword ) + { + EndTable = 1; + } + else + if ( LayerCount < XFSM_MAX_LAYER ) + { + Layer = XsbGetStringValue( FirstWord ); + + for ( Field = 0; Field < 3; Field++ ) + { + FirstWord = XsbGetNextWord( 1, 0 ); + + if ( FirstWord == EndRecordKeyword ) + { + XsbError( MISSING_VALUE, (char *)NULL, XsbCurrentLine ); + } + else + { + XFSM_LAYER_NAME_TABLE [ Layer ][ Field ] = FirstWord; + } + } + + FirstWord = XsbGetNextWord( 0, 1 ); + + if ( FirstWord != EndRecordKeyword ) + { + XsbError( TOO_MANY_WORDS, FirstWord, XsbCurrentLine ); + } + } + + LayerCount = LayerCount + 1; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Xsb Read Parameters | +| | +\------------------------------------------------------------*/ + +void XsbReadParam() + +{ + char *FirstWord; + char *SecondWord; + long Continue; + + autbegin(); + + Continue = 0; + + while ( Continue != XSB_ALL_DEFINED_MASK ) + { + XsbGetLine( XsbBuffer ); + + FirstWord = XsbGetFirstWord( XsbBuffer, 0, 1); + + if ( FirstWord == DefineKeyword ) + { + FirstWord = XsbGetNextWord( 1, 1 ); + + if (! FirstWord ) + { + XsbError( MISSING_NAME, DefineKeyword, XsbCurrentLine ); + } + + SecondWord = XsbGetNextWord( 1, 0 ); + + if (! SecondWord ) + { + XsbError( MISSING_VALUE, SecondWord, XsbCurrentLine ); + } + + if ( FirstWord == LowerGridStepKeyword ) + { + XFSM_LOWER_GRID_STEP = XsbGetStringFloat( SecondWord ); + + Continue |= XSB_LOWER_GRID_STEP_MASK; + } + else + if ( FirstWord == CursorColorNameKeyword ) + { + XFSM_CURSOR_COLOR_NAME = SecondWord; + + Continue |= XSB_CURSOR_COLOR_NAME_MASK; + } + else + if ( FirstWord == BackgroundColorNameKeyword ) + { + XFSM_BACKGROUND_COLOR_NAME = SecondWord; + + Continue |= XSB_BACKGROUND_COLOR_NAME_MASK; + } + else + if ( FirstWord == ForegroundColorNameKeyword ) + { + XFSM_FOREGROUND_COLOR_NAME = SecondWord; + + Continue |= XSB_FOREGROUND_COLOR_NAME_MASK; + } + else + if ( FirstWord == AcceptColorNameKeyword ) + { + XFSM_ACCEPT_COLOR_NAME = SecondWord; + + Continue |= XSB_ACCEPT_COLOR_NAME_MASK; + } + else + if ( FirstWord == ConnectColorNameKeyword ) + { + XFSM_CONNECT_COLOR_NAME = SecondWord; + + Continue |= XSB_CONNECT_COLOR_NAME_MASK; + } + else + if ( FirstWord == CursorSizeKeyword ) + { + XFSM_CURSOR_SIZE = XsbGetStringValue( SecondWord ); + + Continue |= XSB_CURSOR_SIZE_MASK; + } + else + if ( FirstWord == UnitKeyword ) + { + XFSM_UNIT = XsbGetStringValue( SecondWord ); + + Continue |= XSB_UNIT_MASK; + } + else + { + XsbError( UNKNOWN_DEFINE, FirstWord, XsbCurrentLine ); + } + } + else + if ( FirstWord == TableKeyword ) + { + if (!( FirstWord = XsbGetNextWord(1, 1))) + { + XsbError( MISSING_NAME, TableKeyword ); + } + + if ( FirstWord == LayerNameKeyword ) + { + XsbReadLayerName(); + + Continue |= XSB_LAYER_NAME_MASK; + } + else + { + XsbError( UNKNOWN_TABLE, FirstWord, XsbCurrentLine ); + } + } + else + { + XsbError( SYNTAX_ERROR, FirstWord, XsbCurrentLine ); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Xsb Load Parameters | +| | +\------------------------------------------------------------*/ + +void XfsmLoadParameters() + +{ + short Layer; + + autbegin(); + + XFSM_PARAM_NAME = mbkgetenv( "XFSM_PARAM_NAME" ); + + if ( XFSM_PARAM_NAME == (char *)NULL ) + { + XFSM_PARAM_NAME = XfsmDefaultTechnoName; + } + + if ( ! KeywordDefined ) + { + DefineKeyword = namealloc( DEFINE_KEYWORD ); + TableKeyword = namealloc( TABLE_KEYWORD ); + EndTableKeyword = namealloc( END_TABLE_KEYWORD ); + EndRecordKeyword = namealloc( END_RECORD_KEYWORD ); + LowerGridStepKeyword = namealloc( LOWER_GRID_STEP_KEYWORD ); + CursorColorNameKeyword = namealloc( CURSOR_COLOR_NAME_KEYWORD ); + BackgroundColorNameKeyword = namealloc( BACKGROUND_COLOR_NAME_KEYWORD ); + ForegroundColorNameKeyword = namealloc( FOREGROUND_COLOR_NAME_KEYWORD ); + AcceptColorNameKeyword = namealloc( ACCEPT_COLOR_NAME_KEYWORD ); + ConnectColorNameKeyword = namealloc( CONNECT_COLOR_NAME_KEYWORD ); + CursorSizeKeyword = namealloc( CURSOR_SIZE_KEYWORD ); + UnitKeyword = namealloc( UNIT_KEYWORD ); + LayerNameKeyword = namealloc( LAYER_NAME_KEYWORD ); + + KeywordDefined = 1; + } + + XFSM_LOWER_GRID_STEP = 0.0; + + XFSM_CURSOR_COLOR_NAME = (char *)NULL; + XFSM_BACKGROUND_COLOR_NAME = (char *)NULL; + XFSM_FOREGROUND_COLOR_NAME = (char *)NULL; + XFSM_ACCEPT_COLOR_NAME = (char *)NULL; + XFSM_CONNECT_COLOR_NAME = (char *)NULL; + + XFSM_CURSOR_SIZE = 5; + XFSM_UNIT = 4; + + for ( Layer = 0; Layer < XFSM_MAX_LAYER; Layer++ ) + { + XFSM_LAYER_NAME_TABLE[ Layer ][0] = XFSM_NOT_DEFINE; + XFSM_LAYER_NAME_TABLE[ Layer ][1] = (char *)NULL; + XFSM_LAYER_NAME_TABLE[ Layer ][2] = (char *)NULL; + } + + if ( !( XsbFile = fopen( XFSM_PARAM_NAME, "r"))) + + XsbError( OPEN_FILE, XFSM_PARAM_NAME, 0); + + XsbReadParam(); + + fclose( XsbFile ); + + autend(); +} diff --git a/alliance/src/xfsm/src/XSB_parse.h b/alliance/src/xfsm/src/XSB_parse.h new file mode 100644 index 00000000..39203648 --- /dev/null +++ b/alliance/src/xfsm/src/XSB_parse.h @@ -0,0 +1,112 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSB | +| | +| File : Xsbparse.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSB_PARSE +# define XSB_PARSE + +# define XSB_MAX_BUFFER 255 +# define XSB_MAX_KEYWORD 1 + +# define XSB_SEPARATORS_STRING " \t\n" +# define XSB_COMMENT_CHAR '#' + +/*------------------------------------------------------------\ +| | +| Keyword Constants | +| | +\------------------------------------------------------------*/ + +# define DEFINE_KEYWORD "DEFINE" +# define TABLE_KEYWORD "TABLE" +# define END_TABLE_KEYWORD "END" +# define END_RECORD_KEYWORD NULL + +# define LOWER_GRID_STEP_KEYWORD "XFSM_LOWER_GRID_STEP" +# define CURSOR_COLOR_NAME_KEYWORD "XFSM_CURSOR_COLOR_NAME" +# define BACKGROUND_COLOR_NAME_KEYWORD "XFSM_BACKGROUND_COLOR_NAME" +# define FOREGROUND_COLOR_NAME_KEYWORD "XFSM_FOREGROUND_COLOR_NAME" +# define ACCEPT_COLOR_NAME_KEYWORD "XFSM_ACCEPT_COLOR_NAME" +# define CONNECT_COLOR_NAME_KEYWORD "XFSM_CONNECT_COLOR_NAME" +# define CURSOR_SIZE_KEYWORD "XFSM_CURSOR_SIZE" +# define UNIT_KEYWORD "XFSM_UNIT" +# define LAYER_NAME_KEYWORD "XFSM_LAYER_NAME" + +# define XSB_LOWER_GRID_STEP_MASK 0x00001 +# define XSB_CURSOR_COLOR_NAME_MASK 0x00002 +# define XSB_BACKGROUND_COLOR_NAME_MASK 0x00004 +# define XSB_FOREGROUND_COLOR_NAME_MASK 0x00008 +# define XSB_ACCEPT_COLOR_NAME_MASK 0x00010 +# define XSB_CONNECT_COLOR_NAME_MASK 0x00020 +# define XSB_CURSOR_SIZE_MASK 0x00040 +# define XSB_UNIT_MASK 0x00080 +# define XSB_LAYER_NAME_MASK 0x00100 + +# define XSB_ALL_DEFINED_MASK 0x001FF + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct keyword + { + char *NAME; + char VALUE; + + } keyword; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xfsm/src/XSB_share.c b/alliance/src/xfsm/src/XSB_share.c new file mode 100644 index 00000000..dfa47799 --- /dev/null +++ b/alliance/src/xfsm/src/XSB_share.c @@ -0,0 +1,153 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Share.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XSB.h" +# include "XSB_share.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + char XFSM_ACTIVE_NAME_TABLE [ XFSM_MAX_ACTIVE_NAME ] = + { + 1, /* PLACE TEXT */ + 1 /* PLACE TRANS */ + }; + + char XFSM_ACTIVE_LAYER_TABLE [ XFSM_MAX_LAYER ] = + { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + }; + + char *XfsmFirstFileName = (char *)NULL; + char *XFSM_XMS_FILE_NAME = (char *)NULL; + + char XFSM_FORCE_DISPLAY = XFSM_FALSE; + char XFSM_XOR_CURSOR = XFSM_FALSE; + char XFSM_SWITCH_COLOR_MAP = XFSM_FALSE; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmPostTreatString | +| | +\------------------------------------------------------------*/ + +char *XfsmPostTreatString( Text ) + + char *Text; +{ + char OnlySpace; + int Counter; + + autbegin(); + + if ( Text != (char *)NULL ) + { + OnlySpace = 1; + + for ( Counter = 0; Text[ Counter ]; Counter++ ) + { + if ( Text[ Counter ] != ' ' ) OnlySpace = 0; + } + + if ( OnlySpace ) Text = (char *)NULL; + } + + autend(); + return( Text ); +} + +/*------------------------------------------------------------\ +| | +| Xfsmgetenv | +| | +\------------------------------------------------------------*/ + +void Xfsmgetenv() +{ + char *Env; + + Env = mbkgetenv( "HOME" ); + + if ( Env == (char *)NULL ) + { + XFSM_XMS_FILE_NAME = XMS_FILE_NAME; + } + else + { + XFSM_XMS_FILE_NAME = + + (char *)autallocblock( strlen( Env ) + strlen( XMS_FILE_NAME ) + 2 ); + + strcpy( XFSM_XMS_FILE_NAME, Env ); + strcat( XFSM_XMS_FILE_NAME, "/" ); + strcat( XFSM_XMS_FILE_NAME, XMS_FILE_NAME ); + } +} diff --git a/alliance/src/xfsm/src/XSB_share.h b/alliance/src/xfsm/src/XSB_share.h new file mode 100644 index 00000000..73be134d --- /dev/null +++ b/alliance/src/xfsm/src/XSB_share.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Share.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSB_SHARE +# define XSB_SHARE + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xfsm/src/XTB.h b/alliance/src/xfsm/src/XTB.h new file mode 100644 index 00000000..c10b4173 --- /dev/null +++ b/alliance/src/xfsm/src/XTB.h @@ -0,0 +1,215 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : XTB.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_XTB +# define XFSM_XTB + +/*------------------------------------------------------------\ +| | +| MouseCursors | +| | +\------------------------------------------------------------*/ + +# define XFSM_NORMAL_CURSOR 0 +# define XFSM_WATCH_CURSOR 1 +# define XFSM_PIRATE_CURSOR 2 +# define XFSM_CROSS_CURSOR 3 +# define XFSM_NO_CURSOR 4 + +# define XFSM_MAX_CURSOR 5 + +/*------------------------------------------------------------\ +| | +| DialogBoxType | +| | +\------------------------------------------------------------*/ + +# define XFSM_DIALOG_MESSAGE 0 +# define XFSM_DIALOG_ERROR 1 +# define XFSM_DIALOG_INFO 2 +# define XFSM_DIALOG_QUESTION 3 +# define XFSM_DIALOG_WARNING 4 +# define XFSM_DIALOG_WORKING 5 +# define XFSM_DIALOG_FILE 6 +# define XFSM_DIALOG_PROMPT 7 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmDialogBox | +| | +\------------------------------------------------------------*/ + + typedef struct XfsmDialogItem + + { + char *LABEL; + char TYPE; + Widget WIDGET; + void (*CALLBACK_OK)(); + XtPointer CALLDATA_OK; + void (*CALLBACK_CANCEL)(); + XtPointer CALLDATA_CANCEL; + + } XfsmDialogItem; + + +/*------------------------------------------------------------\ +| | +| XfsmMenuItem | +| | +\------------------------------------------------------------*/ + + typedef struct XfsmMenuItem + + { + char *LABEL; + char MNEMONIC; + char *SHORT_KEY; + char *SHORT_KEY_TEXT; + WidgetClass *CLASS; + Boolean SEPARATOR; + Boolean TITLE; + Boolean HELP; + void (*CALLBACK)(); + XtPointer CALLDATA; + Widget BUTTON; + Widget MENU; + struct XfsmMenuItem *NEXT; + + } XfsmMenuItem; + +/*------------------------------------------------------------\ +| | +| XfsmPanelButtonItem | +| | +\------------------------------------------------------------*/ + + typedef struct XfsmPanelButtonItem + + { + char **LABEL; + char *TEXT; + char *BITMAP; + int WIDTH; + int HEIGHT; + char **FOREGROUND; + char **BACKGROUND; + unsigned char X; + unsigned char Y; + unsigned char DX; + unsigned char DY; + void (*CALLBACK)(); + XtPointer CALLDATA; + Widget BUTTON; + + } XfsmPanelButtonItem; + +/*------------------------------------------------------------\ +| | +| XfsmPanelItem | +| | +\------------------------------------------------------------*/ + + typedef struct XfsmPanelItem + + { + char *TITLE; + char COMPUTE; + char MANAGED; + int X; + int Y; + int WIDTH; + int HEIGHT; + unsigned char COLUMN; + unsigned char ROW; + Widget PANEL; + Widget PANEL_FORM; + Widget FRAME; + Widget FORM; + XfsmPanelButtonItem *LIST; + + } XfsmPanelItem; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char *XfsmPanelButtonDisable; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XfsmDestroyDialogCallback(); + extern void XfsmExitDialogCallback(); + + extern void XfsmSetMouseCursor(); + extern Pixmap XfsmCreatePixmap(); + extern void XfsmSetIcon(); + extern void XfsmBuildMenus(); + extern void XfsmBuildPanel(); + extern void XfsmEnterPanel(); + extern void XfsmExitPanel(); + extern void XfsmBuildDialog(); + extern void XfsmEnterDialog(); + extern void XfsmReEnterDialog(); + extern void XfsmExitDialog(); + extern void XfsmWarningMessage(); + extern void XfsmErrorMessage(); + +# endif diff --git a/alliance/src/xfsm/src/XTB_cursor.c b/alliance/src/xfsm/src/XTB_cursor.c new file mode 100644 index 00000000..d2455dea --- /dev/null +++ b/alliance/src/xfsm/src/XTB_cursor.c @@ -0,0 +1,177 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : cursor.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XTB.h" +# include "XSB.h" +# include "XTB_cursor.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static XfsmMouseCursor XfsmMouseCursorArray [ XFSM_MAX_CURSOR ] = + + { + { XC_left_ptr , True }, + { XC_watch , True }, + { XC_pirate , True }, + { XC_cross_reverse , True }, + { 0 , True } + }; + + static char XfsmCursorMaskOr [ 8 ] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + static char XfsmCursorMaskAnd [ 8 ] = + + { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmSetMouseCursor | +| | +\------------------------------------------------------------*/ + +void XfsmSetMouseCursor( MainWidget, CursorType ) + + Widget MainWidget; + char CursorType; +{ + Display *DisplayId; + Window MainWindow; + XColor White; + XColor Black; + XColor ForgetIt; + Colormap ColorMap; + Pixmap MaskOr; + Pixmap MaskAnd; + Cursor Type; + Cursor NewCursor; + + autbegin(); + + DisplayId = XtDisplay( MainWidget ); + MainWindow = XtWindow( MainWidget ); + + Type = XfsmMouseCursorArray[ CursorType ].CURSOR; + + if ( XfsmMouseCursorArray[ CursorType ].MAKE == True ) + { + if ( Type != 0 ) + { + NewCursor = XCreateFontCursor( DisplayId, Type ); + } + else + { + ColorMap = DefaultColormapOfScreen ( XtScreen( MainWidget ) ); + + XAllocNamedColor( DisplayId, ColorMap, "black", &Black, &ForgetIt ); + XAllocNamedColor( DisplayId, ColorMap, "white", &White, &ForgetIt ); + + MaskOr = + + XCreatePixmapFromBitmapData( DisplayId, + MainWindow, + XfsmCursorMaskOr, + 8, 8, + Black.pixel, + White.pixel, 1 ); + + MaskAnd = + + XCreatePixmapFromBitmapData( DisplayId, + MainWindow, + XfsmCursorMaskAnd, + 8, 8, + Black.pixel, + White.pixel, 1 ); + + NewCursor = XCreatePixmapCursor( DisplayId, + MaskAnd, MaskOr, + &Black, &White, 0, 0 ); + } + + XfsmMouseCursorArray[ CursorType ].CURSOR = NewCursor; + XfsmMouseCursorArray[ CursorType ].MAKE = False; + + Type = NewCursor; + } + + XDefineCursor( DisplayId, MainWindow, Type ); + + XmUpdateDisplay( MainWidget ); + + autend(); +} diff --git a/alliance/src/xfsm/src/XTB_cursor.h b/alliance/src/xfsm/src/XTB_cursor.h new file mode 100644 index 00000000..979cb109 --- /dev/null +++ b/alliance/src/xfsm/src/XTB_cursor.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : cursor.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_XTB_CURSOR +# define XFSM_XTB_CURSOR + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct XfsmMouseCursor + { + Cursor CURSOR; + Boolean MAKE; + + } XfsmMouseCursor; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xfsm/src/XTB_dialog.c b/alliance/src/xfsm/src/XTB_dialog.c new file mode 100644 index 00000000..207169f5 --- /dev/null +++ b/alliance/src/xfsm/src/XTB_dialog.c @@ -0,0 +1,471 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XTB.h" +# include "XSB.h" +# include "XTB_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static XfsmLockLoop = 0; + + static XfsmDialogItem XfsmWarningDialog = + + { + "Warning", + XFSM_DIALOG_WARNING, + (Widget)NULL, + (void *)NULL, + (XtPointer)NULL, + (void *)NULL, + (XtPointer)NULL + }; + + static XfsmDialogItem XfsmErrorDialog = + + { + "Error", + XFSM_DIALOG_ERROR, + (Widget)NULL, + (void *)NULL, + (XtPointer)NULL, + (void *)NULL, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmDestroyDialogCallback | +| | +\------------------------------------------------------------*/ + +void XfsmDestroyDialogCallback( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + XfsmLockLoop = 0; + XfsmExitErrorMessage( 1 ); +} + +/*------------------------------------------------------------\ +| | +| XfsmExitDialogCallback | +| | +\------------------------------------------------------------*/ + +void XfsmExitDialogCallback() + +{ + autbegin(); + + XfsmExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmBuildDialog | +| | +\------------------------------------------------------------*/ + +void XfsmBuildDialog( Father, Dialog ) + + Widget Father; + XfsmDialogItem *Dialog; +{ + Arg Args[3]; + XmString Label; + + autbegin(); + + Label = XmStringCreateLtoR( Dialog->LABEL, + XmSTRING_DEFAULT_CHARSET ); + + if ( Dialog->TYPE < XFSM_DIALOG_FILE ) + { + XtSetArg( Args[0], XmNmessageString , Label); + } + else + { + XtSetArg( Args[0], XmNselectionLabelString, Label); + } + + XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING ); + XtSetArg( Args[2], XmNtitle, " " ); + + switch ( Dialog->TYPE ) + { + case XFSM_DIALOG_MESSAGE : + + Dialog->WIDGET = + + XmCreateMessageDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case XFSM_DIALOG_ERROR : + + Dialog->WIDGET = + + XmCreateErrorDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case XFSM_DIALOG_INFO : + + Dialog->WIDGET = + + XmCreateInformationDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case XFSM_DIALOG_QUESTION : + + Dialog->WIDGET = + + XmCreateQuestionDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case XFSM_DIALOG_WARNING : + + Dialog->WIDGET = + + XmCreateWarningDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case XFSM_DIALOG_WORKING : + + Dialog->WIDGET = + + XmCreateWorkingDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case XFSM_DIALOG_FILE : + + Dialog->WIDGET = + + XmCreateFileSelectionDialog( Father, Dialog->LABEL, Args, 3); + + XtUnmanageChild( XmFileSelectionBoxGetChild( Dialog->WIDGET, + XmDIALOG_FILTER_LABEL ) ); + + XtUnmanageChild( XmFileSelectionBoxGetChild( Dialog->WIDGET, + XmDIALOG_FILTER_TEXT ) ); + + break; + + case XFSM_DIALOG_PROMPT : + + Dialog->WIDGET = + + XmCreatePromptDialog( Father, Dialog->LABEL, Args, 3); + + XtUnmanageChild( XmSelectionBoxGetChild( Dialog->WIDGET, + XmDIALOG_HELP_BUTTON ) ); + } + + XmStringFree( Label ); + + XtAddCallback (Dialog->WIDGET, XmNdestroyCallback, + XfsmDestroyDialogCallback, NULL ); + + if ( Dialog->TYPE < XFSM_DIALOG_FILE ) + { + XtUnmanageChild( XmMessageBoxGetChild( Dialog->WIDGET, + XmDIALOG_HELP_BUTTON ) ); + } + + if ( ( Dialog->CALLBACK_OK == NULL ) && + ( Dialog->CALLBACK_CANCEL == NULL ) ) + { + XtAddCallback( Dialog->WIDGET, XmNokCallback, + XfsmExitDialogCallback, NULL ); + } + else + { + if ( Dialog->CALLBACK_OK == NULL ) + { + XtUnmanageChild( XmMessageBoxGetChild( Dialog->WIDGET, + XmDIALOG_OK_BUTTON ) ); + } + else + { + XtAddCallback( Dialog->WIDGET, XmNokCallback, + Dialog->CALLBACK_OK, + Dialog->CALLDATA_OK ); + } + } + + if ( Dialog->CALLBACK_CANCEL == NULL ) + { + XtUnmanageChild( XmMessageBoxGetChild( Dialog->WIDGET, + XmDIALOG_CANCEL_BUTTON ) ); + } + else + { + XtAddCallback( Dialog->WIDGET, XmNcancelCallback, + Dialog->CALLBACK_CANCEL, + Dialog->CALLDATA_CANCEL ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmLimitedLoop | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| XfsmLimitedLoop | +| | +\------------------------------------------------------------*/ + +void XfsmLimitedLoop( MyWidget ) + + Widget MyWidget; +{ + Widget DialogShell, WShell; + XEvent Event; + XAnyEvent *AnyEvent; + XtAppContext Context; + + autbegin(); + + Context = XtWidgetToApplicationContext( MyWidget ); + + XfsmLockLoop = 1; + + for ( WShell = MyWidget; + ! XtIsShell( WShell ); + WShell = XtParent( WShell ) ); + + while( XfsmLockLoop == 1 ) + { + XtAppNextEvent( Context, &Event ); + + AnyEvent = (XAnyEvent *)( &Event ); + + for ( DialogShell = XtWindowToWidget( AnyEvent->display, AnyEvent->window ); + ((DialogShell != NULL ) && (!XtIsShell( DialogShell ))); + DialogShell = XtParent(DialogShell)); + + switch ( AnyEvent->type ) + { + case ButtonPress : + case ButtonRelease : + + if ( WShell == DialogShell ) + { + XtDispatchEvent( &Event ); + } + + break; + + case KeyPress : + case KeyRelease : + + if ( WShell != DialogShell ) + { + AnyEvent->window = XtWindow( WShell ); + } + + default : + + XtDispatchEvent( &Event ); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmEnterDialog | +| | +\------------------------------------------------------------*/ + +void XfsmEnterDialog( Dialog ) + + XfsmDialogItem *Dialog; +{ + autbegin(); + + XtManageChild ( Dialog->WIDGET ); + + XfsmLimitedLoop( Dialog->WIDGET ); + + XtUnmanageChild( Dialog->WIDGET ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmReEnterDialog | +| | +\------------------------------------------------------------*/ + +void XfsmReEnterDialog() +{ + XfsmLockLoop = 1; +} + +/*------------------------------------------------------------\ +| | +| XfsmExitDialog | +| | +\------------------------------------------------------------*/ + +void XfsmExitDialog() + +{ + XfsmLockLoop = 0; +} + +/*------------------------------------------------------------\ +| | +| XfsmWarningMessage | +| | +\------------------------------------------------------------*/ + +void XfsmWarningMessage( Father, Subject ) + + Widget Father; + char *Subject; +{ + XmString Label; + + autbegin(); + + if ( XfsmWarningDialog.WIDGET == (Widget)NULL ) + { + XfsmBuildDialog( Father, &XfsmWarningDialog ); + } + + Label = XmStringCreateLtoR( Subject, + XmSTRING_DEFAULT_CHARSET ); + + XtVaSetValues( XfsmWarningDialog.WIDGET, + XmNmessageString, + Label, NULL ); + + XmStringFree( Label ); + + XfsmEnterDialog( &XfsmWarningDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmErrorMessage | +| | +\------------------------------------------------------------*/ + +void XfsmErrorMessage( Father, Subject ) + + Widget Father; + char *Subject; +{ + XmString Label; + + autbegin(); + + if ( XfsmErrorDialog.WIDGET == (Widget)NULL ) + { + XfsmBuildDialog( Father, &XfsmErrorDialog ); + } + + Label = XmStringCreateLtoR( Subject, + XmSTRING_DEFAULT_CHARSET ); + + XtVaSetValues( XfsmErrorDialog.WIDGET, + XmNmessageString, + Label, NULL ); + + XmStringFree( Label ); + + XfsmEnterDialog( &XfsmErrorDialog ); + + autend(); +} diff --git a/alliance/src/xfsm/src/XTB_dialog.h b/alliance/src/xfsm/src/XTB_dialog.h new file mode 100644 index 00000000..ec869c52 --- /dev/null +++ b/alliance/src/xfsm/src/XTB_dialog.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_XTB_DIALOG +# define XFSM_XTB_DIALOG + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xfsm/src/XTB_icon.c b/alliance/src/xfsm/src/XTB_icon.c new file mode 100644 index 00000000..9d175a73 --- /dev/null +++ b/alliance/src/xfsm/src/XTB_icon.c @@ -0,0 +1,107 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : icon.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XTB.h" +# include "XSB.h" +# include "XTB_icon.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmSetIcon | +| | +\------------------------------------------------------------*/ + +void XfsmSetIcon( ShellWidget, IconBits, IconWidth, IconHeight ) + + Widget ShellWidget; + char *IconBits; + int IconWidth; + int IconHeight; +{ + Pixmap IconPixmap; + + autbegin(); + + IconPixmap = XCreatePixmapFromBitmapData( XtDisplay( ShellWidget ), + RootWindowOfScreen( XtScreen( ShellWidget ) ), + IconBits, IconWidth, IconHeight, + WhitePixelOfScreen( XtScreen( ShellWidget ) ), + BlackPixelOfScreen( XtScreen( ShellWidget ) ), + DefaultDepthOfScreen( XtScreen( ShellWidget ) ) ); + XtVaSetValues( ShellWidget, + XmNiconPixmap, IconPixmap, + XmNiconic, False, + NULL ); + + autend(); +} + diff --git a/alliance/src/xfsm/src/XTB_icon.h b/alliance/src/xfsm/src/XTB_icon.h new file mode 100644 index 00000000..179c39a2 --- /dev/null +++ b/alliance/src/xfsm/src/XTB_icon.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : icon.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_XTB_ICON +# define XFSM_XTB_ICON + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xfsm/src/XTB_menu.c b/alliance/src/xfsm/src/XTB_menu.c new file mode 100644 index 00000000..33e52333 --- /dev/null +++ b/alliance/src/xfsm/src/XTB_menu.c @@ -0,0 +1,198 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XTB.h" +# include "XSB.h" +# include "XTB_menu.h" + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static char MenuBuffer [ MENU_BUFFER_SIZE ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmBuildMenus | +| | +\------------------------------------------------------------*/ + +void XfsmBuildMenus( Father, Menu ) + + Widget Father; + XfsmMenuItem *Menu; +{ + + Widget Button; + Widget SubMenu; + XmString Text; + Arg Args[ 2 ]; + int Counter; + + autbegin(); + + for ( Counter = 0; + Menu[ Counter ].LABEL != NULL; + Counter++ ) + { + if ( Menu[ Counter ].SEPARATOR == True ) + { + XtCreateManagedWidget( "Separator", + xmSeparatorWidgetClass, Father, + NULL , + 0 ); + } + + Button = XtVaCreateManagedWidget( Menu[ Counter ].LABEL, + *Menu[ Counter ].CLASS, Father, + XmNmnemonic, + Menu[ Counter ].MNEMONIC, + NULL ); + Menu[ Counter ].BUTTON = Button; + + if ( Menu[ Counter ].SHORT_KEY != NULL ) + { + XtVaSetValues( Button, + XmNaccelerator, + Menu[ Counter ].SHORT_KEY, + NULL ); + } + + if ( Menu[ Counter ].SHORT_KEY != NULL ) + { + Text = XmStringCreateSimple( Menu[ Counter ].SHORT_KEY_TEXT ); + + XtVaSetValues( Button, + XmNacceleratorText, + Text, + NULL ); + + XmStringFree( Text ); + } + + if ( Menu[ Counter ].CALLBACK != NULL ) + { + XtAddCallback( Button, + XmNactivateCallback, + Menu[ Counter ].CALLBACK, + Menu[ Counter ].CALLDATA ); + } + + if ( Menu[ Counter ].HELP == True ) + { + XtSetArg( Args[ 0 ], XmNmenuHelpWidget, Button ); + + XtSetValues( Father, Args, 1 ); + } + + if ( Menu[ Counter ].NEXT != NULL) + { + strcpy( MenuBuffer, Menu[ Counter ].LABEL ); + strcat( MenuBuffer, " Menu" ); + + SubMenu = XmCreatePulldownMenu( Father, + MenuBuffer, + Args, 0 ); + + Menu[ Counter ].MENU = SubMenu; + + if ( Menu[ Counter ].TITLE == True ) + { + Text = XmStringCreateLtoR( MenuBuffer, XmSTRING_DEFAULT_CHARSET ); + + XtVaCreateManagedWidget( "MenuTitle", + xmLabelWidgetClass, + SubMenu, + XmNlabelString, Text, + NULL ); + + XmStringFree( Text ); + + XtCreateManagedWidget( "Separator", + xmSeparatorWidgetClass, + SubMenu, + NULL, + 0 ); + } + + XtSetArg( Args[ 0 ], XmNsubMenuId, SubMenu ); + XtSetValues( Button, Args, 1 ); + + XfsmBuildMenus( SubMenu, Menu[ Counter ].NEXT ); + } + else Menu[ Counter ].MENU = (Widget)NULL; + } + + autend(); +} + diff --git a/alliance/src/xfsm/src/XTB_menu.h b/alliance/src/xfsm/src/XTB_menu.h new file mode 100644 index 00000000..a9e8d1c7 --- /dev/null +++ b/alliance/src/xfsm/src/XTB_menu.h @@ -0,0 +1,67 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_XTB_MENU +# define XFSM_XTB_MENU + +# define MENU_BUFFER_SIZE 80 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xfsm/src/XTB_panel.c b/alliance/src/xfsm/src/XTB_panel.c new file mode 100644 index 00000000..49ccaf7a --- /dev/null +++ b/alliance/src/xfsm/src/XTB_panel.c @@ -0,0 +1,380 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XTB.h" +# include "XSB.h" +# include "XTB_panel.h" +# include "XTB_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static char *XfsmPanelButtonDisable = "xxxx"; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmBuildPanel | +| | +\------------------------------------------------------------*/ + +void XfsmBuildPanel( Father, Panel ) + + Widget Father; + XfsmPanelItem *Panel; +{ + Arg Args[13]; + XfsmPanelButtonItem *Button; + char *Label; + int Counter; + int Fraction; + int X1; + int Y1; + int X2; + int Y2; + Pixmap ButtonPixmap; + + autbegin(); + + Fraction = Panel->ROW * Panel->COLUMN; + + XtSetArg( Args[0], XmNshadowType, XmSHADOW_ETCHED_IN ); + XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING ); + XtSetArg( Args[2], XmNtitle , Panel->TITLE ); + + Panel->PANEL = XmCreateFormDialog( Father, Panel->TITLE, Args, 3); + + XtAddCallback( Panel->PANEL, XmNdestroyCallback, + XfsmDestroyDialogCallback, NULL ); + + Panel->PANEL_FORM = XtVaCreateManagedWidget( "", + xmFormWidgetClass, + Panel->PANEL, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , 100, + NULL + ); + + Panel->FRAME = XtVaCreateManagedWidget( "", + xmFrameWidgetClass, + Panel->PANEL_FORM, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + NULL + ); + + Panel->FORM = XtVaCreateManagedWidget( "", + xmFormWidgetClass, + Panel->FRAME, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , Fraction, + NULL + ); + Button = Panel->LIST; + + for ( Counter = 0; + Button[ Counter ].LABEL != NULL; + Counter++ ) + { + X1 = Button[ Counter ].X * Panel->ROW; + Y1 = Button[ Counter ].Y * Panel->COLUMN; + X2 = X1 + Button[ Counter ].DX * Panel->ROW; + Y2 = Y1 + Button[ Counter ].DY * Panel->COLUMN; + + if ( *Button[ Counter ].LABEL[0] != '\0' ) + { + Label = *Button[ Counter ].LABEL; + } + else + { + Label = XfsmPanelButtonDisable; + } + + if ( ( Button[ Counter ].TEXT != (char *)NULL ) && + ( Button[ Counter ].BITMAP != (char *)NULL ) ) + { + XtSetArg( Args[0] , XmNtopAttachment , XmATTACH_POSITION ); + XtSetArg( Args[1] , XmNtopPosition , Y1 ); + XtSetArg( Args[2] , XmNbottomAttachment , XmATTACH_POSITION ); + XtSetArg( Args[3] , XmNbottomPosition , Y2 ); + XtSetArg( Args[4] , XmNrightAttachment , XmATTACH_POSITION ); + XtSetArg( Args[5] , XmNrightPosition , X2 ); + XtSetArg( Args[6] , XmNleftAttachment , XmATTACH_POSITION ); + XtSetArg( Args[7] , XmNleftPosition , X1 ); + XtSetArg( Args[8] , XmNscrollBarDisplayPolicy, XmSTATIC ); + XtSetArg( Args[9] , XmNscrollHorizontal , True ); + XtSetArg( Args[10] , XmNscrollVertical , True ); + XtSetArg( Args[11] , XmNlistSizePolicy , XmCONSTANT ); + XtSetArg( Args[12] , XmNselectionPolicy , XmMULTIPLE_SELECT ); + + Button[ Counter ].BUTTON = + + XmCreateScrolledList( Panel->FORM, Button[ Counter ].TEXT, Args, 13 ); + + XtManageChild ( Button[ Counter ].BUTTON ); + } + else + if ( Button[ Counter ].TEXT != (char *)NULL ) + { + XtSetArg( Args[0] , XmNrows , 10 ); + XtSetArg( Args[1] , XmNeditable , False ); + XtSetArg( Args[2] , XmNeditMode , XmMULTI_LINE_EDIT ); + XtSetArg( Args[3] , XmNcursorPositionVisible, False ); + XtSetArg( Args[4] , XmNtopAttachment , XmATTACH_POSITION ); + XtSetArg( Args[5] , XmNtopPosition , Y1 ); + XtSetArg( Args[6] , XmNleftAttachment , XmATTACH_POSITION ); + XtSetArg( Args[7] , XmNleftPosition , X1 ); + XtSetArg( Args[8] , XmNbottomAttachment , XmATTACH_POSITION ); + XtSetArg( Args[9] , XmNbottomPosition , Y2 ); + XtSetArg( Args[10], XmNrightAttachment , XmATTACH_POSITION ); + XtSetArg( Args[11], XmNrightPosition , X2 ); + + Button[ Counter ].BUTTON = + + XmCreateScrolledText( Panel->FORM, Button[ Counter ].TEXT, Args, 12); + + XtManageChild ( Button[ Counter ].BUTTON ); + } + else + if ( Button[ Counter ].BITMAP != (char *)NULL ) + { + ButtonPixmap = XfsmCreatePixmap( Father, + Button[ Counter ].BITMAP, + Button[ Counter ].WIDTH, + Button[ Counter ].HEIGHT ); + Button[ Counter ].BUTTON = + + XtVaCreateManagedWidget( Label, + xmPushButtonWidgetClass, + Panel->FORM, + XmNlabelType , XmPIXMAP, + XmNlabelPixmap , ButtonPixmap, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , X1, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , X2, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , Y1, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , Y2, + NULL + ); + } + else + { + Button[ Counter ].BUTTON = + + XtVaCreateManagedWidget( Label, + xmPushButtonWidgetClass, + Panel->FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , X1, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , X2, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , Y1, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , Y2, + NULL + ); + } + + + if ( Label != XfsmPanelButtonDisable ) + { + if ( Button[ Counter ].FOREGROUND != NULL ) + { + XtVaSetValues ( Button[ Counter ].BUTTON , + XtVaTypedArg , XmNforeground, + XmRString , + *Button[ Counter ].FOREGROUND , + strlen ( *Button[ Counter ].FOREGROUND ) + 1, + NULL + ); + } + + if ( Button[ Counter ].BACKGROUND != NULL ) + { + XtVaSetValues ( Button[ Counter ].BUTTON , + XtVaTypedArg , XmNbackground, + XmRString , + *Button[ Counter ].BACKGROUND , + strlen ( *Button[ Counter ].BACKGROUND ) + 1, + NULL + ); + } + + if ( Button[ Counter ].CALLBACK != NULL ) + { + if ( ( Button[ Counter ].TEXT != (char *)NULL ) && + ( Button[ Counter ].BITMAP != (char *)NULL ) ) + { + XtAddCallback( Button[ Counter ].BUTTON, + XmNdefaultActionCallback, + Button[ Counter ].CALLBACK, + (XtPointer)NULL ); + + XtAddCallback( Button[ Counter ].BUTTON, + XmNmultipleSelectionCallback, + Button[ Counter ].CALLBACK, + Button[ Counter ].CALLDATA ); + + } + else + { + XtAddCallback( Button[ Counter ].BUTTON, + XmNactivateCallback, + Button[ Counter ].CALLBACK, + Button[ Counter ].CALLDATA ); + } + } + } + else + { + Button[ Counter ].BUTTON = NULL; + } + } + + XtVaSetValues( Panel->PANEL , + XmNresizable , False, + XmNx , Panel->X, + XmNy , Panel->Y, + XmNheight , Panel->HEIGHT, + XmNwidth , Panel->WIDTH, + NULL ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmEnterPanel | +| | +\------------------------------------------------------------*/ + +void XfsmEnterPanel( Panel ) + + XfsmPanelItem *Panel; +{ + autbegin(); + + XtManageChild( Panel->PANEL ); + + if ( Panel->COMPUTE == 1 ) + { + XtVaSetValues( Panel->PANEL , + XmNresizable , False, + XmNx , Panel->X, + XmNy , Panel->Y, + XmNheight , Panel->HEIGHT, + XmNwidth , Panel->WIDTH, + NULL ); + + Panel->COMPUTE = 0; + } + + Panel->MANAGED = 1; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XfsmExitPanel | +| | +\------------------------------------------------------------*/ + +void XfsmExitPanel( Panel ) + + XfsmPanelItem *Panel; +{ + autbegin(); + + XtUnmanageChild( Panel->PANEL ); + + Panel->MANAGED = 0; + + autend(); +} diff --git a/alliance/src/xfsm/src/XTB_panel.h b/alliance/src/xfsm/src/XTB_panel.h new file mode 100644 index 00000000..3db9371d --- /dev/null +++ b/alliance/src/xfsm/src/XTB_panel.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_XTB_PANEL +# define XFSM_XTB_PANEL + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xfsm/src/XTB_pixmap.c b/alliance/src/xfsm/src/XTB_pixmap.c new file mode 100644 index 00000000..d4c1dd83 --- /dev/null +++ b/alliance/src/xfsm/src/XTB_pixmap.c @@ -0,0 +1,108 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : Pixmap.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +# include +# include +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "XTB.h" +# include "XSB.h" + +# include "XTB_pixmap.h" + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmCreatePixmap | +| | +\------------------------------------------------------------*/ + +Pixmap XfsmCreatePixmap( MainWidget, IconBits, IconWidth, IconHeight ) + + Widget MainWidget; + char *IconBits; + int IconWidth; + int IconHeight; +{ + Pixel Foreground; + Pixel Background; + Pixmap IconPixmap; + + autbegin(); + + XtVaGetValues( MainWidget, XmNforeground, &Foreground, + XmNbackground, &Background, NULL ); + + IconPixmap = XCreatePixmapFromBitmapData( XtDisplay( MainWidget ), + RootWindowOfScreen( XtScreen( MainWidget ) ), + IconBits, IconWidth, IconHeight, + Foreground, Background, + DefaultDepthOfScreen( XtScreen( MainWidget ) ) ); + + autend(); + return( IconPixmap ); +} + diff --git a/alliance/src/xfsm/src/XTB_pixmap.h b/alliance/src/xfsm/src/XTB_pixmap.h new file mode 100644 index 00000000..424ff525 --- /dev/null +++ b/alliance/src/xfsm/src/XTB_pixmap.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : pixmap.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_XTB_PIXMAP +# define XFSM_XTB_PIXMAP + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xfsm/src/xfsm.c b/alliance/src/xfsm/src/xfsm.c new file mode 100644 index 00000000..80250f9d --- /dev/null +++ b/alliance/src/xfsm/src/xfsm.c @@ -0,0 +1,176 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : xfsm.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +# ident "@(#)XFSM ver 1.01 January 1995" + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "ftl.h" +# include "XSB.h" +# include "XFS.h" +# include "XMX.h" + +# include "xfsm.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| present | +| | +\------------------------------------------------------------*/ + +void XfsmPresent() +{ + alliancebanner_with_authors( "Xfsm", XFSM_VERSION, + "Graphic FSM Viewer", "1995", + ALLIANCE_VERSION, "Ludovic Jacomme" ); +} + +/*------------------------------------------------------------\ +| | +| main | +| | +\------------------------------------------------------------*/ + +int main( argc, argv ) + + int argc; + char *argv[]; +{ + char Debug = 0; + int Index; + + XfsmPresent(); + + mbkenv(); + autenv(); + ablenv(); + bddenv(); + fsmenv(); + + for ( Index = 1; + Index < argc; + Index++ ) + { + if ( ! strcmp( argv[ Index ], "-l" ) ) + { + if ( ( Index + 1 ) < argc ) + { + Index = Index + 1; + XfsmFirstFileName = argv[ Index ]; + } + } + else + if ( ! strcmp( argv[ Index ], "-debug" ) ) + { + Debug = 1; + } + else + if ( ! strcmp( argv[ Index ], "-xor" ) ) + { + XFSM_XOR_CURSOR = XFSM_TRUE; + } + else + if ( ! strcmp( argv[ Index ], "-force" ) ) + { + XFSM_FORCE_DISPLAY = XFSM_TRUE; + } + else + if ( ! strcmp( argv[ Index ], "-install" ) ) + { + XFSM_SWITCH_COLOR_MAP = XFSM_TRUE; + } + else + if ( ! strcmp( argv[ Index ], "-I" ) ) + { + if ( ( Index + 1 ) < argc ) + { + Index = Index + 1; + FSM_IN = namealloc( argv[ Index ] ); + } + } + } + + if ( Debug ) autdebug(); + + autbegin(); + + Xfsmgetenv(); + XfsmLoadParameters(); + + XfsmInitializeRessources( &argc, argv ); + XfsmInitializeErrorMessage( Debug ); + + XtAppMainLoop( XfsmApplication ); + + autend(); + + return( 0 ); +} diff --git a/alliance/src/xfsm/src/xfsm.h b/alliance/src/xfsm/src/xfsm.h new file mode 100644 index 00000000..0ad92adb --- /dev/null +++ b/alliance/src/xfsm/src/xfsm.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XFSM | +| | +| File : xfsm.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XFSM_XFSM +# define XFSM_XFSM + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XfsmInitializeRessources | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xpat/Makefile.am b/alliance/src/xpat/Makefile.am new file mode 100644 index 00000000..5fcaa0d3 --- /dev/null +++ b/alliance/src/xpat/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src man1 diff --git a/alliance/src/xpat/configure.in b/alliance/src/xpat/configure.in new file mode 100644 index 00000000..459ffadb --- /dev/null +++ b/alliance/src/xpat/configure.in @@ -0,0 +1,36 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(src/xpat.c) + +XPAT_MAJOR_VERSION=1 +XPAT_MINOR_VERSION=4 +XPAT_VERSION=$XPAT_MAJOR_VERSION.$XPAT_MINOR_VERSION + +AC_SUBST(XPAT_MAJOR_VERSION) +AC_SUBST(XPAT_MINOR_VERSION) +AC_SUBST(XPAT_VERSION) + +# For automake. +VERSION=$XPAT_VERSION +PACKAGE=xpat + +dnl Initialize automake stuff +AM_INIT_AUTOMAKE($PACKAGE, $VERSION) + +dnl Checks for programs. +AC_PROG_CC +AM_PROG_LEX +AC_PROG_YACC +AC_PROG_RANLIB +AC_PROG_MAKE_SET +AC_FIND_MOTIF + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST + +AM_ALLIANCE + +AC_OUTPUT([ +Makefile +src/Makefile +man1/Makefile +]) diff --git a/alliance/src/xpat/etc/xpat.par b/alliance/src/xpat/etc/xpat.par new file mode 100644 index 00000000..1ab59ec5 --- /dev/null +++ b/alliance/src/xpat/etc/xpat.par @@ -0,0 +1,65 @@ +# /*------------------------------------------------------------\ +# | | +# | Title : Parameters File for Xpat | +# | | +# | Author : Jacomme Ludovic | +# | | +# | Date : 28.05.96 | +# | | +# \------------------------------------------------------------*/ +# /*------------------------------------------------------------\ +# | | +# | Unit | +# | | +# \------------------------------------------------------------*/ + +DEFINE XPAT_UNIT 2 + +# /*------------------------------------------------------------\ +# | | +# | Lower Grid Step in pixel by unit | +# | | +# \------------------------------------------------------------*/ + +DEFINE XPAT_LOWER_GRID_STEP 25 + +# /*------------------------------------------------------------\ +# | | +# | Xpat Color | +# | | +# \------------------------------------------------------------*/ + +DEFINE XPAT_CURSOR_COLOR_NAME Gray +DEFINE XPAT_BACKGROUND_COLOR_NAME Black +DEFINE XPAT_FOREGROUND_COLOR_NAME White +DEFINE XPAT_ACCEPT_COLOR_NAME magenta +DEFINE XPAT_CONNECT_COLOR_NAME White + +# /*------------------------------------------------------------\ +# | | +# | Xpat Cursor Size in pixel | +# | | +# \------------------------------------------------------------*/ + +DEFINE XPAT_CURSOR_SIZE 10 + +# /*------------------------------------------------------------\ +# | | +# | Xpat Layer Color | +# | | +# \------------------------------------------------------------*/ + +TABLE XPAT_LAYER_NAME + + 0 Zero DeepSkyBlue Black + 1 One red Black + 2 Down Cyan Black + 3 Up pink Black + 4 Dont_care orchid Black + 5 Vector MediumSlateBlue Black + 6 Unused gray Black + 7 Unused gray Black + 8 Unused gray Black + 9 Unused gray Black + +END diff --git a/alliance/src/xpat/man1/Makefile.am b/alliance/src/xpat/man1/Makefile.am new file mode 100644 index 00000000..00174741 --- /dev/null +++ b/alliance/src/xpat/man1/Makefile.am @@ -0,0 +1,2 @@ +man_MANS = xpat.1 +EXTRA_DIST = $(man_MANS) diff --git a/alliance/src/xpat/man1/xpat.1 b/alliance/src/xpat/man1/xpat.1 new file mode 100644 index 00000000..da44a8bd --- /dev/null +++ b/alliance/src/xpat/man1/xpat.1 @@ -0,0 +1,91 @@ +.TH XPAT 1 "September 1, 2000" "ASIM/LIP6" "ALLIANCE Reference Manual" +.SH NAME +xpat \- graphic pattern viewer +.SH SYNOPSIS +.B xpat +[\-l file_name] +[\-xor] +[\-install] +[\-force] +.br +.so man1/alc_origin.1 +.SH DESCRIPTION +.B Xpat +is a pattern viewer. All functionnalities can be +accessed through different menus. +.B Xpat +works under Motif and X11r6. +When entering +.B Xpat, +the main window appears and shows 5 different +menus on the top bar. These menus can be entered by simply clicking on the +mouse left button. Here is the description of these menus. + +.TP 10 +.B File +\f4Open\fP : load an existing pattern file (see pat(5)). +.br +\f4Quit\fP : quit xpat. + +.TP 10 +.B Edit +\f4Identify\fP : identify a selected pattern. +.br +\f4Connected\fP : highlight a selected pattern. +.br +\f4Search\fP : search a pattern. + +.TP 10 +.B View +\f4Zoom\fP : perform zoom in, zoom out, center, fit, refresh on figure. +.br +\f4Layer\fP : select types of layers displayed. +.br +\f4Map\fP : show cursor position in the entire figure. +.br +\f4Arrows\fP : show arrows for moving at the grid step. +.br +\f4Grid\fP : Set the X,Y step of the grid if displayed. + +.TP 10 +.B Tools +\f4Message\fP : display the last error messages + +.TP 10 +.B Setup +Save or load a user defined configuration of default displayed menus. + +.SH SPECIAL KEYS +.TP ++/- +Increase or decrease the time scale. + +.SH OPTIONS +.TP +\-l file_name +Load the pattern file file_name (without extention .pat) +.TP +\-xor +Two graphic cursor methods can be used, invert or xor. +.TP +\-force +this option force all graphical objects to be displayed. +.TP +\-install +Switch to a private color map. + +.SH ENVIRONMENT VARIABLES +.TP +.B MBK_WORK_LIB +indicates the path to the read directory for the session. +.TP +.B XPAT_PARAM_NAME (optionnal) +indicates the path to the parameter file used by Xpat. +.TP + +.SH SEE ALSO +mbk(1), MBK_WORK_LIB(1), PAT(5), asimut(1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/xpat/motif.m4 b/alliance/src/xpat/motif.m4 new file mode 100644 index 00000000..0e144693 --- /dev/null +++ b/alliance/src/xpat/motif.m4 @@ -0,0 +1,196 @@ +dnl +dnl +dnl AC_FIND_MOTIF : find OSF/Motif or LessTif, and provide variables +dnl to easily use them in a Makefile. +dnl +dnl Adapted from a macro by Andreas Zeller. +dnl +dnl The variables provided are : +dnl LINK_MOTIF (e.g. -L/usr/lesstif/lib -lXm) +dnl INCLUDE_MOTIF (e.g. -I/usr/lesstif/lib) +dnl MOTIF_LIBRARIES (e.g. /usr/lesstif/lib) +dnl MOTIF_INCLUDES (e.g. /usr/lesstif/include) +dnl +dnl The LINK_MOTIF and INCLUDE_MOTIF variables should be fit to put on +dnl your application's link line in your Makefile. +dnl +dnl Oleo CVS $Id: motif.m4,v 1.1 2002/03/29 17:41:27 ludo Exp $ +dnl +AC_DEFUN(AC_FIND_MOTIF, +[ + +AC_REQUIRE([AC_PATH_XTRA]) + +MOTIF_INCLUDES= +MOTIF_LIBRARIES= + +dnl AC_ARG_WITH(motif, +dnl [ --without-motif do not use Motif widgets]) +dnl Treat --without-motif like +dnl --without-motif-includes --without-motif-libraries. +dnl if test "$with_motif" = "no" +dnl then +dnl MOTIF_INCLUDES=none +dnl MOTIF_LIBRARIES=none +dnl fi + +AC_ARG_WITH(motif-includes, +[ --with-motif-includes=DIR Motif include files are in DIR], +MOTIF_INCLUDES="$withval") + +AC_ARG_WITH(motif-libraries, +[ --with-motif-libraries=DIR Motif libraries are in DIR], +MOTIF_LIBRARIES="$withval") + +AC_MSG_CHECKING(for Motif) + +# +# +# Search the include files. +# +if test "$MOTIF_INCLUDES" = ""; then +AC_CACHE_VAL(ac_cv_motif_includes, +[ +ac_motif_save_LIBS="$LIBS" +ac_motif_save_CFLAGS="$CFLAGS" +ac_motif_save_CPPFLAGS="$CPPFLAGS" +ac_motif_save_LDFLAGS="$LDFLAGS" +# +LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS" +CFLAGS="$X_CFLAGS $CFLAGS" +CPPFLAGS="$X_CFLAGS $CPPFLAGS" +LDFLAGS="$X_LIBS $LDFLAGS" +# +ac_cv_motif_includes="none" +AC_TRY_COMPILE([#include ],[int a;], +[ +# Xm/Xm.h is in the standard search path. +ac_cv_motif_includes= +], +[ +# Xm/Xm.h is not in the standard search path. +# Locate it and put its directory in `MOTIF_INCLUDES' +# +# /usr/include/Motif* are used on HP-UX (Motif). +# /usr/include/X11* are used on HP-UX (X and Athena). +# /usr/dt is used on Solaris (Motif). +# /usr/openwin is used on Solaris (X and Athena). +# Other directories are just guesses. +for dir in "$x_includes" "${prefix}/include" /usr/include /usr/local/include \ + /usr/include/Motif2.0 /usr/include/Motif1.2 /usr/include/Motif1.1 \ + /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 \ + /usr/dt/include /usr/openwin/include \ + /usr/dt/*/include /opt/*/include /usr/include/Motif* \ + "${prefix}"/*/include /usr/*/include /usr/local/*/include \ + "${prefix}"/include/* /usr/include/* /usr/local/include/*; do +if test -f "$dir/Xm/Xm.h"; then +ac_cv_motif_includes="$dir" +break +fi +done +]) +# +LIBS="$ac_motif_save_LIBS" +CFLAGS="$ac_motif_save_CFLAGS" +CPPFLAGS="$ac_motif_save_CPPFLAGS" +LDFLAGS="$ac_motif_save_LDFLAGS" +]) +MOTIF_INCLUDES="$ac_cv_motif_includes" +fi +# +# +# Now for the libraries. +# +if test "$MOTIF_LIBRARIES" = ""; then +AC_CACHE_VAL(ac_cv_motif_libraries, +[ +ac_motif_save_LIBS="$LIBS" +ac_motif_save_CFLAGS="$CFLAGS" +ac_motif_save_CPPFLAGS="$CPPFLAGS" +ac_motif_save_LDFLAGS="$LDFLAGS" +# +LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS" +CFLAGS="$X_CFLAGS $CFLAGS" +CPPFLAGS="$X_CFLAGS $CPPFLAGS" +LDFLAGS="$X_LIBS $LDFLAGS" +# +ac_cv_motif_libraries="none" +AC_TRY_LINK([#include ],[XtToolkitInitialize();], +[ +# libXm.a is in the standard search path. +ac_cv_motif_libraries= +], +[ +# libXm.a is not in the standard search path. +# Locate it and put its directory in `MOTIF_LIBRARIES' +# +# /usr/lib/Motif* are used on HP-UX (Motif). +# /usr/lib/X11* are used on HP-UX (X and Athena). +# /usr/dt is used on Solaris (Motif). +# /usr/lesstif is used on Linux (Lesstif). +# /usr/openwin is used on Solaris (X and Athena). +# Other directories are just guesses. +for dir in "$x_libraries" "${prefix}/lib" /usr/lib /usr/local/lib \ + /usr/lib/Motif2.0 /usr/lib/Motif1.2 /usr/lib/Motif1.1 \ + /usr/lib/X11R6 /usr/lib/X11R5 /usr/lib/X11R4 /usr/lib/X11 \ + /usr/dt/lib /usr/openwin/lib \ + /usr/dt/*/lib /opt/*/lib /usr/lib/Motif* \ + /usr/lesstif*/lib /usr/lib/Lesstif* \ + "${prefix}"/*/lib /usr/*/lib /usr/local/*/lib \ + "${prefix}"/lib/* /usr/lib/* /usr/local/lib/*; do +if test -d "$dir" && test "`ls $dir/libXm.* 2> /dev/null`" != ""; then +ac_cv_motif_libraries="$dir" +break +fi +done +]) +# +LIBS="$ac_motif_save_LIBS" +CFLAGS="$ac_motif_save_CFLAGS" +CPPFLAGS="$ac_motif_save_CPPFLAGS" +LDFLAGS="$ac_motif_save_LDFLAGS" +]) +# +MOTIF_LIBRARIES="$ac_cv_motif_libraries" +fi +# +# Provide an easier way to link +# +if test "$MOTIF_INCLUDES" = "none" -o "$MOTIF_LIBRARIES" = "none"; then + with_motif="no" +else + with_motif="yes" +fi + +if test "$with_motif" != "no"; then + if test "$MOTIF_LIBRARIES" = ""; then + LINK_MOTIF="-lXm" + MOTIF_LIBS="-lXm" + else + LINK_MOTIF="-L$MOTIF_LIBRARIES -lXm" + MOTIF_LIBS="-L$MOTIF_LIBRARIES -lXm" + fi + if test "$MOTIF_INCLUDES" != ""; then + INCLUDE_MOTIF="-I$MOTIF_INCLUDES" + MOTIF_CFLAGS="-I$MOTIF_INCLUDES" + fi + AC_DEFINE(HAVE_MOTIF) +else + with_motif="no" +fi +# +AC_SUBST(LINK_MOTIF) +AC_SUBST(INCLUDE_MOTIF) +# +# +# +motif_libraries_result="$MOTIF_LIBRARIES" +motif_includes_result="$MOTIF_INCLUDES" +test "$motif_libraries_result" = "" && motif_libraries_result="in default path" +test "$motif_includes_result" = "" && motif_includes_result="in default path" +test "$motif_libraries_result" = "none" && motif_libraries_result="(none)" +test "$motif_includes_result" = "none" && motif_includes_result="(none)" +AC_MSG_RESULT( + [libraries $motif_libraries_result, headers $motif_includes_result]) +])dnl + diff --git a/alliance/src/xpat/src/LIP6bw.h b/alliance/src/xpat/src/LIP6bw.h new file mode 100644 index 00000000..cfecd995 --- /dev/null +++ b/alliance/src/xpat/src/LIP6bw.h @@ -0,0 +1,293 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +#define LIP6bw_width 164 +#define LIP6bw_height 150 +static char LIP6bw_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x70, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, + 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x70, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0xfc, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x01, + 0xe0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x7f, 0x00, 0xc0, 0xff, 0x7f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x3f, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xe0, + 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xe0, 0x01, 0xff, 0xff, + 0x01, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x01, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, + 0x01, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, + 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x03, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0xf0, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, + 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0xf9, 0xff, 0xff, + 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0x20, 0xc0, 0xff, 0xff, 0x07, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0x00, 0x80, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0x00, + 0x00, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, + 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x03, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0xe0, 0x00, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xe0, + 0x01, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, + 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x03, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, + 0x01, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, + 0x01, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x01, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0xe0, 0x01, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x3f, 0xc0, + 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x3f, 0x00, 0x80, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x7f, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x03, + 0xf0, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x1f, 0xff, 0xff, 0x1f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; diff --git a/alliance/src/xpat/src/Makefile.am b/alliance/src/xpat/src/Makefile.am new file mode 100644 index 00000000..f2eda189 --- /dev/null +++ b/alliance/src/xpat/src/Makefile.am @@ -0,0 +1,35 @@ +## Process this file with automake to produce Makefile.in + +bin_PROGRAMS = xpat +CFLAGS = @CFLAGS@ @X_CFLAGS@ -DXPAT_VERSION=\"@XPAT_VERSION@\" \ + -DXPAT_TOOL_NAME=\"xpat\" \ + -DXPAT_DEFAULT_PARAM_NAME=\"${ALLIANCE_TOP}/etc/xpat.par\" \ + -DXMS_FILE_NAME=\".xpat.cfg\" + +xpat_LDADD = @LIBS@ @X_LIBS@ @LINK_MOTIF@ \ + -lPpt -lPhl -lPat -lAut -lMut + +INCLUDES = @INCLUDES@ @INCLUDE_MOTIF@ + +xpat_SOURCES = \ +LIP6bw.h XME_dialog.c XME_dialog.h XME_edit.c XME_edit.h \ +XME.h XME_menu.c XME_menu.h XME_message.c XME_message.h XME_panel.c \ +XME_panel.h XME_search.c XME_search.h XME_select.c XME_select.h XMF_dialog.c \ +XMF_dialog.h XMF_file.c XMF_file.h XMF.h XMF_menu.c XMF_menu.h \ +XMF_panel.c XMF_panel.h XMH.h XMH_help.c XMH_help.h XMH_menu.c \ +XMH_menu.h XMH_panel.c XMH_panel.h XMS_dialog.c XMS_dialog.h XMS.h \ +XMS_menu.c XMS_menu.h XMS_panel.c XMS_panel.h XMS_setup.c XMS_setup.h \ +XMT_dialog.c XMT_dialog.h XMT.h XMT_menu.c XMT_menu.h XMT_message.c \ +XMT_message.h XMT_panel.c XMT_panel.h XMT_tools.c XMT_tools.h XMV_dialog.c \ +XMV_dialog.h XMV.h XMV_map.c XMV_map.h XMV_menu.c XMV_menu.h XMV_message.c \ +XMV_message.h XMV_panel.c XMV_panel.h XMV_view.c XMV_view.h XMX_color.c \ +XMX_color.h XMX_cursor.c XMX_cursor.h XMX_dialog.c XMX_dialog.h XMX_event.c \ +XMX_event.h XMX_graphic.c XMX_graphic.h XMX_grid.c XMX_grid.h XMX.h XMX_icon.c \ +XMX_icon.h XMX_menu.c XMX_menu.h XMX_message.c XMX_message.h XMX_motif.c \ +XMX_motif.h XMX_panel.c XMX_panel.h XMX_view.c XMX_view.h xpat.c \ +xpat.h XPT_bound.c XPT_bound.h XPT_error.c XPT_error.h XPT.h \ +XPT_object.c XPT_object.h XPT_pat.c XPT_pat.h XPT_place.c XPT_place.h \ +XPT_select.c XPT_select.h XSB_error.c XSB_error.h XSB.h XSB_parse.c \ +XSB_parse.h XSB_share.c XSB_share.h XTB_cursor.c XTB_cursor.h XTB_dialog.c \ +XTB_dialog.h XTB.h XTB_icon.c XTB_icon.h XTB_menu.c XTB_menu.h \ +XTB_panel.c XTB_panel.h XTB_pixmap.c XTB_pixmap.h diff --git a/alliance/src/xpat/src/XME.h b/alliance/src/xpat/src/XME.h new file mode 100644 index 00000000..af22a544 --- /dev/null +++ b/alliance/src/xpat/src/XME.h @@ -0,0 +1,88 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : XME.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_XME +# define XPAT_XME + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XpatMenuItem XpatEditMenu[]; + + extern XpatPanelItem XpatEditSearchViewPanel; + extern XpatPanelItem XpatEditSelectPanel; + extern XpatPanelItem XpatEditIdentifyPanel; + + extern int XpatEditSearchViewDefaultValues[ 5 ]; + extern int XpatEditIdentifyDefaultValues[ 5 ]; + extern int XpatEditSelectDefaultValues[ 5 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatBuildEditDialog(); + + extern void XpatEditSearch(); + extern void XpatEditIdentify(); + extern void XpatEditConnected(); + extern void XpatEditAddCursor(); + extern void XpatEditDelCursor(); + + extern void XpatEditUnselectAll(); + + extern void XpatDisplayEditIdentify(); + +# endif diff --git a/alliance/src/xpat/src/XME_dialog.c b/alliance/src/xpat/src/XME_dialog.c new file mode 100644 index 00000000..4b862066 --- /dev/null +++ b/alliance/src/xpat/src/XME_dialog.c @@ -0,0 +1,184 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XPT.h" +# include "XMX.h" +# include "XTB.h" +# include "XME.h" + +# include "XME_dialog.h" +# include "XME_edit.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Search Dialog | +| | +\------------------------------------------------------------*/ + + XpatDialogItem XpatSearchObjectDialog = + + { + "Object name", + XPAT_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackSearchObjectOk, + (XtPointer)NULL, + (void *)CallbackSearchObjectCancel, + (XtPointer)NULL + }; + + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatBuildEditDialog | +| | +\------------------------------------------------------------*/ + +void XpatBuildEditDialog() + +{ + autbegin(); + + XpatBuildDialog( XpatMainWindow, &XpatSearchObjectDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Search Callback | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback For Object | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackSearchObjectOk | +| | +\------------------------------------------------------------*/ + +void CallbackSearchObjectOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *NameSet; + + autbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &NameSet ); + + XtUnmanageChild( XpatSearchObjectDialog.WIDGET ); + + XpatExitDialog(); + + NameSet = XpatPostTreatString( NameSet ); + + if ( NameSet != (char *)NULL ) + { + NameSet = namealloc( NameSet ); + + XpatEditSearchObject( NameSet ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSearchObjectCancel | +| | +\------------------------------------------------------------*/ + +void CallbackSearchObjectCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + autbegin(); + + XtUnmanageChild( XpatSearchObjectDialog.WIDGET ); + + XpatExitDialog(); + + autend(); +} diff --git a/alliance/src/xpat/src/XME_dialog.h b/alliance/src/xpat/src/XME_dialog.h new file mode 100644 index 00000000..09749558 --- /dev/null +++ b/alliance/src/xpat/src/XME_dialog.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_EDIT_DIALOG +# define XPAT_EDIT_DIALOG + + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XpatDialogItem XpatSearchObjectDialog; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackSearchObjectOk(); + extern void CallbackSearchObjectCancel(); + +# endif diff --git a/alliance/src/xpat/src/XME_edit.c b/alliance/src/xpat/src/XME_edit.c new file mode 100644 index 00000000..c9024508 --- /dev/null +++ b/alliance/src/xpat/src/XME_edit.c @@ -0,0 +1,363 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Edit.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XPT.h" +# include "XME.h" + +# include "XME_edit.h" +# include "XME_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Identify Buffer | +| | +\------------------------------------------------------------*/ + + static char XpatIdentifyMessage[ XPAT_IDENTIFY_MESSAGE_SIZE ]; + static char XpatIdentifyBuffer [ XPAT_IDENTIFY_BUFFER_SIZE ]; + static char XpatIdentifyLocout [ XPAT_IDENTIFY_LOCOUT_SIZE ]; + + static char *XpatScanIdentify; + static long XpatIdentifyLength; + + extern char *XpatTimeUnit[ PAT_TU__MS + 1 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatAddIdentify | +| | +\------------------------------------------------------------*/ + +short XpatAddIdentify( Obj, X1, Y1 ) + + xpatobj_list *Obj; + long X1; + long Y1; +{ + char **NameArray; + char **ModeArray; + char *Unit; + long X; + long Y; + long X2; + long NumberIO; + long Length; + long TimeDelta; + + autbegin(); + + XpatIdentifyBuffer[0] = '\0'; + + X1 /= XPAT_PATTERN_STEP_X; + + X = Obj->X / ( XPAT_UNIT * XPAT_PATTERN_STEP_X ); + Y = Obj->Y / ( XPAT_UNIT * XPAT_PATTERN_STEP_Y ); + X2 = ( Obj->X + Obj->DX ) / ( XPAT_UNIT * XPAT_PATTERN_STEP_X ); + + NameArray = XpatFigurePat->IO_NAME_ARRAY; + ModeArray = XpatFigurePat->IO_MODE_ARRAY; + NumberIO = XpatFigurePat->IO_NUMBER; + + if ( ( Y < NumberIO ) && + ( Y >= 0 ) ) + { + Unit = XpatTimeUnit[ XpatFigurePat->TIME_UNIT ]; + TimeDelta = XpatFigurePat->TIME_DELTA; + + sprintf( XpatIdentifyBuffer, " IO NAME : %s\n IO MODE: %s\n PREV CHANGE : %d %s\n CURRENT TIME : %d %s\n NEXT CHANGE : %d %s\n VALUE : %s\n\n", + NameArray[ Y ], ModeArray[ Y ], + X * TimeDelta, Unit, + X1 * TimeDelta, Unit, + X2 * TimeDelta, Unit, Obj->NAME ); + } + + Length = strlen( XpatIdentifyBuffer ); + + if ( ( XpatIdentifyLength + Length ) < ( XPAT_IDENTIFY_MESSAGE_SIZE - 1 ) ) + { + strcpy( XpatScanIdentify, XpatIdentifyBuffer ); + + XpatScanIdentify += Length; + XpatIdentifyLength += Length; + + autend(); + return( XPAT_TRUE ); + } + + autend(); + return( XPAT_FALSE ); +} + +/*------------------------------------------------------------\ +| | +| XpatEditIdentify | +| | +\------------------------------------------------------------*/ + +void XpatEditIdentify( X1, Y1 ) + + long X1; + long Y1; +{ + xpatselect_list *Select; + xpatobj_list *Obj; + + strcpy( XpatIdentifyMessage, "No element found !" ); + + XpatScanIdentify = XpatIdentifyMessage; + XpatIdentifyLength = 0; + + XpatEditSelectPoint( X1, Y1 ); + + for ( Select = XpatHeadSelect; + Select != (xpatselect_list *)NULL; + Select = Select->NEXT ) + { + if ( ( ! IsXpatCursor( Select->OBJECT) ) && + ( ! IsXpatIO( Select->OBJECT ) ) ) + { + if ( ! XpatAddIdentify( Select->OBJECT, X1, Y1 ) ) break; + } + } + + XpatDelSelect(); + + XpatDisplayEditIdentify( XpatIdentifyMessage ); + XpatEnterPanel( &XpatEditIdentifyPanel ); +} + +/*------------------------------------------------------------\ +| | +| XpatEditConnected | +| | +\------------------------------------------------------------*/ + +void XpatEditConnected( X1, Y1 ) + + long X1; + long Y1; +{ + xpatselect_list *Select; + xpatselect_list **PrevSelect; + xpatobj_list *Obj; + + if ( XpatHeadConnect != (xpatselect_list *)NULL ) + { + XpatDelConnect(); + XpatZoomRefresh(); + } + + XpatEditSelectPoint( X1, Y1 ); + + XpatDisplaySelectList( (char *)NULL ); + + for ( Select = XpatHeadSelect; + Select != (xpatselect_list *)NULL; + Select = Select->NEXT ) + { + XpatAddSelectList( Select->OBJECT ); + } + + if ( XpatHeadSelect == (xpatselect_list *)NULL ) + { + XpatWarningMessage( XpatMainWindow, "No element found !" ); + } + else + { + if ( XpatHeadSelect->NEXT != (xpatselect_list *)NULL ) + { + XpatEnterPanel( &XpatEditSelectPanel ); + XpatLimitedLoop( XpatEditSelectPanel.PANEL ); + } + else + { + XpatAcceptObject( XpatHeadSelect->OBJECT ); + XpatDisplayObject( XpatHeadSelect->OBJECT ); + } + } + + XpatPurgeSelect(); + + for ( Select = XpatHeadSelect; + Select != (xpatselect_list *)NULL; + Select = Select->NEXT ) + { + XpatAddConnect( Select->OBJECT ); + } + + if ( XpatHeadSelect != (xpatselect_list *)NULL ) + { + if ( XpatHeadSelect->NEXT == (xpatselect_list *)NULL ) + { + Obj = XpatHeadSelect->OBJECT; + XpatDelSelect(); + XpatDisplayObject( Obj ); + } + else + { + XpatDelSelect(); + XpatZoomRefresh(); + } + } +} + +/*------------------------------------------------------------\ +| | +| XpatEditAddCursor | +| | +\------------------------------------------------------------*/ + +void XpatEditAddCursor( X1, Y1 ) + + long X1; + long Y1; +{ + xpatobj_list *Obj; + + if ( XpatHeadConnect != (xpatselect_list *)NULL ) + { + XpatDelConnect(); + XpatZoomRefresh(); + } + + if ( XpatFigure == (xpatfig_list *)NULL ) + { + XpatWarningMessage( XpatMainWindow, "No current figure !" ); + } + else + { + Obj = XpatAddCursor( X1 ); + + if ( Obj != (xpatobj_list *)0 ) + { + XpatZoomRefresh(); + } + } +} + +/*------------------------------------------------------------\ +| | +| XpatEditDelCursor | +| | +\------------------------------------------------------------*/ + +void XpatEditDelCursor( X1, Y1 ) + + long X1; + long Y1; +{ + xpatselect_list *Select; + xpatselect_list **PrevSelect; + xpatobj_list *Obj; + + if ( XpatHeadConnect != (xpatselect_list *)NULL ) + { + XpatDelConnect(); + XpatZoomRefresh(); + } + + XpatEditSelectPoint( X1, Y1 ); + + for ( Select = XpatHeadSelect; + Select != (xpatselect_list *)NULL; + Select = Select->NEXT ) + { + if ( IsXpatCursor( Select->OBJECT ) ) + { + XpatAcceptObject( Select->OBJECT ); + } + } + + XpatPurgeSelect(); + + if ( XpatHeadSelect == (xpatselect_list *)NULL ) + { + XpatWarningMessage( XpatMainWindow, "No element found !" ); + } + + + for ( Select = XpatHeadSelect; + Select != (xpatselect_list *)NULL; + Select = Select->NEXT ) + { + XpatDelCursor( Select->OBJECT ); + } + + if ( XpatHeadSelect != (xpatselect_list *)NULL ) + { + XpatDelSelect(); + XpatZoomRefresh(); + } +} diff --git a/alliance/src/xpat/src/XME_edit.h b/alliance/src/xpat/src/XME_edit.h new file mode 100644 index 00000000..da881c71 --- /dev/null +++ b/alliance/src/xpat/src/XME_edit.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Edit.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_EDIT +# define XPAT_EDIT + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XPAT_IDENTIFY_BUFFER_SIZE 64000 +# define XPAT_IDENTIFY_LOCOUT_SIZE 64000 +# define XPAT_IDENTIFY_MESSAGE_SIZE 64000 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xpat/src/XME_menu.c b/alliance/src/xpat/src/XME_menu.c new file mode 100644 index 00000000..efd0206c --- /dev/null +++ b/alliance/src/xpat/src/XME_menu.c @@ -0,0 +1,264 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XTB.h" +# include "XPT.h" +# include "XMV.h" +# include "XME.h" +# include "XMX.h" + +# include "XME_menu.h" +# include "XME_dialog.h" +# include "XME_edit.h" +# include "XME_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XpatMenuItem XpatEditMenu[] = + + { + { + "Identify", + 'I', + "CtrlI", + "Ctrl I", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditIdentify, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XpatMenuItem *)NULL + } + , + { + "Connected", + 'C', + "CtrlC", + "Ctrl C", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditConnected, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XpatMenuItem *)NULL + } + , + { + "Search ", + 'S', + "CtrlS", + "Ctrl S", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditSearch, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XpatMenuItem *)NULL + } + , + { + "Add Cursor ", + 'A', + "CtrlA", + "Ctrl A", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditAddCursor, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XpatMenuItem *)NULL + } + , + { + "Delete Cursor", + 'D', + "CtrlD", + "Ctrl D", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditDelCursor, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XpatMenuItem *)NULL + } + , + NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackEditDelCursor | +| | +\------------------------------------------------------------*/ + +void CallbackEditDelCursor( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatChangeEditMode( XPAT_EDIT_DEL_CURSOR, + XpatPromptEditDelCursor ); + autend(); +} +/*------------------------------------------------------------\ +| | +| CallbackEditAddCursor | +| | +\------------------------------------------------------------*/ + +void CallbackEditAddCursor( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatChangeEditMode( XPAT_EDIT_ADD_CURSOR, + XpatPromptEditAddCursor ); + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditIdentify | +| | +\------------------------------------------------------------*/ + +void CallbackEditIdentify( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatChangeEditMode( XPAT_EDIT_IDENTIFY, + XpatPromptEditIdentify ); + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditConnected | +| | +\------------------------------------------------------------*/ + +void CallbackEditConnected( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatChangeEditMode( XPAT_EDIT_CONNECTED, + XpatPromptEditConnected ); + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditSearch | +| | +\------------------------------------------------------------*/ + +void CallbackEditSearch( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatEnterDialog( &XpatSearchObjectDialog ); + + autend(); +} diff --git a/alliance/src/xpat/src/XME_menu.h b/alliance/src/xpat/src/XME_menu.h new file mode 100644 index 00000000..6a9ec9d2 --- /dev/null +++ b/alliance/src/xpat/src/XME_menu.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_MENU +# define XPAT_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackEditIdentify(); + extern void CallbackEditConnected(); + extern void CallbackEditSearch(); + extern void CallbackEditAddCursor(); + extern void CallbackEditDelCursor(); + +# endif diff --git a/alliance/src/xpat/src/XME_message.c b/alliance/src/xpat/src/XME_message.c new file mode 100644 index 00000000..dcf70c2c --- /dev/null +++ b/alliance/src/xpat/src/XME_message.c @@ -0,0 +1,151 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Message.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XPT.h" +# include "XMX.h" +# include "XTB.h" +# include "XME.h" +# include "XME_edit.h" +# include "XME_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatPromptEditIdentify | +| | +\------------------------------------------------------------*/ + +void XpatPromptEditIdentify() + +{ + autbegin(); + + XpatDisplayMessage( XPAT_MESSAGE_MODE , "Identify" ); + XpatDisplayMessage( XPAT_MESSAGE_INFO , "Select object" ); + XpatDisplayMessage( XPAT_MESSAGE_PROMPT, "Enter select point" ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatPromptEditConnected | +| | +\------------------------------------------------------------*/ + +void XpatPromptEditConnected() + +{ + autbegin(); + + XpatDisplayMessage( XPAT_MESSAGE_MODE , "Connected" ); + XpatDisplayMessage( XPAT_MESSAGE_INFO , "Select object" ); + XpatDisplayMessage( XPAT_MESSAGE_PROMPT, "Enter select point" ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatPromptEditAddCursor | +| | +\------------------------------------------------------------*/ + +void XpatPromptEditAddCursor() + +{ + autbegin(); + + XpatDisplayMessage( XPAT_MESSAGE_MODE , "Add cursor" ); + XpatDisplayMessage( XPAT_MESSAGE_INFO , "Select time" ); + XpatDisplayMessage( XPAT_MESSAGE_PROMPT, "Enter select point" ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatPromptEditDelCursor | +| | +\------------------------------------------------------------*/ + +void XpatPromptEditDelCursor() + +{ + autbegin(); + + XpatDisplayMessage( XPAT_MESSAGE_MODE , "Delete cursor" ); + XpatDisplayMessage( XPAT_MESSAGE_INFO , "Select cursor" ); + XpatDisplayMessage( XPAT_MESSAGE_PROMPT, "Enter select point" ); + + autend(); +} diff --git a/alliance/src/xpat/src/XME_message.h b/alliance/src/xpat/src/XME_message.h new file mode 100644 index 00000000..a8b3e966 --- /dev/null +++ b/alliance/src/xpat/src/XME_message.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Message.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_MESSAGE +# define XPAT_MESSAGE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatPromptEditIdentify(); + extern void XpatPromptEditConnected(); + extern void XpatPromptEditAddCursor(); + extern void XpatPromptEditDelCursor(); + +# endif diff --git a/alliance/src/xpat/src/XME_panel.c b/alliance/src/xpat/src/XME_panel.c new file mode 100644 index 00000000..775786be --- /dev/null +++ b/alliance/src/xpat/src/XME_panel.c @@ -0,0 +1,495 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XPT.h" +# include "XMX.h" +# include "XTB.h" +# include "XME.h" + +# include "XME_panel.h" +# include "XME_message.h" +# include "XME_dialog.h" +# include "XME_edit.h" +# include "XME_search.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Search View Panel | +| | +\------------------------------------------------------------*/ + + static char *XpatEditSearchViewButtonName[] = + + { + "Continue", + "Abort" + }; + + static XpatPanelButtonItem XpatEditSearchViewButton[] = + + { + { + &XpatEditSearchViewButtonName[0], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackEditSearchViewContinue, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatEditSearchViewButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 1, + 1, 1, + CallbackEditSearchViewAbort, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XpatPanelItem XpatEditSearchViewPanel = + + { + "View search", + 1, + 0, + XPAT_EDIT_VIEW_SEARCH_X, + XPAT_EDIT_VIEW_SEARCH_Y, + 100, + 50, + 1, + 2, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XpatEditSearchViewButton + }; + + int XpatEditSearchViewDefaultValues[ 5 ] = + + { + XPAT_EDIT_VIEW_SEARCH_X, + XPAT_EDIT_VIEW_SEARCH_Y, + 100, 50, 0 + }; + +/*------------------------------------------------------------\ +| | +| Panel Identify | +| | +\------------------------------------------------------------*/ + + static char *XpatPanelIdentifyButtonName[] = + + { + "Text", + "Close" + }; + + XpatPanelButtonItem XpatEditIdentifyButton[] = + + { + { + &XpatPanelIdentifyButtonName[0], + "Nothing", NULL, 0, 0, + NULL, + NULL, + 0, 0, + 8, 9, + NULL, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatPanelIdentifyButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 3, 9, + 2, 1, + CallbackEditCloseIdentify, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XpatPanelItem XpatEditIdentifyPanel = + + { + "Identify", + 1, + 0, + XPAT_EDIT_IDENTIFY_X, + XPAT_EDIT_IDENTIFY_Y, + 360, + 250, + 8, + 10, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XpatEditIdentifyButton + }; + + int XpatEditIdentifyDefaultValues[ 5 ] = + + { + XPAT_EDIT_IDENTIFY_X, + XPAT_EDIT_IDENTIFY_Y, + 360, 250, 0 + }; + +/*------------------------------------------------------------\ +| | +| Select Panel | +| | +\------------------------------------------------------------*/ + + static char *XpatEditSelectButtonName[] = + + { + "Select", + "Accept", + "Cancel" + }; + + XpatPanelButtonItem XpatEditSelectButton[] = + + { + { + &XpatEditSelectButtonName[0], + "List", + "List", 0, 0, + NULL, + NULL, + 0, 0, + 8, 9, + CallbackEditSelectList, + (XtPointer)1, + (Widget)NULL + } + , + { + &XpatEditSelectButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 1, 9, + 2, 1, + CallbackEditSelectAccept, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatEditSelectButtonName[2], + NULL, NULL, 0, 0, + NULL, + NULL, + 5, 9, + 2, 1, + CallbackEditSelectCancel, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XpatPanelItem XpatEditSelectPanel = + + { + "Select", + 1, + 0, + XPAT_EDIT_SELECT_X, + XPAT_EDIT_SELECT_Y, + 360, + 250, + 8, + 10, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XpatEditSelectButton + }; + + int XpatEditSelectDefaultValues[ 5 ] = + + { + XPAT_EDIT_SELECT_X, + XPAT_EDIT_SELECT_Y, + 360, 250, 0 + }; + +/*------------------------------------------------------------\ +| | +| Callback For View Search | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackEditSearchViewContinue | +| | +\------------------------------------------------------------*/ + +void CallbackEditSearchViewContinue( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditSearchViewAbort | +| | +\------------------------------------------------------------*/ + +void CallbackEditSearchViewAbort( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatSearchAbort = XPAT_TRUE; + + XpatExitDialog(); + + autbegin(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Identify | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackEditCloseIdentify | +| | +\------------------------------------------------------------*/ + +void CallbackEditCloseIdentify( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatExitPanel( &XpatEditIdentifyPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatDisplayEditIdentify | +| | +\------------------------------------------------------------*/ + +void XpatDisplayEditIdentify( Message ) + + char *Message; +{ + autbegin(); + + XmTextSetString( XpatEditIdentifyButton[0].BUTTON, Message ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Select | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackEditSelectList | +| | +\------------------------------------------------------------*/ + +void CallbackEditSelectList( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmListCallbackStruct *CallData; +{ + autbegin(); + + if ( ClientData == (caddr_t)NULL ) + { + CallbackEditSelectAccept( MyWidget, (caddr_t)NULL, (caddr_t)NULL ); + } + else + { + XpatEditSelectObject( CallData->item_position - 1 ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditSelectAccept | +| | +\------------------------------------------------------------*/ + +void CallbackEditSelectAccept( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatExitPanel( &XpatEditSelectPanel ); + + XpatExitDialog(); + + XpatEditSelectAccept(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditSelectCancel | +| | +\------------------------------------------------------------*/ + +void CallbackEditSelectCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatExitPanel( &XpatEditSelectPanel ); + + XpatExitDialog(); + + XpatEditSelectCancel(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatDisplaySelectList | +| | +\------------------------------------------------------------*/ + +void XpatDisplaySelectList( Message ) + + char *Message; +{ + XmString Label; + + autbegin(); + + if ( Message == (char *)NULL ) + { + XmListDeleteAllItems( XpatEditSelectButton[ 0 ].BUTTON ); + } + else + { + Label = XmStringCreateSimple( Message ); + XmListAddItem( XpatEditSelectButton[ 0 ].BUTTON , Label , NULL ); + XmStringFree( Label ); + } + + autend(); +} diff --git a/alliance/src/xpat/src/XME_panel.h b/alliance/src/xpat/src/XME_panel.h new file mode 100644 index 00000000..eb5c9e69 --- /dev/null +++ b/alliance/src/xpat/src/XME_panel.h @@ -0,0 +1,90 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_EDIT_PANEL +# define XPAT_EDIT_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XPAT_EDIT_VIEW_SEARCH_X 790 +# define XPAT_EDIT_VIEW_SEARCH_Y 450 + +# define XPAT_EDIT_IDENTIFY_X 330 +# define XPAT_EDIT_IDENTIFY_Y 280 + +# define XPAT_EDIT_SELECT_X 330 +# define XPAT_EDIT_SELECT_Y 280 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackEditSearchViewContinue(); + extern void CallbackEditSearchViewAbort(); + + extern void CallbackEditCloseIdentify(); + + extern void CallbackEditSelectList(); + extern void CallbackEditSelectAccept(); + extern void CallbackEditSelectCancel(); + + extern void XpatDisplaySelectList(); + +# endif diff --git a/alliance/src/xpat/src/XME_search.c b/alliance/src/xpat/src/XME_search.c new file mode 100644 index 00000000..65b9161a --- /dev/null +++ b/alliance/src/xpat/src/XME_search.c @@ -0,0 +1,230 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Search.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XPT.h" +# include "XME.h" + +# include "XME_search.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + char XpatSearchAbort; + int XpatSearchNumber; + char *XpatSearchString; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatEditInitializeSearch | +| | +\------------------------------------------------------------*/ + +void XpatEditInitializeSearch( Name ) + + char *Name; +{ + char *Star; + + autbegin(); + + Star = strrchr( Name, '*' ); + + if ( Star != (char *)NULL ) + { + XpatSearchNumber = (int)(Star - Name); + } + else + { + XpatSearchNumber = 0; + } + + XpatSearchString = Name; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatEditSearchCompare | +| | +\------------------------------------------------------------*/ + +int XpatEditSearchCompare( Name ) + + char *Name; +{ + if ( Name != (char *)NULL ) + { + if ( XpatSearchNumber ) + { + return( ! strncmp( XpatSearchString, Name, XpatSearchNumber ) ); + } + else + { + return( Name == XpatSearchString ); + } + } + + return( 0 ); +} + +/*------------------------------------------------------------\ +| | +| XpatEditSearchObject | +| | +\------------------------------------------------------------*/ + +void XpatEditSearchObject( ObjectName ) + + char *ObjectName; +{ + xpatobj_list *Obj; + xpatselect_list *Search; + short Layer; + long X1; + long Y1; + + autbegin(); + + if ( XpatHeadConnect != (xpatselect_list *)NULL ) + { + XpatDelConnect(); + XpatZoomRefresh(); + } + + XpatEditInitializeSearch( ObjectName ); + + for ( Layer = 0; Layer < XPAT_MAX_LAYER; Layer++ ) + { + if ( XPAT_ACTIVE_LAYER_TABLE[ Layer ] == 0 ) continue; + + for ( Obj = XpatFigure->OBJECT[ Layer ]; + Obj != (xpatobj_list *)NULL; + Obj = Obj->NEXT ) + { + if ( ( ! IsXpatSelect( Obj ) ) && + ( ( IsXpatVector( Obj ) ) || + ( IsXpatIO ( Obj ) ) ) ) + { + if ( XpatEditSearchCompare( Obj->NAME ) ) + { + XpatAddSelect( Obj ); + } + } + } + } + + for ( Search = XpatHeadSelect; + Search != (xpatselect_list *)NULL; + Search = Search->NEXT ) + { + XpatUnselectObject( Search->OBJECT ); + } + + if ( XpatHeadSelect == (xpatselect_list *)NULL ) + { + XpatWarningMessage( XpatMainWindow, "No object found !" ); + } + else + { + XpatSearchAbort = XPAT_FALSE; + + for ( Search = XpatHeadSelect; + Search != (xpatselect_list *)NULL; + Search = Search->NEXT ) + { + Obj = Search->OBJECT; + + XpatAddConnect( Obj ); + + if ( XpatSearchAbort ) continue; + + X1 = ( Obj->X + ( Obj->DX >> 1 ) ) / XPAT_UNIT; + Y1 = ( Obj->Y + ( Obj->DY >> 1 ) ) / XPAT_UNIT; + + XpatZoomCenter( X1, Y1 ); + + if ( Search->NEXT != (xpatselect_list *)NULL ) + { + XpatEnterPanel( &XpatEditSearchViewPanel ); + XpatLimitedLoop( XpatEditSearchViewPanel.PANEL ); + } + } + + XpatDelSelect(); + + XpatExitPanel( &XpatEditSearchViewPanel ); + } + + autend(); +} diff --git a/alliance/src/xpat/src/XME_search.h b/alliance/src/xpat/src/XME_search.h new file mode 100644 index 00000000..957a9dde --- /dev/null +++ b/alliance/src/xpat/src/XME_search.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Search.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_SEARCH +# define XPAT_SEARCH + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char XpatSearchAbort; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatEditSearchObject(); + +# endif diff --git a/alliance/src/xpat/src/XME_select.c b/alliance/src/xpat/src/XME_select.c new file mode 100644 index 00000000..01aca03d --- /dev/null +++ b/alliance/src/xpat/src/XME_select.c @@ -0,0 +1,406 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Edit.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XPT.h" +# include "XME.h" + +# include "XME_select.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Select Buffer | +| | +\------------------------------------------------------------*/ + + static char XpatSelectBuffer [ XPAT_SELECT_BUFFER_SIZE ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatAddSelectList | +| | +\------------------------------------------------------------*/ + +void XpatAddSelectList( Obj ) + + xpatobj_list *Obj; +{ + autbegin(); + + XpatSelectBuffer[0] = '\0'; + + XpatDisplaySelectList( XpatSelectBuffer ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatEditSelectObject | +| | +\------------------------------------------------------------*/ + +void XpatEditSelectObject( Number ) + + int Number; +{ + xpatselect_list *Select; + int Counter; + + autbegin(); + + Select = XpatHeadSelect; + + for ( Counter = 0; Counter < Number; Counter++ ) + { + Select = Select->NEXT; + } + + if ( IsXpatAccept( Select->OBJECT ) ) + { + XpatRejectObject( Select->OBJECT ); + } + else + { + XpatAcceptObject( Select->OBJECT ); + } + + XpatDisplayObject( Select->OBJECT ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatEditSelectAccept | +| | +\------------------------------------------------------------*/ + +void XpatEditSelectAccept() +{ + autbegin(); + + XpatPurgeSelect(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatEditSelectCancel | +| | +\------------------------------------------------------------*/ + +void XpatEditSelectCancel() +{ + autbegin(); + + XpatEditUnselectAll(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Select Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatEditUnselectAll | +| | +\------------------------------------------------------------*/ + +void XpatEditUnselectAll() +{ + xpatobj_list *Obj; + + autbegin(); + + if ( XpatHeadSelect != (xpatselect_list *)NULL ) + { + if ( XpatHeadSelect->NEXT == (xpatselect_list *)NULL ) + { + Obj = XpatHeadSelect->OBJECT; + XpatDelSelect(); + XpatDisplayObject( Obj ); + } + else + { + XpatDelSelect(); + XpatZoomRefresh(); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatEditObjectNearPoint | +| | +\------------------------------------------------------------*/ + +char XpatEditObjectNearPoint( Obj, X1, Y1 ) + + xpatobj_list *Obj; + long X1; + long Y1; +{ + short Type; + long X1r; + long Y1r; + long X2r; + long Y2r; + long Delta; + float VectorX; + float VectorY; + float LineX; + float LineY; + float Norm; + float Distance; + float MinDistance; + + Type = GetXpatObjectType( Obj ); + + if ( ( Type == XPAT_OBJECT_LINE ) || + ( Type == XPAT_OBJECT_ARROW ) ) + { + if ( IsXpatLineLeft( Obj ) ) + { + X1r = Obj->X + Obj->DX; + X2r = Obj->X; + } + else + { + X1r = Obj->X; + X2r = Obj->X + Obj->DX; + } + + if ( IsXpatLineDown( Obj ) ) + { + Y1r = Obj->Y + Obj->DY; + Y2r = Obj->Y; + } + else + { + Y1r = Obj->Y; + Y2r = Obj->Y + Obj->DY; + } + } + else + { + X1r = Obj->X; + X2r = Obj->X + Obj->DX; + Y1r = Obj->Y; + Y2r = Obj->Y + Obj->DY; + } + + if ( Obj->DY == 0 ) + { + if ( ( X1 < X1r ) || + ( X1 > X2r ) ) + { + return( XPAT_FALSE ); + } + + Delta = Y1 - Y1r; + if ( Delta < 0 ) Delta = - Delta; + + if ( Delta < (XPAT_PATTERN_STEP_Y >> 1) * XPAT_UNIT ) + { + return( XPAT_TRUE ); + } + + return( XPAT_FALSE ); + } + else + if ( Obj->DX == 0 ) + { + if ( ( Y1 < Y1r ) || + ( Y1 > Y2r ) ) + { + return( XPAT_FALSE ); + } + + Delta = X1 - X1r; + if ( Delta < 0 ) Delta = - Delta; + + if ( Delta < (XPAT_PATTERN_STEP_Y >> 1) * XPAT_UNIT ) + { + return( XPAT_TRUE ); + } + + return( XPAT_FALSE ); + } + else + if ( ( X1r > X1 ) || + ( Y1r > Y1 ) || + ( X2r < X1 ) || + ( Y2r < Y1 ) ) + { + return( XPAT_FALSE ); + } + + if ( ( Type == XPAT_OBJECT_LINE ) || + ( Type == XPAT_OBJECT_ARROW ) ) + { + if ( ( Obj->DX == 0 ) && + ( Obj->DY == 0 ) ) + { + if ( ( Obj->X == X1 ) && + ( Obj->Y == Y1 ) ) + { + return( XPAT_TRUE ); + } + } + else + { + LineX = (float)( X2r - X1r ); + LineY = (float)( Y2r - Y1r ); + Norm = sqrt( ( LineX * LineX ) + ( LineY * LineY ) ); + LineX /= Norm; + LineY /= Norm; + + VectorX = (float)( X2r - X1 ); + VectorY = (float)( Y2r - Y1 ); + + Distance = fabs( ( VectorX * LineY ) - ( VectorY * LineX ) ); + Distance = sqrt( Distance ); + + if ( Distance < (float)( (XPAT_PATTERN_STEP_Y >> 1) * XPAT_UNIT ) ) + { + return( XPAT_TRUE ); + } + } + } + else + { + return( XPAT_TRUE ); + } + + return( XPAT_FALSE ); +} + +/*------------------------------------------------------------\ +| | +| XpatEditSelectPoint | +| | +\------------------------------------------------------------*/ + +void XpatEditSelectPoint( X1, Y1 ) + + long X1; + long Y1; +{ + xpatobj_list *Obj; + xpatselect_list *Select; + int Layer; + + if ( XpatFigure == (xpatfig_list *)0 ) return; + + X1 = X1 * XPAT_UNIT; + Y1 = Y1 * XPAT_UNIT; + + for ( Layer = 0; Layer < XPAT_MAX_LAYER; Layer++ ) + { + if ( XPAT_ACTIVE_LAYER_TABLE[ Layer ] == 0 ) continue; + + for ( Obj = XpatFigure->OBJECT[ Layer ]; + Obj != (xpatobj_list *)NULL; + Obj = Obj->NEXT ) + { + if ( IsXpatDelete( Obj ) ) continue; + + if ( XPAT_ACTIVE_LAYER_TABLE[ Obj->LAYER ] == 0 ) continue; + + if ( ! IsXpatSelect( Obj ) ) + { + if ( XpatEditObjectNearPoint( Obj, X1, Y1 ) ) + { + XpatAddSelect( Obj ); + } + } + } + } + + for ( Select = XpatHeadSelect; + Select != (xpatselect_list *)NULL; + Select = Select->NEXT ) + { + XpatUnselectObject( Select->OBJECT ); + } +} diff --git a/alliance/src/xpat/src/XME_select.h b/alliance/src/xpat/src/XME_select.h new file mode 100644 index 00000000..f4ae7a1a --- /dev/null +++ b/alliance/src/xpat/src/XME_select.h @@ -0,0 +1,69 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Select.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_SELECT +# define XPAT_SELECT + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XPAT_SELECT_BUFFER_SIZE 256 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatEditSelectObject(); + +# endif diff --git a/alliance/src/xpat/src/XMF.h b/alliance/src/xpat/src/XMF.h new file mode 100644 index 00000000..8223a370 --- /dev/null +++ b/alliance/src/xpat/src/XMF.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : XMF.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_XMF +# define XPAT_XMF + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XpatMenuItem XpatFileMenu []; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatBuildFileDialog(); + extern void XpatBuildPanelLibrary(); + +# endif diff --git a/alliance/src/xpat/src/XMF_dialog.c b/alliance/src/xpat/src/XMF_dialog.c new file mode 100644 index 00000000..bbb3ee30 --- /dev/null +++ b/alliance/src/xpat/src/XMF_dialog.c @@ -0,0 +1,236 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XPT.h" +# include "XMX.h" +# include "XTB.h" +# include "XMF.h" + +# include "XMF_dialog.h" +# include "XMF_file.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| File Dialog | +| | +\------------------------------------------------------------*/ + + XpatDialogItem XpatFileOpenDialog = + + { + "Open File", + XPAT_DIALOG_FILE, + (Widget)NULL, + (void *)CallbackFileOpenOk, + (XtPointer)NULL, + (void *)CallbackFileOpenCancel, + (XtPointer)NULL + }; + + XpatDialogItem XpatFileQuitDialog = + + { + "Do you really want to quit Xpat ?", + XPAT_DIALOG_WARNING, + (Widget)NULL, + (void *)CallbackFileQuitOk, + (XtPointer)NULL, + (void *)CallbackFileQuitCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatBuildFileDialog | +| | +\------------------------------------------------------------*/ + +void XpatBuildFileDialog() + +{ + autbegin(); + + XpatBuildDialog( XpatMainWindow, &XpatFileOpenDialog ); + XpatBuildDialog( XpatMainWindow, &XpatFileQuitDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileQuitOk | +| | +\------------------------------------------------------------*/ + +void CallbackFileQuitOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatExitDialog(); + + XtCloseDisplay( XtDisplay( XtParent( MyWidget ) ) ); + XpatExitErrorMessage( 0 ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileQuitCancel | +| | +\------------------------------------------------------------*/ + +void CallbackFileQuitCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileOpenOk | +| | +\------------------------------------------------------------*/ + +void CallbackFileOpenOk( MyWidget, ClientData, FileStruct ) + + Widget MyWidget; + caddr_t ClientData; + XmFileSelectionBoxCallbackStruct *FileStruct; +{ + char *FileName; + + autbegin(); + + XtUnmanageChild( XpatFileOpenDialog.WIDGET ); + + XpatExitDialog(); + + if ( FileStruct->value != NULL ) + { + XmStringGetLtoR( FileStruct->value, + XmSTRING_DEFAULT_CHARSET, + &FileName + ); + + FileName = XpatPostTreatString( FileName ); + + if ( FileName != (char *)NULL ) + { + XpatFileOpen( FileName ); + + XpatChangeEditMode( XPAT_EDIT_MEASURE, + XpatPromptEditMeasure ); + } + else + { + XpatErrorMessage( XpatMainWindow, "Unable to load this file !" ); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileOpenCancel | +| | +\------------------------------------------------------------*/ + +void CallbackFileOpenCancel( MyWidget, ClientData, FileStruct ) + + Widget MyWidget; + caddr_t ClientData; + XmFileSelectionBoxCallbackStruct *FileStruct; +{ + autbegin(); + + XtUnmanageChild( XpatFileOpenDialog.WIDGET ); + + XpatExitDialog(); + + autend(); +} diff --git a/alliance/src/xpat/src/XMF_dialog.h b/alliance/src/xpat/src/XMF_dialog.h new file mode 100644 index 00000000..b68de1ea --- /dev/null +++ b/alliance/src/xpat/src/XMF_dialog.h @@ -0,0 +1,79 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_FILE_DIALOG +# define XPAT_FILE_DIALOG + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XpatDialogItem XpatFileOpenDialog; + extern XpatDialogItem XpatFileQuitDialog; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackFileQuitOk(); + extern void CallbackFileQuitCancel(); + extern void CallbackFileOpenOk(); + extern void CallbackFileOpenCancel(); + +# endif diff --git a/alliance/src/xpat/src/XMF_file.c b/alliance/src/xpat/src/XMF_file.c new file mode 100644 index 00000000..e37d8cc9 --- /dev/null +++ b/alliance/src/xpat/src/XMF_file.c @@ -0,0 +1,183 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : File.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XPT.h" +# include "XMX.h" +# include "XTB.h" +# include "XMF.h" + +# include "XMF_file.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + char XpatFileFilter[ 10 ] = "*."; + char XpatFileExtention[ 10 ] = "."; + + char XpatFileBuffer[ 128 ]; + char XpatDirectoryBuffer[ 512 ]; + + char *XPAT_WORK_LIB = (char *)NULL; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatFileOpen | +| | +\------------------------------------------------------------*/ + +void XpatFileOpen( FileName ) + + char *FileName; +{ + int Index; + char *SWAP_WORK_LIB = WORK_LIB; + + autbegin(); + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_WATCH_CURSOR ); + XpatUndisplayCursor(); + + XpatDelConnect(); + XpatDelFigure(); + + XpatRecomputeBound = XPAT_TRUE; + + if ( XPAT_WORK_LIB == (char *)NULL ) + { + XPAT_WORK_LIB = WORK_LIB; + } + + if ( XpatFileFilter[2] == '\0' ) + { + strcat( XpatFileFilter, "pat" ); + strcat( XpatFileExtention, "pat" ); + } + + for ( Index = strlen( FileName ); Index >= 0; Index-- ) + { + if ( FileName[ Index ] == '/' ) break; + } + + if ( Index >= 0 ) + { + strcpy( XpatDirectoryBuffer, FileName ); + strcpy( XpatFileBuffer, FileName + Index + 1); + + XpatDirectoryBuffer[ Index + 1 ] = '\0'; + + WORK_LIB = XpatDirectoryBuffer; + } + else + { + strcpy( XpatFileBuffer, FileName ); + + WORK_LIB = XPAT_WORK_LIB; + } + + Index = strlen( XpatFileBuffer ) - strlen( XpatFileExtention ); + + if ( Index >= 0 ) + { + if ( ! strcmp( XpatFileBuffer + Index, XpatFileExtention ) ) + { + XpatFileBuffer[ Index ] = '\0'; + } + } + + XpatLoadFigure( XpatFileBuffer ); + + if ( XpatFigure != (xpatfig_list *)NULL ) + { + XpatChangeTopLevelTitle( XpatFileBuffer ); + } + else + { + XpatChangeTopLevelTitle( (char *)NULL ); + } + + XpatDisplayToolsMessage(); + + XpatInitializeZoom(); + XpatDisplayFigure( 0, 0, XpatGraphicDx, XpatGraphicDy ); + + XpatRefreshGraphicWindow( 0, 0, + XpatGraphicDx, XpatGraphicDy ); + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_NORMAL_CURSOR ); + XpatDisplayCursor(); + + WORK_LIB = SWAP_WORK_LIB; + + autend(); +} diff --git a/alliance/src/xpat/src/XMF_file.h b/alliance/src/xpat/src/XMF_file.h new file mode 100644 index 00000000..b1f26889 --- /dev/null +++ b/alliance/src/xpat/src/XMF_file.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : File.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_FILE +# define XPAT_FILE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char XpatFileFilter[ 10 ]; + extern char XpatFileExtention[ 10 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatFileOpen(); + +# endif diff --git a/alliance/src/xpat/src/XMF_menu.c b/alliance/src/xpat/src/XMF_menu.c new file mode 100644 index 00000000..407227bf --- /dev/null +++ b/alliance/src/xpat/src/XMF_menu.c @@ -0,0 +1,188 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XPT.h" +# include "XMX.h" +# include "XTB.h" +# include "XMF.h" + +# include "XMF_menu.h" +# include "XMF_dialog.h" +# include "XMF_file.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static XpatFirstFileOpen = 1; + +/*------------------------------------------------------------\ +| | +| Menu | +| | +\------------------------------------------------------------*/ + + XpatMenuItem XpatFileMenu[] = + + { + { + "Open", + 'O', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackFileOpen, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XpatMenuItem *)NULL + } + , + { + "Quit ", + 'Q', + "CtrlQ", + "Ctrl Q", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackFileQuit, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XpatMenuItem *)NULL + } + , + NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackFileOpen | +| | +\------------------------------------------------------------*/ + +void CallbackFileOpen( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + XmString Filter; + + autbegin(); + + if ( XpatFirstFileOpen ) + { + XpatFirstFileOpen = 0; + + if ( XpatFileFilter[2] == '\0' ) + { + strcat( XpatFileFilter, "pat" ); + strcat( XpatFileExtention, "pat" ); + } + + Filter = XmStringCreateSimple( XpatFileFilter ); + + XtVaSetValues( XpatFileOpenDialog.WIDGET, + XmNpattern, Filter, NULL); + + XmStringFree( Filter ); + } + + XpatEnterDialog( &XpatFileOpenDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileQuit | +| | +\------------------------------------------------------------*/ + +void CallbackFileQuit( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatEnterDialog( &XpatFileQuitDialog ); + + autend(); +} diff --git a/alliance/src/xpat/src/XMF_menu.h b/alliance/src/xpat/src/XMF_menu.h new file mode 100644 index 00000000..1a833fb8 --- /dev/null +++ b/alliance/src/xpat/src/XMF_menu.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_FILE_MENU +# define XPAT_FILE_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackFileOpen(); + extern void CallbackFileQuit(); + +# endif diff --git a/alliance/src/xpat/src/XMF_panel.c b/alliance/src/xpat/src/XMF_panel.c new file mode 100644 index 00000000..05be527d --- /dev/null +++ b/alliance/src/xpat/src/XMF_panel.c @@ -0,0 +1,824 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XPT.h" +# include "XMX.h" +# include "XTB.h" +# include "XMF.h" + +# include "XMF_panel.h" +# include "XMF_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XpatPanelItem XpatLibraryPanel = + + { + "Library", + 1, + 0, + XPAT_LIBRARY_X, + XPAT_LIBRARY_Y, + 250, + 375, + 0, + 0, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (XpatPanelButtonItem *)NULL + }; + + int XpatLibraryDefaultValues[ 5 ] = + + { + XPAT_LIBRARY_X, + XPAT_LIBRARY_Y, + 250, 375, 0 + }; + + static char **XPAT_CATA_LIB = (char **)NULL; + static char *XPAT_WORK_LIB = (char *)NULL; + static char *XPAT_DEFAULT_LIB = (char *)NULL; + + static char XpatFirstLibrary = 1; + +/*------------------------------------------------------------\ +| | +| Buffer | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Widget For Library Panel | +| | +\------------------------------------------------------------*/ + + Widget XpatLibraryListLabel; + Widget XpatLibraryList; + + Widget XpatLibraryButtonOk; + Widget XpatLibraryButtonUpdate; + Widget XpatLibraryButtonCancel; + + Widget XpatLibraryCataLabel; + Widget XpatLibraryCata; + + Widget XpatLibraryWorkLabel; + Widget XpatLibraryWork; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatIsDirectory | +| | +\------------------------------------------------------------*/ + +char XpatIsDirectory( FileName ) + + char *FileName; +{ + struct stat Buffer; + + autbegin(); + + if ( stat( FileName, &Buffer ) != -1 ) + { + if ( ( Buffer.st_mode & S_IFMT ) == S_IFDIR ) + { + autend(); + return( 1 ); + } + } + + autend(); + return( 0 ); +} + +/*------------------------------------------------------------\ +| | +| XpatSetLibraryList | +| | +\------------------------------------------------------------*/ + +void XpatSetLibraryList() +{ + int Index; + XmString Label; + + autbegin(); + + XmListDeleteAllItems( XpatLibraryList ); + + for ( Index = 0; + XPAT_CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + Label = XmStringCreateSimple( XPAT_CATA_LIB[ Index ] ); + XmListAddItem( XpatLibraryList , Label , NULL ); + XmStringFree( Label ); + } + + Label = XmStringCreateSimple( XPAT_WORK_LIB ); + XmListAddItem( XpatLibraryList , Label , NULL ); + XmStringFree( Label ); + + XPAT_DEFAULT_LIB = (char *)NULL; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatSetWorkLibrary | +| | +\------------------------------------------------------------*/ + +void XpatSetWorkLibrary() +{ + autbegin(); + + XmTextSetString( XpatLibraryWork, XPAT_WORK_LIB ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatSetCataLibrary | +| | +\------------------------------------------------------------*/ + +void XpatSetCataLibrary() +{ + int Index; + long Length; + char *Buffer; + char *Scan; + + autbegin(); + + for ( Index = 0, Length = 0; + XPAT_CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + Length = Length + strlen( XPAT_CATA_LIB[ Index ] ) + 1; + } + + Buffer = (char *)autallocblock( Length + 1 ); + Buffer[ 0 ] = '\0'; + Scan = Buffer; + + for ( Index = 0; + XPAT_CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + strcpy( Scan, XPAT_CATA_LIB[ Index ] ); + strcat( Scan, "\n" ); + + Scan = Scan + strlen( Scan ); + } + + XmTextSetString( XpatLibraryCata, Buffer ); + + autfreeblock( Buffer ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatInitializeLibrary | +| | +\------------------------------------------------------------*/ + +void XpatInitializeLibrary() +{ + int Index; + + autbegin(); + + for ( Index = 0; CATA_LIB[ Index ] != (char *)NULL; Index++ ); + + XPAT_CATA_LIB = (char **)autallocblock( sizeof(char *) * ( Index + 1 )); + + for ( Index = 0; + CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + XPAT_CATA_LIB[ Index ] = autallocblock( strlen( CATA_LIB[ Index ] ) + 1 ); + strcpy( XPAT_CATA_LIB[ Index ], CATA_LIB[ Index ] ); + } + + XPAT_CATA_LIB[ Index ] = (char *)NULL; + + XPAT_WORK_LIB = autallocblock( strlen( WORK_LIB ) + 1 ); + strcpy( XPAT_WORK_LIB, WORK_LIB ); + + XpatSetCataLibrary(); + XpatSetWorkLibrary(); + XpatSetLibraryList(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatGetCataLibrary | +| | +\------------------------------------------------------------*/ + + void XpatGetCataLibrary() + { + char *NewCata; + char *Scan; + int Index; + int Count; + int Length; + + autbegin(); + + for ( Index = 0; + XPAT_CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + autfreeblock( XPAT_CATA_LIB[ Index ] ); + } + + autfreeblock( XPAT_CATA_LIB ); + + NewCata = XmTextGetString( XpatLibraryCata ); + + Count = 1; + + for ( Index = 0; NewCata[ Index ] != '\0'; Index++ ) + { + if ( NewCata[ Index ] == '\n' ) + { + Count = Count + 1; + } + } + + XPAT_CATA_LIB = (char **)autallocblock( sizeof(char *) * ( Count + 1 )); + + Count = 0; + Scan = NewCata; + + for ( Index = 0; NewCata[ Index ] != '\0'; Index++ ) + { + if ( NewCata[ Index ] == '\n' ) + { + NewCata[ Index ] = '\0'; + + Length = strlen( Scan ); + + if ( ( Length > 0 ) && + ( XpatIsDirectory( Scan ) ) ) + { + XPAT_CATA_LIB[ Count ] = autallocblock( Length + 1 ); + strcpy( XPAT_CATA_LIB[ Count ], Scan ); + Count = Count + 1; + } + + Scan = NewCata + Index + 1; + } + else + if ( NewCata[ Index ] == ' ' ) + { + NewCata[ Index ] = '\0'; + } + } + + Length = strlen( Scan ); + + if ( Length > 0 ) + { + XPAT_CATA_LIB[ Count ] = autallocblock( Length + 1 ); + strcpy( XPAT_CATA_LIB[ Count ], Scan ); + Count = Count + 1; + } + + XPAT_CATA_LIB[ Count ] = (char *)NULL; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatGetWorkLibrary | +| | +\------------------------------------------------------------*/ + +void XpatGetWorkLibrary() +{ + char *NewWork; + + autbegin(); + + autfreeblock( XPAT_WORK_LIB ); + + NewWork = XmTextGetString( XpatLibraryWork ); + + if ( XpatIsDirectory( NewWork ) ) + { + XPAT_WORK_LIB = autallocblock( strlen( NewWork ) + 1 ); + strcpy( XPAT_WORK_LIB, NewWork ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLibraryList | +| | +\------------------------------------------------------------*/ + +void CallbackLibraryList( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmListCallbackStruct *CallData; +{ + autbegin(); + + XPAT_DEFAULT_LIB = XPAT_CATA_LIB[ CallData->item_position - 1 ]; + + if ( XPAT_DEFAULT_LIB == (char *)NULL ) + { + XPAT_DEFAULT_LIB = XPAT_WORK_LIB; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLibraryOk | +| | +\------------------------------------------------------------*/ + +void CallbackLibraryOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + XmString Label; + int Index; + + autbegin(); + + XpatExitPanel( &XpatLibraryPanel ); + + XpatExitDialog(); + + if ( XpatFirstLibrary == 0 ) + { + for ( Index = 0; + CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + autfreeblock( CATA_LIB[ Index ] ); + } + + autfreeblock( CATA_LIB ); + autfreeblock( WORK_LIB ); + } + + XpatFirstLibrary = 0; + + CATA_LIB = XPAT_CATA_LIB; + WORK_LIB = XPAT_WORK_LIB; + + if ( XPAT_DEFAULT_LIB != (char *)NULL ) + { + Label = XmStringCreateSimple( XPAT_DEFAULT_LIB ); + + XtVaSetValues( XpatFileOpenDialog.WIDGET, + XmNdirectory, Label, NULL ); + + XmStringFree( Label ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLibraryUpdate | +| | +\------------------------------------------------------------*/ + +void CallbackLibraryUpdate( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatGetCataLibrary(); + XpatGetWorkLibrary(); + XpatSetLibraryList(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLibraryCancel | +| | +\------------------------------------------------------------*/ + +void CallbackLibraryCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + int Index; + + autbegin(); + + for ( Index = 0; + XPAT_CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + autfreeblock( XPAT_CATA_LIB[ Index ] ); + } + + autfreeblock( XPAT_CATA_LIB ); + autfreeblock( XPAT_WORK_LIB ); + + XpatExitPanel( &XpatLibraryPanel ); + + XpatExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEnterLibrary | +| | +\------------------------------------------------------------*/ + +void CallbackEnterLibrary( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatInitializeLibrary(); + + XpatEnterPanel( &XpatLibraryPanel ); + XpatLimitedLoop( XpatLibraryPanel.PANEL ); + XpatReEnterDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatBuildPanelLibrary | +| | +\------------------------------------------------------------*/ + +void XpatBuildPanelLibrary() +{ + Arg Args[15]; + XmString Label; + + autbegin(); + + XtSetArg( Args[0], XmNshadowType , XmSHADOW_ETCHED_IN ); + XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING ); + XtSetArg( Args[2], XmNtitle , XpatLibraryPanel.TITLE ); + + XpatLibraryPanel.PANEL = + + XmCreateFormDialog( XpatMainWindow, "XpatLibraryPanel", Args, 3); + + XtAddCallback( XpatLibraryPanel.PANEL, XmNdestroyCallback, + XpatDestroyDialogCallback, NULL ); + + XpatLibraryPanel.PANEL_FORM = + + XtVaCreateManagedWidget( "XpatLibraryPanelForm", + xmFormWidgetClass, + XpatLibraryPanel.PANEL, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , 10, + NULL + ); + + XpatLibraryPanel.FRAME = + + XtVaCreateManagedWidget( "XpatLibraryFrame", + xmFrameWidgetClass, + XpatLibraryPanel.PANEL_FORM, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + NULL + ); + + XpatLibraryPanel.FORM = + + XtVaCreateManagedWidget( "XpatLibraryForm", + xmFormWidgetClass, + XpatLibraryPanel.FRAME, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , 120, + NULL + ); + + XpatLibraryButtonUpdate = + + XtVaCreateManagedWidget( "Update", + xmPushButtonWidgetClass, + XpatLibraryPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 10, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 40, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 105, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 115, + NULL + ); + + XpatLibraryButtonOk = + + XtVaCreateManagedWidget( "Ok", + xmPushButtonWidgetClass, + XpatLibraryPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 50, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 70, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 105, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 115, + NULL + ); + + XpatLibraryButtonCancel = + + XtVaCreateManagedWidget( "Cancel", + xmPushButtonWidgetClass, + XpatLibraryPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 80, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 110, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 105, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 115, + NULL + ); + + Label = XmStringCreateSimple( "Directories" ); + + XpatLibraryListLabel = + + XtVaCreateManagedWidget( "XpatLibraryListLabel", + xmLabelGadgetClass , + XpatLibraryPanel.FORM, + XmNlabelString , Label, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 5, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 5, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 10, + NULL ); + + XmStringFree( Label ); + + XtSetArg( Args[0] , XmNtopAttachment , XmATTACH_POSITION ); + XtSetArg( Args[1] , XmNtopPosition , 10 ); + XtSetArg( Args[2] , XmNbottomAttachment , XmATTACH_POSITION ); + XtSetArg( Args[3] , XmNbottomPosition , 40 ); + XtSetArg( Args[4] , XmNrightAttachment , XmATTACH_POSITION ); + XtSetArg( Args[5] , XmNrightPosition , 115 ); + XtSetArg( Args[6] , XmNleftAttachment , XmATTACH_POSITION ); + XtSetArg( Args[7] , XmNleftPosition , 5 ); + XtSetArg( Args[8] , XmNscrollBarDisplayPolicy, XmSTATIC ); + XtSetArg( Args[9] , XmNscrollHorizontal , True ); + XtSetArg( Args[10] , XmNscrollVertical , True ); + XtSetArg( Args[11] , XmNlistSizePolicy , XmCONSTANT ); + + XpatLibraryList = + + XmCreateScrolledList( XpatLibraryPanel.FORM, + "XpatLibraryList", Args, 12 ); + + Label = XmStringCreateSimple( "Catalog libraries" ); + + XpatLibraryCataLabel = + + XtVaCreateManagedWidget( "XpatLibraryCataLabel", + xmLabelGadgetClass , + XpatLibraryPanel.FORM, + XmNlabelString , Label, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 5, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 45, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 50, + NULL ); + + XmStringFree( Label ); + + XtSetArg( Args[0] , XmNrows , 4 ); + XtSetArg( Args[1] , XmNeditable , True ); + XtSetArg( Args[2] , XmNcursorPositionVisible , True ); + XtSetArg( Args[3] , XmNscrollHorizontal , True ); + XtSetArg( Args[4] , XmNscrollVertical , True ); + XtSetArg( Args[5] , XmNeditMode , XmMULTI_LINE_EDIT ); + XtSetArg( Args[6] , XmNtopAttachment , XmATTACH_POSITION ); + XtSetArg( Args[7] , XmNtopPosition , 50 ); + XtSetArg( Args[8] , XmNleftAttachment , XmATTACH_POSITION ); + XtSetArg( Args[9] , XmNleftPosition , 5 ); + XtSetArg( Args[10] , XmNrightAttachment , XmATTACH_POSITION ); + XtSetArg( Args[11] , XmNrightPosition , 115 ); + XtSetArg( Args[12] , XmNbottomAttachment , XmATTACH_POSITION ); + XtSetArg( Args[13] , XmNbottomPosition , 80 ); + + XpatLibraryCata = + + XmCreateScrolledText( XpatLibraryPanel.FORM, + "XpatLibraryCata", Args, 14 ); + + Label = XmStringCreateSimple( "Work library" ); + + XpatLibraryWorkLabel = + + XtVaCreateManagedWidget( "XpatLibraryWorkLabel", + xmLabelGadgetClass , + XpatLibraryPanel.FORM, + XmNlabelString , Label, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 5, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 85, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 90, + NULL ); + XmStringFree( Label ); + + XtSetArg( Args[0] , XmNrows , 1 ); + XtSetArg( Args[1] , XmNeditable , True ); + XtSetArg( Args[2] , XmNeditMode , XmSINGLE_LINE_EDIT ); + XtSetArg( Args[3] , XmNscrollHorizontal , False ); + XtSetArg( Args[4] , XmNscrollVertical , False ); + XtSetArg( Args[5] , XmNcursorPositionVisible , True ); + XtSetArg( Args[6] , XmNtopAttachment , XmATTACH_POSITION ); + XtSetArg( Args[7] , XmNtopPosition , 90 ); + XtSetArg( Args[8] , XmNleftAttachment , XmATTACH_POSITION ); + XtSetArg( Args[9] , XmNleftPosition , 5 ); + XtSetArg( Args[10] , XmNrightAttachment , XmATTACH_POSITION ); + XtSetArg( Args[11] , XmNrightPosition , 115 ); + XtSetArg( Args[12] , XmNbottomAttachment , XmATTACH_POSITION ); + XtSetArg( Args[13] , XmNbottomPosition , 100 ); + + XpatLibraryWork = + + XmCreateText( XpatLibraryPanel.FORM, + "XpatLibraryWork", Args, 14 ); + + XtManageChild( XpatLibraryWork ); + XtManageChild( XpatLibraryList ); + XtManageChild( XpatLibraryCata ); + + XtAddCallback( XpatLibraryList, + XmNdefaultActionCallback, + CallbackLibraryList, NULL ); + + XtAddCallback( XpatLibraryButtonOk, + XmNactivateCallback, + CallbackLibraryOk, NULL ); + + XtAddCallback( XpatLibraryButtonCancel, + XmNactivateCallback, + CallbackLibraryCancel, NULL ); + + XtAddCallback( XpatLibraryButtonUpdate, + XmNactivateCallback, + CallbackLibraryUpdate, NULL ); + + XtVaSetValues( XpatLibraryPanel.PANEL, + XmNheight, XpatLibraryPanel.HEIGHT, + XmNwidth , XpatLibraryPanel.WIDTH, + XmNx , XpatLibraryPanel.X, + XmNy , XpatLibraryPanel.Y, + NULL ); + + Label = XmStringCreateSimple( "Library" ); + + XtVaSetValues( XmFileSelectionBoxGetChild( XpatFileOpenDialog.WIDGET, + XmDIALOG_HELP_BUTTON ), + XmNlabelString, Label, NULL ); + + XmStringFree( Label ); + + XtAddCallback( XmFileSelectionBoxGetChild( XpatFileOpenDialog.WIDGET, + XmDIALOG_HELP_BUTTON ), + XmNactivateCallback, + CallbackEnterLibrary, NULL ); + + autend(); +} diff --git a/alliance/src/xpat/src/XMF_panel.h b/alliance/src/xpat/src/XMF_panel.h new file mode 100644 index 00000000..366c7af7 --- /dev/null +++ b/alliance/src/xpat/src/XMF_panel.h @@ -0,0 +1,79 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_FILE_PANEL +# define XPAT_FILE_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XPAT_LIBRARY_X 100 +# define XPAT_LIBRARY_Y 230 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackLibraryList(); + extern void CallbackLibraryOk(); + extern void CallbackLibraryUpdate(); + extern void CallbackLibraryCancel(); + extern void CallbackEnterLibrary(); + +# endif diff --git a/alliance/src/xpat/src/XMH.h b/alliance/src/xpat/src/XMH.h new file mode 100644 index 00000000..0a0ad40d --- /dev/null +++ b/alliance/src/xpat/src/XMH.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : XMH101.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_XMH +# define XPAT_XMH + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XpatMenuItem XpatHelpMenu[]; + extern XpatPanelItem XpatHelpPresentPanel; + + extern int XpatHelpPresentDefaultValues[5]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatBuildPresentPanel(); + extern void XpatEnterPresentPanel(); + +# endif diff --git a/alliance/src/xpat/src/XMH_help.c b/alliance/src/xpat/src/XMH_help.c new file mode 100644 index 00000000..b84ec0b0 --- /dev/null +++ b/alliance/src/xpat/src/XMH_help.c @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Help.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "XSB.h" +# include "XTB.h" +# include "XMH.h" +# include "XMX.h" + +# include "XMH_help.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ diff --git a/alliance/src/xpat/src/XMH_help.h b/alliance/src/xpat/src/XMH_help.h new file mode 100644 index 00000000..a24f42c5 --- /dev/null +++ b/alliance/src/xpat/src/XMH_help.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Help.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_HELP +# define XPAT_HELP + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xpat/src/XMH_menu.c b/alliance/src/xpat/src/XMH_menu.c new file mode 100644 index 00000000..722eda23 --- /dev/null +++ b/alliance/src/xpat/src/XMH_menu.c @@ -0,0 +1,125 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XTB.h" +# include "XSB.h" +# include "XMH.h" +# include "XMX.h" + +# include "XMH_menu.h" +# include "XMH_panel.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Help Menu | +| | +\------------------------------------------------------------*/ + + XpatMenuItem XpatHelpMenu[] = + + { + { + "About Xpat", + 'G', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackHelpAbout, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XpatMenuItem *)NULL + } + , + NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackHelpAbout | +| | +\------------------------------------------------------------*/ + +void CallbackHelpAbout( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatEnterPresentPanel(); + + autend(); +} diff --git a/alliance/src/xpat/src/XMH_menu.h b/alliance/src/xpat/src/XMH_menu.h new file mode 100644 index 00000000..5cf1dc05 --- /dev/null +++ b/alliance/src/xpat/src/XMH_menu.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_HELP_MENU +# define XPAT_HELP_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackHelpAbout(); + +# endif diff --git a/alliance/src/xpat/src/XMH_panel.c b/alliance/src/xpat/src/XMH_panel.c new file mode 100644 index 00000000..4d72ecd1 --- /dev/null +++ b/alliance/src/xpat/src/XMH_panel.c @@ -0,0 +1,324 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XMH.h" + +# include "XMH_panel.h" +# include "LIP6bw.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XpatPanelItem XpatHelpPresentPanel = + + { + "Xpat present", + 1, + 0, + XPAT_HELP_PRESENT_X, + XPAT_HELP_PRESENT_Y, + 700, + 360, + 0, + 0, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (XpatPanelButtonItem *)NULL + }; + + int XpatHelpPresentDefaultValues[ 5 ] = + + { + XPAT_HELP_PRESENT_X, + XPAT_HELP_PRESENT_Y, + 700, 360, 0 + }; + + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatBuildPresentPanel | +| | +\------------------------------------------------------------*/ + +void XpatBuildPresentPanel() + +{ + Widget PanelLabel; + Widget PanelButton; + Pixmap PanelPixmap; + XmString PanelString; + XmString PanelString1; + XmString PanelString2; + XmFontList PanelFontList; + XFontStruct *PanelFont; + Display *PanelDisplay; + char Buffer[ 64 ]; + Arg Args[3]; + + autbegin(); + + PanelDisplay = XtDisplay( XpatMainWindow ); + PanelFont = XLoadQueryFont( PanelDisplay, "-*-helvetica-bold-o-*--24-*" ); + PanelFontList = XmFontListCreate( PanelFont, "Panel_charset1" ); + PanelFont = XLoadQueryFont( PanelDisplay, "-*-helvetica-bold-r-*--18-*" ); + PanelFontList = XmFontListAdd( PanelFontList, PanelFont, "Panel_charset2" ); + PanelFont = XLoadQueryFont( PanelDisplay, "-*-helvetica-bold-r-*--12-*" ); + PanelFontList = XmFontListAdd( PanelFontList, PanelFont, "Panel_charset4" ); + + XtSetArg( Args[0], XmNshadowType , XmSHADOW_ETCHED_IN ); + XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING ); + XtSetArg( Args[2], XmNtitle , "Xpat present" ); + + XpatHelpPresentPanel.PANEL = + + XmCreateFormDialog( XpatMainWindow, XpatHelpPresentPanel.TITLE, Args, 3); + + XtAddCallback( XpatHelpPresentPanel.PANEL, XmNdestroyCallback, + XpatDestroyDialogCallback, NULL ); + + XpatHelpPresentPanel.PANEL_FORM = + + XtVaCreateManagedWidget( "", + xmFormWidgetClass, + XpatHelpPresentPanel.PANEL, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + NULL + ); + + XpatHelpPresentPanel.FRAME = + + XtVaCreateManagedWidget( "", + xmFrameWidgetClass, + XpatHelpPresentPanel.PANEL_FORM, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 05, + XmNbottomAttachment, XmATTACH_POSITION, + XmNbottomPosition , 95, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 05, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 95, + NULL + ); + + XpatHelpPresentPanel.FORM = + + XtVaCreateManagedWidget( "", + xmFormWidgetClass, + XpatHelpPresentPanel.FRAME, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 05, + XmNbottomAttachment, XmATTACH_POSITION, + XmNbottomPosition , 95, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 05, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 95, + NULL + ); + + PanelPixmap = XpatCreatePixmap( XpatMainWindow, + LIP6bw_bits, + LIP6bw_width, + LIP6bw_height); + + + PanelLabel = XtVaCreateManagedWidget( "", + xmLabelGadgetClass, + XpatHelpPresentPanel.FORM, + XmNlabelType , XmPIXMAP, + XmNlabelPixmap , PanelPixmap, + NULL + ); + + sprintf( Buffer, "ALLIANCE CAD SYSTEM %s\n", ALLIANCE_VERSION ); + + PanelString = XmStringCreateLtoR( Buffer, "Panel_charset2" ); + + PanelLabel = XtVaCreateManagedWidget( "", + xmLabelWidgetClass, + XpatHelpPresentPanel.FORM, + XmNfontList , PanelFontList, + XmNlabelString , PanelString, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 15, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 75, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 25, + NULL + ); + XmStringFree( PanelString ); + + PanelString1 = XmStringCreateLtoR( "Xpat" , "Panel_charset1" ); + PanelString2 = XmStringCreateLtoR( "\n( Touch Me )", "Panel_charset4" ); + PanelString = XmStringConcat( PanelString1, PanelString2 ); + + PanelButton = XtVaCreateManagedWidget( "", + xmPushButtonWidgetClass, + XpatHelpPresentPanel.FORM, + XmNfontList , PanelFontList, + XmNlabelString , PanelString, + XmNshadowThickness , 3, + XmNtopAttachment , XmATTACH_WIDGET, + XmNtopWidget , PanelLabel, + XmNtopOffset , 5, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 60, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 40, + NULL + ); + XmStringFree( PanelString ); + XmStringFree( PanelString1 ); + XmStringFree( PanelString2 ); + + XtAddCallback( PanelButton, + XmNactivateCallback, + XpatExitDialogCallback, NULL ); + + sprintf( Buffer, "\nGraphic Pattern Viewer\nVersion %s", XPAT_VERSION ); + + PanelString = XmStringCreateLtoR( Buffer, "Panel_charset2" ); + + PanelLabel = XtVaCreateManagedWidget( "", + xmLabelWidgetClass, + XpatHelpPresentPanel.FORM, + XmNfontList , PanelFontList, + XmNlabelString , PanelString, + XmNtopAttachment , XmATTACH_WIDGET, + XmNtopWidget , PanelButton, + XmNtopOffset , 5, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 75, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 25, + NULL + ); + XmStringFree( PanelString ); + + PanelString = XmStringCreateLtoR( "copyright \251 1996-2000 ASIM, \ +CAO-VLSI Team\nWritten by Ludovic Jacomme\nE-mail support: alliance-support@asim.lip6.fr", "Panel_charset4" ); + + + PanelLabel = XtVaCreateManagedWidget( "", + xmLabelWidgetClass, + XpatHelpPresentPanel.FORM, + XmNfontList , PanelFontList, + XmNlabelString , PanelString, + XmNtopAttachment , XmATTACH_WIDGET, + XmNtopWidget , PanelLabel, + XmNtopOffset , 5, + XmNrightAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + NULL + ); + XmStringFree( PanelString ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatEnterPresentPanel | +| | +\------------------------------------------------------------*/ + +void XpatEnterPresentPanel() + +{ + autbegin(); + + XpatEnterPanel( &XpatHelpPresentPanel ); + + XpatLimitedLoop( XpatHelpPresentPanel.PANEL ); + + XpatExitPanel( &XpatHelpPresentPanel ); + + autend(); +} diff --git a/alliance/src/xpat/src/XMH_panel.h b/alliance/src/xpat/src/XMH_panel.h new file mode 100644 index 00000000..46ce108d --- /dev/null +++ b/alliance/src/xpat/src/XMH_panel.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_HELP_PANEL +# define XPAT_HELP_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XPAT_HELP_PRESENT_X 180 +# define XPAT_HELP_PRESENT_Y 200 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xpat/src/XMS.h b/alliance/src/xpat/src/XMS.h new file mode 100644 index 00000000..43d79999 --- /dev/null +++ b/alliance/src/xpat/src/XMS.h @@ -0,0 +1,79 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : XMS.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_XMS +# define XPAT_XMS + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XpatMenuItem XpatSetupMenu[]; + extern XpatPanelItem XpatSetupInformationsPanel; + + extern int XpatSetupInformationsDefaultValues[ 5 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackSetupLoadConfig(); + extern void CallbackSetupSaveConfig(); + extern void CallbackSetupDefaultConfig(); + extern void CallbackSetupInformations(); + + extern void XpatLoadConfig(); + extern void XpatLoadTopLevelConfig(); + +# endif diff --git a/alliance/src/xpat/src/XMS_dialog.c b/alliance/src/xpat/src/XMS_dialog.c new file mode 100644 index 00000000..68fbe835 --- /dev/null +++ b/alliance/src/xpat/src/XMS_dialog.c @@ -0,0 +1,82 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XPT.h" +# include "XMX.h" +# include "XTB.h" +# include "XMS.h" + +# include "XMS_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ diff --git a/alliance/src/xpat/src/XMS_dialog.h b/alliance/src/xpat/src/XMS_dialog.h new file mode 100644 index 00000000..0a2dd686 --- /dev/null +++ b/alliance/src/xpat/src/XMS_dialog.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_SETUP_DIALOG +# define XPAT_SETUP_DIALOG + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xpat/src/XMS_menu.c b/alliance/src/xpat/src/XMS_menu.c new file mode 100644 index 00000000..63089824 --- /dev/null +++ b/alliance/src/xpat/src/XMS_menu.c @@ -0,0 +1,232 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XTB.h" +# include "XMS.h" + +# include "XMS_menu.h" +# include "XMS_panel.h" +# include "XMS_setup.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XpatMenuItem XpatSetupMenu[] = + + { + { + "Default Config", + 'D', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackSetupDefaultConfig, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XpatMenuItem *)NULL + } + , + { + "Load Config", + 'L', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackSetupLoadConfig, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XpatMenuItem *)NULL + } + , + { + "Save Config", + 'S', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackSetupSaveConfig, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XpatMenuItem *)NULL + } + , + { + "Informations", + 'I', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackSetupInformations, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XpatMenuItem *)NULL + } + , + NULL + }; + + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackSetupLoadConfig | +| | +\------------------------------------------------------------*/ + +void CallbackSetupLoadConfig( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatLoadConfig( XPAT_TRUE ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSetupSaveConfig | +| | +\------------------------------------------------------------*/ + +void CallbackSetupSaveConfig( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatSaveConfig(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSetupDefaultConfig | +| | +\------------------------------------------------------------*/ + +void CallbackSetupDefaultConfig( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatDefaultConfig(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSetupInformations | +| | +\------------------------------------------------------------*/ + +void CallbackSetupInformations( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatDisplayInformations(); + + autend(); +} + diff --git a/alliance/src/xpat/src/XMS_menu.h b/alliance/src/xpat/src/XMS_menu.h new file mode 100644 index 00000000..c8bc5735 --- /dev/null +++ b/alliance/src/xpat/src/XMS_menu.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_SETUP_MENU +# define XPAT_SETUP_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xpat/src/XMS_panel.c b/alliance/src/xpat/src/XMS_panel.c new file mode 100644 index 00000000..3139c892 --- /dev/null +++ b/alliance/src/xpat/src/XMS_panel.c @@ -0,0 +1,181 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XTB.h" +# include "XPT.h" +# include "XMS.h" + +# include "XMS_panel.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Panel | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Panel Informations | +| | +\------------------------------------------------------------*/ + + static char *XpatPanelInformationsButtonName[] = + + { + "Text", + "Close" + }; + + XpatPanelButtonItem XpatSetupInformationsButton[] = + + { + { + &XpatPanelInformationsButtonName[0], + "Nothing", NULL, 0, 0, + NULL, + NULL, + 0, 0, + 8, 9, + NULL, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatPanelInformationsButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 3, 9, + 2, 1, + XpatExitDialogCallback, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XpatPanelItem XpatSetupInformationsPanel = + + { + "Informations", + 1, + 0, + XPAT_SETUP_INFORMATIONS_X, + XPAT_SETUP_INFORMATIONS_Y, + 360, + 250, + 8, + 10, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XpatSetupInformationsButton + }; + + int XpatSetupInformationsDefaultValues[ 5 ] = + + { + XPAT_SETUP_INFORMATIONS_X, + XPAT_SETUP_INFORMATIONS_Y, + 360, 250, 0 + }; + +/*------------------------------------------------------------\ +| | +| Callback For Informations | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatDisplayInformations | +| | +\------------------------------------------------------------*/ + +void XpatDisplayInformations() + +{ + char *Message; + + autbegin(); + + Message = XpatGetInformations(); + + XmTextSetString( XpatSetupInformationsButton[0].BUTTON, Message ); + + XpatEnterPanel( &XpatSetupInformationsPanel ); + + XpatLimitedLoop( XpatSetupInformationsPanel.PANEL ); + + XpatExitPanel( &XpatSetupInformationsPanel ); + + autend(); +} diff --git a/alliance/src/xpat/src/XMS_panel.h b/alliance/src/xpat/src/XMS_panel.h new file mode 100644 index 00000000..d11a7bf0 --- /dev/null +++ b/alliance/src/xpat/src/XMS_panel.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_SETUP_PANEL +# define XPAT_SETUP_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XPAT_SETUP_INFORMATIONS_X 330 +# define XPAT_SETUP_INFORMATIONS_Y 280 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatDisplayInformations(); + +# endif diff --git a/alliance/src/xpat/src/XMS_setup.c b/alliance/src/xpat/src/XMS_setup.c new file mode 100644 index 00000000..3245e33d --- /dev/null +++ b/alliance/src/xpat/src/XMS_setup.c @@ -0,0 +1,518 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Setup.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XMF.h" +# include "XME.h" +# include "XMV.h" +# include "XMT.h" +# include "XMS.h" +# include "XMH.h" + +# include "XMS_setup.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static FILE *FileConfig; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Set Panel New Values | +| | +\------------------------------------------------------------*/ + +void XpatSetPanelValues( Panel, Values ) + + XpatPanelItem *Panel; + int *Values; +{ + autbegin(); + + Panel->COMPUTE = 1; + Panel->X = Values[0]; + Panel->Y = Values[1]; + Panel->WIDTH = Values[2]; + Panel->HEIGHT = Values[3]; + Panel->MANAGED = Values[4]; + + XtVaSetValues( Panel->PANEL, + XmNx , Values[0], + XmNy , Values[1], + XmNwidth , Values[2], + XmNheight , Values[3], + NULL ); + + if ( Panel->MANAGED ) + { + XpatEnterPanel( Panel ); + } + else + { + XtUnmanageChild( Panel->PANEL ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Write TopLevel Values | +| | +\------------------------------------------------------------*/ + +void XpatWriteTopLevelValues() + +{ + Dimension Values[5]; + + autbegin(); + + XtVaGetValues( XpatTopLevel, + XmNx , &Values[0], + XmNy , &Values[1], + XmNwidth , &Values[2], + XmNheight , &Values[3], + NULL ); + + Values[0] = Values[0] - XPAT_TOPLEVEL_TRANSLATE_X; + Values[1] = Values[1] - XPAT_TOPLEVEL_TRANSLATE_Y; + Values[4] = 1; + + fprintf( FileConfig, "VERSION: %s\n", XPAT_VERSION ); + fprintf( FileConfig, "X: %d, Y: %d, WIDTH: %d, HEIGHT: %d, MANAGED: %d\n", + Values[0], Values[1], Values[2], Values[3], Values[4] ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Write Panel Values | +| | +\------------------------------------------------------------*/ + +void XpatWritePanelValues( Panel ) + + XpatPanelItem *Panel; +{ + Dimension Values[5]; + + autbegin(); + + if ( Panel->COMPUTE == 0 ) + { + XtVaGetValues( Panel->PANEL, + XmNx , &Values[0], + XmNy , &Values[1], + XmNwidth , &Values[2], + XmNheight , &Values[3], + NULL ); + + Values[0] = Values[0] - XPAT_PANEL_TRANSLATE_X; + Values[1] = Values[1] - XPAT_PANEL_TRANSLATE_Y; + } + else + { + Values[0] = Panel->X; + Values[1] = Panel->Y; + Values[2] = Panel->WIDTH; + Values[3] = Panel->HEIGHT; + } + + Values[4] = Panel->MANAGED; + + fprintf( FileConfig, "X: %d, Y: %d, WIDTH: %d, HEIGHT: %d, MANAGED: %d\n", + Values[0], Values[1], Values[2], Values[3], Values[4] ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Read Panel Values | +| | +\------------------------------------------------------------*/ + +void XpatReadPanelValues( Panel ) + + XpatPanelItem *Panel; +{ + int Values[5]; + + autbegin(); + + fscanf( FileConfig, "X: %d, Y: %d, WIDTH: %d, HEIGHT: %d, MANAGED: %d\n", + &Values[0], &Values[1], &Values[2], &Values[3], &Values[4] ); + + XpatSetPanelValues( Panel, Values ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Read Panel Values | +| | +\------------------------------------------------------------*/ + +char XpatReadTopLevelValues() + +{ + int Values[5]; + char Version[64]; + + autbegin(); + + fscanf( FileConfig, "VERSION: %s\n", Version ); + + if ( strcmp( Version, XPAT_VERSION ) ) + { + autend(); + return( 0 ); + } + + fscanf( FileConfig, "X: %d, Y: %d, WIDTH: %d, HEIGHT: %d, MANAGED: %d\n", + &Values[0], &Values[1], &Values[2], &Values[3], &Values[4] ); + + XtVaSetValues( XpatTopLevel, + XmNx , Values[0], + XmNy , Values[1], + XmNwidth , Values[2], + XmNheight , Values[3], + NULL ); + autend(); + return( 1 ); +} + +/*------------------------------------------------------------\ +| | +| ReadActiveLayers | +| | +\------------------------------------------------------------*/ + +void XpatReadActiveLayers() + +{ + short Layer; + int Value; + + autbegin(); + + for ( Layer = 0; Layer < XPAT_MAX_LAYER; Layer++ ) + { + fscanf( FileConfig, "ACTIVE: %d\n", &Value ); + + XPAT_ACTIVE_LAYER_TABLE[ Layer ] = Value; + } + + for ( Layer = 0; Layer < XPAT_MAX_ACTIVE_NAME; Layer++ ) + { + fscanf( FileConfig, "ACTIVE: %d\n", &Value ); + + XPAT_ACTIVE_NAME_TABLE[ Layer ] = Value; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| WriteActiveLayers | +| | +\------------------------------------------------------------*/ + +void XpatWriteActiveLayers() + +{ + char Layer; + + autbegin(); + + for ( Layer = 0; Layer < XPAT_MAX_LAYER; Layer++ ) + { + fprintf( FileConfig, "ACTIVE: %d\n", + XPAT_ACTIVE_LAYER_TABLE[ Layer ] ); + } + + for ( Layer = 0; Layer < XPAT_MAX_ACTIVE_NAME; Layer++ ) + { + fprintf( FileConfig, "ACTIVE: %d\n", + XPAT_ACTIVE_NAME_TABLE[ Layer ] ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatDefaultTopLevelValues | +| | +\------------------------------------------------------------*/ + +void XpatDefaultTopLevelValues() + +{ + autbegin(); + + XtVaSetValues( XpatTopLevel, + XmNheight , XPAT_TOPLEVEL_HEIGHT, + XmNwidth , XPAT_TOPLEVEL_WIDTH, + XmNx , XPAT_TOPLEVEL_X, + XmNy , XPAT_TOPLEVEL_Y, + NULL + ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatDefaultConfig | +| | +\------------------------------------------------------------*/ + +void XpatDefaultConfig() + +{ + short Layer; + + autbegin(); + + XpatDefaultTopLevelValues(); + + XpatSetPanelValues( &XpatViewArrowsPanel, + XpatViewArrowsDefaultValues ); + XpatSetPanelValues( &XpatViewZoomPanel, + XpatViewZoomDefaultValues ); + XpatSetPanelValues( &XpatViewGridPanel, + XpatViewGridDefaultValues ); + XpatSetPanelValues( &XpatViewLayerPanel, + XpatViewLayerDefaultValues ); + XpatSetPanelValues( &XpatViewMapPanel, + XpatViewMapDefaultValues ); + XpatSetPanelValues( &XpatEditSearchViewPanel, + XpatEditSearchViewDefaultValues ); + XpatSetPanelValues( &XpatEditSelectPanel, + XpatEditSelectDefaultValues ); + XpatSetPanelValues( &XpatEditIdentifyPanel, + XpatEditIdentifyDefaultValues ); + XpatSetPanelValues( &XpatToolsMessagePanel, + XpatToolsMessageDefaultValues ); + XpatSetPanelValues( &XpatSetupInformationsPanel, + XpatSetupInformationsDefaultValues ); + XpatSetPanelValues( &XpatHelpPresentPanel, + XpatHelpPresentDefaultValues ); + + for ( Layer = 0; Layer < XPAT_MAX_LAYER; Layer++ ) + { + XPAT_ACTIVE_LAYER_TABLE[ Layer ] = 1; + } + + for ( Layer = 0; Layer < XPAT_MAX_ACTIVE_NAME; Layer++ ) + { + XPAT_ACTIVE_NAME_TABLE[ Layer ] = 1; + } + + XpatInitializeLayer(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatLoadTopLevelConfig | +| | +\------------------------------------------------------------*/ + +void XpatLoadTopLevelConfig() + +{ + autbegin(); + + FileConfig = fopen( XPAT_XMS_FILE_NAME, "r" ); + + if ( FileConfig == (FILE *)NULL ) + { + XpatDefaultTopLevelValues(); + } + else + { + if ( ! XpatReadTopLevelValues() ) + { + XpatDefaultTopLevelValues(); + } + + fclose( FileConfig ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatLoadConfig | +| | +\------------------------------------------------------------*/ + +void XpatLoadConfig( Message ) + + char Message; +{ + autbegin(); + + FileConfig = fopen( XPAT_XMS_FILE_NAME, "r" ); + + if ( FileConfig == (FILE *)NULL ) + { + if ( Message ) + { + XpatErrorMessage( XpatMainWindow, + "Unable to open config file !" ); + } + else + { + XpatDefaultConfig(); + } + } + else + { + if ( XpatReadTopLevelValues() ) + { + XpatReadPanelValues( &XpatViewArrowsPanel ); + XpatReadPanelValues( &XpatViewZoomPanel ); + XpatReadPanelValues( &XpatViewGridPanel ); + XpatReadPanelValues( &XpatViewLayerPanel ); + XpatReadPanelValues( &XpatViewMapPanel ); + XpatReadPanelValues( &XpatEditSearchViewPanel ); + XpatReadPanelValues( &XpatEditSelectPanel ); + XpatReadPanelValues( &XpatEditIdentifyPanel ); + XpatReadPanelValues( &XpatToolsMessagePanel ); + XpatReadPanelValues( &XpatSetupInformationsPanel ); + XpatReadPanelValues( &XpatHelpPresentPanel ); + + XpatReadActiveLayers(); + XpatInitializeLayer(); + } + else + if ( Message ) + { + XpatErrorMessage( XpatMainWindow, + "Bad version, unable to open config file !" ); + } + + fclose( FileConfig ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatSaveConfig | +| | +\------------------------------------------------------------*/ + +void XpatSaveConfig() + +{ + autbegin(); + + FileConfig = fopen( XPAT_XMS_FILE_NAME, "w" ); + + if ( FileConfig == (FILE *)NULL ) + { + XpatErrorMessage( XpatMainWindow, + "Unable to open config file !" ); + } + else + { + XpatWriteTopLevelValues(); + + XpatWritePanelValues( &XpatViewArrowsPanel ); + XpatWritePanelValues( &XpatViewZoomPanel ); + XpatWritePanelValues( &XpatViewGridPanel ); + XpatWritePanelValues( &XpatViewLayerPanel ); + XpatWritePanelValues( &XpatViewMapPanel ); + XpatWritePanelValues( &XpatEditSearchViewPanel ); + XpatWritePanelValues( &XpatEditSelectPanel ); + XpatWritePanelValues( &XpatEditIdentifyPanel ); + XpatWritePanelValues( &XpatToolsMessagePanel ); + XpatWritePanelValues( &XpatSetupInformationsPanel ); + XpatWritePanelValues( &XpatHelpPresentPanel ); + + XpatWriteActiveLayers(); + + fclose( FileConfig ); + } + + autend(); +} diff --git a/alliance/src/xpat/src/XMS_setup.h b/alliance/src/xpat/src/XMS_setup.h new file mode 100644 index 00000000..8803f9bb --- /dev/null +++ b/alliance/src/xpat/src/XMS_setup.h @@ -0,0 +1,85 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Setup.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_SETUP +# define XPAT_SETUP + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XPAT_TOPLEVEL_TRANSLATE_X 8 +# define XPAT_TOPLEVEL_TRANSLATE_Y 25 +# define XPAT_PANEL_TRANSLATE_X 0 +# define XPAT_PANEL_TRANSLATE_Y 0 + +# define XPAT_TOPLEVEL_X 10 +# define XPAT_TOPLEVEL_Y 10 +# define XPAT_TOPLEVEL_WIDTH 1024 +# define XPAT_TOPLEVEL_HEIGHT 768 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatDefaultConfig(); + extern void XpatSaveConfig(); + extern void XpatLoadConfig(); + +# endif diff --git a/alliance/src/xpat/src/XMT.h b/alliance/src/xpat/src/XMT.h new file mode 100644 index 00000000..f2eaa2dc --- /dev/null +++ b/alliance/src/xpat/src/XMT.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : XMT.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_XMT +# define XPAT_XMT + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XpatMenuItem XpatToolsMenu[]; + extern XpatPanelItem XpatToolsMessagePanel; + + extern int XpatToolsMessageDefaultValues[ 5 ]; + + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatDisplayToolsMessage(); + +# endif diff --git a/alliance/src/xpat/src/XMT_dialog.c b/alliance/src/xpat/src/XMT_dialog.c new file mode 100644 index 00000000..33e742a8 --- /dev/null +++ b/alliance/src/xpat/src/XMT_dialog.c @@ -0,0 +1,78 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XPT.h" +# include "XMX.h" +# include "XTB.h" +# include "XMT.h" + +# include "XMT_dialog.h" +# include "XMT_tools.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ diff --git a/alliance/src/xpat/src/XMT_dialog.h b/alliance/src/xpat/src/XMT_dialog.h new file mode 100644 index 00000000..bc8e7ee1 --- /dev/null +++ b/alliance/src/xpat/src/XMT_dialog.h @@ -0,0 +1,71 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_TOOLS_DIALOG +# define XPAT_TOOLS_DIALOG + + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xpat/src/XMT_menu.c b/alliance/src/xpat/src/XMT_menu.c new file mode 100644 index 00000000..4710d42b --- /dev/null +++ b/alliance/src/xpat/src/XMT_menu.c @@ -0,0 +1,124 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XTB.h" +# include "XPT.h" +# include "XMV.h" +# include "XMT.h" +# include "XMX.h" + +# include "XMT_menu.h" +# include "XMT_tools.h" +# include "XMT_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XpatMenuItem XpatToolsMenu[] = + + { + { + "Message", + 'M', + "CtrlM", + "Ctrl M", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackToolsMessage, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XpatMenuItem *)NULL + } + , + NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackToolsMessage | +| | +\------------------------------------------------------------*/ + +void CallbackToolsMessage( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatEnterPanel( &XpatToolsMessagePanel ); + + autend(); +} diff --git a/alliance/src/xpat/src/XMT_menu.h b/alliance/src/xpat/src/XMT_menu.h new file mode 100644 index 00000000..82996148 --- /dev/null +++ b/alliance/src/xpat/src/XMT_menu.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_MENU +# define XPAT_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackToolsMessage(); + +# endif diff --git a/alliance/src/xpat/src/XMT_message.c b/alliance/src/xpat/src/XMT_message.c new file mode 100644 index 00000000..da15f070 --- /dev/null +++ b/alliance/src/xpat/src/XMT_message.c @@ -0,0 +1,80 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Message.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XPT.h" +# include "XMX.h" +# include "XTB.h" +# include "XMT.h" +# include "XMT_tools.h" +# include "XMT_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ diff --git a/alliance/src/xpat/src/XMT_message.h b/alliance/src/xpat/src/XMT_message.h new file mode 100644 index 00000000..7da61b93 --- /dev/null +++ b/alliance/src/xpat/src/XMT_message.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Message.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_MESSAGE +# define XPAT_MESSAGE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xpat/src/XMT_panel.c b/alliance/src/xpat/src/XMT_panel.c new file mode 100644 index 00000000..3119dbd1 --- /dev/null +++ b/alliance/src/xpat/src/XMT_panel.c @@ -0,0 +1,201 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XPT.h" +# include "XMX.h" +# include "XTB.h" +# include "XMT.h" + +# include "XMT_panel.h" +# include "XMT_message.h" +# include "XMT_dialog.h" +# include "XMT_tools.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Panel Message | +| | +\------------------------------------------------------------*/ + + static char *XpatPanelMessageButtonName[] = + + { + "Text", + "Close" + }; + + XpatPanelButtonItem XpatToolsMessageButton[] = + + { + { + &XpatPanelMessageButtonName[0], + "Nothing", NULL, 0, 0, + NULL, + NULL, + 0, 0, + 8, 9, + NULL, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatPanelMessageButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 3, 9, + 2, 1, + CallbackToolsCloseMessage, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XpatPanelItem XpatToolsMessagePanel = + + { + "Message", + 1, + 0, + XPAT_TOOLS_MESSAGE_X, + XPAT_TOOLS_MESSAGE_Y, + 360, + 250, + 8, + 10, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XpatToolsMessageButton + }; + + int XpatToolsMessageDefaultValues[ 5 ] = + + { + XPAT_TOOLS_MESSAGE_X, + XPAT_TOOLS_MESSAGE_Y, + 360, 250, 0 + }; + +/*------------------------------------------------------------\ +| | +| Callback For Message | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackToolsCloseMessage | +| | +\------------------------------------------------------------*/ + +void CallbackToolsCloseMessage( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatExitPanel( &XpatToolsMessagePanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatDisplayToolsMessage | +| | +\------------------------------------------------------------*/ + +void XpatDisplayToolsMessage() +{ + char *Message; + + autbegin(); + + Message = XpatGetErrorMessage(); + + if ( Message != (char *)NULL ) + { + XmTextSetString( XpatToolsMessageButton[0].BUTTON, Message ); + + XpatEnterPanel( &XpatToolsMessagePanel ); + } + else + { + XmTextSetString( XpatToolsMessageButton[0].BUTTON, "" ); + } + + autend(); +} diff --git a/alliance/src/xpat/src/XMT_panel.h b/alliance/src/xpat/src/XMT_panel.h new file mode 100644 index 00000000..3816eb32 --- /dev/null +++ b/alliance/src/xpat/src/XMT_panel.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_TOOLS_PANEL +# define XPAT_TOOLS_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XPAT_TOOLS_MESSAGE_X 330 +# define XPAT_TOOLS_MESSAGE_Y 280 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackToolsCloseMessage(); + +# endif diff --git a/alliance/src/xpat/src/XMT_tools.c b/alliance/src/xpat/src/XMT_tools.c new file mode 100644 index 00000000..e65e87ed --- /dev/null +++ b/alliance/src/xpat/src/XMT_tools.c @@ -0,0 +1,80 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Tools.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XPT.h" +# include "XMT.h" + +# include "XMT_tools.h" +# include "XMT_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ diff --git a/alliance/src/xpat/src/XMT_tools.h b/alliance/src/xpat/src/XMT_tools.h new file mode 100644 index 00000000..20d52309 --- /dev/null +++ b/alliance/src/xpat/src/XMT_tools.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Tools.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_TOOLS +# define XPAT_TOOLS + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xpat/src/XMV.h b/alliance/src/xpat/src/XMV.h new file mode 100644 index 00000000..ced9d103 --- /dev/null +++ b/alliance/src/xpat/src/XMV.h @@ -0,0 +1,123 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : XMV.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_XMV +# define XPAT_XMV + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char XpatFirstViewLayer; + +/*------------------------------------------------------------\ +| | +| Panel And Menu | +| | +\------------------------------------------------------------*/ + + extern XpatMenuItem XpatViewMenu[]; + extern XpatPanelItem XpatViewArrowsPanel; + extern XpatPanelItem XpatViewZoomPanel; + extern XpatPanelItem XpatViewGridPanel; + extern XpatPanelItem XpatViewLayerPanel; + extern XpatPanelItem XpatViewMapPanel; + + extern int XpatPercentZoom; + extern int XpatPercentMoveX; + extern int XpatPercentMoveY; + + extern int XpatViewArrowsDefaultValues[5]; + extern int XpatViewZoomDefaultValues[5]; + extern int XpatViewLayerDefaultValues[5]; + extern int XpatViewGridDefaultValues[5]; + extern int XpatViewMapDefaultValues[5]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Values | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Zoom | +| | +\------------------------------------------------------------*/ + + extern void XpatComputeAndDisplayMap(); + extern void XpatInitializeZoom(); + extern void XpatBuildViewDialog(); + extern void XpatBuildPanelMap(); + extern void XpatInitializeMapEvent(); + + extern void XpatZoomCenter(); + extern void XpatZoomRefresh(); + extern void XpatZoomIn(); + extern void XpatZoomPan(); + + extern void XpatReScale(); + + extern void XpatPromptZoomIn(); + extern void XpatPromptZoomPan(); + extern void XpatPromptZoomCenter(); + +# endif diff --git a/alliance/src/xpat/src/XMV_dialog.c b/alliance/src/xpat/src/XMV_dialog.c new file mode 100644 index 00000000..bc2c14bb --- /dev/null +++ b/alliance/src/xpat/src/XMV_dialog.c @@ -0,0 +1,541 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XPT.h" +# include "XTB.h" +# include "XMX.h" +# include "XMV.h" + +# include "XMV_dialog.h" +# include "XMV_view.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Dialog Box | +| | +\------------------------------------------------------------*/ + + XpatDialogItem XpatViewZoomSetDialog = + + { + "Zoom set", + XPAT_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackViewZoomSetOk, + (XtPointer)NULL, + (void *)CallbackViewZoomSetCancel, + (XtPointer)NULL + }; + + XpatDialogItem XpatViewZoomGotoDialog = + + { + "Goto X,Y", + XPAT_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackViewZoomGotoOk, + (XtPointer)NULL, + (void *)CallbackViewZoomGotoCancel, + (XtPointer)NULL + }; + + XpatDialogItem XpatViewMoveSetDialog = + + { + "Move set dx,dy", + XPAT_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackViewMoveSetOk, + (XtPointer)NULL, + (void *)CallbackViewMoveSetCancel, + (XtPointer)NULL + }; + + XpatDialogItem XpatViewGridXDialog = + + { + "Grid X", + XPAT_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackViewGridXOk, + (XtPointer)NULL, + (void *)CallbackViewGridXCancel, + (XtPointer)NULL + }; + + XpatDialogItem XpatViewGridYDialog = + + { + "Grid Y", + XPAT_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackViewGridYOk, + (XtPointer)NULL, + (void *)CallbackViewGridYCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Build Dialog Box | +| | +\------------------------------------------------------------*/ + +void XpatBuildViewDialog() + +{ + autbegin(); + + XpatBuildDialog( XpatMainWindow, &XpatViewZoomSetDialog ); + XpatBuildDialog( XpatMainWindow, &XpatViewZoomGotoDialog ); + XpatBuildDialog( XpatMainWindow, &XpatViewMoveSetDialog ); + XpatBuildDialog( XpatMainWindow, &XpatViewGridXDialog ); + XpatBuildDialog( XpatMainWindow, &XpatViewGridYDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Dialog | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackViewZoomSetOk | +| | +\------------------------------------------------------------*/ + +void CallbackViewZoomSetOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *ZoomSet; + int ZoomPercent; + + autbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &ZoomSet ); + + XtUnmanageChild( XpatViewZoomSetDialog.WIDGET ); + + XpatExitDialog(); + + if ( ZoomSet != (char *)NULL ) + { + ZoomPercent = atoi( ZoomSet ); + + if ( ( ZoomPercent < XPAT_PERCENT_ZOOM_MIN ) || + ( ZoomPercent > XPAT_PERCENT_ZOOM_MAX ) ) + { + XpatErrorMessage( XpatMainWindow, "The value must be between 5% and 95% !" ); + } + else + { + XpatPercentZoom = ZoomPercent; + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewZoomSetCancel | +| | +\------------------------------------------------------------*/ + +void CallbackViewZoomSetCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + autbegin(); + + XtUnmanageChild( XpatViewZoomSetDialog.WIDGET ); + + XpatExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewZoomGotoOk | +| | +\------------------------------------------------------------*/ + +void CallbackViewZoomGotoOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *ZoomGoto; + int Index; + long GotoX; + long GotoY; + + autbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &ZoomGoto ); + + XtUnmanageChild( XpatViewZoomGotoDialog.WIDGET ); + + XpatExitDialog(); + + if ( ZoomGoto != (char *)NULL ) + { + for ( Index = 0; ZoomGoto[ Index ]; Index++ ) + { + if ( ZoomGoto[ Index ] == ',' ) + { + ZoomGoto[ Index ] = '\0'; + + if ( Index == 0 ) + { + GotoX = XpatUnitGridX + ( XpatUnitGridDx >> 1 ); + } + else + { + GotoX = atoi( ZoomGoto ); + } + + if ( ZoomGoto[ Index + 1 ] == '\0' ) + { + GotoY = XpatUnitGridY + ( XpatUnitGridDy >> 1 ); + } + else + { + GotoY = atoi( ZoomGoto + Index + 1 ); + GotoY = GotoY * XPAT_PATTERN_STEP_Y; + } + + ZoomGoto = (char *)NULL; + + XpatZoomCenter( GotoX, GotoY ); + + break; + } + } + + if ( ZoomGoto != (char *)NULL ) + { + XpatErrorMessage( XpatMainWindow, "A coordinate must be specified !" ); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewZoomGotoCancel | +| | +\------------------------------------------------------------*/ + +void CallbackViewZoomGotoCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + autbegin(); + + XtUnmanageChild( XpatViewZoomGotoDialog.WIDGET ); + + XpatExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewMoveSetOk | +| | +\------------------------------------------------------------*/ + +void CallbackViewMoveSetOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *MoveSet; + int MovePercentX; + int MovePercentY; + int Index; + + autbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &MoveSet ); + + XtUnmanageChild( XpatViewMoveSetDialog.WIDGET ); + + XpatExitDialog(); + + if ( MoveSet != (char *)NULL ) + { + for ( Index = 0; MoveSet[ Index ]; Index++ ) + { + if ( MoveSet[ Index ] == ',' ) + { + MoveSet[ Index ] = '\0'; + + MovePercentX = atoi( MoveSet ); + MovePercentY = atoi( MoveSet + Index + 1 ); + MoveSet = (char *)NULL; + + break; + } + } + + if ( MoveSet != (char *)NULL ) + { + MovePercentY = MovePercentX = atoi( MoveSet ); + } + + if ( ( MovePercentX < XPAT_PERCENT_MOVE_MIN ) || + ( MovePercentX > XPAT_PERCENT_MOVE_MAX ) || + ( MovePercentY < XPAT_PERCENT_MOVE_MIN ) || + ( MovePercentY > XPAT_PERCENT_MOVE_MAX ) ) + { + XpatErrorMessage( XpatMainWindow, "The values must be between 5% and 95% !" ); + } + else + { + XpatPercentMoveX = MovePercentX; + XpatPercentMoveY = MovePercentY; + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewMoveSetCancel | +| | +\------------------------------------------------------------*/ + +void CallbackViewMoveSetCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + autbegin(); + + XtUnmanageChild( XpatViewMoveSetDialog.WIDGET ); + + XpatExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewGridXOk | +| | +\------------------------------------------------------------*/ + +void CallbackViewGridXOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *GridSet; + int GridPercent; + + autbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &GridSet ); + + XtUnmanageChild( XpatViewGridXDialog.WIDGET ); + + XpatExitDialog(); + + if ( GridSet != (char *)NULL ) + { + GridPercent = atoi( GridSet ); + + if ( GridPercent < 2 ) + { + XpatErrorMessage( XpatMainWindow, "The value must be greater than one !" ); + } + else + { + XpatUnitUserGridDx = GridPercent; + XpatZoomRefresh(); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewGridXCancel | +| | +\------------------------------------------------------------*/ + +void CallbackViewGridXCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + autbegin(); + + XtUnmanageChild( XpatViewGridXDialog.WIDGET ); + + XpatExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewGridYOk | +| | +\------------------------------------------------------------*/ + +void CallbackViewGridYOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *GridSet; + int GridPercent; + + autbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &GridSet ); + + XtUnmanageChild( XpatViewGridYDialog.WIDGET ); + + XpatExitDialog(); + + if ( GridSet != (char *)NULL ) + { + GridPercent = atoi( GridSet ); + + if ( GridPercent < 2 ) + { + XpatErrorMessage( XpatMainWindow, "The value must be greater than one !" ); + } + else + { + XpatUnitUserGridDy = GridPercent; + XpatZoomRefresh(); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewGridYCancel | +| | +\------------------------------------------------------------*/ + +void CallbackViewGridYCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + autbegin(); + + XtUnmanageChild( XpatViewGridYDialog.WIDGET ); + + XpatExitDialog(); + + autend(); +} diff --git a/alliance/src/xpat/src/XMV_dialog.h b/alliance/src/xpat/src/XMV_dialog.h new file mode 100644 index 00000000..070241d4 --- /dev/null +++ b/alliance/src/xpat/src/XMV_dialog.h @@ -0,0 +1,93 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_VIEW_DIALOG +# define XPAT_VIEW_DIALOG + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XpatDialogItem XpatViewZoomSetDialog; + extern XpatDialogItem XpatViewZoomGotoDialog; + extern XpatDialogItem XpatViewMoveSetDialog; + extern XpatDialogItem XpatViewGridXDialog; + extern XpatDialogItem XpatViewGridYDialog; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback View Dialog | +| | +\------------------------------------------------------------*/ + + extern void CallbackViewZoomGotoOk(); + extern void CallbackViewZoomGotoCancel(); + extern void CallbackViewZoomSetOk(); + extern void CallbackViewZoomSetCancel(); + extern void CallbackViewMoveSetOk(); + extern void CallbackViewMoveSetCancel(); + extern void CallbackViewGridXOk(); + extern void CallbackViewGridXCancel(); + extern void CallbackViewGridYOk(); + extern void CallbackViewGridYCancel(); + +# endif diff --git a/alliance/src/xpat/src/XMV_map.c b/alliance/src/xpat/src/XMV_map.c new file mode 100644 index 00000000..cedf2145 --- /dev/null +++ b/alliance/src/xpat/src/XMV_map.c @@ -0,0 +1,755 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Map.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XPT.h" +# include "XTB.h" +# include "XMX.h" +# include "XMV.h" + +# include "XMV_map.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XpatPanelItem XpatViewMapPanel = + + { + "Map", + 1, + 0, + XPAT_VIEW_MAP_X, + XPAT_VIEW_MAP_Y, + 190, + 200, + 0, + 0, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (XpatPanelButtonItem *)NULL + }; + + int XpatViewMapDefaultValues[ 5 ] = + + { + XPAT_VIEW_MAP_X, + XPAT_VIEW_MAP_Y, + 190, 200, 0 + }; + +/*------------------------------------------------------------\ +| | +| Graphic Map Window | +| | +\------------------------------------------------------------*/ + + Widget XpatMapWindow; + Widget XpatMapButtonCompute; + Widget XpatMapButtonClose; + + Dimension XpatMapDx = 0; + Dimension XpatMapDy = 0; + + static char XpatFirstEnterMap = XPAT_TRUE; + static char XpatFirstExpose = XPAT_TRUE; + +/*------------------------------------------------------------\ +| | +| Unit Map | +| | +\------------------------------------------------------------*/ + + float XpatUnitMapStep; + + long XpatUnitMapX; + long XpatUnitMapY; + long XpatUnitMapDx; + long XpatUnitMapDy; + + long XpatBoundMapX; + long XpatBoundMapY; + long XpatBoundMapDx; + long XpatBoundMapDy; + + long XpatPixelMapX; + long XpatPixelMapY; + +/*------------------------------------------------------------\ +| | +| Expose | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Translation | +| | +\------------------------------------------------------------*/ + + static String XpatMapEventTranslation = + + ": CallbackMapEvent( 0 )\n\ + : CallbackMapEvent( 1 )\n\ + : CallbackMapEvent( 2 )"; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Event Callback | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackCloseMap | +| | +\------------------------------------------------------------*/ + +void CallbackCloseMap( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatExitPanel( &XpatViewMapPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackMapCompute | +| | +\------------------------------------------------------------*/ + +void CallbackMapCompute( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatComputeAndDisplayMap(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackMapEvent | +| | +\------------------------------------------------------------*/ + +void CallbackMapEvent ( MyWidget, Event, Args, Argc ) + + Widget MyWidget; + XButtonEvent *Event; + String *Args; + int *Argc; +{ + Display *EventDisplay; + char MouseEvent; + long X; + long Y; + + autbegin(); + + EventDisplay = Event->display; + MouseEvent = Args[ 0 ][ 0 ] - '0'; + + X = Event->x; + Y = XpatMapDy - Event->y; + + X = X + XpatPixelMapX; + Y = Y + XpatPixelMapY; + + if ( X < 0 ) + { + X = ((float)(X) / XpatUnitMapStep) - 0.5 ; + } + else + { + X = ((float)(X) / XpatUnitMapStep) + 0.5 ; + } + + if ( Y < 0 ) + { + Y = ((float)(Y) / XpatUnitMapStep) - 0.5 ; + } + else + { + Y = ((float)(Y) / XpatUnitMapStep) + 0.5 ; + } + + switch ( MouseEvent ) + { + case XPAT_B1UP : + case XPAT_B2UP : + case XPAT_B3UP : + + XpatZoomCenter( X, Y ); + + break; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackMapResize | +| | +\------------------------------------------------------------*/ + +void CallbackMapResize( MyWidget, ClientData, CallData ) + + Widget MyWidget; + XtPointer ClientData; + XmDrawingAreaCallbackStruct *CallData; +{ + if ( ! XpatFirstExpose ) + { + autbegin(); + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_WATCH_CURSOR ); + XpatResizeMapWindow(); + XpatSetMouseCursor( XpatGraphicWindow, XPAT_NORMAL_CURSOR ); + + autend(); + } +} + +/*------------------------------------------------------------\ +| | +| CallbackMapExpose | +| | +\------------------------------------------------------------*/ + +void CallbackMapExpose( MyWidget, ClientData, CallData ) + + Widget MyWidget; + XtPointer ClientData; + XmDrawingAreaCallbackStruct *CallData; +{ + XExposeEvent *ExposeEvent; + + autbegin(); + + ExposeEvent = (XExposeEvent *)CallData->event; + + if ( XpatFirstExpose ) + { + XpatFirstExpose = XPAT_FALSE; + + XpatInitializeMapWindow(); + } + + XpatRefreshMapWindow(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Initialize Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatsnitializeMapWindow | +| | +\------------------------------------------------------------*/ + +void XpatInitializeMapWindow() + +{ + autbegin(); + + XtVaGetValues( XpatMapWindow, + XmNwidth , &XpatMapDx, + XmNheight, &XpatMapDy, + NULL + ); + + XpatInitializeUnitMap(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Graphic Window Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatRefreshMapWindow | +| | +\------------------------------------------------------------*/ + +void XpatRefreshMapWindow() +{ + autbegin(); + + XpatClearMapWindow(); + XpatDisplayUnitMap(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatClearMapWindow | +| | +\------------------------------------------------------------*/ + +void XpatClearMapWindow() + +{ + XFillRectangle( XtDisplay( XpatMapWindow ), + XtWindow( XpatMapWindow ), + XpatBackgroundGC, + 0, 0, XpatMapDx, XpatMapDy ); +} + +/*------------------------------------------------------------\ +| | +| XpatResizeMapWindow | +| | +\------------------------------------------------------------*/ + +void XpatResizeMapWindow() + +{ + autbegin(); + + XtVaGetValues( XpatMapWindow, + XmNwidth, &XpatMapDx, + XmNheight, &XpatMapDy, + NULL + ); + + XpatComputeAndDisplayMap(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatInitializeMapEvent | +| | +\------------------------------------------------------------*/ + +void XpatInitializeMapEvent() + +{ + XtActionsRec NewActions; + + autbegin(); + + XtVaSetValues( XpatMapWindow, + XmNtranslations, + XtParseTranslationTable( XpatMapEventTranslation ), + NULL + ); + + NewActions.string = "CallbackMapEvent"; + NewActions.proc = CallbackMapEvent; + + XtAppAddActions( XpatApplication, &NewActions, 1 ); + + XtAddCallback( XpatMapWindow, + XmNresizeCallback, + CallbackMapResize, NULL ); + + XtAddCallback( XpatMapWindow, + XmNexposeCallback, + CallbackMapExpose, NULL ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Unit Map Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatInitializeUnitMap | +| | +\------------------------------------------------------------*/ + +void XpatInitializeUnitMap() + +{ + autbegin(); + + if ( ! XpatComputeBound() ) + { + XpatBoundMapX = XPAT_DEFAULT_MAP_X; + XpatBoundMapY = XPAT_DEFAULT_MAP_Y; + XpatBoundMapDx = XPAT_DEFAULT_MAP_DX; + XpatBoundMapDy = XPAT_DEFAULT_MAP_DY; + } + else + { + XpatBoundMapX = XpatBoundXmin / XPAT_UNIT; + XpatBoundMapY = XpatBoundYmin / XPAT_UNIT; + XpatBoundMapDx = XpatBoundXmax / XPAT_UNIT; + XpatBoundMapDy = XpatBoundYmax / XPAT_UNIT; + XpatBoundMapDx = XpatBoundMapDx - XpatBoundMapX; + XpatBoundMapDy = XpatBoundMapDy - XpatBoundMapY; + } + + XpatUnitMapX = XpatBoundMapX - 2; + XpatUnitMapY = XpatBoundMapY - 2; + XpatUnitMapDx = XpatBoundMapDx + 4; + XpatUnitMapDy = XpatBoundMapDy + 4; + + XpatComputeUnitMap(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatComputeUnitMap | +| | +\------------------------------------------------------------*/ + +void XpatComputeUnitMap() + +{ + long Delta; + float StepX; + float StepY; + + autbegin(); + + StepX = (float)(XpatMapDx) / (float)(XpatUnitMapDx); + StepY = (float)(XpatMapDy) / (float)(XpatUnitMapDy); + + if ( StepX < StepY ) + { + XpatUnitMapStep = StepX; + Delta = XpatUnitMapDy; + XpatUnitMapDy = 1 + ( XpatMapDy / StepX ); + Delta = ( XpatUnitMapDy - Delta ) >> 1; + XpatUnitMapY = XpatUnitMapY - Delta; + } + else + { + XpatUnitMapStep = StepY; + Delta = XpatUnitMapDx; + XpatUnitMapDx = 1 + ( XpatMapDx / StepY ); + Delta = ( XpatUnitMapDx - Delta ) >> 1; + XpatUnitMapX = XpatUnitMapX - Delta; + } + + XpatPixelMapX = (float)(XpatUnitMapX) * XpatUnitMapStep; + XpatPixelMapY = (float)(XpatUnitMapY) * XpatUnitMapStep; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatDisplayUnitMap | +| | +\------------------------------------------------------------*/ + +void XpatDisplayUnitMap() +{ + long X1; + long Y1; + long X2; + long Y2; + + autbegin(); + + X1 = (float)( XpatBoundMapX ) * XpatUnitMapStep; + Y1 = (float)( XpatBoundMapY ) * XpatUnitMapStep; + X2 = (float)( XpatBoundMapX + XpatBoundMapDx ) * XpatUnitMapStep; + Y2 = (float)( XpatBoundMapY + XpatBoundMapDy ) * XpatUnitMapStep; + + X1 = X1 - XpatPixelMapX; + X2 = X2 - XpatPixelMapX; + Y1 = Y1 - XpatPixelMapY; + Y2 = Y2 - XpatPixelMapY; + + XDrawRectangle( XtDisplay( XpatMapWindow ), + XtWindow( XpatMapWindow ), + XpatLargeTextGC, + X1, XpatMapDy - Y2, + X2 - X1, Y2 - Y1 ); + + X1 = XpatUnitGridX + ( XpatUnitGridDx >> 1 ); + Y1 = XpatUnitGridY + ( XpatUnitGridDy >> 1 ); + X1 = (float)( X1 ) * XpatUnitMapStep; + Y1 = (float)( Y1 ) * XpatUnitMapStep; + + X1 = X1 - XpatPixelMapX; + Y1 = Y1 - XpatPixelMapY; + Y1 = XpatMapDy - Y1; + + if ( ( X1 > 0 ) && + ( Y1 > 0 ) && + ( X1 < XpatMapDx ) && + ( Y1 < XpatMapDy ) ) + { + XDrawLine( XtDisplay( XpatMapWindow ), + XtWindow( XpatMapWindow ), + XpatLargeTextGC, + X1 - 2, Y1, + X1 + 2, Y1 ); + + XDrawLine( XtDisplay( XpatMapWindow ), + XtWindow( XpatMapWindow ), + XpatLargeTextGC, + X1, Y1 - 2, + X1, Y1 + 2 ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatBuildPanelMap | +| | +\------------------------------------------------------------*/ + +void XpatBuildPanelMap() +{ + Arg Args[3]; + + autbegin(); + + XtSetArg( Args[0], XmNshadowType , XmSHADOW_ETCHED_IN ); + XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING ); + XtSetArg( Args[2], XmNtitle , XpatViewMapPanel.TITLE ); + + XpatViewMapPanel.PANEL = + + XmCreateFormDialog( XpatMainWindow, "XpatViewMapPanel", Args, 3); + + XtAddCallback( XpatViewMapPanel.PANEL, XmNdestroyCallback, + XpatDestroyDialogCallback, NULL ); + + XpatViewMapPanel.PANEL_FORM = + + XtVaCreateManagedWidget( "XpatViewMapPanelForm", + xmFormWidgetClass, + XpatViewMapPanel.PANEL, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , 100, + NULL + ); + + XpatViewMapPanel.FRAME = + + XtVaCreateManagedWidget( "XpatViewMapFrame", + xmFrameWidgetClass, + XpatViewMapPanel.PANEL_FORM, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + NULL + ); + + XpatViewMapPanel.FORM = + + XtVaCreateManagedWidget( "XpatViewMapForm", + xmFormWidgetClass, + XpatViewMapPanel.FRAME, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , 100, + NULL + ); + + XpatMapButtonCompute = + + XtVaCreateManagedWidget( "Compute", + xmPushButtonWidgetClass, + XpatViewMapPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 1, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 44, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 89, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 99, + NULL + ); + XpatMapButtonClose = + + XtVaCreateManagedWidget( "Close", + xmPushButtonWidgetClass, + XpatViewMapPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 45, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 99, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 89, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 99, + NULL + ); + + XpatMapWindow = + + XtVaCreateManagedWidget( "XpatMapWindow", + xmDrawingAreaWidgetClass, + XpatViewMapPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 1, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 99, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 1, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 88, + XmNbackground , 1, + XmNforeground , 0, + NULL + ); + + XtAddCallback( XpatMapButtonCompute, + XmNactivateCallback, + CallbackMapCompute, NULL ); + + XtAddCallback( XpatMapButtonClose, + XmNactivateCallback, + CallbackCloseMap, NULL ); + + XtVaSetValues( XpatViewMapPanel.PANEL, + XmNheight, XpatViewMapPanel.HEIGHT, + XmNwidth , XpatViewMapPanel.WIDTH, + XmNx , XpatViewMapPanel.X, + XmNy , XpatViewMapPanel.Y, + NULL ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatEnterMapPanel | +| | +\------------------------------------------------------------*/ + +void XpatEnterMapPanel() + +{ + autbegin(); + + XpatFirstEnterMap = XPAT_FALSE; + + XpatEnterPanel( &XpatViewMapPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatComputeAndDisplayMap | +| | +\------------------------------------------------------------*/ + +void XpatComputeAndDisplayMap() + +{ + + if ( ! XpatFirstEnterMap ) + { + autbegin(); + + XpatInitializeUnitMap(); + XpatClearMapWindow(); + XpatDisplayUnitMap(); + + autend(); + } +} diff --git a/alliance/src/xpat/src/XMV_map.h b/alliance/src/xpat/src/XMV_map.h new file mode 100644 index 00000000..729616ad --- /dev/null +++ b/alliance/src/xpat/src/XMV_map.h @@ -0,0 +1,102 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Map.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_MAP +# define XPAT_MAP + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XPAT_B1UP 0 +# define XPAT_B2UP 1 +# define XPAT_B3UP 2 + +# define XPAT_VIEW_MAP_X 25 +# define XPAT_VIEW_MAP_Y 520 + +# define XPAT_DEFAULT_MAP_X 0 +# define XPAT_DEFAULT_MAP_Y 0 +# define XPAT_DEFAULT_MAP_DX 40 +# define XPAT_DEFAULT_MAP_DY 40 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern Widget XpatMapPanel; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatComputeUnitMap(); + extern void XpatInitializeUnitMap(); + extern void XpatDisplayUnitMap(); + + extern void XpatEnterMapPanel(); + extern void XpatClearMapWindow(); + extern void XpatResizeMapWindow(); + extern void XpatRefreshMapWindow(); + extern void XpatInitializeMapWindow(); + + extern void CallbackCloseMap(); + extern void CallbackMapCompute(); + extern void CallbackMapResize(); + extern void CallbackMapExpose(); + extern void CallbackMapEvent(); + +# endif diff --git a/alliance/src/xpat/src/XMV_menu.c b/alliance/src/xpat/src/XMV_menu.c new file mode 100644 index 00000000..7c6dcc49 --- /dev/null +++ b/alliance/src/xpat/src/XMV_menu.c @@ -0,0 +1,283 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XMV.h" + +# include "XMV_menu.h" +# include "XMV_dialog.h" +# include "XMV_view.h" +# include "XMV_map.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + char XpatFirstViewLayer = 1; + +/*------------------------------------------------------------\ +| | +| Menu | +| | +\------------------------------------------------------------*/ + + XpatMenuItem XpatViewMenu[] = + + { + { + "Zoom", + 'Z', + "MetaZ", + "Meta Z", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackViewZoom, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XpatMenuItem *)NULL + } + , + { + "Layers ", + 'L', + "MetaL", + "Meta L", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackViewLayer, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XpatMenuItem *)NULL + } + , + { + "Map", + 'M', + "MetaP", + "Meta P", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackViewMap, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XpatMenuItem *)NULL + } + , + { + "Arrows ", + 'A', + "MetaA", + "Meta A", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackViewArrows, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XpatMenuItem *)NULL + } + , + { + "Grid ", + 'G', + "MetaG", + "Meta G", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackViewGrid, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XpatMenuItem *)NULL + } + , + NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback For Menu | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackViewLayer | +| | +\------------------------------------------------------------*/ + +void CallbackViewLayer( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + if ( XpatFirstViewLayer ) + { + XpatFirstViewLayer = 0; + + XpatInitializeLayer(); + } + + XpatEnterPanel( &XpatViewLayerPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewGrid | +| | +\------------------------------------------------------------*/ + +void CallbackViewGrid( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatEnterPanel( &XpatViewGridPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewArrows | +| | +\------------------------------------------------------------*/ + +void CallbackViewArrows( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatEnterPanel( &XpatViewArrowsPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewZoom | +| | +\------------------------------------------------------------*/ + +void CallbackViewZoom( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatEnterPanel( &XpatViewZoomPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewMap | +| | +\------------------------------------------------------------*/ + +void CallbackViewMap( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatEnterMapPanel(); + + autend(); +} diff --git a/alliance/src/xpat/src/XMV_menu.h b/alliance/src/xpat/src/XMV_menu.h new file mode 100644 index 00000000..3ab7f254 --- /dev/null +++ b/alliance/src/xpat/src/XMV_menu.h @@ -0,0 +1,82 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_VIEW_MENU +# define XPAT_VIEW_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback View Menu | +| | +\------------------------------------------------------------*/ + + + extern void CallbackViewZoom(); + extern void CallbackViewGrid(); + extern void CallbackViewLayer(); + extern void CallbackViewMap(); + extern void CallbackViewArrows(); + +# endif diff --git a/alliance/src/xpat/src/XMV_message.c b/alliance/src/xpat/src/XMV_message.c new file mode 100644 index 00000000..dac4448d --- /dev/null +++ b/alliance/src/xpat/src/XMV_message.c @@ -0,0 +1,157 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Message.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XPT.h" +# include "XMX.h" +# include "XTB.h" +# include "XMV.h" +# include "XMV_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatPromptZoomIn | +| | +\------------------------------------------------------------*/ + +void XpatPromptZoomIn() + +{ + autbegin(); + + XpatDisplayMessage( XPAT_MESSAGE_MODE, "Zoom In" ); + XpatDisplayMessage( XPAT_MESSAGE_INFO, "Select window" ); + + switch ( XpatCountEventZoom ) + { + case 0 : + + XpatDisplayMessage( XPAT_MESSAGE_PROMPT, "Enter first corner" ); + + break; + + case 1 : + + XpatDisplayMessage( XPAT_MESSAGE_PROMPT, "Enter second corner" ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatPromptZoomPan | +| | +\------------------------------------------------------------*/ + +void XpatPromptZoomPan() + +{ + autbegin(); + + XpatDisplayMessage( XPAT_MESSAGE_MODE, "Zoom Pan" ); + XpatDisplayMessage( XPAT_MESSAGE_INFO, "Select line" ); + + switch ( XpatCountEventZoom ) + { + case 0 : + + XpatDisplayMessage( XPAT_MESSAGE_PROMPT, "Enter source point" ); + + break; + + case 1 : + + XpatDisplayMessage( XPAT_MESSAGE_PROMPT, "Enter target point" ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatPromptZoomCenter | +| | +\------------------------------------------------------------*/ + +void XpatPromptZoomCenter() + +{ + autbegin(); + + XpatDisplayMessage( XPAT_MESSAGE_MODE, "Zoom Center" ); + XpatDisplayMessage( XPAT_MESSAGE_INFO, "Select point" ); + XpatDisplayMessage( XPAT_MESSAGE_PROMPT, "Enter center point" ); + + autend(); +} + diff --git a/alliance/src/xpat/src/XMV_message.h b/alliance/src/xpat/src/XMV_message.h new file mode 100644 index 00000000..7613b2c4 --- /dev/null +++ b/alliance/src/xpat/src/XMV_message.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Message.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_MESSAGE +# define XPAT_MESSAGE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatPromptZoomIn(); + extern void XpatPromptZoomCenter(); + extern void XpatPromptZoomPan(); + +# endif diff --git a/alliance/src/xpat/src/XMV_panel.c b/alliance/src/xpat/src/XMV_panel.c new file mode 100644 index 00000000..d4809068 --- /dev/null +++ b/alliance/src/xpat/src/XMV_panel.c @@ -0,0 +1,2090 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XTB.h" +# include "XPT.h" +# include "XMX.h" +# include "XMV.h" + +# include "XMV_panel.h" +# include "XMV_dialog.h" +# include "XMV_view.h" +# include "XMV_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Panel Pixmap | +| | +\------------------------------------------------------------*/ + + static char XpatPixmapDownArrow[] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xfe, 0xff, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, + 0x00, 0x02, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, + 0x00, 0x02, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, + 0xf0, 0x03, 0x80, 0x1f, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, + 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x20, 0x00, 0x00, 0x08, + 0x40, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, + 0x00, 0x02, 0x80, 0x00, 0x00, 0x04, 0x40, 0x00, 0x00, 0x08, 0x20, 0x00, + 0x00, 0x10, 0x10, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x40, 0x04, 0x00, + 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + static char XpatPixmapLeftArrow[] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x0f, 0x00, 0x00, 0x40, 0x08, 0x00, 0x00, 0x20, 0x08, 0x00, + 0x00, 0x10, 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x04, 0xf8, 0x1f, + 0x00, 0x02, 0x00, 0x10, 0x00, 0x01, 0x00, 0x10, 0x80, 0x00, 0x00, 0x10, + 0x40, 0x00, 0x00, 0x10, 0x20, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, + 0x08, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x20, 0x00, 0x00, 0x10, + 0x40, 0x00, 0x00, 0x10, 0x80, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00, 0x10, + 0x00, 0x02, 0x00, 0x10, 0x00, 0x04, 0xf8, 0x1f, 0x00, 0x08, 0x08, 0x00, + 0x00, 0x10, 0x08, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x40, 0x08, 0x00, + 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + static char XpatPixmapRightArrow[] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xf0, 0x01, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x10, 0x04, 0x00, + 0x00, 0x10, 0x08, 0x00, 0x00, 0x10, 0x10, 0x00, 0xf8, 0x1f, 0x20, 0x00, + 0x08, 0x00, 0x40, 0x00, 0x08, 0x00, 0x80, 0x00, 0x08, 0x00, 0x00, 0x01, + 0x08, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x04, 0x08, 0x00, 0x00, 0x08, + 0x08, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x04, + 0x08, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x01, 0x08, 0x00, 0x80, 0x00, + 0x08, 0x00, 0x40, 0x00, 0xf8, 0x1f, 0x20, 0x00, 0x00, 0x10, 0x10, 0x00, + 0x00, 0x10, 0x08, 0x00, 0x00, 0x10, 0x04, 0x00, 0x00, 0x10, 0x02, 0x00, + 0x00, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + static char XpatPixmapUpArrow[] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x20, 0x02, 0x00, + 0x00, 0x10, 0x04, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x04, 0x10, 0x00, + 0x00, 0x02, 0x20, 0x00, 0x00, 0x01, 0x40, 0x00, 0x80, 0x00, 0x80, 0x00, + 0x40, 0x00, 0x00, 0x01, 0x20, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x04, + 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x08, + 0x08, 0x00, 0x00, 0x08, 0xf8, 0x01, 0xc0, 0x0f, 0x00, 0x01, 0x40, 0x00, + 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x40, 0x00, + 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x40, 0x00, + 0x00, 0x01, 0x40, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + +/*------------------------------------------------------------\ +| | +| Panel Arrows | +| | +\------------------------------------------------------------*/ + + static char *XpatPanelArrowsButtonName[] = + + { + "Left", + "Up", + "Down", + "Right", + "Move Set", + "Close" + }; + + static XpatPanelButtonItem XpatViewArrowsButton[] = + + { + { + &XpatPanelArrowsButtonName[0], + NULL, XpatPixmapLeftArrow, 32, 32, + NULL, + NULL, + 0, 0, + 1, 2, + CallbackLeftArrow, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatPanelArrowsButtonName[1], + NULL, XpatPixmapUpArrow, 32, 32, + NULL, + NULL, + 1, 0, + 1, 2, + CallbackUpArrow, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatPanelArrowsButtonName[2], + NULL, XpatPixmapDownArrow, 32, 32, + NULL, + NULL, + 0, 2, + 1, 2, + CallbackDownArrow, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatPanelArrowsButtonName[3], + NULL, XpatPixmapRightArrow, 32, 32, + NULL, + NULL, + 1, 2, + 1, 2, + CallbackRightArrow, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatPanelArrowsButtonName[4], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 4, + 2, 1, + CallbackMoveSet, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatPanelArrowsButtonName[5], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 5, + 2, 1, + CallbackCloseArrows, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XpatPanelItem XpatViewArrowsPanel = + + { + "Arrows", + 1, + 0, + XPAT_VIEW_ARROWS_X, + XPAT_VIEW_ARROWS_Y, + 100, + 125, + 2, + 6, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XpatViewArrowsButton + }; + + int XpatViewArrowsDefaultValues[ 5 ] = + + { + XPAT_VIEW_ARROWS_X, + XPAT_VIEW_ARROWS_Y, + 100, 125 , 1 + }; + +/*------------------------------------------------------------\ +| | +| Panel Zoom | +| | +\------------------------------------------------------------*/ + + static char *XpatPanelZoomButtonName[] = + + { + "Refresh", + "UnZoom", + "Zoom", + "Mooz", + "Zoom Set", + "Zoom In", + "Center", + "Goto", + "Pan", + "Fit", + "Close" + }; + + + XpatPanelButtonItem XpatViewZoomButton[] = + + { + { + &XpatPanelZoomButtonName[0], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackZoomRefresh, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatPanelZoomButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 1, + 1, 1, + CallbackZoomPrevious, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatPanelZoomButtonName[2], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 2, + 1, 1, + CallbackZoomMore, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatPanelZoomButtonName[3], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 3, + 1, 1, + CallbackZoomLess, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatPanelZoomButtonName[4], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 4, + 1, 1, + CallbackZoomSet, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatPanelZoomButtonName[5], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 5, + 1, 1, + CallbackZoomIn, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatPanelZoomButtonName[6], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 6, + 1, 1, + CallbackZoomCenter, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatPanelZoomButtonName[7], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 7, + 1, 1, + CallbackZoomGoto, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatPanelZoomButtonName[8], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 8, + 1, 1, + CallbackZoomPan, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatPanelZoomButtonName[9], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 9, + 1, 1, + CallbackZoomFit, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatPanelZoomButtonName[10], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 10, + 1, 1, + CallbackCloseZoom, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XpatPanelItem XpatViewZoomPanel = + + { + "Zoom", + 1, + 0, + XPAT_VIEW_ZOOM_X, + XPAT_VIEW_ZOOM_Y, + 100, + 275, + 1, + 11, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XpatViewZoomButton + }; + + int XpatViewZoomDefaultValues[ 5 ] = + + { + XPAT_VIEW_ZOOM_X, + XPAT_VIEW_ZOOM_Y, + 100, 275, 1 + }; + +/*------------------------------------------------------------\ +| | +| Panel Grid | +| | +\------------------------------------------------------------*/ + + static char *XpatPanelGridButtonName[] = + + { + "Grid X", + "Grid Y", + "Grid Off", + "Close" + }; + + + XpatPanelButtonItem XpatViewGridButton[] = + + { + { + &XpatPanelGridButtonName[0], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackSetGridX, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatPanelGridButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 1, + 1, 1, + CallbackSetGridY, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatPanelGridButtonName[2], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 2, + 1, 1, + CallbackGridOnOff, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatPanelGridButtonName[3], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 3, + 1, 1, + CallbackCloseGrid, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XpatPanelItem XpatViewGridPanel = + + { + "Grid", + 1, + 0, + XPAT_VIEW_GRID_X, + XPAT_VIEW_GRID_Y, + 100, + 100, + 1, + 4, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XpatViewGridButton + }; + + int XpatViewGridDefaultValues[ 5 ] = + + { + XPAT_VIEW_GRID_X, + XPAT_VIEW_GRID_Y, + 100, 100, 0 + }; + +/*------------------------------------------------------------\ +| | +| Panel Layer | +| | +\------------------------------------------------------------*/ + + static char *XpatViewLayerButtonBackground = "Black"; + static char *XpatViewLayerButtonForeground = "White"; + + static char *XpatPanelLayerButtonName[] = + + { + "All visible", + "All invisible", + "Vector Text", + "IO Text", + "Apply", + "Close" + }; + + static char *XpatViewLayerCursorType[] = + + { + "Invert", + "Xor" + }; + + static char *XpatViewLayerForceDisplay[] = + + { + "Quick display", + "Force display" + }; + + static char *XpatViewLayerScale[] = + { + "Scale +", + "Scale -" + }; + + XpatPanelButtonItem XpatViewLayerButton[] = + + { + { + &XpatPanelLayerButtonName[0], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerAllVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatPanelLayerButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 1, 0, + 1, 1, + CallbackLayerAllInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XPAT_LAYER_NAME_TABLE[ 0 ][ 0 ], + NULL, NULL, 0, 0, + &XPAT_LAYER_NAME_TABLE[ 0 ][ 1 ], + &XPAT_LAYER_NAME_TABLE[ 0 ][ 2 ], + 0, 1, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + &XPAT_LAYER_NAME_TABLE[ 0 ][ 0 ], + NULL, NULL, 0, 0, + &XPAT_LAYER_NAME_TABLE[ 0 ][ 1 ], + &XPAT_LAYER_NAME_TABLE[ 0 ][ 2 ], + 1, 1, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + &XPAT_LAYER_NAME_TABLE[ 1 ][ 0 ], + NULL, NULL, 0, 0, + &XPAT_LAYER_NAME_TABLE[ 1 ][ 1 ], + &XPAT_LAYER_NAME_TABLE[ 1 ][ 2 ], + 0, 2, + 1, 1, + CallbackLayerVisible, + (XtPointer)1, + (Widget)NULL + } + , + { + &XPAT_LAYER_NAME_TABLE[ 1 ][ 0 ], + NULL, NULL, 0, 0, + &XPAT_LAYER_NAME_TABLE[ 1 ][ 1 ], + &XPAT_LAYER_NAME_TABLE[ 1 ][ 2 ], + 1, 2, + 1, 1, + CallbackLayerInvisible, + (XtPointer)1, + (Widget)NULL + } + , + { + &XPAT_LAYER_NAME_TABLE[ 2 ][ 0 ], + NULL, NULL, 0, 0, + &XPAT_LAYER_NAME_TABLE[ 2 ][ 1 ], + &XPAT_LAYER_NAME_TABLE[ 2 ][ 2 ], + 0, 3, + 1, 1, + CallbackLayerVisible, + (XtPointer)2, + (Widget)NULL + } + , + { + &XPAT_LAYER_NAME_TABLE[ 2 ][ 0 ], + NULL, NULL, 0, 0, + &XPAT_LAYER_NAME_TABLE[ 2 ][ 1 ], + &XPAT_LAYER_NAME_TABLE[ 2 ][ 2 ], + 1, 3, + 1, 1, + CallbackLayerInvisible, + (XtPointer)2, + (Widget)NULL + } + , + { + &XPAT_LAYER_NAME_TABLE[ 3 ][ 0 ], + NULL, NULL, 0, 0, + &XPAT_LAYER_NAME_TABLE[ 3 ][ 1 ], + &XPAT_LAYER_NAME_TABLE[ 3 ][ 2 ], + 0, 4, + 1, 1, + CallbackLayerVisible, + (XtPointer)3, + (Widget)NULL + } + , + { + &XPAT_LAYER_NAME_TABLE[ 3 ][ 0 ], + NULL, NULL, 0, 0, + &XPAT_LAYER_NAME_TABLE[ 3 ][ 1 ], + &XPAT_LAYER_NAME_TABLE[ 3 ][ 2 ], + 1, 4, + 1, 1, + CallbackLayerInvisible, + (XtPointer)3, + (Widget)NULL + } + , + { + &XPAT_LAYER_NAME_TABLE[ 4 ][ 0 ], + NULL, NULL, 0, 0, + &XPAT_LAYER_NAME_TABLE[ 4 ][ 1 ], + &XPAT_LAYER_NAME_TABLE[ 4 ][ 2 ], + 0, 5, + 1, 1, + CallbackLayerVisible, + (XtPointer)4, + (Widget)NULL + } + , + { + &XPAT_LAYER_NAME_TABLE[ 4 ][ 0 ], + NULL, NULL, 0, 0, + &XPAT_LAYER_NAME_TABLE[ 4 ][ 1 ], + &XPAT_LAYER_NAME_TABLE[ 4 ][ 2 ], + 1, 5, + 1, 1, + CallbackLayerInvisible, + (XtPointer)4, + (Widget)NULL + } + , + { + &XPAT_LAYER_NAME_TABLE[ 5 ][ 0 ], + NULL, NULL, 0, 0, + &XPAT_LAYER_NAME_TABLE[ 5 ][ 1 ], + &XPAT_LAYER_NAME_TABLE[ 5 ][ 2 ], + 0, 6, + 1, 1, + CallbackLayerVisible, + (XtPointer)5, + (Widget)NULL + } + , + { + &XPAT_LAYER_NAME_TABLE[ 5 ][ 0 ], + NULL, NULL, 0, 0, + &XPAT_LAYER_NAME_TABLE[ 5 ][ 1 ], + &XPAT_LAYER_NAME_TABLE[ 5 ][ 2 ], + 1, 6, + 1, 1, + CallbackLayerInvisible, + (XtPointer)5, + (Widget)NULL + } + , + { + &XPAT_LAYER_NAME_TABLE[ 6 ][ 0 ], + NULL, NULL, 0, 0, + &XPAT_LAYER_NAME_TABLE[ 6 ][ 1 ], + &XPAT_LAYER_NAME_TABLE[ 6 ][ 2 ], + 0, 7, + 1, 1, + CallbackLayerVisible, + (XtPointer)6, + (Widget)NULL + } + , + { + &XPAT_LAYER_NAME_TABLE[ 6 ][ 0 ], + NULL, NULL, 0, 0, + &XPAT_LAYER_NAME_TABLE[ 6 ][ 1 ], + &XPAT_LAYER_NAME_TABLE[ 6 ][ 2 ], + 1, 7, + 1, 1, + CallbackLayerInvisible, + (XtPointer)6, + (Widget)NULL + } + , + { + &XPAT_LAYER_NAME_TABLE[ 7 ][ 0 ], + NULL, NULL, 0, 0, + &XPAT_LAYER_NAME_TABLE[ 7 ][ 1 ], + &XPAT_LAYER_NAME_TABLE[ 7 ][ 2 ], + 0, 8, + 1, 1, + CallbackLayerVisible, + (XtPointer)7, + (Widget)NULL + } + , + { + &XPAT_LAYER_NAME_TABLE[ 7 ][ 0 ], + NULL, NULL, 0, 0, + &XPAT_LAYER_NAME_TABLE[ 7 ][ 1 ], + &XPAT_LAYER_NAME_TABLE[ 7 ][ 2 ], + 1, 8, + 1, 1, + CallbackLayerInvisible, + (XtPointer)7, + (Widget)NULL + } + , + { + &XPAT_LAYER_NAME_TABLE[ 8 ][ 0 ], + NULL, NULL, 0, 0, + &XPAT_LAYER_NAME_TABLE[ 8 ][ 1 ], + &XPAT_LAYER_NAME_TABLE[ 8 ][ 2 ], + 0, 9, + 1, 1, + CallbackLayerVisible, + (XtPointer)8, + (Widget)NULL + } + , + { + &XPAT_LAYER_NAME_TABLE[ 8 ][ 0 ], + NULL, NULL, 0, 0, + &XPAT_LAYER_NAME_TABLE[ 8 ][ 1 ], + &XPAT_LAYER_NAME_TABLE[ 8 ][ 2 ], + 1, 9, + 1, 1, + CallbackLayerInvisible, + (XtPointer)8, + (Widget)NULL + } + , + { + &XPAT_LAYER_NAME_TABLE[ 9 ][ 0 ], + NULL, NULL, 0, 0, + &XPAT_LAYER_NAME_TABLE[ 9 ][ 1 ], + &XPAT_LAYER_NAME_TABLE[ 9 ][ 2 ], + 0, 10, + 1, 1, + CallbackLayerVisible, + (XtPointer)9, + (Widget)NULL + } + , + { + &XPAT_LAYER_NAME_TABLE[ 9 ][ 0 ], + NULL, NULL, 0, 0, + &XPAT_LAYER_NAME_TABLE[ 9 ][ 1 ], + &XPAT_LAYER_NAME_TABLE[ 9 ][ 2 ], + 1, 10, + 1, 1, + CallbackLayerInvisible, + (XtPointer)9, + (Widget)NULL + } + , + { + &XpatPanelLayerButtonName[2], + NULL, NULL, 0, 0, + &XpatViewLayerButtonForeground, + &XpatViewLayerButtonBackground, + 0, 11, + 1, 1, + CallbackNameVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + &XpatPanelLayerButtonName[2], + NULL, NULL, 0, 0, + &XpatViewLayerButtonForeground, + &XpatViewLayerButtonBackground, + 1, 11, + 1, 1, + CallbackNameInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + &XpatPanelLayerButtonName[3], + NULL, NULL, 0, 0, + &XpatViewLayerButtonForeground, + &XpatViewLayerButtonBackground, + 0, 12, + 1, 1, + CallbackNameVisible, + (XtPointer)1, + (Widget)NULL + } + , + { + &XpatPanelLayerButtonName[3], + NULL, NULL, 0, 0, + &XpatViewLayerButtonForeground, + &XpatViewLayerButtonBackground, + 1, 12, + 1, 1, + CallbackNameInvisible, + (XtPointer)1, + (Widget)NULL + } + , + { + &XpatViewLayerCursorType[0], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 13, + 1, 1, + CallbackLayerCursor, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatViewLayerForceDisplay[0], + NULL, NULL, 0, 0, + NULL, + NULL, + 1, 13, + 1, 1, + CallbackLayerForceDisplay, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatViewLayerScale[0], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 14, + 1, 1, + CallbackLayerScale, + (XtPointer)0, + (Widget)NULL + } + , + { + &XpatViewLayerScale[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 1, 14, + 1, 1, + CallbackLayerScale, + (XtPointer)1, + (Widget)NULL + } + , + { + &XpatPanelLayerButtonName[4], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 15, + 1, 1, + CallbackLayerApply, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XpatPanelLayerButtonName[5], + NULL, NULL, 0, 0, + NULL, + NULL, + 1, 15, + 1, 1, + CallbackCloseLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XpatPanelItem XpatViewLayerPanel = + + { + "Layer", + 1, + 0, + XPAT_VIEW_LAYER_X, + XPAT_VIEW_LAYER_Y, + 200, + 400, + 2, + 16, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XpatViewLayerButton + }; + + int XpatViewLayerDefaultValues[ 5 ] = + + { + XPAT_VIEW_LAYER_X, + XPAT_VIEW_LAYER_Y, + 200, 400, 0 + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback For Arrows | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackLeftArrow | +| | +\------------------------------------------------------------*/ + +void CallbackLeftArrow( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatZoomLeft(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackRightArrow | +| | +\------------------------------------------------------------*/ + +void CallbackRightArrow( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatZoomRight(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackUpArrow | +| | +\------------------------------------------------------------*/ + +void CallbackUpArrow( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatZoomUp(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackDownArrow | +| | +\------------------------------------------------------------*/ + +void CallbackDownArrow( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatZoomDown(); + + autend(); +} + + +/*------------------------------------------------------------\ +| | +| CallbackMoveSet | +| | +\------------------------------------------------------------*/ + +void CallbackMoveSet( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatEnterDialog( &XpatViewMoveSetDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCloseArrows | +| | +\------------------------------------------------------------*/ + +void CallbackCloseArrows( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatExitPanel( &XpatViewArrowsPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Zoom Callback | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackZoomRefresh | +| | +\------------------------------------------------------------*/ + +void CallbackZoomRefresh( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatZoomRefresh(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomPrevious | +| | +\------------------------------------------------------------*/ + +void CallbackZoomPrevious( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatZoomUndo(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomLess | +| | +\------------------------------------------------------------*/ + +void CallbackZoomLess( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatZoomLess(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomMore | +| | +\------------------------------------------------------------*/ + +void CallbackZoomMore( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatZoomMore(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomSet | +| | +\------------------------------------------------------------*/ + +void CallbackZoomSet( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatEnterDialog( &XpatViewZoomSetDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCloseZoom | +| | +\------------------------------------------------------------*/ + +void CallbackCloseZoom( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatExitPanel( &XpatViewZoomPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomIn | +| | +\------------------------------------------------------------*/ + +void CallbackZoomIn( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatChangeEditMode( XPAT_ZOOM_IN, + XpatPromptZoomIn ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomCenter | +| | +\------------------------------------------------------------*/ + +void CallbackZoomCenter( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatChangeEditMode( XPAT_ZOOM_CENTER, + XpatPromptZoomCenter ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomGoto | +| | +\------------------------------------------------------------*/ + +void CallbackZoomGoto( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatEnterDialog( &XpatViewZoomGotoDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomPan | +| | +\------------------------------------------------------------*/ + +void CallbackZoomPan( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatChangeEditMode( XPAT_ZOOM_PAN, + XpatPromptZoomPan ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomFit | +| | +\------------------------------------------------------------*/ + +void CallbackZoomFit( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatZoomFit(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Grid | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackSetGridX | +| | +\------------------------------------------------------------*/ + +void CallbackSetGridX( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatEnterDialog( &XpatViewGridXDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSetGridY | +| | +\------------------------------------------------------------*/ + +void CallbackSetGridY( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatEnterDialog( &XpatViewGridYDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackGridOnOff | +| | +\------------------------------------------------------------*/ + +void CallbackGridOnOff( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + XmString Label; + + autbegin(); + + XpatUnitUserGrid = ! XpatUnitUserGrid; + + if ( XpatUnitUserGrid == XPAT_FALSE ) + { + Label = XmStringCreateSimple( "Grid Off" ); + } + else + { + Label = XmStringCreateSimple( "Grid On" ); + } + + XtVaSetValues( MyWidget, XmNlabelString, Label, + XmNresizable , False, + NULL ); + XmStringFree( Label ); + + XpatZoomRefresh(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCloseGrid | +| | +\------------------------------------------------------------*/ + +void CallbackCloseGrid( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatExitPanel( &XpatViewGridPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Layer | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackLayerAllVisible | +| | +\------------------------------------------------------------*/ + +void CallbackLayerAllVisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatLayerAllVisible(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerAllInvisible | +| | +\------------------------------------------------------------*/ + +void CallbackLayerAllInvisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatLayerAllInvisible(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerVisible | +| | +\------------------------------------------------------------*/ + +void CallbackLayerVisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + if ( XPAT_ACTIVE_LAYER_TABLE[ (int)ClientData ] == 0 ) + { + XpatSetLayerVisible( (int)ClientData ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerInvisible | +| | +\------------------------------------------------------------*/ + +void CallbackLayerInvisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + if ( XPAT_ACTIVE_LAYER_TABLE[ (int)ClientData ] ) + { + XpatSetLayerInvisible( (int)ClientData ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackNameVisible | +| | +\------------------------------------------------------------*/ + +void CallbackNameVisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + if ( XPAT_ACTIVE_NAME_TABLE[ (int)ClientData ] == 0 ) + { + XpatSetNameVisible( ClientData ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackNameInvisible | +| | +\------------------------------------------------------------*/ + +void CallbackNameInvisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + if ( XPAT_ACTIVE_NAME_TABLE[ (int)ClientData ] ) + { + XpatSetNameInvisible( ClientData ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerCursor | +| | +\------------------------------------------------------------*/ + +void CallbackLayerCursor( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XPAT_XOR_CURSOR = ! XPAT_XOR_CURSOR; + XpatChangeCursor( XPAT_XOR_CURSOR ); + + XpatChangeCursorContext(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerForceDisplay | +| | +\------------------------------------------------------------*/ + +void CallbackLayerForceDisplay( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XPAT_FORCE_DISPLAY = ! XPAT_FORCE_DISPLAY; + XpatChangeForceDisplay( XPAT_FORCE_DISPLAY ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerScale | +| | +\------------------------------------------------------------*/ + +void CallbackLayerScale( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatReScale( ClientData ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatChangeCursor | +| | +\------------------------------------------------------------*/ + +void XpatChangeCursor( Type ) + + char Type; +{ + int Pos; + XmString Label; + + autbegin(); + + Pos = 2 + ( ( XPAT_MAX_LAYER + XPAT_MAX_ACTIVE_NAME ) << 1 ); + Label = XmStringCreateSimple( XpatViewLayerCursorType[ Type ] ); + + XtVaSetValues( XpatViewLayerButton[ Pos ].BUTTON, + XmNlabelString, Label, + XmNresizable , False, + NULL ); + + XmStringFree( Label ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatChangeForceDisplay | +| | +\------------------------------------------------------------*/ + +void XpatChangeForceDisplay( Index ) + + char Index; +{ + int Pos; + XmString Label; + + autbegin(); + + Pos = 3 + ( ( XPAT_MAX_LAYER + XPAT_MAX_ACTIVE_NAME ) << 1 ); + Label = XmStringCreateSimple( XpatViewLayerForceDisplay[ Index ] ); + + XtVaSetValues( XpatViewLayerButton[ Pos ].BUTTON, + XmNlabelString, Label, + XmNresizable , False, + NULL ); + + XmStringFree( Label ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerApply | +| | +\------------------------------------------------------------*/ + +void CallbackLayerApply( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatZoomRefresh(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCloseLayer | +| | +\------------------------------------------------------------*/ + +void CallbackCloseLayer( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XpatExitPanel( &XpatViewLayerPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatSetLayerVisible | +| | +\------------------------------------------------------------*/ + +void XpatSetLayerVisible( Layer ) + + int Layer; +{ + int Index; + char *Background; + char *Foreground; + + autbegin(); + + Index = ( Layer << 1 ) + 2; + + if ( XpatViewLayerButton[ Index ].BUTTON != NULL ) + { + XPAT_ACTIVE_LAYER_TABLE[ Layer ] = 1; + + XtVaSetValues( XpatViewLayerButton[ Index + 1 ].BUTTON, + XtVaTypedArg , + XmNbackground , + XmRString , + XPAT_BLACK_COLOR_NAME , + strlen( XPAT_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + XtVaSetValues( XpatViewLayerButton[ Index + 1 ].BUTTON, + XtVaTypedArg , + XmNforeground , + XmRString , + XPAT_BLACK_COLOR_NAME , + strlen( XPAT_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + Background = *XpatViewLayerButton[ Index ].BACKGROUND; + Foreground = *XpatViewLayerButton[ Index ].FOREGROUND; + + XtVaSetValues( XpatViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNbackground , + XmRString , + Background , + strlen( Background ) + 1, + NULL + ); + + XtVaSetValues( XpatViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNforeground , + XmRString , + Foreground , + strlen( Foreground ) + 1, + NULL + ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatSetNameVisible | +| | +\------------------------------------------------------------*/ + +void XpatSetNameVisible( Name ) + + int Name; +{ + int Index; + char *Background; + char *Foreground; + + autbegin(); + + Index = 2 + ( ( XPAT_MAX_LAYER + Name ) << 1 ); + + if ( XpatViewLayerButton[ Index ].BUTTON != NULL ) + { + XPAT_ACTIVE_NAME_TABLE[ Name ] = 1; + + XtVaSetValues( XpatViewLayerButton[ Index + 1 ].BUTTON, + XtVaTypedArg , + XmNbackground , + XmRString , + XPAT_BLACK_COLOR_NAME , + strlen( XPAT_BLACK_COLOR_NAME ) + 1, + NULL + ); + + XtVaSetValues( XpatViewLayerButton[ Index + 1 ].BUTTON, + XtVaTypedArg , + XmNforeground , + XmRString , + XPAT_BLACK_COLOR_NAME , + strlen( XPAT_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + Background = *XpatViewLayerButton[ Index ].BACKGROUND; + Foreground = *XpatViewLayerButton[ Index ].FOREGROUND; + + XtVaSetValues( XpatViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNbackground , + XmRString , + Background , + strlen( Background ) + 1, + NULL + ); + + XtVaSetValues( XpatViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNforeground , + XmRString , + Foreground , + strlen( Foreground ) + 1, + NULL + ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatSetLayerInvisible | +| | +\------------------------------------------------------------*/ + +void XpatSetLayerInvisible( Layer ) + + int Layer; +{ + int Index; + char *Background; + char *Foreground; + + autbegin(); + + Index = 3 + ( Layer << 1 ); + + if ( XpatViewLayerButton[ Index ].BUTTON != NULL ) + { + XPAT_ACTIVE_LAYER_TABLE[ Layer ] = 0; + + XtVaSetValues( XpatViewLayerButton[ Index - 1 ].BUTTON, + XtVaTypedArg , + XmNbackground , + XmRString , + XPAT_BLACK_COLOR_NAME , + strlen( XPAT_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + XtVaSetValues( XpatViewLayerButton[ Index - 1 ].BUTTON, + XtVaTypedArg , + XmNforeground , + XmRString , + XPAT_BLACK_COLOR_NAME , + strlen( XPAT_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + Background = *XpatViewLayerButton[ Index ].BACKGROUND; + Foreground = *XpatViewLayerButton[ Index ].FOREGROUND; + + XtVaSetValues( XpatViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNbackground , + XmRString , + Background , + strlen( Background ) + 1 , + NULL + ); + + XtVaSetValues( XpatViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNforeground , + XmRString , + Foreground , + strlen( Foreground ) + 1 , + NULL + ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatSetNameInvisible | +| | +\------------------------------------------------------------*/ + +void XpatSetNameInvisible( Name ) + + int Name; +{ + int Index; + char *Background; + char *Foreground; + + autbegin(); + + Index = 3 + ( ( XPAT_MAX_LAYER + Name ) << 1 ); + + if ( XpatViewLayerButton[ Index ].BUTTON != NULL ) + { + XPAT_ACTIVE_NAME_TABLE[ Name ] = 0; + + XtVaSetValues( XpatViewLayerButton[ Index - 1 ].BUTTON, + XtVaTypedArg , + XmNbackground , + XmRString , + XPAT_BLACK_COLOR_NAME , + strlen( XPAT_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + XtVaSetValues( XpatViewLayerButton[ Index - 1 ].BUTTON, + XtVaTypedArg , + XmNforeground , + XmRString , + XPAT_BLACK_COLOR_NAME , + strlen( XPAT_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + Background = *XpatViewLayerButton[ Index ].BACKGROUND; + Foreground = *XpatViewLayerButton[ Index ].FOREGROUND; + + XtVaSetValues( XpatViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNbackground , + XmRString , + Background , + strlen( Background ) + 1 , + NULL + ); + + XtVaSetValues( XpatViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNforeground , + XmRString , + Foreground , + strlen( Foreground ) + 1 , + NULL + ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatLayerAllVisible | +| | +\------------------------------------------------------------*/ + +void XpatLayerAllVisible() + +{ + int Index; + + autbegin(); + + for ( Index = 0; Index < XPAT_MAX_LAYER; Index++ ) + { + XpatSetLayerVisible( Index ); + } + + for ( Index = 0; Index < XPAT_MAX_ACTIVE_NAME; Index++ ) + { + XpatSetNameVisible( Index ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatInitializeLayer | +| | +\------------------------------------------------------------*/ + +void XpatInitializeLayer() + +{ + int Index; + + autbegin(); + + for ( Index = 0; Index < XPAT_MAX_LAYER; Index++ ) + { + if ( XPAT_ACTIVE_LAYER_TABLE[ Index ] == 0 ) + { + XpatSetLayerInvisible( Index ); + } + else + { + XpatSetLayerVisible( Index ); + } + } + + for ( Index = 0; Index < XPAT_MAX_ACTIVE_NAME; Index++ ) + { + if ( XPAT_ACTIVE_NAME_TABLE[ Index ] == 0 ) + { + XpatSetNameInvisible( Index ); + } + else + { + XpatSetNameVisible( Index ); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatLayerAllInvisible | +| | +\------------------------------------------------------------*/ + +void XpatLayerAllInvisible() + +{ + int Index; + + autbegin(); + + for ( Index = 0; Index < XPAT_MAX_LAYER; Index++ ) + { + XpatSetLayerInvisible( Index ); + } + + for ( Index = 0; Index < XPAT_MAX_ACTIVE_NAME; Index++ ) + { + XpatSetNameInvisible( Index ); + } + + autend(); +} diff --git a/alliance/src/xpat/src/XMV_panel.h b/alliance/src/xpat/src/XMV_panel.h new file mode 100644 index 00000000..9de951f5 --- /dev/null +++ b/alliance/src/xpat/src/XMV_panel.h @@ -0,0 +1,132 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_VIEW_PANEL +# define XPAT_VIEW_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XPAT_VIEW_ARROWS_X 990 +# define XPAT_VIEW_ARROWS_Y 80 +# define XPAT_VIEW_ZOOM_X 990 +# define XPAT_VIEW_ZOOM_Y 230 +# define XPAT_VIEW_GRID_X 470 +# define XPAT_VIEW_GRID_Y 330 +# define XPAT_VIEW_LAYER_X 430 +# define XPAT_VIEW_LAYER_Y 190 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback View Panel | +| | +\------------------------------------------------------------*/ + + extern void CallbackLeftArrow(); + extern void CallbackRightArrow(); + extern void CallbackUpArrow(); + extern void CallbackDownArrow(); + extern void CallbackMoveSet(); + extern void CallbackCloseArrows(); + + extern void CallbackZoomRefresh(); + extern void CallbackZoomPrevious(); + extern void CallbackZoomLess(); + extern void CallbackZoomMore(); + extern void CallbackZoomSet(); + extern void CallbackZoomIn(); + extern void CallbackZoomFit(); + extern void CallbackZoomCenter(); + extern void CallbackZoomGoto(); + extern void CallbackZoomPan(); + extern void CallbackCloseZoom(); + + extern void CallbackSetGridX(); + extern void CallbackSetGridY(); + extern void CallbackGridOnOff(); + extern void CallbackCloseGrid(); + + extern void CallbackLayerAllVisible(); + extern void CallbackLayerAllInvisible(); + extern void CallbackLayerVisible(); + extern void CallbackLayerInvisible(); + extern void CallbackLayerCursor(); + extern void CallbackLayerForceDisplay(); + extern void CallbackLayerScale(); + extern void CallbackNameVisible(); + extern void CallbackNameInvisible(); + + extern void CallbackLayerApply(); + extern void CallbackCloseLayer(); + + extern void XpatChangeForceDisplay(); + extern void XpatChangeCursor(); + + extern void XpatSetLayerVisible(); + extern void XpatSetLayerInvisible(); + extern void XpatSetNameVisible(); + extern void XpatSetNameInvisible(); + extern void XpatLayerAllVisible(); + extern void XpatLayerAllInvisible(); + +# endif diff --git a/alliance/src/xpat/src/XMV_view.c b/alliance/src/xpat/src/XMV_view.c new file mode 100644 index 00000000..37e62d9e --- /dev/null +++ b/alliance/src/xpat/src/XMV_view.c @@ -0,0 +1,721 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : View.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XPT.h" +# include "XTB.h" +# include "XMX.h" +# include "XMV.h" + +# include "XMV_view.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + xpatzoom *XpatHeadZoom = (xpatzoom *)NULL; + + int XpatPercentZoom = XPAT_PERCENT_ZOOM; + int XpatPercentMoveX = XPAT_PERCENT_MOVE; + int XpatPercentMoveY = XPAT_PERCENT_MOVE; + +/*------------------------------------------------------------\ +| | +| Menu | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatAllocZoom | +| | +\------------------------------------------------------------*/ + +xpatzoom *XpatAllocZoom () + +{ + return ( (xpatzoom *) autalloc( sizeof ( xpatzoom ), 1)); +} + +/*------------------------------------------------------------\ +| | +| XpatFreeZoom | +| | +\------------------------------------------------------------*/ + +void XpatFreeZoom ( FreeZoom ) + + xpatzoom *FreeZoom; + +{ + autfree( (char *)FreeZoom, sizeof(FreeZoom) ); +} + +/*------------------------------------------------------------\ +| | +| XpatAddZoom | +| | +\------------------------------------------------------------*/ + +void XpatAddZoom () + +{ + xpatzoom *XpatZoom; + + autbegin(); + + XpatZoom = XpatAllocZoom (); + XpatZoom->X = XpatUnitGridX; + XpatZoom->Y = XpatUnitGridY; + XpatZoom->DX = XpatUnitGridDx; + XpatZoom->DY = XpatUnitGridDy; + XpatZoom->NEXT = XpatHeadZoom; + XpatHeadZoom = XpatZoom; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatDelZoom | +| | +\------------------------------------------------------------*/ + +char XpatDelZoom() + +{ + xpatzoom *XpatZoom; + + if ( XpatHeadZoom != (xpatzoom *) NULL ) + { + autbegin(); + + XpatZoom = XpatHeadZoom; + XpatHeadZoom = XpatHeadZoom->NEXT; + XpatFreeZoom( XpatZoom ); + + autend(); + return( XPAT_TRUE ); + } + + return( XPAT_FALSE ); +} + +/*------------------------------------------------------------\ +| | +| XpatInitializeZoom | +| | +\------------------------------------------------------------*/ + +void XpatInitializeZoom() + +{ + autbegin(); + + while( XpatDelZoom() != XPAT_FALSE ); + + if ( XpatComputeBound() == XPAT_FALSE ) + { + XpatInitializeUnitGrid(); + } + else + { + XpatZoomFit(); + + while( XpatDelZoom() != XPAT_FALSE ); + } + + XpatComputeAndDisplayMap(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatZoomUndo | +| | +\------------------------------------------------------------*/ + +void XpatZoomUndo() + +{ + autbegin(); + + if ( XpatHeadZoom == (xpatzoom *)NULL ) + { + XpatErrorMessage( XpatMainWindow, "No previous zoom !" ); + } + else + { + XpatSetMouseCursor( XpatGraphicWindow, XPAT_WATCH_CURSOR ); + + XpatUnitGridX = XpatHeadZoom->X; + XpatUnitGridY = XpatHeadZoom->Y; + XpatUnitGridDx = XpatHeadZoom->DX; + XpatUnitGridDy = XpatHeadZoom->DY; + + XpatComputeUnitGrid(); + XpatComputeAndDisplayMap(); + + XpatDisplayFigure( 0, 0, + XpatGraphicDx, XpatGraphicDy ); + + XpatRefreshGraphicWindow( 0, 0, + XpatGraphicDx, XpatGraphicDy); + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_NORMAL_CURSOR ); + + XpatDelZoom(); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatZoomRight | +| | +\------------------------------------------------------------*/ + +void XpatZoomRight() + +{ + long Delta; + long Offset; + long XpatOldPixelGridX; + + autbegin(); + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_WATCH_CURSOR ); + + Delta = ( XpatPercentMoveX * XpatUnitGridDx ) / 100; + + if ( Delta == 0 ) Delta = 1; + + XpatUnitGridX = XpatUnitGridX + Delta; + XpatOldPixelGridX = XpatPixelGridX; + XpatPixelGridX = (float)(XpatUnitGridX) * XpatUnitGridStep; + Offset = XpatPixelGridX - XpatOldPixelGridX; + + XCopyArea( XpatGraphicDisplay, + XpatGraphicPixmap, + XpatGraphicPixmap, + XpatBackgroundGC, + Offset, 0, + XpatGraphicDx - Offset, + XpatGraphicDy, + 0, 0 + ); + + XpatComputeAndDisplayMap(); + XpatDisplayFigure( XpatGraphicDx - Offset, 0, + XpatGraphicDx, XpatGraphicDy ); + XpatRefreshGraphicWindow( 0, 0, + XpatGraphicDx, XpatGraphicDy); + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatZoomLeft | +| | +\------------------------------------------------------------*/ + +void XpatZoomLeft() + +{ + long Delta; + long Offset; + long XpatOldPixelGridX; + + autbegin(); + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_WATCH_CURSOR ); + + Delta = ( XpatPercentMoveX * XpatUnitGridDx ) / 100; + + if ( Delta == 0 ) Delta = 1; + + XpatUnitGridX = XpatUnitGridX - Delta; + XpatOldPixelGridX = XpatPixelGridX; + XpatPixelGridX = (float)(XpatUnitGridX) * XpatUnitGridStep; + Offset = XpatOldPixelGridX - XpatPixelGridX; + + XCopyArea( XpatGraphicDisplay, + XpatGraphicPixmap, + XpatGraphicPixmap, + XpatBackgroundGC, + 0, 0, + XpatGraphicDx - Offset, + XpatGraphicDy, + Offset, 0 + ); + + XpatComputeAndDisplayMap(); + XpatDisplayFigure( 0, 0, Offset, XpatGraphicDy ); + XpatRefreshGraphicWindow( 0, 0, XpatGraphicDx, XpatGraphicDy); + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatZoomDown | +| | +\------------------------------------------------------------*/ + +void XpatZoomDown() + +{ + long Delta; + long Offset; + long XpatOldPixelGridY; + + autbegin(); + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_WATCH_CURSOR ); + + Delta = ( XpatPercentMoveY * XpatUnitGridDy ) / 100; + + if ( Delta == 0 ) Delta = 1; + + XpatUnitGridY = XpatUnitGridY - Delta; + XpatOldPixelGridY = XpatPixelGridY; + XpatPixelGridY = (float)(XpatUnitGridY) * XpatUnitGridStep; + Offset = XpatOldPixelGridY - XpatPixelGridY; + + XCopyArea( XpatGraphicDisplay, + XpatGraphicPixmap, + XpatGraphicPixmap, + XpatBackgroundGC, + 0, Offset, + XpatGraphicDx, + XpatGraphicDy - Offset, + 0, 0 + ); + + XpatComputeAndDisplayMap(); + XpatDisplayFigure( 0, 0, XpatGraphicDx, Offset ); + XpatRefreshGraphicWindow( 0, 0, XpatGraphicDx, XpatGraphicDy); + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatZoomUp | +| | +\------------------------------------------------------------*/ + +void XpatZoomUp() + +{ + long Delta; + long Offset; + long XpatOldPixelGridY; + + autbegin(); + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_WATCH_CURSOR ); + + Delta = ( XpatPercentMoveY * XpatUnitGridDy ) / 100; + + if ( Delta == 0 ) Delta = 1; + + XpatUnitGridY = XpatUnitGridY + Delta; + XpatOldPixelGridY = XpatPixelGridY; + XpatPixelGridY = (float)(XpatUnitGridY) * XpatUnitGridStep; + Offset = XpatPixelGridY - XpatOldPixelGridY; + + XCopyArea( XpatGraphicDisplay, + XpatGraphicPixmap, + XpatGraphicPixmap, + XpatBackgroundGC, + 0, 0, + XpatGraphicDx, + XpatGraphicDy - Offset, + 0, Offset + ); + + XpatComputeAndDisplayMap(); + XpatDisplayFigure( 0, XpatGraphicDy - Offset, + XpatGraphicDx, XpatGraphicDy ); + XpatRefreshGraphicWindow( 0, 0, XpatGraphicDx, XpatGraphicDy); + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatZoomMore | +| | +\------------------------------------------------------------*/ + +void XpatZoomMore() + +{ + long DeltaX; + long DeltaY; + + autbegin(); + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_WATCH_CURSOR ); + + DeltaX = ( XpatPercentZoom * XpatUnitGridDx ) / 100; + DeltaY = ( XpatPercentZoom * XpatUnitGridDy ) / 100; + + if ( ( DeltaX >= 2 ) && + ( DeltaY >= 2 ) ) + { + XpatAddZoom(); + + XpatUnitGridX = XpatUnitGridX + (DeltaX >> 1); + XpatUnitGridY = XpatUnitGridY + (DeltaY >> 1); + XpatUnitGridDx = XpatUnitGridDx - DeltaX; + XpatUnitGridDy = XpatUnitGridDy - DeltaY; + + XpatComputeUnitGrid(); + XpatComputeAndDisplayMap(); + XpatDisplayFigure( 0, 0, XpatGraphicDx, XpatGraphicDy ); + XpatRefreshGraphicWindow( 0, 0, XpatGraphicDx, XpatGraphicDy ); + } + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatZoomLess | +| | +\------------------------------------------------------------*/ + +void XpatZoomLess() + +{ + long DeltaX; + long DeltaY; + + autbegin(); + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_WATCH_CURSOR ); + + DeltaX = 100 * XpatUnitGridDx / ( 100 - XpatPercentZoom ); + DeltaY = 100 * XpatUnitGridDy / ( 100 - XpatPercentZoom ); + + XpatAddZoom(); + + XpatUnitGridX = XpatUnitGridX - ((DeltaX - XpatUnitGridDx) >> 1); + XpatUnitGridY = XpatUnitGridY - ((DeltaY - XpatUnitGridDy) >> 1); + XpatUnitGridDx = DeltaX; + XpatUnitGridDy = DeltaY; + + XpatComputeUnitGrid(); + XpatComputeAndDisplayMap(); + XpatDisplayFigure( 0, 0, XpatGraphicDx, XpatGraphicDy ); + XpatRefreshGraphicWindow( 0, 0, XpatGraphicDx, XpatGraphicDy ); + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatZoomFit | +| | +\------------------------------------------------------------*/ + +void XpatZoomFit() + +{ + long DeltaX; + long DeltaY; + long Delta; + + autbegin(); + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_WATCH_CURSOR ); + + if ( XpatComputeBound() == XPAT_FALSE ) + { + XpatErrorMessage( XpatMainWindow, "No element to display !" ); + } + else + { + XpatAddZoom(); + + XpatUnitGridX = 0; + XpatUnitGridY = ( XpatBoundYmin / XPAT_UNIT ) - 1; + XpatUnitGridDx = 1; + XpatUnitGridDy = XpatBoundYmax / XPAT_UNIT; + XpatUnitGridDx = XpatUnitGridDx - XpatUnitGridX + 1; + XpatUnitGridDy = XpatUnitGridDy - XpatUnitGridY + 1; + + XpatComputeUnitGrid(); + + DeltaX = 5 * XpatUnitGridDx / 4; + DeltaY = 5 * XpatUnitGridDy / 4; + + XpatUnitGridX = XpatUnitGridX - ((DeltaX - XpatUnitGridDx) >> 1); + XpatUnitGridY = XpatUnitGridY - ((DeltaY - XpatUnitGridDy) >> 1); + XpatUnitGridDx = DeltaX; + XpatUnitGridDy = DeltaY; + + XpatComputeUnitGrid(); + + Delta = ( 3 * XpatUnitGridDx ) / 10; + + if ( Delta == 0 ) Delta = 1; + + XpatUnitGridX = XpatUnitGridX - Delta; + XpatPixelGridX = (float)(XpatUnitGridX) * XpatUnitGridStep; + + XpatComputeUnitGrid(); + XpatComputeAndDisplayMap(); + XpatDisplayFigure( 0, 0, XpatGraphicDx, XpatGraphicDy ); + XpatRefreshGraphicWindow( 0, 0, XpatGraphicDx, XpatGraphicDy ); + } + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatZoomCenter | +| | +\------------------------------------------------------------*/ + +void XpatZoomCenter( UnitX, UnitY ) + + long UnitX; + long UnitY; +{ + autbegin(); + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_WATCH_CURSOR ); + + XpatUnitGridX = UnitX - ( XpatUnitGridDx >> 1 ); + XpatUnitGridY = UnitY - ( XpatUnitGridDy >> 1 ); + + XpatComputeUnitGrid(); + XpatComputeAndDisplayMap(); + XpatDisplayFigure( 0, 0, XpatGraphicDx, XpatGraphicDy ); + XpatRefreshGraphicWindow( 0, 0, XpatGraphicDx, XpatGraphicDy ); + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatZoomIn | +| | +\------------------------------------------------------------*/ + +void XpatZoomIn( UnitX1, UnitY1, UnitX2, UnitY2 ) + + long UnitX1; + long UnitY1; + long UnitX2; + long UnitY2; +{ + long Swap; + + autbegin(); + + if ( ( UnitX1 != UnitX2 ) && + ( UnitY1 != UnitY2 ) ) + { + if ( UnitX1 > UnitX2 ) + { + Swap = UnitX1; UnitX1 = UnitX2; UnitX2 = Swap; + } + + if ( UnitY1 > UnitY2 ) + { + Swap = UnitY1; UnitY1 = UnitY2; UnitY2 = Swap; + } + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_WATCH_CURSOR ); + + XpatAddZoom(); + + XpatUnitGridX = UnitX1; + XpatUnitGridY = UnitY1; + XpatUnitGridDx = UnitX2 - UnitX1; + XpatUnitGridDy = UnitY2 - UnitY1; + + XpatComputeUnitGrid(); + XpatComputeAndDisplayMap(); + XpatDisplayFigure( 0, 0, XpatGraphicDx, XpatGraphicDy ); + XpatRefreshGraphicWindow( 0, 0, XpatGraphicDx, XpatGraphicDy ); + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_NORMAL_CURSOR ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatZoomPan | +| | +\------------------------------------------------------------*/ + +void XpatZoomPan( UnitX1, UnitY1, UnitX2, UnitY2 ) + + long UnitX1; + long UnitY1; + long UnitX2; + long UnitY2; +{ + if ( ( UnitX1 != UnitX2 ) || + ( UnitY1 != UnitY2 ) ) + { + autbegin(); + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_WATCH_CURSOR ); + + XpatUnitGridX = XpatUnitGridX + ( UnitX1 - UnitX2 ); + XpatUnitGridY = XpatUnitGridY + ( UnitY1 - UnitY2 ); + + XpatComputeUnitGrid(); + XpatComputeAndDisplayMap(); + XpatDisplayFigure( 0, 0, XpatGraphicDx, XpatGraphicDy ); + XpatRefreshGraphicWindow( 0, 0, XpatGraphicDx, XpatGraphicDy ); + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_NORMAL_CURSOR ); + + autend(); + } +} + +/*------------------------------------------------------------\ +| | +| XpatZoomRefresh | +| | +\------------------------------------------------------------*/ + +void XpatZoomRefresh() + +{ + autbegin(); + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_WATCH_CURSOR ); + + XpatDisplayFigure( 0, 0, XpatGraphicDx, XpatGraphicDy ); + XpatRefreshGraphicWindow( 0, 0, XpatGraphicDx, XpatGraphicDy ); + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatReScale | +| | +\------------------------------------------------------------*/ + +void XpatReScale( Less ) + + int Less; +{ + double Ratio; + + autbegin(); + + Ratio = XpatReScaleFigure( Less ); + + XpatBoundYmin *= Ratio; + XpatBoundYmax *= Ratio; + + XpatUnitGridY *= Ratio; + XpatUnitGridDx = 1; + XpatUnitGridDy *= Ratio; + + if ( XpatUnitGridX < 0 ) XpatUnitGridX *= Ratio; + + XpatComputeUnitGrid(); + XpatComputeAndDisplayMap(); + XpatZoomRefresh(); + + autend(); +} diff --git a/alliance/src/xpat/src/XMV_view.h b/alliance/src/xpat/src/XMV_view.h new file mode 100644 index 00000000..0a3b8616 --- /dev/null +++ b/alliance/src/xpat/src/XMV_view.h @@ -0,0 +1,108 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : View.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_VIEW +# define XPAT_VIEW + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XPAT_PERCENT_ZOOM 15 +# define XPAT_PERCENT_ZOOM_MIN 5 +# define XPAT_PERCENT_ZOOM_MAX 95 + +# define XPAT_PERCENT_MOVE 15 +# define XPAT_PERCENT_MOVE_MIN 5 +# define XPAT_PERCENT_MOVE_MAX 95 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct xpatzoom + { + struct xpatzoom *NEXT; + + long X; + long Y; + long DX; + long DY; + + } xpatzoom; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern int XpatPercentZoom; + extern int XpatPercentMove; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatZoomUndo(); + extern void XpatZoomRefresh(); + + extern void XpatZoomLeft(); + extern void XpatZoomRight(); + extern void XpatZoomUp(); + extern void XpatZoomDown(); + + extern void XpatZoomMore(); + extern void XpatZoomLess(); + + extern void XpatZoomFit(); + +# endif diff --git a/alliance/src/xpat/src/XMX.h b/alliance/src/xpat/src/XMX.h new file mode 100644 index 00000000..ba78b5ab --- /dev/null +++ b/alliance/src/xpat/src/XMX.h @@ -0,0 +1,273 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : XMX.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_XMX +# define XPAT_XMX + +/*------------------------------------------------------------\ +| | +| Graphic Context | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Colors Define | +| | +\------------------------------------------------------------*/ + +# define XPAT_BLACK_COLOR_NAME "Black" + +/*------------------------------------------------------------\ +| | +| Xpat Message | +| | +\------------------------------------------------------------*/ + +# define XPAT_MAX_MESSAGE 6 + +# define XPAT_MESSAGE_X 0 +# define XPAT_MESSAGE_Y 1 +# define XPAT_MESSAGE_DX 2 +# define XPAT_MESSAGE_MODE 3 +# define XPAT_MESSAGE_INFO 4 +# define XPAT_MESSAGE_PROMPT 5 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Xpat Widget | +| | +\------------------------------------------------------------*/ + + extern XtAppContext XpatApplication; + extern Widget XpatTopLevel; + extern Widget XpatMainWindow; + extern Widget XpatMainForm; + + extern Widget XpatMenuBar; + + extern Widget XpatGraphicFrame; + extern Widget XpatGraphicWindow; + extern Display *XpatGraphicDisplay; + + extern Widget XpatMessageMainPaned; + extern Widget XpatMessageMainForm; + extern Widget XpatMessageForm [ XPAT_MAX_MESSAGE ]; + extern Widget XpatMessageText [ XPAT_MAX_MESSAGE ]; + extern Widget XpatMessageLabel [ XPAT_MAX_MESSAGE ]; + extern Widget XpatMessageFrame [ XPAT_MAX_MESSAGE ]; + +/*------------------------------------------------------------\ +| | +| Xpat Graphic Context | +| | +\------------------------------------------------------------*/ + + extern GC XpatBackgroundGC; + extern GC XpatGridGC; + extern GC XpatXorGC; + extern GC XpatAcceptDrawGC; + extern GC XpatConnectDrawGC; + extern GC XpatLayerDrawGC[ XPAT_MAX_LAYER ]; + extern GC XpatSmallTextGC; + extern GC XpatMediumTextGC; + extern GC XpatLargeTextGC; + + extern XFontStruct *XpatSmallTextFont; + extern XFontStruct *XpatLargeTextFont; + extern XFontStruct *XpatMediumTextFont; + +/*------------------------------------------------------------\ +| | +| Xpat Graphic Pixmap | +| | +\------------------------------------------------------------*/ + + extern Pixmap XpatGraphicPixmap; + +/*------------------------------------------------------------\ +| | +| Xpat Graphic Size | +| | +\------------------------------------------------------------*/ + + extern Dimension XpatOldGraphicDx; + extern Dimension XpatOldGraphicDy; + extern Dimension XpatGraphicDx; + extern Dimension XpatGraphicDy; + +/*------------------------------------------------------------\ +| | +| Xpat Unit Grid | +| | +\------------------------------------------------------------*/ + + extern float XpatUnitGridStep; + extern long XpatUnitGridX; + extern long XpatUnitGridY; + extern long XpatUnitGridDx; + extern long XpatUnitGridDy; + extern long XpatPixelGridX; + extern long XpatPixelGridY; + +/*------------------------------------------------------------\ +| | +| User Unit Grid | +| | +\------------------------------------------------------------*/ + + extern long XpatUnitUserGridDx; + extern long XpatUnitUserGridDy; + extern char XpatUnitUserGrid; + +/*------------------------------------------------------------\ +| | +| Xpat Cursor | +| | +\------------------------------------------------------------*/ + + extern long XpatUnitCursorX; + extern long XpatUnitCursorY; + +/*------------------------------------------------------------\ +| | +| Xpat Event | +| | +\------------------------------------------------------------*/ + + extern char XpatCountEventZoom; + extern char XpatCountEventEdit; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatInitializeRessources | +| | +\------------------------------------------------------------*/ + + extern void XpatInitializeRessources(); + +/*------------------------------------------------------------\ +| | +| Xpat Change Title | +| | +\------------------------------------------------------------*/ + + extern void XpatChangeTopLevelTitle(); + +/*------------------------------------------------------------\ +| | +| Xpat Edit Mode | +| | +\------------------------------------------------------------*/ + + extern void XpatChangeEditMode(); + extern void XpatContinueEditMode(); + +/*------------------------------------------------------------\ +| | +| XpatDisplayMessage | +| | +\------------------------------------------------------------*/ + + extern void XpatDisplayMessage(); + extern void XpatPromptEditMeasure(); + +/*------------------------------------------------------------\ +| | +| Xpat Graphic Window | +| | +\------------------------------------------------------------*/ + + extern void XpatClearGraphicWindow(); + extern void XpatResizeGraphicWindow(); + extern void XpatRefreshGraphicWindow(); + +/*------------------------------------------------------------\ +| | +| Xpat Unit Grid | +| | +\------------------------------------------------------------*/ + + extern void XpatComputeUnitGrid(); + extern void XpatResizeUnitGrid(); + +/*------------------------------------------------------------\ +| | +| Xpat Display Figure | +| | +\------------------------------------------------------------*/ + + extern void XpatDisplayFigure(); + extern void XpatDisplayObject(); + +/*------------------------------------------------------------\ +| | +| Xpat Cursor | +| | +\------------------------------------------------------------*/ + + extern void XpatDisplayCursor(); + extern void XpatUndisplayCursor(); + +# endif diff --git a/alliance/src/xpat/src/XMX_color.c b/alliance/src/xpat/src/XMX_color.c new file mode 100644 index 00000000..947020fd --- /dev/null +++ b/alliance/src/xpat/src/XMX_color.c @@ -0,0 +1,347 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Colors.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XMX.h" +# include "XMX_color.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + GC XpatBackgroundGC; + GC XpatGridGC; + GC XpatAcceptDrawGC; + GC XpatConnectDrawGC; + GC XpatLayerDrawGC[ XPAT_MAX_LAYER ]; + + GC XpatSmallTextGC; + GC XpatMediumTextGC; + GC XpatLargeTextGC; + GC XpatXorGCXor; + GC XpatXorGCInvert; + GC XpatXorGC; + + XFontStruct *XpatLargeTextFont; + XFontStruct *XpatMediumTextFont; + XFontStruct *XpatSmallTextFont; + + Colormap XpatColorMap; + +/*------------------------------------------------------------\ +| | +| Layer Color Define | +| | +\------------------------------------------------------------*/ + + static char **XpatColorName[ 5 ] = + + { + &XPAT_BACKGROUND_COLOR_NAME, + &XPAT_FOREGROUND_COLOR_NAME, + &XPAT_CURSOR_COLOR_NAME, + &XPAT_ACCEPT_COLOR_NAME, + &XPAT_CONNECT_COLOR_NAME + }; + + static int XpatColor[ XPAT_MAX_COLOR ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatSwitchColormap | +| | +\------------------------------------------------------------*/ + +void XpatInitializeColorMap() +{ + Display *ADisplay; + Screen *AScreen; + + ADisplay = XtDisplay( XpatTopLevel ); + AScreen = XtScreen( XpatTopLevel ); + XpatColorMap = DefaultColormapOfScreen( AScreen ); + + if ( XPAT_SWITCH_COLOR_MAP ) + { + XpatColorMap = XCopyColormapAndFree( ADisplay, XpatColorMap ); + XInstallColormap( ADisplay, XpatColorMap ); + XtVaSetValues( XpatTopLevel, XmNcolormap, XpatColorMap, NULL ); + } +} + +/*------------------------------------------------------------\ +| | +| XpatInitializeColors | +| | +\------------------------------------------------------------*/ + +void XpatInitializeColors() + +{ + XColor ForgetIt; + XColor GetIt; + Window Root; + int Counter; + char Error; + char *ColorName; + + autbegin(); + + Error = False; + + for ( Counter = 0; Counter < XPAT_MAX_COLOR; Counter++ ) + { + if ( Counter < 5 ) + { + ColorName = *XpatColorName[ Counter ]; + } + else + { + ColorName = XPAT_LAYER_NAME_TABLE[ Counter - 5 ][ 1 ]; + } + + if ( ColorName != (char *)NULL ) + { + if ( ! XAllocNamedColor( XpatGraphicDisplay, + XpatColorMap, ColorName, + &GetIt, &ForgetIt ) ) + { + fprintf ( stderr, "\nXmx: Unable to allocate color '%s' !\n", + ColorName ); + + Error = True; + } + + XpatColor[ Counter ] = GetIt.pixel; + } + else + { + XpatColor[ Counter ] = XpatColor[ 0 ]; + } + } + + if ( Error == True ) exit( 1 ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatChangeCursorContext | +| | +\------------------------------------------------------------*/ + +void XpatChangeCursorContext() +{ + XGCValues GraphicValue; + + if ( XPAT_XOR_CURSOR == XPAT_TRUE ) + { + XpatXorGC = XpatXorGCXor; + } + else + { + XpatXorGC = XpatXorGCInvert; + } +} + +/*------------------------------------------------------------\ +| | +| XpatInitializeGraphicContext | +| | +\------------------------------------------------------------*/ + +void XpatInitializeGraphicContext() + +{ + XGCValues GraphicValue; + int Counter; + Window Root; + + autbegin(); + + XpatLargeTextFont = XLoadQueryFont( XpatGraphicDisplay, + XPAT_LARGE_TEXT_FONT_NAME ); + + XpatMediumTextFont = XLoadQueryFont( XpatGraphicDisplay, + XPAT_MEDIUM_TEXT_FONT_NAME ); + + XpatSmallTextFont = XLoadQueryFont( XpatGraphicDisplay, + XPAT_SMALL_TEXT_FONT_NAME ); + + GraphicValue.foreground = XpatColor[ 0 ]; /* Black */ + GraphicValue.background = XpatColor[ 0 ]; + GraphicValue.plane_mask = AllPlanes; + + Root = RootWindowOfScreen ( XtScreen ( XpatGraphicWindow ) ), + + XpatBackgroundGC = XCreateGC ( XpatGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + GraphicValue.foreground = XpatColor[ 1 ]; /* White */ + + XpatGridGC = XCreateGC ( XpatGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + GraphicValue.foreground = XpatColor[ 1 ]; /* Text */ + + XpatSmallTextGC = XCreateGC ( XpatGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + XpatMediumTextGC = XCreateGC ( XpatGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + XpatLargeTextGC = XCreateGC ( XpatGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + XSetFont( XpatGraphicDisplay, + XpatSmallTextGC, XpatSmallTextFont->fid ); + + XSetFont( XpatGraphicDisplay, + XpatMediumTextGC, XpatMediumTextFont->fid ); + + XSetFont( XpatGraphicDisplay, + XpatLargeTextGC, XpatLargeTextFont->fid ); + + GraphicValue.background = XpatColor[ 2 ]; + GraphicValue.foreground = XpatColor[ 2 ]; + GraphicValue.function = GXxor; + + XpatXorGCXor = XCreateGC ( XpatGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCFunction | + GCPlaneMask ), + &GraphicValue ); + + GraphicValue.function = GXinvert; + + XpatXorGCInvert = XCreateGC ( XpatGraphicDisplay, + Root, + ( GCFunction | + GCPlaneMask ), + &GraphicValue ); + XpatChangeCursorContext(); + + + GraphicValue.background = XpatColor[ 0 ]; /* Black */ + GraphicValue.foreground = XpatColor[ 3 ]; /* Accept Color */ + + XpatAcceptDrawGC = XCreateGC ( XpatGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + GraphicValue.foreground = XpatColor[ 4 ]; /* Connect Color */ + + XpatConnectDrawGC = XCreateGC ( XpatGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + for ( Counter = 0; Counter < XPAT_MAX_LAYER; Counter++ ) + { + GraphicValue.foreground = XpatColor[ Counter + 5 ]; + + XpatLayerDrawGC[ Counter ] = + + XCreateGC ( XpatGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + } + + autend(); +} diff --git a/alliance/src/xpat/src/XMX_color.h b/alliance/src/xpat/src/XMX_color.h new file mode 100644 index 00000000..843cc2df --- /dev/null +++ b/alliance/src/xpat/src/XMX_color.h @@ -0,0 +1,87 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Color.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_COLOR +# define XPAT_COLOR + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Pattern | +| | +\------------------------------------------------------------*/ + +# define XPAT_MAX_COLOR ( 5 + XPAT_MAX_LAYER ) + +# define XPAT_LARGE_TEXT_FONT_NAME "9x15" +# define XPAT_MEDIUM_TEXT_FONT_NAME "7x13" +# define XPAT_SMALL_TEXT_FONT_NAME "5x8" + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatInitializeGraphicContext(); + extern void XpatInitializeColors(); + extern void XpatChangeCursorContext(); + extern void XpatInitializeColorMap(); + +# endif diff --git a/alliance/src/xpat/src/XMX_cursor.c b/alliance/src/xpat/src/XMX_cursor.c new file mode 100644 index 00000000..1d75d177 --- /dev/null +++ b/alliance/src/xpat/src/XMX_cursor.c @@ -0,0 +1,575 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Cursor.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XPT.h" +# include "XMX.h" +# include "XMX_grid.h" +# include "XMX_cursor.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Buffer | +| | +\------------------------------------------------------------*/ + + static char XpatCursorBuffer[ XPAT_MAX_CURSOR_BUFFER ]; + + char *XpatTimeUnit[ PAT_TU__MS + 1 ] = + { + "vu", + "fs", + "ps", + "ns", + "us", + "ms" + }; + +/*------------------------------------------------------------\ +| | +| Coordinates | +| | +\------------------------------------------------------------*/ + + Position XpatCursorX = 0; + Position XpatCursorY = 0; + Position XpatCursorSaveX = 0; + Position XpatCursorSaveY = 0; + char XpatCursorSaved = XPAT_FALSE; + char XpatCursorInside = XPAT_FALSE; + char XpatCursorType = XPAT_INPUT_HALF_BOX; + + long XpatUnitCursorX = 0; + long XpatUnitCursorY = 0; + long XpatPixelCursorX = 0; + long XpatPixelCursorY = 0; + + long XpatUnitCursorSaveX[ 2 ] = { 0, 0 }; + long XpatUnitCursorSaveY[ 2 ] = { 0, 0 }; + char XpatCursorIndex = 0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatComputeCursor | +| | +\------------------------------------------------------------*/ + +void XpatComputeCursor( X, Y ) + + Position X; + Position Y; +{ + autbegin(); + + Y = XpatGraphicDy - Y; + + XpatUnitCursorX = X + XpatPixelGridX; + XpatUnitCursorY = Y + XpatPixelGridY; + + if ( XpatUnitCursorX < 0 ) + { + XpatUnitCursorX = ((float)(XpatUnitCursorX) / XpatUnitGridStep) - 0.5 ; + } + else + { + XpatUnitCursorX = ((float)(XpatUnitCursorX) / XpatUnitGridStep) + 0.5 ; + } + + if ( XpatUnitCursorY < 0 ) + { + XpatUnitCursorY = ((float)(XpatUnitCursorY) / XpatUnitGridStep) - 0.5 ; + } + else + { + XpatUnitCursorY = ((float)(XpatUnitCursorY) / XpatUnitGridStep) + 0.5 ; + } + + XpatPixelCursorX = ((float)(XpatUnitCursorX) * XpatUnitGridStep); + XpatPixelCursorY = ((float)(XpatUnitCursorY) * XpatUnitGridStep); + + XpatCursorX = XpatPixelCursorX - XpatPixelGridX; + XpatCursorY = XpatPixelCursorY - XpatPixelGridY; + XpatCursorY = XpatGraphicDy - XpatCursorY; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatDisplayCoordinates | +| | +\------------------------------------------------------------*/ + +void XpatDisplayCoordinates() + +{ + char **NameArray; + long NumberIO; + char *NameX; + char *NameY; + int Unit; + long X; + long Y; + long Dx; + long Dy; + long TimeDelta; + + autbegin(); + + X = XpatUnitCursorX / XPAT_PATTERN_STEP_X; + Y = XpatUnitCursorY / XPAT_PATTERN_STEP_Y; + Dx = X - ( XpatUnitCursorSaveX[0] / XPAT_PATTERN_STEP_X ); + Dy = Y - ( XpatUnitCursorSaveX[1] / XPAT_PATTERN_STEP_Y ); + + NameX = (char *)0; + NameY = (char *)0; + + if ( XpatFigurePat != (patfig_list *)0 ) + { + NameArray = XpatFigurePat->IO_NAME_ARRAY; + NumberIO = XpatFigurePat->IO_NUMBER; + + if ( ( Y < NumberIO ) && + ( Y >= 0 ) ) + { + NameY = NameArray[ Y ];; + } + } + + if ( NameY == (char *)0 ) XpatCursorBuffer[ 0 ] = '\0'; + else sprintf( XpatCursorBuffer, "%s", NameY ); + + XpatDisplayMessage( XPAT_MESSAGE_Y, XpatCursorBuffer ); + + if ( XpatFigurePat != (patfig_list *)0 ) + { + Unit = XpatFigurePat->TIME_UNIT; + TimeDelta = XpatFigurePat->TIME_DELTA; + } + else + { + Unit = 0; + TimeDelta = 1; + } + + sprintf( XpatCursorBuffer, "%ld %s", X * TimeDelta, XpatTimeUnit[ Unit ] ); + XpatDisplayMessage( XPAT_MESSAGE_X, XpatCursorBuffer ); + + sprintf( XpatCursorBuffer, "%ld %s", Dx * TimeDelta, XpatTimeUnit[ Unit ] ); + XpatDisplayMessage( XPAT_MESSAGE_DX, XpatCursorBuffer ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatPointCursor | +| | +\------------------------------------------------------------*/ + +void XpatPointCursor() + +{ + autbegin(); + + XpatUndisplayCursor(); + + XpatUnitCursorSaveX[ XpatCursorIndex ] = XpatUnitCursorX; + XpatUnitCursorSaveY[ XpatCursorIndex ] = XpatUnitCursorY; + + XpatCursorIndex = XpatCursorIndex + 1; + + XpatDisplayCursor(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatResetCursor | +| | +\------------------------------------------------------------*/ + +void XpatResetCursor() + +{ + autbegin(); + + XpatUndisplayCursor(); + + XpatCursorIndex = XpatCursorIndex - 1; + + XpatDisplayCursor(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatChangeCursor | +| | +\------------------------------------------------------------*/ + +void XpatChangeCursorType( ArrayX, ArrayY, Index, Type ) + + long *ArrayX; + long *ArrayY; + char Index; + char Type; +{ + autbegin(); + + XpatUndisplayCursor(); + + XpatCursorType = Type; + XpatCursorIndex = Index; + + if ( Index != 0 ) + { + XpatUnitCursorSaveX[ 0 ] = ArrayX[0]; + XpatUnitCursorSaveY[ 0 ] = ArrayY[0]; + XpatUnitCursorSaveX[ 1 ] = ArrayX[1]; + XpatUnitCursorSaveY[ 1 ] = ArrayY[1]; + } + + XpatDisplayCursor(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatDrawCursor | +| | +\------------------------------------------------------------*/ + +void XpatDrawCursor() + +{ + long X1; + long Y1; + long X2; + long Y2; + long DeltaX; + long DeltaY; + long Swap; + char DrawLine; + + autbegin(); + + XDrawLine( XpatGraphicDisplay, + XtWindow( XpatGraphicWindow ), + XpatXorGC, + XpatCursorSaveX - XPAT_CURSOR_SIZE, + XpatCursorSaveY - XPAT_CURSOR_SIZE, + XpatCursorSaveX + XPAT_CURSOR_SIZE, + XpatCursorSaveY + XPAT_CURSOR_SIZE ); + + XDrawLine( XpatGraphicDisplay, + XtWindow( XpatGraphicWindow ), + XpatXorGC, + XpatCursorSaveX - XPAT_CURSOR_SIZE, + XpatCursorSaveY + XPAT_CURSOR_SIZE, + XpatCursorSaveX + XPAT_CURSOR_SIZE, + XpatCursorSaveY - XPAT_CURSOR_SIZE ); + + if ( XpatCursorIndex > 0 ) + { + X1 = (float)(XpatUnitCursorSaveX[0]) * XpatUnitGridStep; + Y1 = (float)(XpatUnitCursorSaveY[0]) * XpatUnitGridStep; + X1 = X1 - XpatPixelGridX; + Y1 = Y1 - XpatPixelGridY; + Y1 = XpatGraphicDy - Y1; + + if ( XpatCursorIndex == 1 ) + { + X2 = XpatCursorSaveX; + Y2 = XpatCursorSaveY; + } + else + { + X2 = (float)(XpatUnitCursorSaveX[1]) * XpatUnitGridStep; + Y2 = (float)(XpatUnitCursorSaveY[1]) * XpatUnitGridStep; + X2 = X2 - XpatPixelGridX; + Y2 = Y2 - XpatPixelGridY; + Y2 = XpatGraphicDy - Y2; + } + + switch( XpatCursorType ) + { + case XPAT_INPUT_POINT : + + break; + + case XPAT_INPUT_LINE : + + XDrawLine( XpatGraphicDisplay, + XtWindow( XpatGraphicWindow ), + XpatXorGC, + X1, Y1, X2, Y2 ); + break; + + case XPAT_INPUT_HALF_BOX : + + XDrawLine( XpatGraphicDisplay, + XtWindow( XpatGraphicWindow ), + XpatXorGC, + X1, Y1, X2, Y1 ); + + XDrawLine( XpatGraphicDisplay, + XtWindow( XpatGraphicWindow ), + XpatXorGC, + X2, 0, X2, XpatGraphicDy ); + + break; + + case XPAT_INPUT_ORTHO : + case XPAT_INPUT_SORTHO : + case XPAT_INPUT_LSTRING : + + DeltaX = X2 - X1; if ( DeltaX < 0 ) DeltaX = - DeltaX; + DeltaY = Y2 - Y1; if ( DeltaY < 0 ) DeltaY = - DeltaY; + + if ( DeltaX > DeltaY ) + { + Y2 = Y1; + + if ( X1 > X2 ) { Swap = X1; X1 = X2; X2 = Swap; } + + if ( X1 < 0 ) X1 = 0; + if ( X2 > XpatGraphicDx ) X2 = XpatGraphicDx; + + if ( ( X1 < X2 ) && + ( Y1 >= 0 ) && + ( Y1 <= XpatGraphicDy ) ) + { + XDrawLine( XpatGraphicDisplay, + XtWindow( XpatGraphicWindow ), + XpatXorGC, + X1, Y1, X2, Y2 ); + } + } + else + { + X2 = X1; + + if ( Y1 > Y2 ) { Swap = Y1; Y1 = Y2; Y2 = Swap; } + + if ( Y1 < 0 ) Y1 = 0; + if ( Y2 > XpatGraphicDy ) Y2 = XpatGraphicDy; + + if ( ( Y1 < Y2 ) && + ( X1 >= 0 ) && + ( X1 <= XpatGraphicDx ) ) + { + XDrawLine( XpatGraphicDisplay, + XtWindow( XpatGraphicWindow ), + XpatXorGC, + X1, Y1, X2, Y2 ); + } + } + + break; + + case XPAT_INPUT_BOX : + + if ( X1 > X2 ) { Swap = X1; X1 = X2; X2 = Swap; } + if ( Y1 > Y2 ) { Swap = Y1; Y1 = Y2; Y2 = Swap; } + + DrawLine = 0; + + if ( X1 < 0 ) { X1 = 0; DrawLine |= XPAT_WEST; } + if ( X2 > XpatGraphicDx ) { X2 = XpatGraphicDx; DrawLine |= XPAT_EAST; } + if ( Y1 < 0 ) { Y1 = 0; DrawLine |= XPAT_SOUTH; } + if ( Y2 > XpatGraphicDy ) { Y2 = XpatGraphicDy; DrawLine |= XPAT_NORTH; } + + if ( DrawLine == 0 ) + { + XDrawRectangle( XpatGraphicDisplay, + XtWindow( XpatGraphicWindow ), + XpatXorGC, + X1, Y1, + X2 - X1, Y2 - Y1 ); + } + else + { + if ( ( DrawLine & XPAT_WEST ) == 0 ) + { + XDrawLine( XpatGraphicDisplay, + XtWindow( XpatGraphicWindow ), + XpatXorGC, + X1, Y2, + X1, Y1 ); + } + + if ( ( DrawLine & XPAT_EAST ) == 0 ) + { + XDrawLine( XpatGraphicDisplay, + XtWindow( XpatGraphicWindow ), + XpatXorGC, + X2, Y2, + X2, Y1 ); + } + + if ( ( DrawLine & XPAT_SOUTH ) == 0 ) + { + XDrawLine( XpatGraphicDisplay, + XtWindow( XpatGraphicWindow ), + XpatXorGC, + X1, Y1, + X2, Y1 ); + } + + if ( ( DrawLine & XPAT_NORTH ) == 0 ) + { + XDrawLine( XpatGraphicDisplay, + XtWindow( XpatGraphicWindow ), + XpatXorGC, + X1, Y2, + X2, Y2 ); + } + } + + break; + + } + } + else + { + XDrawLine( XpatGraphicDisplay, + XtWindow( XpatGraphicWindow ), + XpatXorGC, + XpatCursorSaveX, 0, XpatCursorSaveX, XpatGraphicDy ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatUndisplayCursor | +| | +\------------------------------------------------------------*/ + +void XpatUndisplayCursor() + +{ + autbegin(); + + if ( XpatCursorInside == XPAT_TRUE ) + { + if ( XpatCursorSaved == XPAT_TRUE ) + { + XpatDrawCursor(); + } + + XpatCursorSaved = XPAT_FALSE; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatDisplayCursor | +| | +\------------------------------------------------------------*/ + +void XpatDisplayCursor() + +{ + autbegin(); + + if ( XpatCursorInside == XPAT_TRUE ) + { + if ( XpatCursorSaved == XPAT_TRUE ) + { + XpatDrawCursor(); + + XpatCursorSaved = XPAT_FALSE; + } + + if ( ( XpatCursorY >= 0 ) && + ( XpatCursorX <= XpatGraphicDx ) ) + { + XpatCursorSaveX = XpatCursorX; + XpatCursorSaveY = XpatCursorY; + + XpatDrawCursor(); + + XpatCursorSaved = XPAT_TRUE; + } + } + + autend(); +} diff --git a/alliance/src/xpat/src/XMX_cursor.h b/alliance/src/xpat/src/XMX_cursor.h new file mode 100644 index 00000000..63910b13 --- /dev/null +++ b/alliance/src/xpat/src/XMX_cursor.h @@ -0,0 +1,95 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Cursor.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_CURSOR +# define XPAT_CURSOR + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XPAT_MAX_CURSOR_BUFFER 256 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern Position XpatCursorX; + extern Position XpatCursorY; + extern Position XpatCursorSaveX; + extern Position XpatCursorSaveY; + extern char XpatCursorSaved; + extern char XpatCursorInside; + extern long XpatLambdaCursorX; + extern long XpatLambdaCursorY; + + extern long XpatPixelCursorX; + extern long XpatPixelCursorY; + + extern long XpatPixelCursorX1; + extern long XpatPixelCursorY1; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatComputeCursor(); + extern void XpatChangeCursorType(); + extern void XpatPointCursor(); + extern void XpatResetCursor(); + extern void XpatDisplayCoordinates(); + +# endif diff --git a/alliance/src/xpat/src/XMX_dialog.c b/alliance/src/xpat/src/XMX_dialog.c new file mode 100644 index 00000000..3c1c844a --- /dev/null +++ b/alliance/src/xpat/src/XMX_dialog.c @@ -0,0 +1,102 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XTB.h" +# include "XMF.h" +# include "XMV.h" +# include "XMT.h" +# include "XMS.h" +# include "XMH.h" +# include "XMX.h" + +# include "XMX_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatInitializeDialog | +| | +\------------------------------------------------------------*/ + +void XpatInitializeDialog() + +{ + autbegin(); + + XpatBuildFileDialog(); + XpatBuildEditDialog(); + XpatBuildViewDialog(); + + autend(); +} diff --git a/alliance/src/xpat/src/XMX_dialog.h b/alliance/src/xpat/src/XMX_dialog.h new file mode 100644 index 00000000..617332a4 --- /dev/null +++ b/alliance/src/xpat/src/XMX_dialog.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_DIALOG +# define XPAT_DIALOG + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatInitializeDialog(); + +# endif diff --git a/alliance/src/xpat/src/XMX_event.c b/alliance/src/xpat/src/XMX_event.c new file mode 100644 index 00000000..83ed1666 --- /dev/null +++ b/alliance/src/xpat/src/XMX_event.c @@ -0,0 +1,812 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Event.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XPT.h" +# include "XMX.h" +# include "XTB.h" +# include "XME.h" +# include "XMV.h" +# include "XMS.h" +# include "XMH.h" +# include "XMX_motif.h" +# include "XMX_grid.h" +# include "XMX_cursor.h" +# include "XMX_event.h" +# include "XMX_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Translation | +| | +\------------------------------------------------------------*/ + + static String XpatEventTranslation = + + ": CallbackEvent( 0 )\n\ + : CallbackEvent( 1 )\n\ + : CallbackEvent( 2 )\n\ + : CallbackEvent( 3 )\n\ + : CallbackEvent( 4 )\n\ + osfUp: CallbackEvent( 5 )\n\ + osfDown: CallbackEvent( 6 )\n\ + osfLeft: CallbackEvent( 7 )\n\ + osfRight: CallbackEvent( 8 )\n\ + Z: CallbackEvent( 9 )\n\ + M: CallbackEvent( 10 )\n\ + F: CallbackEvent( 11 )\n\ + R: CallbackEvent( 12 )\n\ + U: CallbackEvent( 13 )\n\ + I: CallbackEvent( 14 )\n\ + C: CallbackEvent( 15 )\n\ + P: CallbackEvent( 16 )\n\ + +: CallbackEvent( 17 )\n\ + -: CallbackEvent( 18 )\n"; + + +/*------------------------------------------------------------\ +| | +| Event Count | +| | +\------------------------------------------------------------*/ + + static char XpatMaxEventEditTable[] = + + { + 2, /* XPAT_EDIT_MEASURE */ + 1, /* XPAT_EDIT_IDENTIFY */ + 1, /* XPAT_EDIT_CONNECTED */ + 1, /* XPAT_EDIT_ADD_CURSOR */ + 1 /* XPAT_EDIT_DEL_CURSOR */ + }; + + static char XpatInputEventEditTable[] = + + { + XPAT_INPUT_HALF_BOX, /* XPAT_EDIT_MEASURE */ + XPAT_INPUT_POINT, /* XPAT_EDIT_IDENTIFY */ + XPAT_INPUT_POINT, /* XPAT_EDIT_CONNECTED */ + XPAT_INPUT_POINT, /* XPAT_EDIT_ADD_CURSOR */ + XPAT_INPUT_POINT /* XPAT_EDIT_DEL_CURSOR */ + }; + + static char XpatMaxEventZoomTable[] = + + { + 1, /* XPAT_ZOOM_CENTER */ + 2, /* XPAT_ZOOM_IN */ + 2 /* XPAT_ZOOM_PAN */ + }; + + static char XpatInputEventZoomTable[] = + + { + XPAT_INPUT_POINT, /* XPAT_ZOOM_CENTER */ + XPAT_INPUT_BOX, /* XPAT_ZOOM_IN */ + XPAT_INPUT_LINE /* XPAT_ZOOM_PAN */ + }; + +/*------------------------------------------------------------\ +| | +| Translation | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Expose Edit Zoom | +| | +\------------------------------------------------------------*/ + + static long XpatUnitEventZoomX[ 2 ] = { 0, 0 }; + static long XpatUnitEventZoomY[ 2 ] = { 0, 0 }; + static char XpatMaxEventZoom = 0; + char XpatCountEventZoom = 0; + + static long XpatUnitEventEditX[ 2 ] = { 0, 0 }; + static long XpatUnitEventEditY[ 2 ] = { 0, 0 }; + static char XpatMaxEventEdit = 2; + char XpatCountEventEdit = 0; + + static char XpatFirstExpose = XPAT_TRUE; + +/*------------------------------------------------------------\ +| | +| Input | +| | +\------------------------------------------------------------*/ + + static char XpatInputMode = XPAT_INPUT_HALF_BOX; + static char XpatSaveInputMode = XPAT_INPUT_HALF_BOX; + static char XpatEditMode = XPAT_EDIT_MEASURE; + static char XpatSaveEditMode = XPAT_EDIT_MEASURE; + +/*------------------------------------------------------------\ +| | +| Edit Message | +| | +\------------------------------------------------------------*/ + + static void (*XpatPromptMessage)() = XpatPromptEditMeasure; + static void (*XpatSavePromptMessage)() = XpatPromptEditMeasure; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatChangeEditMode | +| | +\------------------------------------------------------------*/ + +void XpatChangeEditMode( EditMode , PromptMessage ) + + char EditMode; + void (*PromptMessage)(); +{ + autbegin(); + + if ( EditMode & XPAT_ZOOM_MARK ) + { + EditMode = EditMode & ~XPAT_ZOOM_MARK; + + XpatCountEventZoom = 0; + XpatMaxEventZoom = XpatMaxEventZoomTable[ EditMode ]; + + if ( ! ( XpatEditMode & XPAT_ZOOM_MARK ) ) + { + XpatSaveEditMode = XpatEditMode; + XpatSaveInputMode = XpatInputMode; + XpatSavePromptMessage = XpatPromptMessage; + } + + XpatInputMode = XpatInputEventZoomTable[ EditMode ]; + XpatPromptMessage = PromptMessage; + XpatEditMode = EditMode | XPAT_ZOOM_MARK; + + XpatChangeCursorType( NULL, NULL, 0, XpatInputMode ); + } + else + { + if ( XpatEditMode & XPAT_ZOOM_MARK ) + { + XpatSaveEditMode = EditMode; + XpatSaveInputMode = XpatInputEventEditTable[ EditMode ]; + XpatSavePromptMessage = PromptMessage; + XpatCountEventEdit = 0; + XpatMaxEventEdit = XpatMaxEventEditTable[ EditMode ]; + } + else + { + if ( XpatEditMode != EditMode ) + { + XpatCountEventEdit = 0; + XpatMaxEventEdit = XpatMaxEventEditTable[ EditMode ]; + XpatEditMode = EditMode; + XpatInputMode = XpatInputEventEditTable[ EditMode ]; + XpatPromptMessage = PromptMessage; + + XpatChangeCursorType( NULL, NULL, 0, XpatInputMode ); + } + } + + XpatEditUnselectAll(); + } + + XpatPromptMessage(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatContinueEditMode | +| | +\------------------------------------------------------------*/ + +void XpatContinueEditMode( EditMode , PromptMessage, CountEvent ) + + char EditMode; + void (*PromptMessage)(); + char CountEvent; +{ + autbegin(); + + if ( XpatEditMode & XPAT_ZOOM_MARK ) + { + XpatSaveEditMode = EditMode; + XpatSaveInputMode = XpatInputEventEditTable[ EditMode ]; + XpatSavePromptMessage = PromptMessage; + XpatCountEventEdit = CountEvent; + XpatMaxEventEdit = XpatMaxEventEditTable[ EditMode ]; + } + else + { + XpatCountEventEdit = CountEvent; + XpatMaxEventEdit = XpatMaxEventEditTable[ EditMode ]; + XpatEditMode = EditMode; + XpatInputMode = XpatInputEventEditTable[ EditMode ]; + XpatPromptMessage = PromptMessage; + + XpatChangeCursorType( XpatUnitEventEditX, + XpatUnitEventEditY, + XpatCountEventEdit, + XpatInputMode ); + + } + + XpatPromptMessage(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatTreatEventZoom | +| | +\------------------------------------------------------------*/ + +void XpatTreatEventZoom() + +{ + autbegin(); + + XpatChangeCursorType( XpatUnitEventEditX, + XpatUnitEventEditY, + XpatCountEventEdit, + XpatSaveInputMode ); + + switch ( XpatEditMode ) + { + case XPAT_ZOOM_CENTER : + + XpatZoomCenter( XpatUnitEventZoomX[ 0 ], + XpatUnitEventZoomY[ 0 ] ); + break; + + case XPAT_ZOOM_IN : + + XpatZoomIn( XpatUnitEventZoomX[ 0 ], + XpatUnitEventZoomY[ 0 ], + XpatUnitEventZoomX[ 1 ], + XpatUnitEventZoomY[ 1 ] ); + break; + + case XPAT_ZOOM_PAN : + + XpatZoomPan( XpatUnitEventZoomX[ 0 ], + XpatUnitEventZoomY[ 0 ], + XpatUnitEventZoomX[ 1 ], + XpatUnitEventZoomY[ 1 ] ); + break; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatTreatEventEdit | +| | +\------------------------------------------------------------*/ + +void XpatTreatEventEdit() + +{ + long DeltaX; + long DeltaY; + long X1; + long X2; + long Y1; + long Y2; + + autbegin(); + + X1 = XpatUnitEventEditX[0]; + X2 = XpatUnitEventEditX[1]; + Y1 = XpatUnitEventEditY[0]; + Y2 = XpatUnitEventEditY[1]; + + if ( ( XpatInputMode == XPAT_INPUT_LSTRING ) || + ( XpatInputMode == XPAT_INPUT_ORTHO ) || + ( XpatInputMode == XPAT_INPUT_SORTHO ) ) + { + DeltaX = X1 - X2; + DeltaY = Y1 - Y2; + + if ( DeltaX < 0 ) DeltaX = - DeltaX; + if ( DeltaY < 0 ) DeltaY = - DeltaY; + + if ( DeltaX > DeltaY ) + { + Y2 = Y1; + + XpatUnitEventEditX[0] = X2; + XpatUnitEventEditY[0] = Y2; + } + else + { + X2 = X1; + + XpatUnitEventEditX[0] = X2; + XpatUnitEventEditY[0] = Y2; + } + } + + if ( XpatInputMode == XPAT_INPUT_LSTRING ) + { + XpatChangeCursorType( XpatUnitEventEditX, + XpatUnitEventEditY, + 1, XpatInputMode ); + + XpatCountEventEdit = 1; + } + else + { + XpatChangeCursorType( NULL, NULL, 0, + XpatInputMode ); + + XpatCountEventEdit = 0; + } + + switch ( XpatEditMode ) + { + case XPAT_EDIT_MEASURE : + + break; + + case XPAT_EDIT_IDENTIFY : + + XpatEditIdentify( X1, Y1 ); + + break; + + case XPAT_EDIT_CONNECTED : + + XpatEditConnected( X1, Y1 ); + + break; + + case XPAT_EDIT_ADD_CURSOR : + + XpatEditAddCursor( X1, Y1 ); + + break; + + case XPAT_EDIT_DEL_CURSOR : + + XpatEditDelCursor( X1, Y1 ); + + break; + + + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEvent | +| | +\------------------------------------------------------------*/ + +void CallbackEvent ( MyWidget, Event, Args, Argc ) + + Widget MyWidget; + XButtonEvent *Event; + String *Args; + int *Argc; +{ + Display *EventDisplay; + char MouseEvent; + Position OldUnitCursorX; + Position OldUnitCursorY; + + autbegin(); + + EventDisplay = Event->display; + + MouseEvent = atoi( Args[ 0 ] ); + + if ( MouseEvent == XPAT_LEAVE ) + { + XpatUndisplayCursor(); + XpatCursorInside = XPAT_FALSE; + } + else + { + OldUnitCursorX = XpatUnitCursorX; + OldUnitCursorY = XpatUnitCursorY; + + XpatComputeCursor( Event->x, Event->y ); + + switch ( MouseEvent ) + { + case XPAT_B1DN : + + if ( XpatEditMode & XPAT_ZOOM_MARK ) + { + if ( XpatCountEventZoom < XpatMaxEventZoom ) + { + XpatUnitEventZoomX[ XpatCountEventZoom ] = XpatUnitCursorX; + XpatUnitEventZoomY[ XpatCountEventZoom ] = XpatUnitCursorY; + + XpatCountEventZoom = XpatCountEventZoom + 1; + + XpatPointCursor(); + + if ( XpatCountEventZoom == XpatMaxEventZoom ) + { + XpatChangeCursorType( NULL, NULL, 0, XpatInputMode ); + + XpatTreatEventZoom(); + + XpatInputMode = XpatSaveInputMode; + XpatEditMode = XpatSaveEditMode; + XpatPromptMessage = XpatSavePromptMessage; + XpatSaveEditMode = XPAT_EDIT_MEASURE; + XpatSaveInputMode = XPAT_INPUT_HALF_BOX; + XpatCountEventZoom = 0; + XpatMaxEventZoom = 0; + + XpatChangeCursorType( XpatUnitEventEditX, + XpatUnitEventEditY, + XpatCountEventEdit, + XpatInputMode ); + + XpatComputeCursor( Event->x, Event->y ); + XpatDisplayCursor(); + } + } + } + else + { + if ( XpatCountEventEdit < XpatMaxEventEdit ) + { + XpatUnitEventEditX[ XpatCountEventEdit ] = XpatUnitCursorX; + XpatUnitEventEditY[ XpatCountEventEdit ] = XpatUnitCursorY; + + XpatCountEventEdit = XpatCountEventEdit + 1; + + XpatPointCursor(); + + if ( XpatCountEventEdit == XpatMaxEventEdit ) + { + XpatTreatEventEdit(); + + XpatDisplayCursor(); + } + } + } + + XpatPromptMessage(); + + break; + + case XPAT_B3DN : + + if ( XpatEditMode & XPAT_ZOOM_MARK ) + { + if ( XpatCountEventZoom != 0 ) + { + XpatCountEventZoom = XpatCountEventZoom - 1; + + XpatResetCursor(); + } + else + { + XpatChangeCursorType( XpatUnitEventEditX, + XpatUnitEventEditY, + XpatCountEventEdit, + XpatSaveInputMode ); + + XpatInputMode = XpatSaveInputMode; + XpatEditMode = XpatSaveEditMode; + XpatPromptMessage = XpatSavePromptMessage; + XpatSaveEditMode = XPAT_EDIT_MEASURE; + XpatSaveInputMode = XPAT_INPUT_HALF_BOX; + XpatSavePromptMessage = XpatPromptEditMeasure; + XpatCountEventZoom = 0; + XpatMaxEventZoom = 0; + } + } + else + { + if ( XpatCountEventEdit != 0 ) + { + XpatCountEventEdit = XpatCountEventEdit - 1; + + XpatResetCursor(); + } + else + { + XpatEditUnselectAll(); + + XpatChangeCursorType( NULL, NULL, 0, + XPAT_INPUT_HALF_BOX ); + + XpatInputMode = XPAT_INPUT_HALF_BOX; + XpatEditMode = XPAT_EDIT_MEASURE; + XpatPromptMessage = XpatPromptEditMeasure; + XpatCountEventEdit = 0; + XpatMaxEventEdit = 2; + } + } + + XpatPromptMessage(); + + break; + + case XPAT_MOTION : + + break; + + case XPAT_ENTER : XpatCursorInside = XPAT_TRUE; + XpatDisplayCursor(); + break; + + case XPAT_KEY_UP : XpatZoomUp(); + + break; + + case XPAT_KEY_DN : XpatZoomDown(); + + break; + + case XPAT_KEY_LEFT : XpatZoomLeft(); + + break; + + case XPAT_KEY_RIGHT : XpatZoomRight(); + + break; + + case XPAT_KEY_MORE : XpatZoomMore(); + + break; + + case XPAT_KEY_LESS : XpatZoomLess(); + + break; + + case XPAT_KEY_FIT : XpatZoomFit(); + + break; + + case XPAT_KEY_REFRESH : XpatZoomRefresh(); + + break; + + case XPAT_KEY_UNZOOM : XpatZoomUndo(); + + break; + + case XPAT_KEY_ZOOM_IN : + + XpatChangeEditMode( XPAT_ZOOM_IN, XpatPromptZoomIn ); + + break; + + case XPAT_KEY_CENTER : + + XpatChangeEditMode( XPAT_ZOOM_CENTER, XpatPromptZoomCenter ); + + break; + + case XPAT_KEY_PAN : + + XpatChangeEditMode( XPAT_ZOOM_PAN, XpatPromptZoomPan ); + + break; + + case XPAT_RESCALE_MORE : + + XpatReScale( 0 ); + + break; + + case XPAT_RESCALE_LESS : + + XpatReScale( 1 ); + + break; + } + + if ( ( OldUnitCursorX != XpatUnitCursorX ) || + ( OldUnitCursorY != XpatUnitCursorY ) ) + { + XpatDisplayCoordinates(); + XpatDisplayCursor(); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackResize | +| | +\------------------------------------------------------------*/ + +void CallbackResize( MyWidget, ClientData, CallData ) + + Widget MyWidget; + XtPointer ClientData; + XmDrawingAreaCallbackStruct *CallData; +{ + if ( XpatFirstExpose == XPAT_FALSE ) + { + autbegin(); + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_WATCH_CURSOR ); + XpatUndisplayCursor(); + + XpatResizeGraphicWindow(); + XpatRefreshGraphicWindow( 0, 0, + XpatGraphicDx, XpatGraphicDy ); + XpatSetMouseCursor( XpatGraphicWindow, XPAT_NORMAL_CURSOR ); + XpatDisplayCursor(); + + autend(); + } +} + +/*------------------------------------------------------------\ +| | +| CallbackExpose | +| | +\------------------------------------------------------------*/ + +void CallbackExpose( MyWidget, ClientData, CallData ) + + Widget MyWidget; + XtPointer ClientData; + XmDrawingAreaCallbackStruct *CallData; +{ + XExposeEvent *ExposeEvent; + + ExposeEvent = (XExposeEvent *)CallData->event; + + autbegin(); + + if ( XpatFirstExpose == XPAT_TRUE ) + { + XpatFirstExpose = XPAT_FALSE; + + XpatInitializeGraphicWindow(); + XpatUndisplayCursor(); + + XpatLoadConfig( XPAT_FALSE ); + + if ( XpatFirstFileName != (char *)NULL ) + { + XpatDisplayCursor(); + XpatFileOpen( XpatFirstFileName ); + + XpatFirstFileName = (char *)NULL; + } + else + { + XpatChangeTopLevelTitle( (char *)NULL ); + + XpatRefreshGraphicWindow( 0, 0, XpatGraphicDx, XpatGraphicDy ); + XpatDisplayCursor(); + } + + XpatEnterPresentPanel(); + } + else + { + XpatUndisplayCursor(); + XpatRefreshGraphicWindow( ExposeEvent->x, ExposeEvent->y, + ExposeEvent->width, ExposeEvent->height ); + XpatDisplayCursor(); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatInitializeEvent | +| | +\------------------------------------------------------------*/ + +void XpatInitializeEvent() + +{ + XtActionsRec NewActions; + + autbegin(); + + XtVaSetValues( XpatGraphicWindow, + XmNtranslations, + XtParseTranslationTable( XpatEventTranslation ), + NULL + ); + + NewActions.string = "CallbackEvent"; + NewActions.proc = CallbackEvent; + + XtAppAddActions( XpatApplication, &NewActions, 1 ); + + XtAddCallback( XpatGraphicWindow, + XmNresizeCallback, + CallbackResize, NULL ); + + XtAddCallback( XpatGraphicWindow, + XmNexposeCallback, + CallbackExpose, NULL ); + + autend(); +} diff --git a/alliance/src/xpat/src/XMX_event.h b/alliance/src/xpat/src/XMX_event.h new file mode 100644 index 00000000..33a8f9db --- /dev/null +++ b/alliance/src/xpat/src/XMX_event.h @@ -0,0 +1,101 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Event.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_EVENT +# define XPAT_EVENT + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XPAT_B1DN 0 +# define XPAT_B3DN 1 +# define XPAT_MOTION 2 +# define XPAT_ENTER 3 +# define XPAT_LEAVE 4 + +# define XPAT_KEY_UP 5 +# define XPAT_KEY_DN 6 +# define XPAT_KEY_LEFT 7 +# define XPAT_KEY_RIGHT 8 + +# define XPAT_KEY_MORE 9 +# define XPAT_KEY_LESS 10 + +# define XPAT_KEY_FIT 11 +# define XPAT_KEY_REFRESH 12 +# define XPAT_KEY_UNZOOM 13 + +# define XPAT_KEY_ZOOM_IN 14 +# define XPAT_KEY_CENTER 15 +# define XPAT_KEY_PAN 16 + +# define XPAT_RESCALE_MORE 17 +# define XPAT_RESCALE_LESS 18 + +# define XPAT_MAX_EVENT_BUFFER 128 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatInitializeEvent(); + extern void XpatDisplayEditMeasure(); + +# endif diff --git a/alliance/src/xpat/src/XMX_graphic.c b/alliance/src/xpat/src/XMX_graphic.c new file mode 100644 index 00000000..10e160df --- /dev/null +++ b/alliance/src/xpat/src/XMX_graphic.c @@ -0,0 +1,315 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Graphic.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" + +# include "XMX_graphic.h" +# include "XMX_grid.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + Widget XpatGraphicFrame; + Widget XpatGraphicWindow; + Display *XpatGraphicDisplay = (Display *)NULL; + + Dimension XpatGraphicDx = 0; + Dimension XpatGraphicDy = 0; + Dimension XpatOldGraphicDx = 0; + Dimension XpatOldGraphicDy = 0; + + Pixmap XpatGraphicPixmap = (Pixmap)NULL; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatInitializeGraphicWindow | +| | +\------------------------------------------------------------*/ + +void XpatInitializeGraphicWindow() + +{ + autbegin(); + + XtVaGetValues( XpatGraphicWindow, + XmNwidth, &XpatGraphicDx, + XmNheight, &XpatGraphicDy, + NULL + ); + + XpatOldGraphicDx = XpatGraphicDx; + XpatOldGraphicDy = XpatGraphicDy; + + XpatGraphicPixmap = + + XCreatePixmap ( XpatGraphicDisplay, + RootWindowOfScreen( XtScreen ( XpatGraphicWindow ) ), + XpatGraphicDx, + XpatGraphicDy, + DefaultDepthOfScreen ( XtScreen ( XpatGraphicWindow ) ) + ); + + XpatClearGraphicWindow( 0, 0, XpatGraphicDx, XpatGraphicDy ); + XpatInitializeUnitGrid(); + + XpatSetMouseCursor( XpatGraphicWindow, XPAT_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatClearGraphicWindow | +| | +\------------------------------------------------------------*/ + +void XpatClearGraphicWindow( GraphicX, GraphicY, GraphicDx, GraphicDy ) + + long GraphicX; + long GraphicY; + long GraphicDx; + long GraphicDy; +{ + XFillRectangle( XpatGraphicDisplay, + XpatGraphicPixmap, + XpatBackgroundGC, + GraphicX, GraphicY, + GraphicDx, + GraphicDy ); +} + +/*------------------------------------------------------------\ +| | +| XpatRefreshGraphicWindow | +| | +\------------------------------------------------------------*/ + +void XpatRefreshGraphicWindow( GraphicX, GraphicY, GraphicDx, GraphicDy ) + + Dimension GraphicX; + Dimension GraphicY; + Dimension GraphicDx; + Dimension GraphicDy; +{ + autbegin(); + + XpatUndisplayCursor(); + + XCopyArea( XpatGraphicDisplay, + XpatGraphicPixmap, + XtWindow ( XpatGraphicWindow ), + XpatBackgroundGC, + GraphicX, GraphicY, + GraphicDx, GraphicDy, + GraphicX, GraphicY + ); + + XpatDisplayUnitGrid( GraphicX, GraphicY, + GraphicX + GraphicDx, + GraphicY + GraphicDy ); + XpatUndisplayCursor(); + + autend(); +} + + +/*------------------------------------------------------------\ +| | +| XpatResizeGraphicWindow | +| | +\------------------------------------------------------------*/ + +void XpatResizeGraphicWindow() + +{ + Pixmap OldPixmap; + Dimension SourceY; + Dimension TargetY; + Dimension TargetDx; + Dimension TargetDy; + + autbegin(); + + XpatOldGraphicDx = XpatGraphicDx; + XpatOldGraphicDy = XpatGraphicDy; + + XtVaGetValues( XpatGraphicWindow, + XmNwidth, &XpatGraphicDx, + XmNheight, &XpatGraphicDy, + NULL + ); + + if ( ( XpatOldGraphicDx != XpatGraphicDx ) || + ( XpatOldGraphicDy != XpatGraphicDy ) ) + { + OldPixmap = XpatGraphicPixmap; + + XpatGraphicPixmap = + + XCreatePixmap ( XpatGraphicDisplay, + RootWindowOfScreen( XtScreen ( XpatGraphicWindow ) ), + XpatGraphicDx, + XpatGraphicDy, + DefaultDepthOfScreen ( XtScreen ( XpatGraphicWindow ) ) + ); + + XpatClearGraphicWindow( 0, 0, XpatGraphicDx, XpatGraphicDy ); + + XpatResizeUnitGrid(); + + if ( XpatOldGraphicDx < XpatGraphicDx ) + { + TargetDx = XpatOldGraphicDx; + + XpatDisplayFigure( TargetDx, 0, + XpatGraphicDx, XpatGraphicDy ); + } + else + { + TargetDx = XpatGraphicDx; + } + + if ( XpatOldGraphicDy < XpatGraphicDy ) + { + SourceY = 0; + TargetDy = XpatOldGraphicDy; + TargetY = XpatGraphicDy - XpatOldGraphicDy; + + XpatDisplayFigure( 0, TargetDy, + TargetDx, XpatGraphicDy ); + } + else + { + TargetDy = XpatGraphicDy; + TargetY = 0; + SourceY = XpatOldGraphicDy - XpatGraphicDy; + } + + XCopyArea( XpatGraphicDisplay, + OldPixmap, + XpatGraphicPixmap, + XpatBackgroundGC, + 0, SourceY, + TargetDx, TargetDy, + 0, TargetY + ); + + XFreePixmap( XpatGraphicDisplay, OldPixmap ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatInitializeGraphic | +| | +\------------------------------------------------------------*/ + +void XpatInitializeGraphic() + +{ + autbegin(); + + XpatGraphicFrame = XtVaCreateManagedWidget( "XpatGraphicFrame", + xmFrameWidgetClass, + XpatMainForm, + XmNshadowType , XmSHADOW_ETCHED_IN, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 1, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 191, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 1, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 199, + NULL ); + + XpatGraphicWindow = XtVaCreateManagedWidget( + "XpatGraphicWindow", + xmDrawingAreaWidgetClass, + XpatGraphicFrame, + XmNtopAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNbackground, 1, + XmNforeground, 0, + NULL + ); + + XpatGraphicDisplay = XtDisplay( XpatGraphicWindow ); + + autend(); +} diff --git a/alliance/src/xpat/src/XMX_graphic.h b/alliance/src/xpat/src/XMX_graphic.h new file mode 100644 index 00000000..7ac2861b --- /dev/null +++ b/alliance/src/xpat/src/XMX_graphic.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Graphic.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_GRAPHIC +# define XPAT_GRAPHIC + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatInitializeGraphic(); + +# endif diff --git a/alliance/src/xpat/src/XMX_grid.c b/alliance/src/xpat/src/XMX_grid.c new file mode 100644 index 00000000..ad4a8f04 --- /dev/null +++ b/alliance/src/xpat/src/XMX_grid.c @@ -0,0 +1,312 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Grid.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XPT.h" +# include "XMX.h" + +# include "XMX_grid.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Unit Grid | +| | +\------------------------------------------------------------*/ + + float XpatUnitGridStep; + + long XpatUnitGridX; + long XpatUnitGridY; + long XpatUnitGridDx; + long XpatUnitGridDy; + + long XpatPixelGridX; + long XpatPixelGridY; + +/*------------------------------------------------------------\ +| | +| User Unit Grid | +| | +\------------------------------------------------------------*/ + + long XpatUnitUserGridDx; + long XpatUnitUserGridDy; + char XpatUnitUserGrid; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatInitializeUnitGrid | +| | +\------------------------------------------------------------*/ + +void XpatInitializeUnitGrid() + +{ + autbegin(); + + XpatUnitGridX = XPAT_DEFAULT_GRID_X; + XpatUnitGridY = XPAT_DEFAULT_GRID_Y; + XpatUnitGridDx = XPAT_DEFAULT_GRID_DX; + XpatUnitGridDy = XPAT_DEFAULT_GRID_DY; + XpatUnitUserGridDx = 4; + XpatUnitUserGridDy = 4; + XpatUnitUserGrid = XPAT_FALSE; + + XpatComputeUnitGrid(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatComputeUnitGrid | +| | +\------------------------------------------------------------*/ + +void XpatComputeUnitGrid() + +{ + float StepX; + float StepY; + + autbegin(); + + StepX = (float)(XpatGraphicDx) / (float)(XpatUnitGridDx); + StepY = (float)(XpatGraphicDy) / (float)(XpatUnitGridDy); + + if ( StepX < StepY ) + { + XpatUnitGridStep = StepX; + XpatUnitGridDy = 1 + ( XpatGraphicDy / StepX ); + } + else + { + XpatUnitGridStep = StepY; + XpatUnitGridDx = 1 + ( XpatGraphicDx / StepY ); + } + + XpatPixelGridX = (float)(XpatUnitGridX) * XpatUnitGridStep; + XpatPixelGridY = (float)(XpatUnitGridY) * XpatUnitGridStep; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatResizeUnitGrid | +| | +\------------------------------------------------------------*/ + +void XpatResizeUnitGrid() + +{ + autbegin(); + + XpatUnitGridDx = 1 + ( XpatGraphicDx / XpatUnitGridStep ); + XpatUnitGridDy = 1 + ( XpatGraphicDy / XpatUnitGridStep ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatDisplayUnitGrid | +| | +\------------------------------------------------------------*/ + +char XpatDisplayUnitGrid( GraphicX1, GraphicY1, GraphicX2, GraphicY2 ) + + Dimension GraphicX1; + Dimension GraphicY1; + Dimension GraphicX2; + Dimension GraphicY2; +{ + long X; + long Y; + long MaxGridX; + long MaxGridY; + long PixelX; + long PixelY; + long Xmin; + long Ymin; + char UserGrid; + char UnitGrid; + float Check; + + autbegin(); + + if ( XpatUnitGridStep < XPAT_LOWER_GRID_STEP ) + { + UnitGrid = 0; + } + else + { + UnitGrid = 1; + } + + if ( XpatUnitUserGrid == 1 ) + { + if ( XpatUnitUserGridDx > XpatUnitUserGridDy ) + { + Check = ( XPAT_LOWER_GRID_STEP * 2 / XpatUnitUserGridDy ); + } + else + { + Check = ( XPAT_LOWER_GRID_STEP * 2 / XpatUnitUserGridDy ); + } + + if ( XpatUnitGridStep < Check ) UserGrid = 0; + else UserGrid = 1; + } + else + { + UserGrid = 0; + } + + if ( ( UserGrid == 0 ) && + ( UnitGrid == 0 ) ) + { + autend(); + return( XPAT_FALSE ); + } + + MaxGridX = XpatUnitGridX + XpatUnitGridDx; + MaxGridY = XpatUnitGridY + XpatUnitGridDy; + + if ( UnitGrid ) + { + for ( X = XpatUnitGridX; X < MaxGridX; X = X + 1 ) + { + PixelX = ((float)(X) * XpatUnitGridStep); + PixelX = PixelX - XpatPixelGridX; + + if ( ( PixelX <= GraphicX2 ) && + ( PixelX >= GraphicX1 ) ) + + for ( Y = XpatUnitGridY; Y < MaxGridY; Y = Y + 1 ) + { + PixelY = ((float)(Y) * XpatUnitGridStep); + PixelY = PixelY - XpatPixelGridY; + PixelY = XpatGraphicDy - PixelY; + + if ( ( PixelY <= GraphicY2 ) && + ( PixelY >= GraphicY1 ) ) + { + XDrawPoint( XpatGraphicDisplay, + XtWindow( XpatGraphicWindow ), + XpatGridGC, + PixelX, PixelY ); + } + } + } + } + + if ( UserGrid ) + { + Xmin = ( XpatUnitGridX / XpatUnitUserGridDx ) * XpatUnitUserGridDx; + Ymin = ( XpatUnitGridY / XpatUnitUserGridDy ) * XpatUnitUserGridDy; + + for ( X = Xmin; X < MaxGridX ; X = X + XpatUnitUserGridDx ) + { + PixelX = ((float)(X) * XpatUnitGridStep); + PixelX = PixelX - XpatPixelGridX; + + if ( ( PixelX <= GraphicX2 ) && + ( PixelX >= GraphicX1 ) ) + + for ( Y = Ymin; Y < MaxGridY; Y = Y + XpatUnitUserGridDy ) + { + PixelY = ((float)(Y) * XpatUnitGridStep); + PixelY = PixelY - XpatPixelGridY; + PixelY = XpatGraphicDy - PixelY; + + if ( ( PixelY <= GraphicY2 ) && + ( PixelY >= GraphicY1 ) ) + { + XDrawLine( XpatGraphicDisplay, + XtWindow( XpatGraphicWindow ), + XpatGridGC, + PixelX - 2, PixelY, + PixelX + 2, PixelY ); + + XDrawLine( XpatGraphicDisplay, + XtWindow( XpatGraphicWindow ), + XpatGridGC, + PixelX, PixelY + 2, + PixelX, PixelY - 2 ); + } + } + } + } + + autend(); + return( XPAT_TRUE ); +} diff --git a/alliance/src/xpat/src/XMX_grid.h b/alliance/src/xpat/src/XMX_grid.h new file mode 100644 index 00000000..270b1b77 --- /dev/null +++ b/alliance/src/xpat/src/XMX_grid.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Grid.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_GRID +# define XPAT_GRID + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XPAT_DEFAULT_GRID_X 0 +# define XPAT_DEFAULT_GRID_Y 0 +# define XPAT_DEFAULT_GRID_DX 40 +# define XPAT_DEFAULT_GRID_DY 40 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xpat/src/XMX_icon.c b/alliance/src/xpat/src/XMX_icon.c new file mode 100644 index 00000000..ca318691 --- /dev/null +++ b/alliance/src/xpat/src/XMX_icon.c @@ -0,0 +1,132 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Icon.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" + +# include "XMX_icon.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static char IconBits[] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x80, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x80, + 0x00, 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x1f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0xff, 0xff, + 0xff, 0xff, 0x01, 0xf0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xc3, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xc3, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x10, 0x00, 0x00, 0xff, 0xff, 0xff, 0x01, 0xf0, 0xff, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00 + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatInitializeIcon | +| | +\------------------------------------------------------------*/ + +void XpatInitializeIcon() + +{ + autbegin(); + + XpatSetIcon( XpatTopLevel, + IconBits, IconWidth, IconHeight ); + + autend(); +} diff --git a/alliance/src/xpat/src/XMX_icon.h b/alliance/src/xpat/src/XMX_icon.h new file mode 100644 index 00000000..a6b1137f --- /dev/null +++ b/alliance/src/xpat/src/XMX_icon.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Icon.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_ICON +# define XPAT_ICON + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define IconWidth 50 +# define IconHeight 50 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatInitializeIcon(); + +# endif diff --git a/alliance/src/xpat/src/XMX_menu.c b/alliance/src/xpat/src/XMX_menu.c new file mode 100644 index 00000000..0252f885 --- /dev/null +++ b/alliance/src/xpat/src/XMX_menu.c @@ -0,0 +1,202 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XTB.h" +# include "XMF.h" +# include "XME.h" +# include "XMV.h" +# include "XMT.h" +# include "XMS.h" +# include "XMH.h" +# include "XMX.h" + +# include "XMX_menu.h" + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + Widget XpatMenuBar; + + XpatMenuItem XpatMainMenu[] = + + { + { + "File", + 'F', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + XpatFileMenu + } + , + { + "Edit", + 'E', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + XpatEditMenu + } + , + { + "View", + 'V', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + XpatViewMenu + } + , + { + "Tools", + 'T', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + XpatToolsMenu + } + , + { + "Setup", + 'S', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + XpatSetupMenu + } + , + { + "Help", + 'H', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + True, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + XpatHelpMenu + } + , + NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatInitializeMenu | +| | +\------------------------------------------------------------*/ + +void XpatInitializeMenu() + +{ + autbegin(); + + XpatMenuBar = XmCreateMenuBar( XpatMainWindow, + "XpatMenuBar", NULL, 0 ); + + XpatBuildMenus( XpatMenuBar, XpatMainMenu ); + + XtManageChild( XpatMenuBar ); + + autend(); +} + diff --git a/alliance/src/xpat/src/XMX_menu.h b/alliance/src/xpat/src/XMX_menu.h new file mode 100644 index 00000000..3ef53f17 --- /dev/null +++ b/alliance/src/xpat/src/XMX_menu.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_MENU +# define XPAT_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XpatMenuItem XpatMainMenu[]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatInitializeMenu(); + +# endif diff --git a/alliance/src/xpat/src/XMX_message.c b/alliance/src/xpat/src/XMX_message.c new file mode 100644 index 00000000..fe2b560d --- /dev/null +++ b/alliance/src/xpat/src/XMX_message.c @@ -0,0 +1,287 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Message.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XMX_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + Widget XpatMessageMainForm; + Widget XpatMessageText [ XPAT_MAX_MESSAGE ]; + Widget XpatMessageLabel [ XPAT_MAX_MESSAGE ]; + Widget XpatMessageFrame [ XPAT_MAX_MESSAGE ]; + Widget XpatMessageForm [ XPAT_MAX_MESSAGE ]; + + static char *XpatMessageLabelName [ XPAT_MAX_MESSAGE ] = + + { + "Time :", + "Name :", + "Delta :", + NULL, + NULL, + NULL + }; + + static char *XpatMessageTextName [ XPAT_MAX_MESSAGE ] = + + { + "0", + "0", + "0", + "Measure", + "Select point", + "Enter base point" + }; + + static char *XpatMessageFormName [ XPAT_MAX_MESSAGE ] = + + { + "XpatMessageFormX", + "XpatMessageFormY", + "XpatMessageFormDx", + "XpatMessageFormMode", + "XpatMessageFormInfo", + "XpatMessageFormPrompt" + }; + + static char *XpatMessageFrameName [ XPAT_MAX_MESSAGE ] = + + { + "XpatMessageFrameX", + "XpatMessageFrameY", + "XpatMessageFrameDx", + "XpatMessageFrameMode", + "XpatMessageFrameInfo", + "XpatMessageFramePrompt" + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatDisplayMessage | +| | +\------------------------------------------------------------*/ + +void XpatDisplayMessage( Where, Text ) + + char Where; + char *Text; +{ + XmString TextString; + + autbegin(); + + TextString = XmStringCreateSimple( Text ); + + XtVaSetValues( XpatMessageText[ Where ], XmNlabelString, TextString, NULL ); + + XmStringFree( TextString ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatPromptEditMeasure | +| | +\------------------------------------------------------------*/ + +void XpatPromptEditMeasure() + +{ + autbegin(); + + XpatDisplayMessage( XPAT_MESSAGE_MODE , "Measure" ); + XpatDisplayMessage( XPAT_MESSAGE_PROMPT, "Enter base point" ); + XpatDisplayMessage( XPAT_MESSAGE_INFO , "Select point" ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatInitializeMessage | +| | +\------------------------------------------------------------*/ + +void XpatInitializeMessage() + +{ + int Counter; + int Column; + int Left; + int Width; + + autbegin(); + + XpatMessageMainForm = + + XtVaCreateManagedWidget( "XpatMessageMainForm", + xmFormWidgetClass , + XpatMainForm , + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 193, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 199, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 0, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 200, + XmNfractionBase , 200, + NULL ); + + Column = 1; + Width = 25; + + for ( Counter = 0; Counter < XPAT_MAX_MESSAGE; Counter++ ) + { + if ( Counter == 1 ) Width = 60; + if ( Counter == 2 ) Width = 25; + if ( Counter == 3 ) Width = 22; + if ( Counter == 4 ) Width = 32; + if ( Counter == 5 ) Width = 32; + + XpatMessageFrame[ Counter ] = + + XtVaCreateManagedWidget( XpatMessageFrameName[ Counter ], + xmFrameWidgetClass, + XpatMessageMainForm, + XmNshadowType , XmSHADOW_ETCHED_IN, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , Column, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , Column + Width, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + NULL + ); + + XpatMessageForm[ Counter ] = + + XtVaCreateManagedWidget( XpatMessageFormName[ Counter ], + xmFormWidgetClass , + XpatMessageFrame[ Counter ], + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNfractionBase , 18, + NULL + ); + + if ( XpatMessageLabelName[ Counter ] != (char *)NULL ) + { + XpatMessageLabel [ Counter ] = + + XtVaCreateManagedWidget( XpatMessageLabelName[ Counter ], + xmLabelWidgetClass, + XpatMessageForm [ Counter ], + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 6, + XmNbottomAttachment , XmATTACH_FORM, + XmNtopAttachment , XmATTACH_FORM, + XmNrecomputeSize , False, + NULL + ); + Left = 6; + } + else + { + Left = 0; + } + + XpatMessageText [ Counter ] = + + XtVaCreateManagedWidget( XpatMessageTextName[ Counter ], + xmLabelWidgetClass, + XpatMessageForm [ Counter ], + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , Left, + XmNrecomputeSize , False, + NULL + ); + + Column = Column + Width; + } + + autend(); +} diff --git a/alliance/src/xpat/src/XMX_message.h b/alliance/src/xpat/src/XMX_message.h new file mode 100644 index 00000000..dea0fe2f --- /dev/null +++ b/alliance/src/xpat/src/XMX_message.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Message.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_MESSAGE +# define XPAT_MESSAGE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatInitializeMessage(); + extern void XpatPromptEditMeasure(); + +# endif diff --git a/alliance/src/xpat/src/XMX_motif.c b/alliance/src/xpat/src/XMX_motif.c new file mode 100644 index 00000000..b872be05 --- /dev/null +++ b/alliance/src/xpat/src/XMX_motif.c @@ -0,0 +1,197 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Motif.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XMS.h" + +# include "XMX_motif.h" +# include "XMX_graphic.h" +# include "XMX_event.h" +# include "XMX_message.h" +# include "XMX_menu.h" +# include "XMX_color.h" +# include "XMX_panel.h" +# include "XMX_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XtAppContext XpatApplication; + Widget XpatTopLevel; + Widget XpatMainWindow; + Widget XpatMainForm; + + static String XpatFallBacks [] = + + { + "*.XpatMainWindow.iconName : Xpat", + "*XpatMenuBar*fontList : -*-helvetica-bold-r-*--14-*", + "*foreground : black", + "*background : gray", + "*fontList : -*-helvetica-medium-r-*--12-*", + NULL + }; + + static char XpatTopLevelTitle[ 128 ] = "Xpat : "; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatChangeTopLevelTitle | +| | +\------------------------------------------------------------*/ + +void XpatChangeTopLevelTitle( Title ) + + char *Title; +{ + autbegin(); + + if ( Title != (char *)NULL ) + { + strcpy( XpatTopLevelTitle + 7, Title ); + } + else + { + XpatTopLevelTitle[ 7 ] = '\0'; + } + + XtVaSetValues( XpatTopLevel, XmNtitle, XpatTopLevelTitle, NULL ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatInitializeRessources | +| | +\------------------------------------------------------------*/ + +void XpatInitializeRessources( argc, argv ) + + int *argc; + char *argv[]; +{ + Arg Args[ 2 ]; + + autbegin(); + + XpatTopLevel = XtVaAppInitialize( + &XpatApplication, + "xpat.xrdb", + NULL, + 0, + argc, + argv, + XpatFallBacks, + NULL + ); + + XpatLoadTopLevelConfig(); + + XpatInitializeColorMap(); + + XpatMainWindow = XtVaCreateManagedWidget( "XpatMainWindow", + xmMainWindowWidgetClass, + XpatTopLevel, + NULL); + + XpatMainForm = XtVaCreateManagedWidget( "XpatMainForm", + xmFormWidgetClass, + XpatMainWindow, + XmNfractionBase, + 200, + NULL ); + + XpatInitializeIcon(); + XpatInitializeMenu(); + XpatInitializeMessage(); + XpatInitializePanel(); + XpatInitializeGraphic(); + XpatInitializeEvent(); + XpatBuildPanelMap(); + XpatInitializeMapEvent(); + XpatInitializeColors(); + XpatInitializeGraphicContext(); + XpatInitializeDialog(); + XpatBuildPanelLibrary(); + + XtSetArg( Args[0], XmNallowShellResize, True ); + XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING ); + + XtSetValues( XpatTopLevel, Args, 2 ); + + XtRealizeWidget( XpatTopLevel ); + + autend(); +} diff --git a/alliance/src/xpat/src/XMX_motif.h b/alliance/src/xpat/src/XMX_motif.h new file mode 100644 index 00000000..e6e7cb11 --- /dev/null +++ b/alliance/src/xpat/src/XMX_motif.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Motif.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_MOTIF +# define XPAT_MOTIF + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xpat/src/XMX_panel.c b/alliance/src/xpat/src/XMX_panel.c new file mode 100644 index 00000000..17786edc --- /dev/null +++ b/alliance/src/xpat/src/XMX_panel.c @@ -0,0 +1,111 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XTB.h" +# include "XMF.h" +# include "XME.h" +# include "XMV.h" +# include "XMT.h" +# include "XMS.h" +# include "XMH.h" +# include "XMX.h" + +# include "XMX_panel.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatInitializePanel | +| | +\------------------------------------------------------------*/ + +void XpatInitializePanel() + +{ + autbegin(); + + XpatBuildPanel( XpatMainWindow, &XpatViewArrowsPanel ); + XpatBuildPanel( XpatMainWindow, &XpatViewZoomPanel ); + XpatBuildPanel( XpatMainWindow, &XpatViewGridPanel ); + XpatBuildPanel( XpatMainWindow, &XpatViewLayerPanel ); + XpatBuildPanel( XpatMainWindow, &XpatEditSearchViewPanel ); + XpatBuildPanel( XpatMainWindow, &XpatEditSelectPanel ); + XpatBuildPanel( XpatMainWindow, &XpatEditIdentifyPanel ); + XpatBuildPanel( XpatMainWindow, &XpatToolsMessagePanel ); + XpatBuildPanel( XpatMainWindow, &XpatSetupInformationsPanel ); + + XpatBuildPresentPanel(); + + autend(); +} diff --git a/alliance/src/xpat/src/XMX_panel.h b/alliance/src/xpat/src/XMX_panel.h new file mode 100644 index 00000000..fe6de471 --- /dev/null +++ b/alliance/src/xpat/src/XMX_panel.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_PANEL +# define XPAT_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatInitializePanel(); + +# endif diff --git a/alliance/src/xpat/src/XMX_view.c b/alliance/src/xpat/src/XMX_view.c new file mode 100644 index 00000000..e9013258 --- /dev/null +++ b/alliance/src/xpat/src/XMX_view.c @@ -0,0 +1,864 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : View.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 28.01.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XPT.h" +# include "XMX.h" + +# include "XMX_view.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static long XpatGraphicX1; + static long XpatGraphicX2; + static long XpatGraphicY1; + static long XpatGraphicY2; + static XFontStruct *XpatTextFont; + static GC XpatTextGC; + static GC XpatDrawGC; + static char XpatInterrupt = 0; + + static xpatview_list *XpatHeadView = (xpatview_list *)NULL; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Alloc Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatAllocView | +| | +\------------------------------------------------------------*/ + +xpatview_list *XpatAllocView() +{ + return( (xpatview_list *)autallocheap( sizeof( xpatview_list ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Free Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatFreeView | +| | +\*-----------------------------------------------------------*/ + +void XpatFreeView( FreeView ) + + xpatview_list *FreeView; +{ + autfreeheap( (char *)FreeView, sizeof( xpatview_list ) ); +} + +/*------------------------------------------------------------\ +| | +| XpatAddViewLater | +| | +\------------------------------------------------------------*/ + +void XpatAddViewLater( Obj ) + + xpatobj_list *Obj; +{ + xpatview_list *View; + + autbegin(); + + View = XpatAllocView(); + + View->OBJECT = Obj; + View->NEXT = XpatHeadView; + XpatHeadView = View; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatDelView | +| | +\------------------------------------------------------------*/ + +void XpatDelView() +{ + xpatview_list *DelView; + xpatview_list *View; + + autbegin(); + + View = XpatHeadView; + XpatHeadView = (xpatview_list *)NULL; + + while( View != (xpatview_list *)NULL ) + { + DelView = View; + View = View->NEXT; + + XpatFreeView( DelView ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatInterruptDisplay | +| | +\------------------------------------------------------------*/ + +void XpatInterruptDisplay() +{ + XEvent Event; + KeySym Key; + char Text; + + autbegin(); + +# ifdef XPAT_CTRL_C + if ( XCheckTypedEvent( XpatGraphicDisplay, KeyPress, &Event ) ) + { + XLookupString( &Event.xkey, &Text, 1, &Key, 0 ); + + if ( Text == '\003' ) + { + XpatInterrupt = 1; + + XBell( XpatGraphicDisplay, 0 ); + } + } +# endif + + signal( SIGALRM, XpatInterruptDisplay ); + alarm( 1 ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatFlushEventDisplay | +| | +\------------------------------------------------------------*/ + +void XpatFlushEventDisplay() +{ + XEvent Event; + + autbegin(); + +# ifdef XPAT_CTRL_C + while ( XCheckTypedEvent( XpatGraphicDisplay, KeyPress, &Event ) ); +# endif + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatComputeArrow | +| | +\------------------------------------------------------------*/ + +char XpatComputeArrow( X1, Y1, X2, Y2, Points ) + + long X1; + long Y1; + long X2; + long Y2; + XPoint *Points; +{ + float LineX; + float LineY; + float HalfX; + float HalfY; + float CrossX; + float CrossY; + float Norm; + + LineX = (float)( X2 - X1 ); + LineY = (float)( Y2 - Y1 ); + + LineY = LineY * 2.0 / XPAT_PATTERN_STEP_Y; + + if ( ( LineX != 0.0 ) || + ( LineY != 0.0 ) ) + { + Norm = 3 * sqrt( ( LineX * LineX ) + ( LineY * LineY ) ); + Norm = Norm / XpatUnitGridStep; + LineX = LineX / Norm; + LineY = LineY / Norm; + + LineY = LineY * XPAT_PATTERN_STEP_Y / 2.0; + + HalfX = LineX / 2; + HalfY = LineY / 2; + CrossX = - HalfY; + CrossY = HalfX; + + Points[ 0 ].x = X1 + LineX; + Points[ 0 ].y = Y1 + LineY; + Points[ 1 ].x = Points[ 0 ].x + LineX + HalfX + CrossX; + Points[ 1 ].y = Points[ 0 ].y + LineY + HalfY + CrossY; + Points[ 2 ].x = Points[ 0 ].x + LineX + HalfX - CrossX; + Points[ 2 ].y = Points[ 0 ].y + LineY + HalfY - CrossY; + + return( XPAT_TRUE ); + } + + return( XPAT_FALSE ); +} + +/*------------------------------------------------------------\ +| | +| XpatComputeHexagon | +| | +\------------------------------------------------------------*/ + +char XpatComputeHexagon( X1, Y1, X2, Y2, Points ) + + long X1; + long Y1; + long X2; + long Y2; + XPoint *Points; +{ + long StepX; + long StepY; + long DeltaX; + + StepY = ( Y2 - Y1 ) >> 1; + StepX = StepY >> 1; + + DeltaX = X2 - X1; + + if ( DeltaX < StepY ) StepX = (DeltaX >> 1); + + if ( ( StepY > 0 ) && + ( StepX > 0 ) ) + { + Points[ 0 ].x = X1 + StepX; + Points[ 0 ].y = Y1; + Points[ 1 ].x = X1; + Points[ 1 ].y = Y1 + StepY; + Points[ 2 ].x = X1 + StepX; + Points[ 2 ].y = Y2; + Points[ 3 ].x = X2 - StepX; + Points[ 3 ].y = Y2; + Points[ 4 ].x = X2; + Points[ 4 ].y = Y1 + StepY; + Points[ 5 ].x = X2 - StepX; + Points[ 5 ].y = Y1; + Points[ 6 ].x = X1 + StepX; + Points[ 6 ].y = Y1; + + return( XPAT_TRUE ); + } + + return( XPAT_FALSE ); +} + +/*------------------------------------------------------------\ +| | +| XpatDisplayOneObject | +| | +\------------------------------------------------------------*/ + +void XpatDisplayOneObject( Obj ) + + xpatobj_list *Obj; +{ + XPoint Arrow[ 3 ]; + XPoint Hexagon[ 7 ]; + int Index; + long X1r; + long X2r; + long Y1r; + long Y2r; + long DeltaX; + long DeltaY; + + if ( IsXpatLineLeft( Obj ) ) + { + X1r = Obj->X + Obj->DX; + X2r = Obj->X; + } + else + { + X1r = Obj->X; + X2r = Obj->X + Obj->DX; + } + + if ( IsXpatLineDown( Obj ) ) + { + Y1r = Obj->Y + Obj->DY; + Y2r = Obj->Y; + } + else + { + Y1r = Obj->Y; + Y2r = Obj->Y + Obj->DY; + } + + X1r = (float)( X1r ) * XpatUnitGridStep; + Y1r = (float)( Y1r ) * XpatUnitGridStep; + X2r = (float)( X2r ) * XpatUnitGridStep; + Y2r = (float)( Y2r ) * XpatUnitGridStep; + + X1r = ( X1r / XPAT_UNIT ) - XpatPixelGridX; + X2r = ( X2r / XPAT_UNIT ) - XpatPixelGridX; + Y1r = ( Y1r / XPAT_UNIT ) - XpatPixelGridY; + Y2r = ( Y2r / XPAT_UNIT ) - XpatPixelGridY; + + if ( ( ( X1r < 0 ) && + ( X2r < 0 ) ) || + ( ( X1r > (long)XpatGraphicDx ) && + ( X2r > (long)XpatGraphicDx ) ) || + ( ( Y1r < 0 ) && + ( Y2r < 0 ) ) || + ( ( Y1r > (long)XpatGraphicDy ) && + ( Y2r > (long)XpatGraphicDy ) ) ) + { + return; + } + + switch ( GetXpatObjectType( Obj ) ) + { + case XPAT_OBJECT_LINE : + + if ( Y1r == Y2r ) + { + if ( X1r < 0 ) X1r = 0; + if ( X2r < 0 ) X2r = 0; + if ( X1r > (long)XpatGraphicDx ) X1r = (long)XpatGraphicDx; + if ( X2r > (long)XpatGraphicDx ) X2r = (long)XpatGraphicDx; + } + + XDrawLine( XpatGraphicDisplay, + XpatGraphicPixmap, + XpatDrawGC, + X1r, XpatGraphicDy - Y1r, + X2r, XpatGraphicDy - Y2r ); + break; + + case XPAT_OBJECT_ARROW : + + XDrawLine( XpatGraphicDisplay, + XpatGraphicPixmap, + XpatDrawGC, + X1r, XpatGraphicDy - Y1r, + X2r, XpatGraphicDy - Y2r ); + + if ( XpatComputeArrow( X1r, Y1r, X2r, Y2r, Arrow ) ) + { + for ( Index = 0; Index < 3; Index++ ) + { + Arrow[ Index ].y = XpatGraphicDy - Arrow[ Index ].y; + } + + XFillPolygon( XpatGraphicDisplay, + XpatGraphicPixmap, + XpatDrawGC, Arrow, 3, + Convex, + CoordModeOrigin ); + } + + break; + + case XPAT_OBJECT_CIRCLE : + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + + XFillArc( XpatGraphicDisplay, + XpatGraphicPixmap, + XpatDrawGC, + X1r, XpatGraphicDy - Y2r, + DeltaX, DeltaY, 0, 23040 ); + break; + + case XPAT_OBJECT_RECTANGLE : + + if ( X1r < -1 ) X1r = -1; + if ( X2r < -1 ) X2r = -1; + if ( X1r > (long)XpatGraphicDx ) X1r = (long)XpatGraphicDx + 1; + if ( X2r > (long)XpatGraphicDx ) X2r = (long)XpatGraphicDx + 1; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + + XFillRectangle( XpatGraphicDisplay, + XpatGraphicPixmap, + XpatDrawGC, + X1r, XpatGraphicDy - Y2r, + DeltaX, DeltaY ); + + break; + + case XPAT_OBJECT_HEXAGON : + + if ( X1r < -100 ) X1r = -100; + if ( X2r < -100 ) X2r = -100; + if ( X1r > (long)XpatGraphicDx + 100) X1r = (long)XpatGraphicDx + 100; + if ( X2r > (long)XpatGraphicDx + 100) X2r = (long)XpatGraphicDx + 100; + + if ( XpatComputeHexagon( X1r, Y1r, X2r, Y2r, Hexagon ) ) + { + for ( Index = 0; Index < 7; Index++ ) + { + Hexagon[ Index ].y = XpatGraphicDy - Hexagon[ Index ].y; + } + + XFillPolygon( XpatGraphicDisplay, + XpatGraphicPixmap, + XpatDrawGC, Hexagon, 7, + Convex, CoordModeOrigin ); + } + else + { + XDrawLine( XpatGraphicDisplay, + XpatGraphicPixmap, + XpatDrawGC, + X1r, XpatGraphicDy - Y1r, + X2r, XpatGraphicDy - Y2r ); + } + + break; + } +} + +/*------------------------------------------------------------\ +| | +| XpatDisplayOneString | +| | +\------------------------------------------------------------*/ + +void XpatDisplayOneString( Obj ) + + xpatobj_list *Obj; +{ + long X1r; + long X2r; + long Y1r; + long Y2r; + long DeltaX; + long DeltaY; + long WidthText; + long HeightText; + int Length; + + if ( IsXpatLineLeft( Obj ) ) + { + X1r = Obj->X + Obj->DX; + X2r = Obj->X; + } + else + { + X1r = Obj->X; + X2r = Obj->X + Obj->DX; + } + + if ( IsXpatLineDown( Obj ) ) + { + Y1r = Obj->Y + Obj->DY; + Y2r = Obj->Y; + } + else + { + Y1r = Obj->Y; + Y2r = Obj->Y + Obj->DY; + } + + X1r = (float)( X1r ) * XpatUnitGridStep; + Y1r = (float)( Y1r ) * XpatUnitGridStep; + X2r = (float)( X2r ) * XpatUnitGridStep; + Y2r = (float)( Y2r ) * XpatUnitGridStep; + + X1r = ( X1r / XPAT_UNIT ) - XpatPixelGridX; + X2r = ( X2r / XPAT_UNIT ) - XpatPixelGridX; + Y1r = ( Y1r / XPAT_UNIT ) - XpatPixelGridY; + Y2r = ( Y2r / XPAT_UNIT ) - XpatPixelGridY; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + + if ( IsXpatIO( Obj ) ) + { + Length = strlen( Obj->NAME ); + WidthText = XTextWidth( XpatTextFont, Obj->NAME, Length ); + HeightText = XpatTextFont->ascent; + + XDrawString( XpatGraphicDisplay, + XpatGraphicPixmap, + XpatTextGC, + ( X2r - WidthText ), + XpatGraphicDy - (( Y1r + Y2r - HeightText ) >> 1), + Obj->NAME, Length ); + } + else + if ( IsXpatCursor( Obj ) ) + { + Length = strlen( Obj->NAME ); + WidthText = XTextWidth( XpatTextFont, Obj->NAME, Length ); + HeightText = XpatTextFont->ascent; + + XDrawString( XpatGraphicDisplay, + XpatGraphicPixmap, + XpatTextGC, + X2r - (WidthText >> 1), + XpatGraphicDy - ( Y2r + HeightText ), + Obj->NAME, Length ); + } + else + { + Length = strlen( Obj->NAME ); + WidthText = XTextWidth( XpatTextFont, Obj->NAME, Length ); + HeightText = XpatTextFont->ascent; + + if ( WidthText <= ( X2r - X1r ) ) + { + XDrawString( XpatGraphicDisplay, + XpatGraphicPixmap, + XpatTextGC, + (( X1r + X2r - WidthText ) >> 1), + XpatGraphicDy - (( Y1r + Y2r - HeightText ) >> 1), + Obj->NAME, Length ); + } + } +} + +/*------------------------------------------------------------\ +| | +| XpatDisplayFigure | +| | +\------------------------------------------------------------*/ + +void XpatDisplayFigure( GraphicX1, GraphicY1, GraphicX2, GraphicY2 ) + + long GraphicX1; + long GraphicY1; + long GraphicX2; + long GraphicY2; +{ + xpatview_list *View; + xpatobj_list *Obj; + long X1; + long Y1; + long X2; + long Y2; + int Layer; + char DisplayTextIO; + char DisplayTextVector; + + autbegin(); + + DisplayTextIO = XPAT_ACTIVE_NAME_TABLE[ XPAT_ACTIVE_NAME_IO ]; + DisplayTextVector = XPAT_ACTIVE_NAME_TABLE[ XPAT_ACTIVE_NAME_VECTOR ]; + + XpatGraphicX1 = GraphicX1; + XpatGraphicX2 = GraphicX2; + XpatGraphicY1 = GraphicY1; + XpatGraphicY2 = GraphicY2; + + if ( XpatUnitGridStep > ( 22.0 / XPAT_PATTERN_STEP_Y ) ) + { + XpatTextGC = XpatLargeTextGC; + XpatTextFont = XpatLargeTextFont; + } + else + if ( XpatUnitGridStep > ( 18.0 / XPAT_PATTERN_STEP_Y ) ) + { + XpatTextGC = XpatMediumTextGC; + XpatTextFont = XpatMediumTextFont; + } + else + if ( ( XpatUnitGridStep > ( 10.0 / XPAT_PATTERN_STEP_Y ) ) || + ( XPAT_FORCE_DISPLAY ) ) + { + XpatTextGC = XpatSmallTextGC; + XpatTextFont = XpatSmallTextFont; + } + else + { + DisplayTextIO = 0; + DisplayTextVector = 0; + } + + XpatClearGraphicWindow( GraphicX1, + XpatGraphicDy - GraphicY2, + GraphicX2 - GraphicX1, + GraphicY2 - GraphicY1 ); + + if ( XpatFigure == (xpatfig_list *)NULL ) return; + + X1 = GraphicX1 + XpatPixelGridX; + X2 = GraphicX2 + XpatPixelGridX; + Y1 = GraphicY1 + XpatPixelGridY; + Y2 = GraphicY2 + XpatPixelGridY; + + X1 = ( X1 / XpatUnitGridStep ); + Y1 = ( Y1 / XpatUnitGridStep ); + X2 = ( X2 / XpatUnitGridStep ); + Y2 = ( Y2 / XpatUnitGridStep ); + + if ( X2 >= 0 ) { X2 = X2 + 1; } + if ( Y2 >= 0 ) { Y2 = Y2 + 1; } + if ( X1 <= 0 ) { X1 = X1 - 1; } + if ( Y1 <= 0 ) { Y1 = Y1 - 1; } + + X1 = X1 * XPAT_UNIT; + X2 = X2 * XPAT_UNIT; + Y1 = Y1 * XPAT_UNIT; + Y2 = Y2 * XPAT_UNIT; + + XpatInterrupt = 0; + + signal( SIGALRM, XpatInterruptDisplay ); + alarm( 1 ); + + for ( Layer = 0; Layer < XPAT_MAX_LAYER; Layer++ ) + { + if ( XpatInterrupt ) break; + + if ( XPAT_ACTIVE_LAYER_TABLE[ Layer ] == 0 ) continue; + + XpatDrawGC = XpatLayerDrawGC[ Layer ]; + + for ( Obj = XpatFigure->OBJECT[ Layer ]; + Obj != (xpatobj_list *)NULL; + Obj = Obj->NEXT ) + { + if ( XpatInterrupt ) break; + + if ( XPAT_ACTIVE_LAYER_TABLE[ Obj->LAYER ] == 0 ) continue; + + if ( IsXpatDelete( Obj ) ) continue; + + if ( ( Obj->X <= X2 ) && + ( Obj->Y <= Y2 ) && + ( Obj->X + Obj->DX >= X1 ) && + ( Obj->Y + Obj->DY >= Y1 ) ) + { + if ( ( IsXpatAccept( Obj ) ) || + ( IsXpatConnect( Obj ) ) || + ( IsXpatCursor( Obj ) ) ) + { + XpatAddViewLater( Obj ); + } + else + { + XpatDisplayOneObject( Obj ); + + if ( Obj->NAME != (char *)0 ) + { + if ( ( IsXpatIO( Obj ) && DisplayTextIO ) || + ( IsXpatVector( Obj ) && DisplayTextVector ) ) + { + XpatDisplayOneString( Obj ); + } + } + } + } + } + } + + for ( View = XpatHeadView; + View != (xpatview_list *)NULL; + View = View->NEXT ) + { + Obj = View->OBJECT; + + if ( IsXpatAccept( Obj ) ) + { + XpatDrawGC = XpatAcceptDrawGC; + } + else + if ( IsXpatConnect( Obj ) ) + { + XpatDrawGC = XpatConnectDrawGC; + } + else + { + XpatDrawGC = XpatLayerDrawGC[ Obj->LAYER ]; + } + + XpatDisplayOneObject( Obj ); + + if ( Obj->NAME != (char *)0 ) + { + if ( ( IsXpatIO( Obj ) && DisplayTextIO ) || + ( IsXpatVector( Obj ) && DisplayTextVector ) || + ( IsXpatCursor( Obj ) ) ) + { + XpatDisplayOneString( Obj ); + } + } + } + + XpatDelView(); + + alarm( 0 ); + XpatFlushEventDisplay(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatDisplayObject | +| | +\------------------------------------------------------------*/ + +void XpatDisplayObject( Obj ) + + xpatobj_list *Obj; +{ + xpatobj_list *ScanObj; + long Xmin; + long Ymin; + long Xmax; + long Ymax; + + autbegin(); + + Xmin = Obj->X; + Ymin = Obj->Y; + Xmax = Xmin + Obj->DX; + Ymax = Ymin + Obj->DY; + + ScanObj = Obj->LINK; + + while ( ScanObj != Obj ) + { + if ( Xmin > ScanObj->X ) + { + Xmin = ScanObj->X; + } + + if ( Xmax < ( ScanObj->X + ScanObj->DX ) ) + { + Xmax = ScanObj->X + ScanObj->DX; + } + + if ( Ymin > ScanObj->Y ) + { + Ymin = ScanObj->Y; + } + + if ( Ymax < ( ScanObj->Y + ScanObj->DY ) ) + { + Ymax = ScanObj->Y + ScanObj->DY; + } + + ScanObj = ScanObj->LINK; + } + + Xmin = (float)( Xmin - XPAT_UNIT ) * XpatUnitGridStep; + Ymin = (float)( Ymin - XPAT_UNIT ) * XpatUnitGridStep; + Xmax = (float)( Xmax + XPAT_UNIT ) * XpatUnitGridStep; + Ymax = (float)( Ymax + XPAT_UNIT ) * XpatUnitGridStep; + + Xmin = ( Xmin / XPAT_UNIT ) - XpatPixelGridX - 1; + Xmax = ( Xmax / XPAT_UNIT ) - XpatPixelGridX + 1; + Ymin = ( Ymin / XPAT_UNIT ) - XpatPixelGridY - 1; + Ymax = ( Ymax / XPAT_UNIT ) - XpatPixelGridY + 1; + + if ( Xmin < 0 ) Xmin = 0; + if ( Ymin < 0 ) Ymin = 0; + + if ( Xmax > XpatGraphicDx ) Xmax = XpatGraphicDx; + if ( Ymax > XpatGraphicDy ) Ymax = XpatGraphicDy; + + if ( ( Xmax > 0 ) && + ( Ymax > 0 ) && + ( Xmin < XpatGraphicDx ) && + ( Ymin < XpatGraphicDy ) ) + { + XpatDisplayFigure( Xmin, Ymin , Xmax, Ymax ); + + XpatRefreshGraphicWindow( Xmin, XpatGraphicDy - Ymax, + Xmax - Xmin, Ymax - Ymin ); + } + + autend(); +} diff --git a/alliance/src/xpat/src/XMX_view.h b/alliance/src/xpat/src/XMX_view.h new file mode 100644 index 00000000..9507a950 --- /dev/null +++ b/alliance/src/xpat/src/XMX_view.h @@ -0,0 +1,78 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : View.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_VIEW +# define XPAT_VIEW + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct xpatview_list + { + struct xpatview_list *NEXT; + xpatobj_list *OBJECT; + + } xpatview_list; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xpat/src/XPT.h b/alliance/src/xpat/src/XPT.h new file mode 100644 index 00000000..b0483dee --- /dev/null +++ b/alliance/src/xpat/src/XPT.h @@ -0,0 +1,352 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : XPT.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_XPT +# define XPAT_XPT + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Objects | +| | +\------------------------------------------------------------*/ + +# define XPAT_OBJECT_CIRCLE 0x0000 +# define XPAT_OBJECT_LINE 0x0001 +# define XPAT_OBJECT_RECTANGLE 0x0002 +# define XPAT_OBJECT_ARROW 0x0003 +# define XPAT_OBJECT_TEXT 0x0004 +# define XPAT_OBJECT_HEXAGON 0x0005 +# define XPAT_OBJECT_TYPE 0x000F + +# define XPAT_OBJECT_VECTOR 0x0010 +# define XPAT_OBJECT_IO 0x0020 +# define XPAT_OBJECT_CURSOR 0x0040 + +# define XPAT_OBJECT_LINE_DOWN 0x0100 +# define XPAT_OBJECT_LINE_LEFT 0x0200 + +# define XPAT_OBJECT_SELECT 0x0400 +# define XPAT_OBJECT_ACCEPT 0x0800 +# define XPAT_OBJECT_CONNECT 0x1000 +# define XPAT_OBJECT_DELETE 0x2000 + +/*------------------------------------------------------------\ +| | +| Macros | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Object | +| | +\------------------------------------------------------------*/ + +# define GetXpatObjectType( X ) ( ( X )->TYPE & XPAT_OBJECT_TYPE ) + +# define IsXpatLineDown( X ) ( ( X )->TYPE & XPAT_OBJECT_LINE_DOWN ) +# define IsXpatLineLeft( X ) ( ( X )->TYPE & XPAT_OBJECT_LINE_LEFT ) +# define IsXpatVector( X ) ( ( X )->TYPE & XPAT_OBJECT_VECTOR ) +# define IsXpatIO( X ) ( ( X )->TYPE & XPAT_OBJECT_IO ) +# define IsXpatCursor( X ) ( ( X )->TYPE & XPAT_OBJECT_CURSOR ) + +# define SetXpatLineDown( X ) ( ( X )->TYPE |= XPAT_OBJECT_LINE_DOWN ) +# define SetXpatLineLeft( X ) ( ( X )->TYPE |= XPAT_OBJECT_LINE_LEFT ) +# define SetXpatVector( X ) ( ( X )->TYPE |= XPAT_OBJECT_VECTOR ) +# define SetXpatIO( X ) ( ( X )->TYPE |= XPAT_OBJECT_IO ) +# define SetXpatCursor( X ) ( ( X )->TYPE |= XPAT_OBJECT_CURSOR ) + +# define ClearXpatLineDown( X ) ( ( X )->TYPE &= ~XPAT_OBJECT_LINE_DOWN ) +# define ClearXpatLineLeft( X ) ( ( X )->TYPE &= ~XPAT_OBJECT_LINE_LEFT ) +# define ClearXpatVector( X ) ( ( X )->TYPE &= ~XPAT_OBJECT_VECTOR ) +# define ClearXpatIO( X ) ( ( X )->TYPE &= ~XPAT_OBJECT_IO ) +# define ClearXpatCursor( X ) ( ( X )->TYPE &= ~XPAT_OBJECT_CURSOR ) + +/*------------------------------------------------------------\ +| | +| Select | +| | +\------------------------------------------------------------*/ + +# define IsXpatSelect( X ) ( ( X )->TYPE & XPAT_OBJECT_SELECT ) +# define SetXpatSelect( X ) ( ( X )->TYPE |= XPAT_OBJECT_SELECT ) +# define ClearXpatSelect( X ) ( ( X )->TYPE &= ~XPAT_OBJECT_SELECT ) + +/*------------------------------------------------------------\ +| | +| Accept | +| | +\------------------------------------------------------------*/ + +# define IsXpatAccept( X ) ( ( X )->TYPE & XPAT_OBJECT_ACCEPT ) +# define SetXpatAccept( X ) ( ( X )->TYPE |= XPAT_OBJECT_ACCEPT ) +# define ClearXpatAccept( X ) ( ( X )->TYPE &= ~XPAT_OBJECT_ACCEPT ) + +/*------------------------------------------------------------\ +| | +| Connect | +| | +\------------------------------------------------------------*/ + +# define IsXpatConnect( X ) ( ( X )->TYPE & XPAT_OBJECT_CONNECT ) +# define SetXpatConnect( X ) ( ( X )->TYPE |= XPAT_OBJECT_CONNECT ) +# define ClearXpatConnect( X ) ( ( X )->TYPE &= ~XPAT_OBJECT_CONNECT ) + +/*------------------------------------------------------------\ +| | +| Delete | +| | +\------------------------------------------------------------*/ + +# define IsXpatDelete( X ) ( ( X )->TYPE & XPAT_OBJECT_DELETE ) +# define SetXpatDelete( X ) ( ( X )->TYPE |= XPAT_OBJECT_DELETE ) +# define ClearXpatDelete( X ) ( ( X )->TYPE &= ~XPAT_OBJECT_DELETE ) + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Point | +| | +\------------------------------------------------------------*/ + + typedef struct xpatpoint + { + long X; + long Y; + + } xpatpoint; + +/*------------------------------------------------------------\ +| | +| Object | +| | +\------------------------------------------------------------*/ + + typedef struct xpatobj_list + { + struct xpatobj_list *NEXT; + struct xpatobj_list *LINK; + char *NAME; + short LAYER; + long TYPE; + long X; + long Y; + long DX; + long DY; + void *USER; + + } xpatobj_list; + + typedef struct xpatfig_list + { + struct xpatfig_list *NEXT; + char *NAME; + xpatobj_list *OBJECT [ XPAT_MAX_LAYER ]; + + } xpatfig_list; + +/*------------------------------------------------------------\ +| | +| Pattern Figure | +| | +\------------------------------------------------------------*/ + + typedef struct patfig_list + { + struct patfig_list *NEXT; + char *NAME; + char **IO_NAME_ARRAY; + char **IO_MODE_ARRAY; + char *IO_FORMAT_ARRAY; + long *IO_WIDTH_ARRAY; + long IO_NUMBER; + long IO_NUMBER_BIT; + paseq_list *SEQUENCE; + unsigned long TIME_SCALE; + unsigned long TIME_DELTA; + char TIME_UNIT; + + } patfig_list; + +/*------------------------------------------------------------\ +| | +| Select | +| | +\------------------------------------------------------------*/ + + typedef struct xpatselect_list + { + struct xpatselect_list *NEXT; + xpatobj_list *OBJECT; + + } xpatselect_list; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern long XpatBoundXmin; + extern long XpatBoundYmin; + extern long XpatBoundXmax; + extern long XpatBoundYmax; + extern char XpatRecomputeBound; + + extern xpatfig_list *XpatFigure; + extern patfig_list *XpatFigurePat; + + extern xpatselect_list *XpatHeadSelect; + extern xpatselect_list *XpatHeadConnect; + + extern long XPAT_PATTERN_STEP_X; + extern long XPAT_PATTERN_STEP_Y; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Add Functions | +| | +\------------------------------------------------------------*/ + + extern xpatfig_list *XpatAddFigure(); + extern xpatobj_list *XpatAddCircle(); + extern xpatobj_list *XpatAddLine(); + extern xpatobj_list *XpatAddRectangle(); + extern xpatobj_list *XpatAddHexagon(); + extern xpatobj_list *XpatAddArrow(); + extern xpatobj_list *XpatAddText(); + + extern double XpatReScaleFigure(); + +/*------------------------------------------------------------\ +| | +| Del Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatDelFigure(); + +/*------------------------------------------------------------\ +| | +| Flag Set & Clear Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatSelectObject(); + extern void XpatUnselectObject(); + extern void XpatAcceptObject(); + extern void XpatRejectObject(); + extern void XpatConnectObject(); + extern void XpatDisconnectObject(); + +/*------------------------------------------------------------\ +| | +| Select Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatAddSelect(); + extern void XpatDelSelect(); + extern void XpatPurgeSelect(); + +/*------------------------------------------------------------\ +| | +| Connect Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatAddConnect(); + extern void XpatDelConnect(); + +/*------------------------------------------------------------\ +| | +| Cursor Functions | +| | +\------------------------------------------------------------*/ + + extern xpatobj_list *XpatAddCursor(); + extern void XpatDelCursor(); + +/*------------------------------------------------------------\ +| | +| Bound Compute | +| | +\------------------------------------------------------------*/ + + extern char XpatComputeBound(); + +/*------------------------------------------------------------\ +| | +| Load Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatLoadFigure(); + +/*------------------------------------------------------------\ +| | +| Error Message Functions | +| | +\------------------------------------------------------------*/ + + extern char *XpatGetErrorMessage(); + extern void XpatExitErrorMessage(); + +/*------------------------------------------------------------\ +| | +| Informations Functions | +| | +\------------------------------------------------------------*/ + + extern char *XpatGetInformations(); + +# endif diff --git a/alliance/src/xpat/src/XPT_bound.c b/alliance/src/xpat/src/XPT_bound.c new file mode 100644 index 00000000..aa6fe66e --- /dev/null +++ b/alliance/src/xpat/src/XPT_bound.c @@ -0,0 +1,147 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Bound.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XPT.h" +# include "XPT_bound.h" + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + long XpatBoundXmin = 0; + long XpatBoundYmin = 0; + long XpatBoundXmax = 0; + long XpatBoundYmax = 0; + + char XpatRecomputeBound = XPAT_TRUE; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatComputeBound | +| | +\------------------------------------------------------------*/ + +char XpatComputeBound() + +{ + xpatobj_list *Obj; + short Layer; + short FirstBound; + + if ( XpatFigure == (xpatfig_list *)NULL ) + { + return( XPAT_FALSE ); + } + + if ( XpatRecomputeBound == XPAT_FALSE ) + { + return( XPAT_TRUE ); + } + + autbegin(); + + FirstBound = 1; + + for ( Layer = 0; Layer < XPAT_MAX_LAYER; Layer++ ) + { + for ( Obj = XpatFigure->OBJECT[ Layer ]; + Obj != (xpatobj_list *)NULL; + Obj = Obj->NEXT ) + { + if ( FirstBound ) + { + XpatBoundXmin = Obj->X; + XpatBoundYmin = Obj->Y; + XpatBoundXmax = Obj->X + Obj->DX; + XpatBoundYmax = Obj->Y + Obj->DY; + FirstBound = 0; + } + else + { + if ( Obj->X < XpatBoundXmin ) + { + XpatBoundXmin = Obj->X; + } + + if ( Obj->Y < XpatBoundYmin ) + { + XpatBoundYmin = Obj->Y; + } + + if ( ( Obj->X + Obj->DX ) > XpatBoundXmax ) + { + XpatBoundXmax = Obj->X + Obj->DX; + } + + if ( ( Obj->Y + Obj->DY ) > XpatBoundYmax ) + { + XpatBoundYmax = Obj->Y + Obj->DY; + } + } + } + } + + XpatBoundXmin = XpatBoundXmin - ( XPAT_UNIT << 1 ); + XpatBoundYmin = XpatBoundYmin - ( XPAT_UNIT << 1 ); + XpatBoundXmax = XpatBoundXmax + ( XPAT_UNIT << 1 ); + XpatBoundYmax = XpatBoundYmax + ( XPAT_UNIT << 1 ); + + XpatRecomputeBound = XPAT_FALSE; + + autend(); + return( XPAT_TRUE ); +} diff --git a/alliance/src/xpat/src/XPT_bound.h b/alliance/src/xpat/src/XPT_bound.h new file mode 100644 index 00000000..b531c9c2 --- /dev/null +++ b/alliance/src/xpat/src/XPT_bound.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Bound.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPT_BOUND +# define XPT_BOUND + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XPAT_DEFAULT_BOUND_XMIN 0 +# define XPAT_DEFAULT_BOUND_YMIN 0 +# define XPAT_DEFAULT_BOUND_XMAX 100 +# define XPAT_DEFAULT_BOUND_YMAX 100 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xpat/src/XPT_error.c b/alliance/src/xpat/src/XPT_error.c new file mode 100644 index 00000000..74292deb --- /dev/null +++ b/alliance/src/xpat/src/XPT_error.c @@ -0,0 +1,333 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Error.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XPT.h" +# include "XPT_error.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static FILE *XpatStreamErr; + static FILE *XpatStreamOut; + static FILE *XpatStreamAll; + + static char XpatErrFileName[ 40 ]; + static char XpatOutFileName[ 40 ]; + static char XpatAllFileName[ 40 ]; + + static char XpatNormalMode = 1; + +/*------------------------------------------------------------\ +| | +| Xpat Error Message | +| | +\------------------------------------------------------------*/ + + static char *XpatErrorBuffer = (char *)NULL; + +/*------------------------------------------------------------\ +| | +| Xpat Informations | +| | +\------------------------------------------------------------*/ + + static char XpatInformationsBuffer[ XPAT_INFORMATIONS_BUFFER_SIZE ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Xpat Error Message Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatExitErrorMessage | +| | +\------------------------------------------------------------*/ + +void XpatExitErrorMessage( Error ) + + int Error; +{ + autbegin(); + + if ( XpatStreamErr != (FILE *)0 ) + { + fclose( XpatStreamErr ); + unlink( XpatErrFileName ); + } + + if ( XpatStreamAll != (FILE *)0 ) + { + fclose( XpatStreamAll ); + unlink( XpatAllFileName ); + } + + if ( ( XpatNormalMode ) && + ( XpatStreamOut != (FILE *)0 ) ) + { + fclose( XpatStreamOut ); + unlink( XpatOutFileName ); + } + + exit( Error ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatInitializeErrorMessage | +| | +\------------------------------------------------------------*/ + +void XpatInitializeErrorMessage( Debug ) + + char Debug; +{ + autbegin(); + + XpatNormalMode = ! Debug; + + if ( XpatNormalMode ) + { + sprintf( XpatOutFileName, "/tmp/%s_out_%d", XPAT_TOOL_NAME, getpid() ); + } + + sprintf( XpatErrFileName, "/tmp/%s_err_%d", XPAT_TOOL_NAME, getpid() ); + sprintf( XpatAllFileName, "/tmp/%s_all_%d", XPAT_TOOL_NAME, getpid() ); + + XpatStreamErr = freopen( XpatErrFileName, "w+", stderr); + XpatStreamAll = fopen ( XpatAllFileName, "w+" ); + + if ( XpatNormalMode ) + { + XpatStreamOut = freopen( XpatOutFileName, "w+", stdout); + } + else + { + XpatStreamOut = XpatStreamErr; + } + + if ( ( XpatStreamAll == (FILE *)NULL ) || + ( XpatStreamOut == (FILE *)NULL ) || + ( XpatStreamErr == (FILE *)NULL ) ) + { + fprintf( stdout, "Grm: Unable to open trace window !\n"); + exit( 1 ); + } + + if ( XpatNormalMode ) + { + unlink( XpatOutFileName ); + } + + unlink( XpatErrFileName ); + + signal( SIGINT, XpatExitErrorMessage ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatFlushErrorMessage | +| | +\------------------------------------------------------------*/ + +void XpatFlushErrorMessage() +{ + int Data; + + autbegin(); + + fflush( XpatStreamErr ); + fseek( XpatStreamErr, 0L, 0 ); + + while( ( Data = fgetc( XpatStreamErr ) ) != EOF ) + { + fputc( Data, XpatStreamAll ); + } + + fclose( XpatStreamErr ); + + XpatStreamErr = freopen( XpatErrFileName, "w+", stderr ); + + if ( XpatNormalMode ) + { + fflush( XpatStreamOut ); + fseek( XpatStreamOut, 0L, 0 ); + + while( ( Data = fgetc( XpatStreamOut ) ) != EOF ) + { + fputc( Data, XpatStreamAll ); + } + + fclose( XpatStreamOut ); + + XpatStreamOut = freopen( XpatOutFileName, "w+", stdout ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatGetErrorMessage | +| | +\------------------------------------------------------------*/ + +char *XpatGetErrorMessage() + +{ + char *Message; + long Length; + long Index; + int Data; + + autbegin(); + + XpatFlushErrorMessage(); + + fflush( XpatStreamAll ); + + Length = ftell( XpatStreamAll ); + + if ( XpatErrorBuffer != (char *)NULL ) + { + autfreeblock( XpatErrorBuffer ); + } + + XpatErrorBuffer = autallocblock( Length + 1 ); + Index = 0; + + while ( ( ( Data = fgetc( XpatStreamAll ) ) != EOF ) && + ( Index < Length ) ) + { + XpatErrorBuffer[ Index++ ] = (char)Data; + } + + rewind( XpatStreamAll ); + + XpatErrorBuffer[ Index ] = '\0'; + + if ( Index == 0 ) + { + Message = (char *)NULL; + } + else + { + Message = XpatErrorBuffer; + } + + autend(); + return( Message ); +} + +/*------------------------------------------------------------\ +| | +| XpatGetInformations | +| | +\------------------------------------------------------------*/ + +char *XpatGetInformations() + +{ + char *Scan; + + autbegin(); + + XpatComputeBound(); + + Scan = XpatInformationsBuffer; + + if ( XpatFigurePat != (patfig_list *)NULL ) + { + sprintf( Scan, " FIGURE : %s\n\n PATTERNS : %d\n\n", + XpatFigurePat->NAME, + XpatFigurePat->SEQUENCE->PATNBR ); + } + else + { + sprintf( Scan, " FIGURE : No current figure !\n\n" ); + } + + Scan = Scan + strlen( Scan ); + + sprintf( Scan, " BOUNDING BOX : \n\n XMIN : %d\n YMIN : %d\n XMAX : %d\n YMAX : %d\n\n", + XpatBoundXmin / XPAT_UNIT, XpatBoundYmin / XPAT_UNIT, + XpatBoundXmax / XPAT_UNIT, XpatBoundYmax / XPAT_UNIT ); + + Scan = Scan + strlen( Scan ); + + sprintf( Scan, " XPAT PARAM : %s\n\n", XPAT_PARAM_NAME ); + + autend(); + return( XpatInformationsBuffer ); +} diff --git a/alliance/src/xpat/src/XPT_error.h b/alliance/src/xpat/src/XPT_error.h new file mode 100644 index 00000000..8793aef6 --- /dev/null +++ b/alliance/src/xpat/src/XPT_error.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Error.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPT_ERROR +# define XPT_ERROR + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XPAT_INFORMATIONS_BUFFER_SIZE 1024 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatFlushErrorMessage(); + +# endif diff --git a/alliance/src/xpat/src/XPT_object.c b/alliance/src/xpat/src/XPT_object.c new file mode 100644 index 00000000..200d6c4f --- /dev/null +++ b/alliance/src/xpat/src/XPT_object.c @@ -0,0 +1,455 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Object.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XPT.h" +# include "XPT_place.h" +# include "XPT_object.h" +# include "XPT_pat.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + xpatfig_list *XpatFigure = (xpatfig_list *)NULL; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Alloc Functions | +| | +\------------------------------------------------------------*/ + +xpatfig_list *XpatAllocFigure() +{ + return( (xpatfig_list *)autallocblock( sizeof( xpatfig_list ) ) ); +} + +xpatobj_list *XpatAllocObject() +{ + return( (xpatobj_list *)autallocheap( sizeof( xpatobj_list ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Free Functions | +| | +\------------------------------------------------------------*/ + +void XpatFreeFigure( Figure ) + + xpatfig_list *Figure; +{ + autfreeblock( Figure ); +} + +void XpatFreeObject( Object ) + + xpatobj_list *Object; +{ + autfreeheap( Object, sizeof( xpatobj_list ) ); +} + +/*------------------------------------------------------------\ +| | +| Add Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatAddCircle | +| | +\------------------------------------------------------------*/ + +xpatobj_list *XpatAddCircle( X, Y, R, Layer ) + + long X; + long Y; + long R; + short Layer; +{ + xpatobj_list *Object; + + autbegin(); + + Object = XpatAllocObject(); + Object->TYPE = XPAT_OBJECT_CIRCLE; + Object->LAYER = Layer; + Object->NEXT = XpatFigure->OBJECT[ Layer ]; + Object->X = X - R; + Object->Y = Y - R; + Object->DX = ( R << 1 ); + Object->DY = ( R << 1 ); + + XpatFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XpatAddLine | +| | +\------------------------------------------------------------*/ + +xpatobj_list *XpatAddLine( X1, Y1, X2, Y2, Layer ) + + long X1; + long Y1; + long X2; + long Y2; + short Layer; +{ + xpatobj_list *Object; + + autbegin(); + + Object = XpatAllocObject(); + Object->LAYER = Layer; + Object->TYPE = XPAT_OBJECT_LINE; + Object->NEXT = XpatFigure->OBJECT[ Layer ]; + + if ( X1 > X2 ) + { + SetXpatLineLeft( Object ); + + Object->X = X2; + Object->DX = X1 - X2; + } + else + { + Object->X = X1; + Object->DX = X2 - X1; + } + + if ( Y1 > Y2 ) + { + SetXpatLineDown( Object ); + + Object->Y = Y2; + Object->DY = Y1 - Y2; + } + else + { + Object->Y = Y1; + Object->DY = Y2 - Y1; + } + + XpatFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XpatAddArrow | +| | +\------------------------------------------------------------*/ + +xpatobj_list *XpatAddArrow( X1, Y1, X2, Y2, Layer ) + + long X1; + long Y1; + long X2; + long Y2; + short Layer; +{ + xpatobj_list *Object; + + autbegin(); + + Object = XpatAllocObject(); + Object->LAYER = Layer; + Object->TYPE = XPAT_OBJECT_ARROW; + Object->NEXT = XpatFigure->OBJECT[ Layer ]; + + if ( X1 > X2 ) + { + SetXpatLineLeft( Object ); + + Object->X = X2; + Object->DX = X1 - X2; + } + else + { + Object->X = X1; + Object->DX = X2 - X1; + } + + if ( Y1 > Y2 ) + { + SetXpatLineDown( Object ); + + Object->Y = Y2; + Object->DY = Y1 - Y2; + } + else + { + Object->Y = Y1; + Object->DY = Y2 - Y1; + } + + XpatFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XpatAddRectangle | +| | +\------------------------------------------------------------*/ + +xpatobj_list *XpatAddRectangle( X, Y, DX, DY, Layer ) + + long X; + long Y; + long DX; + long DY; + short Layer; +{ + xpatobj_list *Object; + + autbegin(); + + Object = XpatAllocObject(); + Object->TYPE = XPAT_OBJECT_RECTANGLE; + Object->LAYER = Layer; + Object->NEXT = XpatFigure->OBJECT[ Layer ]; + Object->X = X; + Object->Y = Y; + Object->DX = DX; + Object->DY = DY; + + XpatFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XpatAddHexagon | +| | +\------------------------------------------------------------*/ + +xpatobj_list *XpatAddHexagon( X, Y, DX, DY, Layer ) + + long X; + long Y; + long DX; + long DY; + short Layer; +{ + xpatobj_list *Object; + + autbegin(); + + Object = XpatAllocObject(); + Object->TYPE = XPAT_OBJECT_HEXAGON; + Object->LAYER = Layer; + Object->NEXT = XpatFigure->OBJECT[ Layer ]; + Object->X = X; + Object->Y = Y; + Object->DX = DX; + Object->DY = DY; + + XpatFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XpatAddText | +| | +\------------------------------------------------------------*/ + +xpatobj_list *XpatAddText( X, Y, Name, Layer ) + + long X; + long Y; + char *Name; + short Layer; +{ + xpatobj_list *Object; + long Width; + + autbegin(); + + Width = strlen( Name ) * XPAT_PATTERN_STEP_Y * XPAT_UNIT / 2.0; + + Object = XpatAllocObject(); + Object->LAYER = Layer; + Object->TYPE = XPAT_OBJECT_TEXT; + Object->NEXT = XpatFigure->OBJECT[ Layer ]; + Object->NAME = autnamealloc( Name ); + Object->X = X - Width; + Object->Y = Y; + Object->DX = Width; + Object->DY = 0; + + XpatFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XpatAddFigure | +| | +\------------------------------------------------------------*/ + +xpatfig_list *XpatAddFigure() +{ + autbegin(); + + XpatFigure = XpatAllocFigure(); + XpatFigure->NAME = XpatFigurePat->NAME; + + XpatPlaceFigure(); + + autend(); + return( XpatFigure ); +} + +/*------------------------------------------------------------\ +| | +| Load Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatLoadFigure | +| | +\------------------------------------------------------------*/ + +void XpatLoadFigure( FileName ) + + char *FileName; +{ + autbegin(); + + XpatFigurePat = Xpatloadpatfig( FileName ); + + if ( XpatFigurePat != (patfig_list *)NULL ) + { + XpatAddFigure(); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Del Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatDelFigure | +| | +\------------------------------------------------------------*/ + +void XpatDelFigure() +{ + xpatobj_list *ScanObject; + xpatobj_list *DelObject; + short Layer; + + if ( XpatFigure == (xpatfig_list *)NULL ) return; + + autbegin(); + + for ( Layer = 0; Layer < XPAT_MAX_LAYER; Layer++ ) + { + ScanObject = XpatFigure->OBJECT[ Layer ]; + + while ( ScanObject != (xpatobj_list *)NULL ) + { + DelObject = ScanObject; + ScanObject = ScanObject->NEXT; + + XpatFreeObject( DelObject ); + } + } + + XpatFreeFigure( XpatFigure ); + pat_delpatfig( XpatFigurePat ); + + XpatFigure = (xpatfig_list *)NULL; + XpatFigurePat = (patfig_list *)NULL; + + autend(); +} diff --git a/alliance/src/xpat/src/XPT_object.h b/alliance/src/xpat/src/XPT_object.h new file mode 100644 index 00000000..b2c0a8c7 --- /dev/null +++ b/alliance/src/xpat/src/XPT_object.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Object.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPT_OBJECT_H +# define XPT_OBJECT_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xpat/src/XPT_pat.c b/alliance/src/xpat/src/XPT_pat.c new file mode 100644 index 00000000..bd917c25 --- /dev/null +++ b/alliance/src/xpat/src/XPT_pat.c @@ -0,0 +1,502 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Pat.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "ppt.h" +# include "XSB.h" +# include "XPT.h" +# include "XPT_pat.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + patfig_list *XpatFigurePat = (patfig_list *)NULL; + +/*------------------------------------------------------------\ +| | +| For Set Long Jump | +| | +\------------------------------------------------------------*/ + + static jmp_buf XpatJumpBuffer; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Xpat Exit Handler Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatExitHandler | +| | +\------------------------------------------------------------*/ + +void XpatExitHandler() +{ + XpatFlushErrorMessage(); + + longjmp( XpatJumpBuffer, 1); +} + +/*------------------------------------------------------------\ +| | +| XpatActiveExitHandler | +| | +\------------------------------------------------------------*/ + +void XpatActiveExitHandler() +{ + MBK_EXIT_FUNCTION = XpatExitHandler; +} + +/*------------------------------------------------------------\ +| | +| XpatResetExitHandler | +| | +\------------------------------------------------------------*/ + +void XpatResetExitHandler() +{ + MBK_EXIT_FUNCTION = NULL; +} + +/*------------------------------------------------------------\ +| | +| Get Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| pat_frepaseq | +| | +\------------------------------------------------------------*/ + +static void pat_frepaseq( Sequence ) + + paseq_list *Sequence; +{ + pagrp_list *PaGrp; + pains_list *PaIns; + + mbkfree( Sequence->PAIOL ); + + pat_frepapat( Sequence->OLDPAT ); + pat_frepapat( Sequence->CURPAT ); + pat_frepapat( Sequence->NXTPAT ); + + pat_frepacom( Sequence->DECCOM ); + pat_frepacom( Sequence->OLDCOM ); + pat_frepacom( Sequence->CURCOM ); + + while ( Sequence->PAGRP != (pagrp_list *)0 ) + { + PaGrp = Sequence->PAGRP; + Sequence->PAGRP = PaGrp->NEXT; + + mbkfree( PaGrp ); + } + + while ( Sequence->PAINS != (pains_list *)0 ) + { + PaIns = Sequence->PAINS; + Sequence->PAINS = PaIns->NEXT; + + mbkfree( PaIns ); + } + + mbkfree( Sequence ); +} + +/*------------------------------------------------------------\ +| | +| pat_delpatfig | +| | +\------------------------------------------------------------*/ + +void pat_delpatfig( FigurePat ) + + patfig_list *FigurePat; +{ + pat_frepaseq( FigurePat->SEQUENCE ); + + autfreeblock( FigurePat->IO_NAME_ARRAY ); + autfreeblock( FigurePat->IO_FORMAT_ARRAY ); + autfreeblock( FigurePat->IO_MODE_ARRAY ); + autfreeblock( FigurePat->IO_WIDTH_ARRAY ); + + autfreeblock( FigurePat ); +} + +/*------------------------------------------------------------\ +| | +| pat_addpatfig | +| | +\------------------------------------------------------------*/ + +patfig_list *pat_addpatfig( Sequence ) + + paseq_list *Sequence; +{ + patfig_list *FigurePat; + char **ModeArray; + char **NameArray; + char *FormatArray; + long *WidthArray; + char *ScanBuffer; + + char Buffer[ 4096 ]; + char Name [ 256 ]; + char Format; + int Left; + int Right; + char *Direction; + char *Mode; + + long NumberIO; + long NumberBit; + long IndexBit; + + char TimeUnit; + unsigned long TimeScale; + unsigned long TimeDelta; + unsigned long Delta; + unsigned long TimeCurrent; + unsigned long TimeNext; + char TimeAllZero; + + paiol_list *ScanIol; + pagrp_list *ScanGrp; + papat_list *ScanPaPat; + + if ( Sequence == (paseq_list *)0 ) + { + return( (patfig_list *)0 ); + } + + if ( Sequence->ERRFLG != 0 ) + { + pat_frepaseq( Sequence ); + + return( (patfig_list *)0 ); + } + + FigurePat = (patfig_list *)autallocblock( sizeof( patfig_list ) ); + + NumberBit = Sequence->IOLNBR; + ScanGrp = Sequence->PAGRP; + + ScanIol = Sequence->PAIOL; + + NameArray = (char **)autallocblock( sizeof( char * ) * NumberBit ); + FormatArray = (char *)autallocblock( sizeof( char ) * NumberBit ); + ModeArray = (char **)autallocblock( sizeof( char * ) * NumberBit ); + WidthArray = (long *)autallocblock( sizeof( long ) * NumberBit ); + + NumberIO = 0; + IndexBit = 0; + + while ( ScanIol != (paiol_list *)0 ) + { + switch ( ScanIol->MODE) + { + case 'I': Mode = "in"; + break; + case 'O': + case 'B': + case 'Z': Mode = "out"; + break; + case 'R': Mode = "register"; + break; + case 'T': Mode = "inout"; + break; + case 'S': + case 'W': + case 'X': + case 'U': Mode = "signal"; + break; + } + + Format = ScanIol->FORMAT; + +# ifdef DEBUG + if ( ScanGrp != (pagrp_list *)0 ) + { + fprintf( stdout, "ScanGrp %s %d %d %d\n", + ScanGrp->NAME, ScanGrp->FINDEX, ScanGrp->LENGTH, ScanGrp->FLAG ); + } +# endif + + if ( ( ScanGrp != (pagrp_list *)0 ) && + ( IndexBit == ScanGrp->FINDEX ) ) + { + if ( Format == 'B' ) Format = 'X'; + /* + if ( ScanIol->FORMAT != 'B' ) + */ + { + if ( ! ScanGrp->FLAG ) + { + sscanf( ScanIol->NAME, "%s %d", Name, &Left ); + + ScanIol += ScanGrp->LENGTH - 1; + IndexBit += ScanGrp->LENGTH; + + sscanf( ScanIol->NAME, "%s %d", Name, &Right ); + + if ( Left < Right ) Direction = "to"; + else Direction = "downto"; + + sprintf( Buffer, "%s (%d %s %d) %c", Name, Left, Direction, Right, Format ); + + ScanIol = ScanIol->NEXT; + } + else + { +# ifdef DEBUG + fprintf( stdout, "NAME %s\n", ScanGrp->NAME ); +# endif + + ScanBuffer = Buffer; + strcpy( ScanBuffer, ScanGrp->NAME ); + ScanBuffer += strlen( ScanBuffer ); + strcpy( ScanBuffer, " (" ); + ScanBuffer += 2; + + for ( Left = 0; Left < ScanGrp->LENGTH; Left++ ) + { +# ifdef DEBUG + fprintf( stdout, "IOLNAME %s\n", ScanIol->NAME ); +# endif + strcpy( ScanBuffer, ScanIol->NAME ); + ScanBuffer += strlen( ScanBuffer ); + + if ( Left != (ScanGrp->LENGTH - 1) ) + { + strcpy( ScanBuffer, ", " ); + ScanBuffer += 2; + } + + ScanIol = ScanIol->NEXT; + } + + strcpy( ScanBuffer, ")" ); + IndexBit += ScanGrp->LENGTH; +# ifdef DEBUG + fprintf( stdout, "Buffer %s\n", Buffer ); +# endif + } + + NameArray [ NumberIO ] = autnamealloc( Buffer ); + ModeArray [ NumberIO ] = autnamealloc( Mode ); + FormatArray[ NumberIO ] = Format; + WidthArray [ NumberIO ] = ScanGrp->LENGTH; + NumberIO = NumberIO + 1; + + ScanGrp = ScanGrp->NEXT; + + continue; + } + } + + NameArray [ NumberIO ] = ScanIol->NAME; + FormatArray[ NumberIO ] = Format; + ModeArray [ NumberIO ] = autnamealloc( Mode ); + WidthArray [ NumberIO ] = 1; + NumberIO = NumberIO + 1; + + ScanIol = ScanIol->NEXT; + IndexBit = IndexBit + 1; + } + + FigurePat->NAME = Sequence->NAME; + FigurePat->SEQUENCE = Sequence; + FigurePat->IO_NUMBER_BIT = NumberBit; + FigurePat->IO_NUMBER = NumberIO; + FigurePat->IO_NAME_ARRAY = NameArray; + FigurePat->IO_MODE_ARRAY = ModeArray; + FigurePat->IO_FORMAT_ARRAY = FormatArray; + FigurePat->IO_WIDTH_ARRAY = WidthArray; + + switch ( Sequence->TIME_UNIT & PAT_SEQ__TIMEUNIT ) + { + case PAT_TU__FS : TimeScale = 1000000000; + TimeUnit = PAT_TU__US; + break; + case PAT_TU__PS : TimeScale = 1000000000; + TimeUnit = PAT_TU__MS; + break; + case PAT_TU__NS : TimeScale = 1000000; + TimeUnit = PAT_TU__MS; + break; + case PAT_TU__US : TimeScale = 1000; + TimeUnit = PAT_TU__MS; + break; + default : TimeScale = 1; + TimeUnit = Sequence->TIME_UNIT; + break; + } + + TimeDelta = 0; + +# ifdef DEBUG + fprintf( stdout, "PAT_TIMEUNIT %d\n", PAT_TIMEUNIT ); +# endif + + if ( ( Sequence->TIME_UNIT & PAT_SEQ__TIMEUNIT ) != PAT_TU__VU ) + { + for ( ScanPaPat = Sequence->CURPAT; + ScanPaPat != (papat_list *)0; + ScanPaPat = ScanPaPat->NEXT ) + { +# ifdef DEBUG + fprintf( stdout, "%ld\n", ScanPaPat->TIME ); +# endif + if ( ScanPaPat->TIME != 0 ) TimeAllZero = 0; + + if ( ScanPaPat->NEXT != (papat_list *)0 ) + { + Delta = ScanPaPat->NEXT->TIME - ScanPaPat->TIME; + + if ( ( TimeDelta == 0 ) || + ( TimeDelta > Delta ) ) + { + TimeDelta = Delta; + } + } + + while ( ( TimeScale != 1 ) && + ( ( ScanPaPat->TIME % TimeScale ) != 0 ) ) + { + TimeScale /= 1000; + TimeUnit--; + } + } + + TimeDelta /= TimeScale; + + if ( TimeDelta == 0 ) TimeDelta = 1; + } + else + { + TimeUnit = Sequence->TIME_UNIT; + TimeScale = 1; + TimeDelta = 1; + } + +# ifdef DEBUG + fprintf( stdout, "TIME_UNIT %ld\n", TimeUnit ); + fprintf( stdout, "TIME_SCALE %ld\n", TimeScale ); + fprintf( stdout, "TIME_DELTA %ld\n", TimeDelta ); +# endif + + FigurePat->TIME_UNIT = TimeUnit; + FigurePat->TIME_SCALE = TimeScale; + FigurePat->TIME_DELTA = TimeDelta; + + return( FigurePat ); +} + +/*------------------------------------------------------------\ +| | +| Xpatlodpaseq | +| | +\------------------------------------------------------------*/ + +patfig_list *Xpatloadpatfig( FileName ) + + char *FileName; +{ + paseq_list *Sequence; + + autbegin(); + + Sequence = (paseq_list *)NULL; + + XpatActiveExitHandler(); + + if ( setjmp( XpatJumpBuffer ) == 0 ) + { + Sequence = pat_lodpaseq( FileName, (paseq_list *)0, 0, 0 ); + + XpatResetExitHandler(); + + autend(); + return( pat_addpatfig( Sequence ) ); + } + + XpatResetExitHandler(); + + if ( Sequence != (paseq_list *)NULL ) + { + pat_frepaseq( Sequence ); + } + + autend(); + return( (patfig_list *)NULL ); +} diff --git a/alliance/src/xpat/src/XPT_pat.h b/alliance/src/xpat/src/XPT_pat.h new file mode 100644 index 00000000..53d23c6b --- /dev/null +++ b/alliance/src/xpat/src/XPT_pat.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Fsm.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPT_PAT_H +# define XPT_PAT_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern patfig_list *Xpatloadpatfig(); + +# endif diff --git a/alliance/src/xpat/src/XPT_place.c b/alliance/src/xpat/src/XPT_place.c new file mode 100644 index 00000000..d40b99ac --- /dev/null +++ b/alliance/src/xpat/src/XPT_place.c @@ -0,0 +1,635 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Place.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XPT.h" +# include "XPT_place.h" +# include "XPT_pat.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Place Step | +| | +\------------------------------------------------------------*/ + + long XPAT_PATTERN_STEP_X = 1; + long XPAT_PATTERN_STEP_Y = 2; + + extern char *XpatTimeUnit[ PAT_TU__MS + 1 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatPlaceInputOutput | +| | +\------------------------------------------------------------*/ + +void XpatPlaceInputOutput() +{ + xpatobj_list *Text; + char **NameArray; + long NumberIO; + long Index; + long StepX; + long StepY; + long Y; + long X; + + autbegin(); + + StepX = ( XPAT_UNIT * XPAT_PATTERN_STEP_X ); + StepY = ( XPAT_UNIT * XPAT_PATTERN_STEP_Y ); + + NameArray = XpatFigurePat->IO_NAME_ARRAY; + NumberIO = XpatFigurePat->IO_NUMBER; + + X = - 2 * StepX; + Y = StepY / 4; + + for ( Index = 0; Index < NumberIO; Index++ ) + { + Text = XpatAddText( X, Y, NameArray[ Index ], 6 ); + Text->LINK = Text; + + SetXpatIO( Text ); + + Y += StepY; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatGetBitStringHexa | +| | +\------------------------------------------------------------*/ + +char *XpatGetBitStringHexa( BitString, Width ) + + char *BitString; + long Width; +{ + char Buffer[ 512 ]; + char ScanChar; + long Index; + long Target; + long Sum; + long Shift; + + Target = ( ( Width - 1 ) >> 2 ); + Sum = 0; + Shift = 0; + + Buffer[ 0 ] = ' '; + Buffer[ Target + 1 ] = '\0'; + + for ( Index = ( Width - 1 ); Index >= 0; Index-- ) + { + ScanChar = BitString[ Index ]; + + if ( ScanChar == '*' ) + { + return( autnamealloc( "*" ) ); + } + + Sum += ( ( ScanChar - '0' ) << Shift ); + Shift += 1; + + if ( Shift == 4 ) + { + if ( Sum > 9 ) Buffer[ Target-- ] = Sum + 'A' - 10; + else Buffer[ Target-- ] = Sum + '0'; + + Sum = 0; + Shift = 0; + } + } + + if ( Shift != 0 ) + { + if ( Sum > 9 ) Buffer[ Target-- ] = Sum + 'A' - 10; + else Buffer[ Target-- ] = Sum + '0'; + } + + return( autnamealloc( Buffer ) ); +} + +/*------------------------------------------------------------\ +| | +| XpatGetBitStringOctal | +| | +\------------------------------------------------------------*/ + +char *XpatGetBitStringOctal( BitString, Width ) + + char *BitString; + long Width; +{ + char Buffer[ 512 ]; + char *ScanBuffer; + char ScanChar; + long Index; + long Target; + long Sum; + long Shift; + + Target = ( ( Width - 1 ) / 3 ); + Sum = 0; + Shift = 0; + + Buffer[ 0 ] = ' '; + Buffer[ Target + 2 ] = '\0'; + ScanBuffer = &Buffer[ 1 ]; + + for ( Index = ( Width - 1 ); Index >= 0; Index-- ) + { + ScanChar = BitString[ Index ]; + + if ( ScanChar == '*' ) + { + return( autnamealloc( "*" ) ); + } + + Sum += ( ( ScanChar - '0' ) << Shift ); + Shift += 1; + + if ( Shift == 3 ) + { + ScanBuffer[ Target-- ] = Sum + '0'; + + Sum = 0; + Shift = 0; + } + } + + if ( Shift != 0 ) + { + ScanBuffer[ Target-- ] = Sum + '0'; + } + + return( autnamealloc( Buffer ) ); +} + +/*------------------------------------------------------------\ +| | +| XpatPlacePattern | +| | +\------------------------------------------------------------*/ + +void XpatPlacePattern() +{ + xpatobj_list *Object; + xpatobj_list *ScanObj; + paseq_list *PaSeq; + papat_list *PaPat; + paevt_list *PaEvt; + long *WidthArray; + char *FormatArray; + char *CurrentEvent; + char *NextEvent; + xpatobj_list **ObjectEvent; + char Event; + char *NextString; + char *CurrentString; + char *Name; + char FirstTime; + long NumberIO; + long NumberBit; + long IndexIO; + long IndexBit; + long Width; + long X; + long Y; + long StepX; + long StepY; + long Height; + long HalfHeight; + + unsigned long CurrentTime; + unsigned long NextTime; + long DeltaX; + + autbegin(); + + NumberIO = XpatFigurePat->IO_NUMBER; + NumberBit = XpatFigurePat->IO_NUMBER_BIT; + PaSeq = XpatFigurePat->SEQUENCE; + WidthArray = XpatFigurePat->IO_WIDTH_ARRAY; + FormatArray = XpatFigurePat->IO_FORMAT_ARRAY; + + CurrentEvent = autallocblock( NumberBit + 1 ); + NextEvent = autallocblock( NumberBit + 1 ); + ObjectEvent = (xpatobj_list **)autallocblock( sizeof( xpatobj_list *) * NumberIO ); + + memset( NextEvent, '*', NumberBit ); + + XPAT_PATTERN_STEP_X = 1; + XPAT_PATTERN_STEP_Y = 2; + + StepX = ( XPAT_UNIT * XPAT_PATTERN_STEP_X ); + StepY = ( XPAT_UNIT * XPAT_PATTERN_STEP_Y ); + + HalfHeight = ( StepY / 4 ); + Height = ( StepY / 2 ); + X = 0; + FirstTime = 1; + + for ( PaPat = PaSeq->CURPAT; + PaPat != (papat_list *)0; + PaPat = PaPat->NEXT ) + { + CurrentTime = PaPat->TIME / XpatFigurePat->TIME_SCALE; + CurrentTime = CurrentTime / XpatFigurePat->TIME_DELTA; + + if ( PaPat->NEXT != (papat_list *)0 ) + { + NextTime = PaPat->NEXT->TIME / XpatFigurePat->TIME_SCALE; + NextTime = NextTime / XpatFigurePat->TIME_DELTA; + } + else + { + NextTime = CurrentTime + 1; + } + + DeltaX = (NextTime - CurrentTime) * StepX; + + if ( DeltaX == 0 ) DeltaX = StepX; + + if ( ! FirstTime ) + { + memcpy( CurrentEvent, NextEvent, NumberBit ); + } + + for ( PaEvt = PaPat->PAEVT; + PaEvt != (paevt_list *)0; + PaEvt = PaEvt->NEXT ) + { + Event = PaEvt->USRVAL; + + if ( Event == '-' ) Event = '0'; + else + if ( Event == '+' ) Event = '1'; + + NextEvent[ PaEvt->INDEX ] = Event; + } + + if ( FirstTime ) + { + FirstTime = 0; + memcpy( CurrentEvent, NextEvent, NumberBit ); + } + + Y = 0; + IndexBit = 0; + IndexIO = 0; + + while ( IndexBit < NumberBit ) + { + Width = WidthArray[ IndexIO ]; + + if ( Width == 1 ) + { + Object = ObjectEvent[ IndexIO ]; + + if ( ( NextEvent[ IndexBit ] == CurrentEvent[ IndexBit ] ) && + ( Object != (xpatobj_list *)0 ) ) + { + Object->DX += DeltaX; + } + else + { + switch ( NextEvent[ IndexBit ] ) + { + case '0' : + + Object = XpatAddLine( X, Y, X + DeltaX, Y, 0 ); + Name = autnamealloc( "0" ); + + if ( CurrentEvent[ IndexBit ] == '1' ) + { + Object->LINK = XpatAddArrow( X, Y, X, Y + Height, 2 ); + Object->LINK->LINK = XpatAddLine( X, Y, X, Y + Height, 0 ); + Object->LINK->LINK->LINK = Object; + } + else + { + Object->LINK = Object; + } + break; + + case '1' : + + Object = XpatAddLine( X, Y + Height, X + DeltaX, Y + Height, 1 ); + Name = autnamealloc( "1" ); + + if ( CurrentEvent[ IndexBit ] == '0' ) + { + Object->LINK = XpatAddArrow( X, Y + Height, X, Y, 3 ); + Object->LINK->LINK = XpatAddLine( X, Y + Height, X, Y, 1 ); + Object->LINK->LINK->LINK = Object; + } + else + { + Object->LINK = Object; + } + break; + + case '*' : + + Object = XpatAddRectangle( X, Y, DeltaX, Height, 4 ); + Name = autnamealloc( "*" ); + Object->LINK = Object; + + break; + } + + ScanObj = Object; + + do + { + ScanObj->NAME = Name; + ScanObj = ScanObj->LINK; + } + while ( ScanObj != Object ); + } + } + else + { + Object = ObjectEvent[ IndexIO ]; + + if ( FormatArray[ IndexIO ] == 'O' ) + { + CurrentString = XpatGetBitStringOctal( CurrentEvent + IndexBit, Width ); + NextString = XpatGetBitStringOctal( NextEvent + IndexBit, Width ); + } + else + { + CurrentString = XpatGetBitStringHexa( CurrentEvent + IndexBit, Width ); + NextString = XpatGetBitStringHexa( NextEvent + IndexBit, Width ); + } + + if ( ( NextString == CurrentString ) && + ( Object != (xpatobj_list *)0 ) ) + { + Object->DX += DeltaX; + } + else + { + if ( NextString[ 0 ] == '*' ) + { + Object = XpatAddHexagon( X, Y, DeltaX, Height, 4 ); + Object->LINK = Object; + } + else + { + Object = XpatAddHexagon( X, Y, DeltaX, Height, 5 ); + SetXpatVector( Object ); + Object->LINK = Object; + } + + Name = autnamealloc( NextString ); + ScanObj = Object; + + do + { + ScanObj->NAME = Name; + ScanObj = ScanObj->LINK; + } + while ( ScanObj != Object ); + } + } + + ObjectEvent[ IndexIO++ ] = Object; + + IndexBit += Width; + Y += StepY; + } + + X += DeltaX; + } + + autfreeblock( CurrentEvent ); + autfreeblock( NextEvent ); + autfreeblock( ObjectEvent ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatPlaceFigure | +| | +\------------------------------------------------------------*/ + +void XpatPlaceFigure() +{ + autbegin(); + + XpatPlacePattern(); + XpatPlaceInputOutput(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatAddCursor | +| | +\------------------------------------------------------------*/ + +xpatobj_list *XpatAddCursor( X ) + + long X; +{ + xpatobj_list *Obj; + char *Unit; + long NumberIO; + long Y1; + long Y2; + char Buffer[ 32 ]; + + autbegin(); + + if ( X >= 0 ) + { + NumberIO = XpatFigurePat->IO_NUMBER; + Unit = XpatTimeUnit[ XpatFigurePat->TIME_UNIT ]; + + sprintf( Buffer, "<%d %s>", X, Unit ); + + X *= XPAT_UNIT; + Y1 = ( -1 ) * XPAT_PATTERN_STEP_Y * XPAT_UNIT; + Y2 = ( NumberIO + 1 ) * XPAT_PATTERN_STEP_Y * XPAT_UNIT; + + Obj = XpatAddLine( X, Y1, X, Y2, 6 ); + Obj->LINK = XpatAddText( X, Y2, Buffer, 6 ); + Obj->LINK->LINK = Obj; + + SetXpatCursor( Obj ); + SetXpatCursor( Obj->LINK ); + } + else + { + Obj = (xpatobj_list *)0; + } + + return( Obj ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatDelCursor | +| | +\------------------------------------------------------------*/ + +void XpatDelCursor( Object ) + + xpatobj_list *Object; +{ + xpatobj_list *Scan; + + autbegin(); + + Scan = Object; + + do + { + SetXpatDelete( Scan ); + + Scan = Scan->LINK; + } + while ( Scan != Object ); + + autend(); +} + + +/*------------------------------------------------------------\ +| | +| XpatReScaleFigure | +| | +\------------------------------------------------------------*/ + +double XpatReScaleFigure( Less ) + + int Less; +{ + xpatobj_list *ScanObj; + long PatternStepY; + double Ratio; + int Layer; + + autbegin(); + + if ( XpatFigure == (xpatfig_list *)0 ) return( 1.0 ); + + if ( Less ) + { + PatternStepY = XPAT_PATTERN_STEP_Y >> 1; + + if ( PatternStepY < 1 ) + { + PatternStepY = 1; + } + } + else + { + PatternStepY = XPAT_PATTERN_STEP_Y << 1; + + if ( PatternStepY > 0x10000 ) + { + PatternStepY = 0x10000; + } + } + + Ratio = (double)PatternStepY / (double)XPAT_PATTERN_STEP_Y; + + for ( Layer = 0; Layer < XPAT_MAX_LAYER; Layer++ ) + { + for ( ScanObj = XpatFigure->OBJECT[ Layer ]; + ScanObj != (xpatobj_list *)0; + ScanObj = ScanObj->NEXT ) + { + ScanObj->Y *= Ratio; + ScanObj->DY *= Ratio; + } + } + + XPAT_PATTERN_STEP_Y = PatternStepY; + + autend(); + + return( Ratio ); +} diff --git a/alliance/src/xpat/src/XPT_place.h b/alliance/src/xpat/src/XPT_place.h new file mode 100644 index 00000000..3c40498a --- /dev/null +++ b/alliance/src/xpat/src/XPT_place.h @@ -0,0 +1,82 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Place.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPT_PLACE_H +# define XPT_PLACE_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Mask | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatPlaceFigure(); + +# endif diff --git a/alliance/src/xpat/src/XPT_select.c b/alliance/src/xpat/src/XPT_select.c new file mode 100644 index 00000000..ca16d24b --- /dev/null +++ b/alliance/src/xpat/src/XPT_select.c @@ -0,0 +1,423 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Select.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XPT.h" +# include "XPT_select.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + xpatselect_list *XpatHeadSelect = (xpatselect_list *)NULL; + xpatselect_list *XpatHeadConnect = (xpatselect_list *)NULL; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Alloc Functions | +| | +\------------------------------------------------------------*/ + +xpatselect_list *XpatAllocSelect() +{ + return( (xpatselect_list *)autallocheap( sizeof( xpatselect_list ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Free Functions | +| | +\------------------------------------------------------------*/ + +void XpatFreeSelect( Select ) + + xpatselect_list *Select; +{ + autfreeheap( Select, sizeof( xpatselect_list ) ); +} + +/*------------------------------------------------------------\ +| | +| Select Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatSelectObject | +| | +\------------------------------------------------------------*/ + +void XpatSelectObject( Object ) + + xpatobj_list *Object; +{ + xpatobj_list *Scan; + + autbegin(); + + Scan = Object; + + do + { + SetXpatSelect( Scan ); + + Scan = Scan->LINK; + } + while ( Scan != Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatUnselectObject | +| | +\------------------------------------------------------------*/ + +void XpatUnselectObject( Object ) + + xpatobj_list *Object; +{ + xpatobj_list *Scan; + + autbegin(); + + Scan = Object; + + do + { + ClearXpatSelect( Scan ); + + Scan = Scan->LINK; + } + while ( Scan != Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatAcceptObject | +| | +\------------------------------------------------------------*/ + +void XpatAcceptObject( Object ) + + xpatobj_list *Object; +{ + xpatobj_list *Scan; + + autbegin(); + + Scan = Object; + + do + { + SetXpatAccept( Scan ); + + Scan = Scan->LINK; + } + while ( Scan != Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatRejectObject | +| | +\------------------------------------------------------------*/ + +void XpatRejectObject( Object ) + + xpatobj_list *Object; +{ + xpatobj_list *Scan; + + autbegin(); + + Scan = Object; + + do + { + ClearXpatAccept( Scan ); + + Scan = Scan->LINK; + } + while ( Scan != Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatConnectObject | +| | +\------------------------------------------------------------*/ + +void XpatConnectObject( Object ) + + xpatobj_list *Object; +{ + xpatobj_list *Scan; + + autbegin(); + + Scan = Object; + + do + { + SetXpatConnect( Scan ); + + Scan = Scan->LINK; + } + while ( Scan != Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatDisconnectObject | +| | +\------------------------------------------------------------*/ + +void XpatDisconnectObject( Object ) + + xpatobj_list *Object; +{ + xpatobj_list *Scan; + + autbegin(); + + Scan = Object; + + do + { + ClearXpatConnect( Scan ); + + Scan = Scan->LINK; + } + while ( Scan != Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Add Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatAddSelect | +| | +\------------------------------------------------------------*/ + +void XpatAddSelect( Object ) + + xpatobj_list *Object; +{ + xpatselect_list *Select; + + autbegin(); + + Select = XpatAllocSelect(); + Select->NEXT = XpatHeadSelect; + Select->OBJECT = Object; + XpatHeadSelect = Select; + + XpatSelectObject( Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatAddConnect | +| | +\------------------------------------------------------------*/ + +void XpatAddConnect( Object ) + + xpatobj_list *Object; +{ + xpatselect_list *Connect; + + autbegin(); + + Connect = XpatAllocSelect(); + Connect->NEXT = XpatHeadConnect; + Connect->OBJECT = Object; + XpatHeadConnect = Connect; + + XpatConnectObject( Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Del Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatDelSelect | +| | +\------------------------------------------------------------*/ + +void XpatDelSelect() +{ + xpatselect_list *Select; + xpatselect_list *DelSelect; + + autbegin(); + + Select = XpatHeadSelect; + XpatHeadSelect = (xpatselect_list *)NULL; + + while ( Select != (xpatselect_list *)NULL ) + { + XpatRejectObject( Select->OBJECT ); + + DelSelect = Select; + Select = Select->NEXT; + + XpatFreeSelect( DelSelect ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatPurgeSelect | +| | +\------------------------------------------------------------*/ + +void XpatPurgeSelect() +{ + xpatselect_list *DelSelect; + xpatselect_list *Select; + xpatselect_list **Previous; + + autbegin(); + + Previous = &XpatHeadSelect; + Select = XpatHeadSelect; + + while( Select != (xpatselect_list *)NULL ) + { + if ( ! IsXpatAccept( Select->OBJECT ) ) + { + DelSelect = Select; + Select = Select->NEXT; + *Previous = Select; + + XpatFreeSelect( DelSelect ); + } + else + { + Previous = &Select->NEXT; + Select = Select->NEXT; + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatDelConnect | +| | +\------------------------------------------------------------*/ + +void XpatDelConnect() +{ + xpatselect_list *Connect; + xpatselect_list *DelConnect; + + autbegin(); + + Connect = XpatHeadConnect; + XpatHeadConnect = (xpatselect_list *)NULL; + + while ( Connect != (xpatselect_list *)NULL ) + { + XpatDisconnectObject( Connect->OBJECT ); + + DelConnect = Connect; + Connect = Connect->NEXT; + + XpatFreeSelect( DelConnect ); + } + + autend(); +} diff --git a/alliance/src/xpat/src/XPT_select.h b/alliance/src/xpat/src/XPT_select.h new file mode 100644 index 00000000..e40b41f2 --- /dev/null +++ b/alliance/src/xpat/src/XPT_select.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Select.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPT_SELECT_H +# define XPT_SELECT_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xpat/src/XSB.h b/alliance/src/xpat/src/XSB.h new file mode 100644 index 00000000..39b8b3d6 --- /dev/null +++ b/alliance/src/xpat/src/XSB.h @@ -0,0 +1,166 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : XSB.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_XSB +# define XPAT_XSB + +/*------------------------------------------------------\ +| | +| Others | +| | +\------------------------------------------------------*/ + +# define XPAT_TRUE 1 +# define XPAT_FALSE 0 + +# define XPAT_ERROR 1 +# define XPAT_OK 0 + +# define XPAT_NORTH 0 +# define XPAT_SOUTH 1 +# define XPAT_EAST 2 +# define XPAT_WEST 3 + +# define XPAT_NORTH_MASK 1 +# define XPAT_SOUTH_MASK 2 +# define XPAT_WEST_MASK 4 +# define XPAT_EAST_MASK 8 + +# define XPAT_DEFAULT_FIGURE_NAME "NONAME" + +/*------------------------------------------------------\ +| | +| Layer | +| | +\------------------------------------------------------*/ + +# define XPAT_MAX_LAYER 10 + +/*------------------------------------------------------\ +| | +| Active Name | +| | +\------------------------------------------------------*/ + +# define XPAT_ACTIVE_NAME_VECTOR 0 +# define XPAT_ACTIVE_NAME_IO 1 +# define XPAT_MAX_ACTIVE_NAME 2 + +/*------------------------------------------------------------\ +| | +| Edit Mode | +| | +\------------------------------------------------------------*/ + +# define XPAT_EDIT_MEASURE (char)0x00 +# define XPAT_EDIT_IDENTIFY (char)0x01 +# define XPAT_EDIT_CONNECTED (char)0x02 +# define XPAT_EDIT_ADD_CURSOR (char)0x03 +# define XPAT_EDIT_DEL_CURSOR (char)0x04 + +# define XPAT_ZOOM_CENTER (char)0x80 +# define XPAT_ZOOM_IN (char)0x81 +# define XPAT_ZOOM_PAN (char)0x82 + +# define XPAT_ZOOM_MARK (char)0x80 + +/*------------------------------------------------------------\ +| | +| Input Mode | +| | +\------------------------------------------------------------*/ + +# define XPAT_INPUT_POINT 0 +# define XPAT_INPUT_ORTHO 1 +# define XPAT_INPUT_LINE 2 +# define XPAT_INPUT_LSTRING 3 +# define XPAT_INPUT_BOX 4 +# define XPAT_INPUT_SORTHO 5 +# define XPAT_INPUT_HALF_BOX 6 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char XPAT_ACTIVE_LAYER_TABLE[ XPAT_MAX_LAYER ]; + extern char XPAT_ACTIVE_NAME_TABLE [ XPAT_MAX_ACTIVE_NAME ]; + + extern char *XPAT_CURSOR_COLOR_NAME; + extern char *XPAT_BACKGROUND_COLOR_NAME; + extern char *XPAT_FOREGROUND_COLOR_NAME; + extern char *XPAT_ACCEPT_COLOR_NAME; + extern char *XPAT_CONNECT_COLOR_NAME; + + extern long XPAT_CURSOR_SIZE; + extern float XPAT_LOWER_GRID_STEP; + extern long XPAT_UNIT; + extern char *XPAT_LAYER_NAME_TABLE[ XPAT_MAX_LAYER ][ 3 ]; + extern char *XPAT_PARAM_NAME; + + extern char *XPAT_XMS_FILE_NAME; + extern char *XpatFirstFileName; + + extern char XPAT_FORCE_DISPLAY; + extern char XPAT_XOR_CURSOR; + extern char XPAT_SWITCH_COLOR_MAP; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern char *XpatPostTreatString(); + extern void XpatLoadParameters(); + extern void Xpatgetenv(); + +# endif diff --git a/alliance/src/xpat/src/XSB_error.c b/alliance/src/xpat/src/XSB_error.c new file mode 100644 index 00000000..c1a7a557 --- /dev/null +++ b/alliance/src/xpat/src/XSB_error.c @@ -0,0 +1,179 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Xsb Errors | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XSB_error.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +void XsbError( ErrorType, Message, Data ) + + char ErrorType; + char *Message; + long Data; +{ + fflush(stdout); + + switch ( ErrorType ) + { + case DEFINE_MISSING : + + fprintf( stderr, "Xsb: Some defines missing\n"); + break; + + case TABLE_MISSING : + + fprintf( stderr, "Xsb: Some tables missing\n"); + break; + + case LINE_EXPECTED : + + fprintf( stderr, "Xsb: %s expected line %lu\n", + Message, Data ); + break; + + case UNKNOWN_DEFINE : + + fprintf( stderr, "Xsb: Unknown define %s line %lu\n", + Message, Data ); + break; + + case NOT_DEFINED : + + fprintf( stderr, "Xsb: %s not defined line %lu\n", + Message, Data ); + break; + + case TOO_SMAL : + + fprintf( stderr, "Xsb: %s too smal line %lu\n", + Message, Data ); + break; + + case MISSING_VALUE : + + fprintf( stderr, "Xsb: Missing value at line %lu\n", + Data ); + break; + + case MISSING_NAME : + + fprintf( stderr, "Xsb: Missing name of %s line %lu\n", + Message, Data ); + break; + + case UNEXPECTED_LINE : + + fprintf( stderr, "Xsb: %s unexpected line %lu\n", + Message, Data ); + break; + + case UNEXPECTED_EOF : + + fprintf( stderr, "Xsb: Unexpected end of file, missing definitions\n"); + break; + + case TOO_MANY_WORDS : + + fprintf( stderr, "Xsb: Too many words %s unexpected line %lu\n", + Message, Data ); + break; + + case MISSING_TABLE : + + fprintf( stderr, "Xsb: Missing value in %s table line %lu\n", + Message, Data ); + break; + + case OPEN_FILE : + + fprintf( stderr, "Xsb: Parameters file %s can't be opened\n", + Message ); + break; + + case UNKNOWN_TABLE : + + fprintf( stderr, "Xsb: Unknown table %s line %lu\n", + Message , Data ); + break; + + case SYNTAX_ERROR : + + fprintf( stderr, "Xsb: Syntax Error %s at line %lu\n", + Message , Data ); + break; + + case ILLEGAL_FLOAT : + + fprintf( stderr, "Xsb: Illegal floating point number %s line %lu\n", + Message , Data ); + break; + } + + exit( 1 ); +} diff --git a/alliance/src/xpat/src/XSB_error.h b/alliance/src/xpat/src/XSB_error.h new file mode 100644 index 00000000..1eea624d --- /dev/null +++ b/alliance/src/xpat/src/XSB_error.h @@ -0,0 +1,88 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Xsb Errors | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSB_ERROR +# define XSB_ERROR + +/*------------------------------------------------------------\ +| | +| Rpr Error Constants | +| | +\------------------------------------------------------------*/ + +# define DEFINE_MISSING 0 +# define TABLE_MISSING 1 +# define LINE_EXPECTED 2 +# define UNKNOWN_DEFINE 3 +# define NOT_DEFINED 4 +# define TOO_SMAL 5 +# define MISSING_VALUE 6 +# define MISSING_NAME 7 +# define UNEXPECTED_LINE 8 +# define UNEXPECTED_EOF 9 +# define TOO_MANY_WORDS 10 +# define MISSING_TABLE 11 +# define OPEN_FILE 12 +# define UNKNOWN_TABLE 13 +# define SYNTAX_ERROR 14 +# define ILLEGAL_FLOAT 15 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xpat/src/XSB_parse.c b/alliance/src/xpat/src/XSB_parse.c new file mode 100644 index 00000000..31ae2190 --- /dev/null +++ b/alliance/src/xpat/src/XSB_parse.c @@ -0,0 +1,712 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : XsbParse.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XSB_error.h" +# include "XSB_parse.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Global Variables | +| | +\------------------------------------------------------------*/ + + char *XPAT_PARAM_NAME = (char *)NULL; + char *XPAT_LAYER_NAME_TABLE[ XPAT_MAX_LAYER ][ 3 ]; + +/*------------------------------------------------------------\ +| | +| Private Variables | +| | +\------------------------------------------------------------*/ + + static char *XpatDefaultTechnoName = XPAT_DEFAULT_PARAM_NAME; + +/*------------------------------------------------------------\ +| | +| Table variables | +| | +\------------------------------------------------------------*/ + + char *XPAT_CURSOR_COLOR_NAME; + char *XPAT_BACKGROUND_COLOR_NAME; + char *XPAT_FOREGROUND_COLOR_NAME; + char *XPAT_ACCEPT_COLOR_NAME; + char *XPAT_CONNECT_COLOR_NAME; + + long XPAT_CURSOR_SIZE; + float XPAT_LOWER_GRID_STEP; + long XPAT_UNIT; + + char *XPAT_NOT_DEFINE = ""; + +/*------------------------------------------------------------\ +| | +| Keywords variables | +| | +\------------------------------------------------------------*/ + + static char KeywordDefined = 0; + + static char *DefineKeyword; + static char *TableKeyword; + static char *EndTableKeyword; + static char *EndRecordKeyword; + static char *LowerGridStepKeyword; + static char *CursorColorNameKeyword; + static char *BackgroundColorNameKeyword; + static char *ForegroundColorNameKeyword; + static char *AcceptColorNameKeyword; + static char *ConnectColorNameKeyword; + static char *CursorSizeKeyword; + static char *UnitKeyword; + static char *LayerNameKeyword; + + static keyword KeywordDefine[ XSB_MAX_KEYWORD ] = + + { + "None", 0 + }; + +/*------------------------------------------------------------\ +| | +| File variables | +| | +\------------------------------------------------------------*/ + + static FILE *XsbFile; + static char XsbBuffer[ XSB_MAX_BUFFER ]; + static long XsbCurrentLine; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Xsb File Get String | +| | +\------------------------------------------------------------*/ + +char *XsbFileGetString( String, Size ) + + char *String; + int Size; +{ + register char *RegisterString; + register Register; + + autbegin(); + + RegisterString = String; + + while (--Size > 0 && (Register = getc( XsbFile )) != EOF ) + { + if ((*RegisterString++ = Register) == '\\') + { + if ((Register = getc( XsbFile )) == '\n') + { + *(RegisterString - 1) = ' '; + } + else + { + ungetc( Register, XsbFile ); + } + } + else + { + if ( Register == '\n') break; + } + } + + *RegisterString = '\0'; + + autend(); + return ( ( Register == EOF ) && + ( RegisterString == String ) ) ? (char *)NULL : String; +} + +/*------------------------------------------------------------\ +| | +| Xsb File Get Line | +| | +\------------------------------------------------------------*/ + +void XsbGetLine( Buffer ) + + char *Buffer; +{ + char *Check; + char *String; + char OneComment; + + autbegin(); + + do + { + OneComment = 0; + + Check = XsbFileGetString( Buffer, XSB_MAX_BUFFER ); + + if ( Check != (char *)NULL ) + { + XsbCurrentLine++; + } + else + { + XsbError( UNEXPECTED_EOF, (char *)NULL, XsbCurrentLine ); + } + + if ( String = strchr( Buffer, XSB_COMMENT_CHAR )) + { + if ( String == Buffer ) + { + OneComment = 1; + } + else + { + *(String - 1) = '\0'; + } + } + + while (*Buffer != '\0' && strchr( XSB_SEPARATORS_STRING, *Buffer)) + { + Buffer = Buffer + 1;; + } + + if (*Buffer == '\0') OneComment = 1; + + } + while ( OneComment == 1); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Xsb Check Keyword | +| | +\------------------------------------------------------------*/ + +char XsbCheckKeyword( Word ) + + char *Word; +{ + if ( ( Word == DefineKeyword ) || + ( Word == TableKeyword ) ) + { + return 1; + } + else + { + return 0; + } +} + +/*------------------------------------------------------------\ +| | +| Xsb Get First word | +| | +\------------------------------------------------------------*/ + +char *XsbGetFirstWord( Buffer, IsKeyword, Hash ) + + char *Buffer; + char IsKeyword; + char Hash; +{ + char *String; + char *Text; + int Index; + + autbegin(); + + if ( String = (char *)strtok( Buffer, XSB_SEPARATORS_STRING )) + { + if ( Hash ) + { + String = namealloc( String ); + } + else + { + Text = autallocblock( strlen( String ) + 1 ); + strcpy( Text, String ); + String = Text; + + for ( Index = 0; Text[ Index ]; Index++ ) + { + if ( Text[ Index ] == '_' ) Text[ Index ] = ' '; + } + } + + if ( ( IsKeyword ) && XsbCheckKeyword( String ) ) + { + XsbError( UNEXPECTED_LINE, String, XsbCurrentLine ); + } + } + + autend(); + return( String ); +} + +/*------------------------------------------------------------\ +| | +| Xsb Get Next word | +| | +\------------------------------------------------------------*/ + +char *XsbGetNextWord( IsKeyword, Hash ) + + char IsKeyword; + char Hash; +{ + char *String; + char *Text; + int Index; + + autbegin(); + + if ( String = (char *)strtok( (char *)NULL, XSB_SEPARATORS_STRING )) + { + if ( Hash ) + { + String = namealloc( String ); + } + else + { + Text = autallocblock( strlen( String ) + 1 ); + strcpy( Text, String ); + String = Text; + + for ( Index = 0; Text[ Index ]; Index++ ) + { + if ( Text[ Index ] == '_' ) Text[ Index ] = ' '; + } + } + + if ( ( IsKeyword ) && XsbCheckKeyword( String ) ) + { + XsbError( UNEXPECTED_LINE, String, XsbCurrentLine ); + } + } + + autend(); + return( String ); +} + +/*------------------------------------------------------------\ +| | +| Xsb Keyword Compare | +| | +\------------------------------------------------------------*/ + +int XsbKeywordCompare( FirstKey, SecondKey ) + + keyword *FirstKey; + keyword *SecondKey; +{ + return strcmp( FirstKey->NAME, SecondKey->NAME ); +} + +/*------------------------------------------------------------\ +| | +| Xsb Get String Value | +| | +\------------------------------------------------------------*/ + +long XsbGetStringValue( String ) + + char *String; +{ + long Value; + keyword *Keyword; + keyword Entry; + + autbegin(); + + if ( sscanf( String, "%d", &Value) ) + { + autend(); + return ( Value ); + } + + Entry.NAME = String; + + Keyword = (keyword *)bsearch( (char *)(&Entry), + (char *)KeywordDefine, + XSB_MAX_KEYWORD, sizeof( keyword ), + XsbKeywordCompare ); + + if ( Keyword == (keyword *)NULL ) + { + XsbError( UNEXPECTED_LINE, String, XsbCurrentLine ); + } + + autend(); + return( Keyword->VALUE ); +} + +/*------------------------------------------------------------\ +| | +| Xsb Get String Float | +| | +\------------------------------------------------------------*/ + +float XsbGetStringFloat( String ) + + char *String; +{ + float Value; + + autbegin(); + + if ( ! sscanf( String, "%g", &Value) ) + { + XsbError( ILLEGAL_FLOAT, String, XsbCurrentLine ); + } + + autend(); + return ( Value ); +} + +/*------------------------------------------------------------\ +| | +| Xsb Get Number | +| | +\------------------------------------------------------------*/ + +long XsbGetNumber( String ) + + char *String; +{ + long Value; + + autbegin(); + + if ( ! sscanf( String, "%d", &Value )) + { + XsbError( UNEXPECTED_LINE, "number", XsbCurrentLine ); + } + + autend(); + return Value; +} + + +/*------------------------------------------------------------\ +| | +| Xsb Read Layer Name | +| | +\------------------------------------------------------------*/ + +void XsbReadLayerName() + +{ + char Layer; + char LayerCount; + char EndTable; + char Field; + char *FirstWord; + + autbegin(); + + EndTable = 0; + LayerCount = 0; + + while ( ( EndTable != 1 ) && + ( LayerCount <= XPAT_MAX_LAYER ) ) + { + XsbGetLine( XsbBuffer ); + + FirstWord = XsbGetFirstWord( XsbBuffer, 1, 1 ); + + if ( FirstWord == EndTableKeyword ) + { + EndTable = 1; + } + else + if ( LayerCount < XPAT_MAX_LAYER ) + { + Layer = XsbGetStringValue( FirstWord ); + + for ( Field = 0; Field < 3; Field++ ) + { + FirstWord = XsbGetNextWord( 1, 0 ); + + if ( FirstWord == EndRecordKeyword ) + { + XsbError( MISSING_VALUE, (char *)NULL, XsbCurrentLine ); + } + else + { + XPAT_LAYER_NAME_TABLE [ Layer ][ Field ] = FirstWord; + } + } + + FirstWord = XsbGetNextWord( 0, 1 ); + + if ( FirstWord != EndRecordKeyword ) + { + XsbError( TOO_MANY_WORDS, FirstWord, XsbCurrentLine ); + } + } + + LayerCount = LayerCount + 1; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Xsb Read Parameters | +| | +\------------------------------------------------------------*/ + +void XsbReadParam() + +{ + char *FirstWord; + char *SecondWord; + long Continue; + + autbegin(); + + Continue = 0; + + while ( Continue != XSB_ALL_DEFINED_MASK ) + { + XsbGetLine( XsbBuffer ); + + FirstWord = XsbGetFirstWord( XsbBuffer, 0, 1); + + if ( FirstWord == DefineKeyword ) + { + FirstWord = XsbGetNextWord( 1, 1 ); + + if (! FirstWord ) + { + XsbError( MISSING_NAME, DefineKeyword, XsbCurrentLine ); + } + + SecondWord = XsbGetNextWord( 1, 0 ); + + if (! SecondWord ) + { + XsbError( MISSING_VALUE, SecondWord, XsbCurrentLine ); + } + + if ( FirstWord == LowerGridStepKeyword ) + { + XPAT_LOWER_GRID_STEP = XsbGetStringFloat( SecondWord ); + + Continue |= XSB_LOWER_GRID_STEP_MASK; + } + else + if ( FirstWord == CursorColorNameKeyword ) + { + XPAT_CURSOR_COLOR_NAME = SecondWord; + + Continue |= XSB_CURSOR_COLOR_NAME_MASK; + } + else + if ( FirstWord == BackgroundColorNameKeyword ) + { + XPAT_BACKGROUND_COLOR_NAME = SecondWord; + + Continue |= XSB_BACKGROUND_COLOR_NAME_MASK; + } + else + if ( FirstWord == ForegroundColorNameKeyword ) + { + XPAT_FOREGROUND_COLOR_NAME = SecondWord; + + Continue |= XSB_FOREGROUND_COLOR_NAME_MASK; + } + else + if ( FirstWord == AcceptColorNameKeyword ) + { + XPAT_ACCEPT_COLOR_NAME = SecondWord; + + Continue |= XSB_ACCEPT_COLOR_NAME_MASK; + } + else + if ( FirstWord == ConnectColorNameKeyword ) + { + XPAT_CONNECT_COLOR_NAME = SecondWord; + + Continue |= XSB_CONNECT_COLOR_NAME_MASK; + } + else + if ( FirstWord == CursorSizeKeyword ) + { + XPAT_CURSOR_SIZE = XsbGetStringValue( SecondWord ); + + Continue |= XSB_CURSOR_SIZE_MASK; + } + else + if ( FirstWord == UnitKeyword ) + { + XPAT_UNIT = XsbGetStringValue( SecondWord ); + + Continue |= XSB_UNIT_MASK; + } + else + { + XsbError( UNKNOWN_DEFINE, FirstWord, XsbCurrentLine ); + } + } + else + if ( FirstWord == TableKeyword ) + { + if (!( FirstWord = XsbGetNextWord(1, 1))) + { + XsbError( MISSING_NAME, TableKeyword ); + } + + if ( FirstWord == LayerNameKeyword ) + { + XsbReadLayerName(); + + Continue |= XSB_LAYER_NAME_MASK; + } + else + { + XsbError( UNKNOWN_TABLE, FirstWord, XsbCurrentLine ); + } + } + else + { + XsbError( SYNTAX_ERROR, FirstWord, XsbCurrentLine ); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Xsb Load Parameters | +| | +\------------------------------------------------------------*/ + +void XpatLoadParameters() + +{ + short Layer; + + autbegin(); + + XPAT_PARAM_NAME = mbkgetenv( "XPAT_PARAM_NAME" ); + + if ( XPAT_PARAM_NAME == (char *)NULL ) + { + XPAT_PARAM_NAME = XpatDefaultTechnoName; + } + + if ( ! KeywordDefined ) + { + DefineKeyword = namealloc( DEFINE_KEYWORD ); + TableKeyword = namealloc( TABLE_KEYWORD ); + EndTableKeyword = namealloc( END_TABLE_KEYWORD ); + EndRecordKeyword = namealloc( END_RECORD_KEYWORD ); + LowerGridStepKeyword = namealloc( LOWER_GRID_STEP_KEYWORD ); + CursorColorNameKeyword = namealloc( CURSOR_COLOR_NAME_KEYWORD ); + BackgroundColorNameKeyword = namealloc( BACKGROUND_COLOR_NAME_KEYWORD ); + ForegroundColorNameKeyword = namealloc( FOREGROUND_COLOR_NAME_KEYWORD ); + AcceptColorNameKeyword = namealloc( ACCEPT_COLOR_NAME_KEYWORD ); + ConnectColorNameKeyword = namealloc( CONNECT_COLOR_NAME_KEYWORD ); + CursorSizeKeyword = namealloc( CURSOR_SIZE_KEYWORD ); + UnitKeyword = namealloc( UNIT_KEYWORD ); + LayerNameKeyword = namealloc( LAYER_NAME_KEYWORD ); + + KeywordDefined = 1; + } + + XPAT_LOWER_GRID_STEP = 0.0; + + XPAT_CURSOR_COLOR_NAME = (char *)NULL; + XPAT_BACKGROUND_COLOR_NAME = (char *)NULL; + XPAT_FOREGROUND_COLOR_NAME = (char *)NULL; + XPAT_ACCEPT_COLOR_NAME = (char *)NULL; + XPAT_CONNECT_COLOR_NAME = (char *)NULL; + + XPAT_CURSOR_SIZE = 5; + XPAT_UNIT = 4; + + for ( Layer = 0; Layer < XPAT_MAX_LAYER; Layer++ ) + { + XPAT_LAYER_NAME_TABLE[ Layer ][0] = XPAT_NOT_DEFINE; + XPAT_LAYER_NAME_TABLE[ Layer ][1] = (char *)NULL; + XPAT_LAYER_NAME_TABLE[ Layer ][2] = (char *)NULL; + } + + if ( !( XsbFile = fopen( XPAT_PARAM_NAME, "r"))) + + XsbError( OPEN_FILE, XPAT_PARAM_NAME, 0); + + XsbReadParam(); + + fclose( XsbFile ); + + autend(); +} diff --git a/alliance/src/xpat/src/XSB_parse.h b/alliance/src/xpat/src/XSB_parse.h new file mode 100644 index 00000000..11c02c97 --- /dev/null +++ b/alliance/src/xpat/src/XSB_parse.h @@ -0,0 +1,112 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSB | +| | +| File : Xsbparse.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSB_PARSE +# define XSB_PARSE + +# define XSB_MAX_BUFFER 255 +# define XSB_MAX_KEYWORD 1 + +# define XSB_SEPARATORS_STRING " \t\n" +# define XSB_COMMENT_CHAR '#' + +/*------------------------------------------------------------\ +| | +| Keyword Constants | +| | +\------------------------------------------------------------*/ + +# define DEFINE_KEYWORD "DEFINE" +# define TABLE_KEYWORD "TABLE" +# define END_TABLE_KEYWORD "END" +# define END_RECORD_KEYWORD NULL + +# define LOWER_GRID_STEP_KEYWORD "XPAT_LOWER_GRID_STEP" +# define CURSOR_COLOR_NAME_KEYWORD "XPAT_CURSOR_COLOR_NAME" +# define BACKGROUND_COLOR_NAME_KEYWORD "XPAT_BACKGROUND_COLOR_NAME" +# define FOREGROUND_COLOR_NAME_KEYWORD "XPAT_FOREGROUND_COLOR_NAME" +# define ACCEPT_COLOR_NAME_KEYWORD "XPAT_ACCEPT_COLOR_NAME" +# define CONNECT_COLOR_NAME_KEYWORD "XPAT_CONNECT_COLOR_NAME" +# define CURSOR_SIZE_KEYWORD "XPAT_CURSOR_SIZE" +# define UNIT_KEYWORD "XPAT_UNIT" +# define LAYER_NAME_KEYWORD "XPAT_LAYER_NAME" + +# define XSB_LOWER_GRID_STEP_MASK 0x00001 +# define XSB_CURSOR_COLOR_NAME_MASK 0x00002 +# define XSB_BACKGROUND_COLOR_NAME_MASK 0x00004 +# define XSB_FOREGROUND_COLOR_NAME_MASK 0x00008 +# define XSB_ACCEPT_COLOR_NAME_MASK 0x00010 +# define XSB_CONNECT_COLOR_NAME_MASK 0x00020 +# define XSB_CURSOR_SIZE_MASK 0x00040 +# define XSB_UNIT_MASK 0x00080 +# define XSB_LAYER_NAME_MASK 0x00100 + +# define XSB_ALL_DEFINED_MASK 0x001FF + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct keyword + { + char *NAME; + char VALUE; + + } keyword; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xpat/src/XSB_share.c b/alliance/src/xpat/src/XSB_share.c new file mode 100644 index 00000000..1d084c4a --- /dev/null +++ b/alliance/src/xpat/src/XSB_share.c @@ -0,0 +1,151 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Share.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XSB_share.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + char XPAT_ACTIVE_NAME_TABLE [ XPAT_MAX_ACTIVE_NAME ] = + { + 1, /* PATTERN TEXT */ + 1 /* IO TEXT */ + }; + + char XPAT_ACTIVE_LAYER_TABLE [ XPAT_MAX_LAYER ] = + { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + }; + + char *XpatFirstFileName = (char *)NULL; + char *XPAT_XMS_FILE_NAME = (char *)NULL; + + char XPAT_FORCE_DISPLAY = XPAT_FALSE; + char XPAT_XOR_CURSOR = XPAT_FALSE; + char XPAT_SWITCH_COLOR_MAP = XPAT_FALSE; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatPostTreatString | +| | +\------------------------------------------------------------*/ + +char *XpatPostTreatString( Text ) + + char *Text; +{ + char OnlySpace; + int Counter; + + autbegin(); + + if ( Text != (char *)NULL ) + { + OnlySpace = 1; + + for ( Counter = 0; Text[ Counter ]; Counter++ ) + { + if ( Text[ Counter ] != ' ' ) OnlySpace = 0; + } + + if ( OnlySpace ) Text = (char *)NULL; + } + + autend(); + return( Text ); +} + +/*------------------------------------------------------------\ +| | +| Xpatgetenv | +| | +\------------------------------------------------------------*/ + +void Xpatgetenv() +{ + char *Env; + + Env = mbkgetenv( "HOME" ); + + if ( Env == (char *)NULL ) + { + XPAT_XMS_FILE_NAME = XMS_FILE_NAME; + } + else + { + XPAT_XMS_FILE_NAME = + + (char *)autallocblock( strlen( Env ) + strlen( XMS_FILE_NAME ) + 2 ); + + strcpy( XPAT_XMS_FILE_NAME, Env ); + strcat( XPAT_XMS_FILE_NAME, "/" ); + strcat( XPAT_XMS_FILE_NAME, XMS_FILE_NAME ); + } +} diff --git a/alliance/src/xpat/src/XSB_share.h b/alliance/src/xpat/src/XSB_share.h new file mode 100644 index 00000000..798c7534 --- /dev/null +++ b/alliance/src/xpat/src/XSB_share.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Share.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSB_SHARE +# define XSB_SHARE + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xpat/src/XTB.h b/alliance/src/xpat/src/XTB.h new file mode 100644 index 00000000..a6fe0f33 --- /dev/null +++ b/alliance/src/xpat/src/XTB.h @@ -0,0 +1,215 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : XTB.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_XTB +# define XPAT_XTB + +/*------------------------------------------------------------\ +| | +| MouseCursors | +| | +\------------------------------------------------------------*/ + +# define XPAT_NORMAL_CURSOR 0 +# define XPAT_WATCH_CURSOR 1 +# define XPAT_PIRATE_CURSOR 2 +# define XPAT_CROSS_CURSOR 3 +# define XPAT_NO_CURSOR 4 + +# define XPAT_MAX_CURSOR 5 + +/*------------------------------------------------------------\ +| | +| DialogBoxType | +| | +\------------------------------------------------------------*/ + +# define XPAT_DIALOG_MESSAGE 0 +# define XPAT_DIALOG_ERROR 1 +# define XPAT_DIALOG_INFO 2 +# define XPAT_DIALOG_QUESTION 3 +# define XPAT_DIALOG_WARNING 4 +# define XPAT_DIALOG_WORKING 5 +# define XPAT_DIALOG_FILE 6 +# define XPAT_DIALOG_PROMPT 7 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatDialogBox | +| | +\------------------------------------------------------------*/ + + typedef struct XpatDialogItem + + { + char *LABEL; + char TYPE; + Widget WIDGET; + void (*CALLBACK_OK)(); + XtPointer CALLDATA_OK; + void (*CALLBACK_CANCEL)(); + XtPointer CALLDATA_CANCEL; + + } XpatDialogItem; + + +/*------------------------------------------------------------\ +| | +| XpatMenuItem | +| | +\------------------------------------------------------------*/ + + typedef struct XpatMenuItem + + { + char *LABEL; + char MNEMONIC; + char *SHORT_KEY; + char *SHORT_KEY_TEXT; + WidgetClass *CLASS; + Boolean SEPARATOR; + Boolean TITLE; + Boolean HELP; + void (*CALLBACK)(); + XtPointer CALLDATA; + Widget BUTTON; + Widget MENU; + struct XpatMenuItem *NEXT; + + } XpatMenuItem; + +/*------------------------------------------------------------\ +| | +| XpatPanelButtonItem | +| | +\------------------------------------------------------------*/ + + typedef struct XpatPanelButtonItem + + { + char **LABEL; + char *TEXT; + char *BITMAP; + int WIDTH; + int HEIGHT; + char **FOREGROUND; + char **BACKGROUND; + unsigned char X; + unsigned char Y; + unsigned char DX; + unsigned char DY; + void (*CALLBACK)(); + XtPointer CALLDATA; + Widget BUTTON; + + } XpatPanelButtonItem; + +/*------------------------------------------------------------\ +| | +| XpatPanelItem | +| | +\------------------------------------------------------------*/ + + typedef struct XpatPanelItem + + { + char *TITLE; + char COMPUTE; + char MANAGED; + int X; + int Y; + int WIDTH; + int HEIGHT; + unsigned char COLUMN; + unsigned char ROW; + Widget PANEL; + Widget PANEL_FORM; + Widget FRAME; + Widget FORM; + XpatPanelButtonItem *LIST; + + } XpatPanelItem; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char *XpatPanelButtonDisable; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XpatDestroyDialogCallback(); + extern void XpatExitDialogCallback(); + + extern void XpatSetMouseCursor(); + extern Pixmap XpatCreatePixmap(); + extern void XpatSetIcon(); + extern void XpatBuildMenus(); + extern void XpatBuildPanel(); + extern void XpatEnterPanel(); + extern void XpatExitPanel(); + extern void XpatBuildDialog(); + extern void XpatEnterDialog(); + extern void XpatReEnterDialog(); + extern void XpatExitDialog(); + extern void XpatWarningMessage(); + extern void XpatErrorMessage(); + +# endif diff --git a/alliance/src/xpat/src/XTB_cursor.c b/alliance/src/xpat/src/XTB_cursor.c new file mode 100644 index 00000000..c81c947f --- /dev/null +++ b/alliance/src/xpat/src/XTB_cursor.c @@ -0,0 +1,175 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : cursor.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XTB.h" +# include "XSB.h" +# include "XTB_cursor.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static XpatMouseCursor XpatMouseCursorArray [ XPAT_MAX_CURSOR ] = + + { + { XC_left_ptr , True }, + { XC_watch , True }, + { XC_pirate , True }, + { XC_cross_reverse , True }, + { 0 , True } + }; + + static char XpatCursorMaskOr [ 8 ] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + static char XpatCursorMaskAnd [ 8 ] = + + { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatSetMouseCursor | +| | +\------------------------------------------------------------*/ + +void XpatSetMouseCursor( MainWidget, CursorType ) + + Widget MainWidget; + char CursorType; +{ + Display *DisplayId; + Window MainWindow; + XColor White; + XColor Black; + XColor ForgetIt; + Colormap ColorMap; + Pixmap MaskOr; + Pixmap MaskAnd; + Cursor Type; + Cursor NewCursor; + + autbegin(); + + DisplayId = XtDisplay( MainWidget ); + MainWindow = XtWindow( MainWidget ); + + Type = XpatMouseCursorArray[ CursorType ].CURSOR; + + if ( XpatMouseCursorArray[ CursorType ].MAKE == True ) + { + if ( Type != 0 ) + { + NewCursor = XCreateFontCursor( DisplayId, Type ); + } + else + { + ColorMap = DefaultColormapOfScreen ( XtScreen( MainWidget ) ); + + XAllocNamedColor( DisplayId, ColorMap, "black", &Black, &ForgetIt ); + XAllocNamedColor( DisplayId, ColorMap, "white", &White, &ForgetIt ); + + MaskOr = + + XCreatePixmapFromBitmapData( DisplayId, + MainWindow, + XpatCursorMaskOr, + 8, 8, + Black.pixel, + White.pixel, 1 ); + + MaskAnd = + + XCreatePixmapFromBitmapData( DisplayId, + MainWindow, + XpatCursorMaskAnd, + 8, 8, + Black.pixel, + White.pixel, 1 ); + + NewCursor = XCreatePixmapCursor( DisplayId, + MaskAnd, MaskOr, + &Black, &White, 0, 0 ); + } + + XpatMouseCursorArray[ CursorType ].CURSOR = NewCursor; + XpatMouseCursorArray[ CursorType ].MAKE = False; + + Type = NewCursor; + } + + XDefineCursor( DisplayId, MainWindow, Type ); + + XmUpdateDisplay( MainWidget ); + + autend(); +} diff --git a/alliance/src/xpat/src/XTB_cursor.h b/alliance/src/xpat/src/XTB_cursor.h new file mode 100644 index 00000000..4c37933a --- /dev/null +++ b/alliance/src/xpat/src/XTB_cursor.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : cursor.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_XTB_CURSOR +# define XPAT_XTB_CURSOR + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct XpatMouseCursor + { + Cursor CURSOR; + Boolean MAKE; + + } XpatMouseCursor; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xpat/src/XTB_dialog.c b/alliance/src/xpat/src/XTB_dialog.c new file mode 100644 index 00000000..5576d11c --- /dev/null +++ b/alliance/src/xpat/src/XTB_dialog.c @@ -0,0 +1,463 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XTB.h" +# include "XSB.h" +# include "XTB_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static XpatLockLoop = 0; + + static XpatDialogItem XpatWarningDialog = + + { + "Warning", + XPAT_DIALOG_WARNING, + (Widget)NULL, + (void *)NULL, + (XtPointer)NULL, + (void *)NULL, + (XtPointer)NULL + }; + + static XpatDialogItem XpatErrorDialog = + + { + "Error", + XPAT_DIALOG_ERROR, + (Widget)NULL, + (void *)NULL, + (XtPointer)NULL, + (void *)NULL, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatDestroyDialogCallback | +| | +\------------------------------------------------------------*/ + +void XpatDestroyDialogCallback( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + XpatLockLoop = 0; + XpatExitErrorMessage( 1 ); +} + +/*------------------------------------------------------------\ +| | +| XpatExitDialogCallback | +| | +\------------------------------------------------------------*/ + +void XpatExitDialogCallback() + +{ + autbegin(); + + XpatExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatBuildDialog | +| | +\------------------------------------------------------------*/ + +void XpatBuildDialog( Father, Dialog ) + + Widget Father; + XpatDialogItem *Dialog; +{ + Arg Args[3]; + XmString Label; + + autbegin(); + + Label = XmStringCreateLtoR( Dialog->LABEL, + XmSTRING_DEFAULT_CHARSET ); + + if ( Dialog->TYPE < XPAT_DIALOG_FILE ) + { + XtSetArg( Args[0], XmNmessageString , Label); + } + else + { + XtSetArg( Args[0], XmNselectionLabelString, Label); + } + + XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING ); + XtSetArg( Args[2], XmNtitle, " " ); + + switch ( Dialog->TYPE ) + { + case XPAT_DIALOG_MESSAGE : + + Dialog->WIDGET = + + XmCreateMessageDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case XPAT_DIALOG_ERROR : + + Dialog->WIDGET = + + XmCreateErrorDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case XPAT_DIALOG_INFO : + + Dialog->WIDGET = + + XmCreateInformationDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case XPAT_DIALOG_QUESTION : + + Dialog->WIDGET = + + XmCreateQuestionDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case XPAT_DIALOG_WARNING : + + Dialog->WIDGET = + + XmCreateWarningDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case XPAT_DIALOG_WORKING : + + Dialog->WIDGET = + + XmCreateWorkingDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case XPAT_DIALOG_FILE : + + Dialog->WIDGET = + + XmCreateFileSelectionDialog( Father, Dialog->LABEL, Args, 3); + + XtUnmanageChild( XmFileSelectionBoxGetChild( Dialog->WIDGET, + XmDIALOG_FILTER_LABEL ) ); + + XtUnmanageChild( XmFileSelectionBoxGetChild( Dialog->WIDGET, + XmDIALOG_FILTER_TEXT ) ); + + break; + + case XPAT_DIALOG_PROMPT : + + Dialog->WIDGET = + + XmCreatePromptDialog( Father, Dialog->LABEL, Args, 3); + + XtUnmanageChild( XmSelectionBoxGetChild( Dialog->WIDGET, + XmDIALOG_HELP_BUTTON ) ); + } + + XmStringFree( Label ); + + XtAddCallback (Dialog->WIDGET, XmNdestroyCallback, + XpatDestroyDialogCallback, NULL ); + + if ( Dialog->TYPE < XPAT_DIALOG_FILE ) + { + XtUnmanageChild( XmMessageBoxGetChild( Dialog->WIDGET, + XmDIALOG_HELP_BUTTON ) ); + } + + if ( ( Dialog->CALLBACK_OK == NULL ) && + ( Dialog->CALLBACK_CANCEL == NULL ) ) + { + XtAddCallback( Dialog->WIDGET, XmNokCallback, + XpatExitDialogCallback, NULL ); + } + else + { + if ( Dialog->CALLBACK_OK == NULL ) + { + XtUnmanageChild( XmMessageBoxGetChild( Dialog->WIDGET, + XmDIALOG_OK_BUTTON ) ); + } + else + { + XtAddCallback( Dialog->WIDGET, XmNokCallback, + Dialog->CALLBACK_OK, + Dialog->CALLDATA_OK ); + } + } + + if ( Dialog->CALLBACK_CANCEL == NULL ) + { + XtUnmanageChild( XmMessageBoxGetChild( Dialog->WIDGET, + XmDIALOG_CANCEL_BUTTON ) ); + } + else + { + XtAddCallback( Dialog->WIDGET, XmNcancelCallback, + Dialog->CALLBACK_CANCEL, + Dialog->CALLDATA_CANCEL ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatLimitedLoop | +| | +\------------------------------------------------------------*/ + +void XpatLimitedLoop( MyWidget ) + + Widget MyWidget; +{ + Widget DialogShell, WShell; + XEvent Event; + XAnyEvent *AnyEvent; + XtAppContext Context; + + autbegin(); + + Context = XtWidgetToApplicationContext( MyWidget ); + + XpatLockLoop = 1; + + for ( WShell = MyWidget; + ! XtIsShell( WShell ); + WShell = XtParent( WShell ) ); + + while( XpatLockLoop == 1 ) + { + XtAppNextEvent( Context, &Event ); + + AnyEvent = (XAnyEvent *)( &Event ); + + for ( DialogShell = XtWindowToWidget( AnyEvent->display, AnyEvent->window ); + ((DialogShell != NULL ) && (!XtIsShell( DialogShell ))); + DialogShell = XtParent(DialogShell)); + + switch ( AnyEvent->type ) + { + case ButtonPress : + case ButtonRelease : + + if ( WShell == DialogShell ) + { + XtDispatchEvent( &Event ); + } + + break; + + case KeyPress : + case KeyRelease : + + if ( WShell != DialogShell ) + { + AnyEvent->window = XtWindow( WShell ); + } + + default : + + XtDispatchEvent( &Event ); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatEnterDialog | +| | +\------------------------------------------------------------*/ + +void XpatEnterDialog( Dialog ) + + XpatDialogItem *Dialog; +{ + autbegin(); + + XtManageChild ( Dialog->WIDGET ); + + XpatLimitedLoop( Dialog->WIDGET ); + + XtUnmanageChild( Dialog->WIDGET ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatReEnterDialog | +| | +\------------------------------------------------------------*/ + +void XpatReEnterDialog() +{ + XpatLockLoop = 1; +} + +/*------------------------------------------------------------\ +| | +| XpatExitDialog | +| | +\------------------------------------------------------------*/ + +void XpatExitDialog() + +{ + XpatLockLoop = 0; +} + +/*------------------------------------------------------------\ +| | +| XpatWarningMessage | +| | +\------------------------------------------------------------*/ + +void XpatWarningMessage( Father, Subject ) + + Widget Father; + char *Subject; +{ + XmString Label; + + autbegin(); + + if ( XpatWarningDialog.WIDGET == (Widget)NULL ) + { + XpatBuildDialog( Father, &XpatWarningDialog ); + } + + Label = XmStringCreateLtoR( Subject, + XmSTRING_DEFAULT_CHARSET ); + + XtVaSetValues( XpatWarningDialog.WIDGET, + XmNmessageString, + Label, NULL ); + + XmStringFree( Label ); + + XpatEnterDialog( &XpatWarningDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatErrorMessage | +| | +\------------------------------------------------------------*/ + +void XpatErrorMessage( Father, Subject ) + + Widget Father; + char *Subject; +{ + XmString Label; + + autbegin(); + + if ( XpatErrorDialog.WIDGET == (Widget)NULL ) + { + XpatBuildDialog( Father, &XpatErrorDialog ); + } + + Label = XmStringCreateLtoR( Subject, + XmSTRING_DEFAULT_CHARSET ); + + XtVaSetValues( XpatErrorDialog.WIDGET, + XmNmessageString, + Label, NULL ); + + XmStringFree( Label ); + + XpatEnterDialog( &XpatErrorDialog ); + + autend(); +} diff --git a/alliance/src/xpat/src/XTB_dialog.h b/alliance/src/xpat/src/XTB_dialog.h new file mode 100644 index 00000000..be910e4a --- /dev/null +++ b/alliance/src/xpat/src/XTB_dialog.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_XTB_DIALOG +# define XPAT_XTB_DIALOG + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xpat/src/XTB_icon.c b/alliance/src/xpat/src/XTB_icon.c new file mode 100644 index 00000000..92db3af2 --- /dev/null +++ b/alliance/src/xpat/src/XTB_icon.c @@ -0,0 +1,105 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : icon.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XTB.h" +# include "XSB.h" +# include "XTB_icon.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatSetIcon | +| | +\------------------------------------------------------------*/ + +void XpatSetIcon( ShellWidget, IconBits, IconWidth, IconHeight ) + + Widget ShellWidget; + char *IconBits; + int IconWidth; + int IconHeight; +{ + Pixmap IconPixmap; + + autbegin(); + + IconPixmap = XCreatePixmapFromBitmapData( XtDisplay( ShellWidget ), + RootWindowOfScreen( XtScreen( ShellWidget ) ), + IconBits, IconWidth, IconHeight, + WhitePixelOfScreen( XtScreen( ShellWidget ) ), + BlackPixelOfScreen( XtScreen( ShellWidget ) ), + DefaultDepthOfScreen( XtScreen( ShellWidget ) ) ); + XtVaSetValues( ShellWidget, + XmNiconPixmap, IconPixmap, + XmNiconic, False, + NULL ); + + autend(); +} + diff --git a/alliance/src/xpat/src/XTB_icon.h b/alliance/src/xpat/src/XTB_icon.h new file mode 100644 index 00000000..ba30f60b --- /dev/null +++ b/alliance/src/xpat/src/XTB_icon.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : icon.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_XTB_ICON +# define XPAT_XTB_ICON + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xpat/src/XTB_menu.c b/alliance/src/xpat/src/XTB_menu.c new file mode 100644 index 00000000..9e01cfea --- /dev/null +++ b/alliance/src/xpat/src/XTB_menu.c @@ -0,0 +1,196 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XTB.h" +# include "XSB.h" +# include "XTB_menu.h" + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static char MenuBuffer [ MENU_BUFFER_SIZE ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatBuildMenus | +| | +\------------------------------------------------------------*/ + +void XpatBuildMenus( Father, Menu ) + + Widget Father; + XpatMenuItem *Menu; +{ + + Widget Button; + Widget SubMenu; + XmString Text; + Arg Args[ 2 ]; + int Counter; + + autbegin(); + + for ( Counter = 0; + Menu[ Counter ].LABEL != NULL; + Counter++ ) + { + if ( Menu[ Counter ].SEPARATOR == True ) + { + XtCreateManagedWidget( "Separator", + xmSeparatorWidgetClass, Father, + NULL , + 0 ); + } + + Button = XtVaCreateManagedWidget( Menu[ Counter ].LABEL, + *Menu[ Counter ].CLASS, Father, + XmNmnemonic, + Menu[ Counter ].MNEMONIC, + NULL ); + Menu[ Counter ].BUTTON = Button; + + if ( Menu[ Counter ].SHORT_KEY != NULL ) + { + XtVaSetValues( Button, + XmNaccelerator, + Menu[ Counter ].SHORT_KEY, + NULL ); + } + + if ( Menu[ Counter ].SHORT_KEY != NULL ) + { + Text = XmStringCreateSimple( Menu[ Counter ].SHORT_KEY_TEXT ); + + XtVaSetValues( Button, + XmNacceleratorText, + Text, + NULL ); + + XmStringFree( Text ); + } + + if ( Menu[ Counter ].CALLBACK != NULL ) + { + XtAddCallback( Button, + XmNactivateCallback, + Menu[ Counter ].CALLBACK, + Menu[ Counter ].CALLDATA ); + } + + if ( Menu[ Counter ].HELP == True ) + { + XtSetArg( Args[ 0 ], XmNmenuHelpWidget, Button ); + + XtSetValues( Father, Args, 1 ); + } + + if ( Menu[ Counter ].NEXT != NULL) + { + strcpy( MenuBuffer, Menu[ Counter ].LABEL ); + strcat( MenuBuffer, " Menu" ); + + SubMenu = XmCreatePulldownMenu( Father, + MenuBuffer, + Args, 0 ); + + Menu[ Counter ].MENU = SubMenu; + + if ( Menu[ Counter ].TITLE == True ) + { + Text = XmStringCreateLtoR( MenuBuffer, XmSTRING_DEFAULT_CHARSET ); + + XtVaCreateManagedWidget( "MenuTitle", + xmLabelWidgetClass, + SubMenu, + XmNlabelString, Text, + NULL ); + + XmStringFree( Text ); + + XtCreateManagedWidget( "Separator", + xmSeparatorWidgetClass, + SubMenu, + NULL, + 0 ); + } + + XtSetArg( Args[ 0 ], XmNsubMenuId, SubMenu ); + XtSetValues( Button, Args, 1 ); + + XpatBuildMenus( SubMenu, Menu[ Counter ].NEXT ); + } + else Menu[ Counter ].MENU = (Widget)NULL; + } + + autend(); +} + diff --git a/alliance/src/xpat/src/XTB_menu.h b/alliance/src/xpat/src/XTB_menu.h new file mode 100644 index 00000000..904b8ff7 --- /dev/null +++ b/alliance/src/xpat/src/XTB_menu.h @@ -0,0 +1,67 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_XTB_MENU +# define XPAT_XTB_MENU + +# define MENU_BUFFER_SIZE 80 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xpat/src/XTB_panel.c b/alliance/src/xpat/src/XTB_panel.c new file mode 100644 index 00000000..e8f049d2 --- /dev/null +++ b/alliance/src/xpat/src/XTB_panel.c @@ -0,0 +1,378 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XTB.h" +# include "XSB.h" +# include "XTB_panel.h" +# include "XTB_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static char *XpatPanelButtonDisable = "xxxx"; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatBuildPanel | +| | +\------------------------------------------------------------*/ + +void XpatBuildPanel( Father, Panel ) + + Widget Father; + XpatPanelItem *Panel; +{ + Arg Args[13]; + XpatPanelButtonItem *Button; + char *Label; + int Counter; + int Fraction; + int X1; + int Y1; + int X2; + int Y2; + Pixmap ButtonPixmap; + + autbegin(); + + Fraction = Panel->ROW * Panel->COLUMN; + + XtSetArg( Args[0], XmNshadowType , XmSHADOW_ETCHED_IN ); + XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING ); + XtSetArg( Args[2], XmNtitle , Panel->TITLE ); + + Panel->PANEL = XmCreateFormDialog( Father, Panel->TITLE, Args, 3); + + XtAddCallback( Panel->PANEL, XmNdestroyCallback, + XpatDestroyDialogCallback, NULL ); + + Panel->PANEL_FORM = XtVaCreateManagedWidget( "", + xmFormWidgetClass, + Panel->PANEL, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , 100, + NULL + ); + + Panel->FRAME = XtVaCreateManagedWidget( "", + xmFrameWidgetClass, + Panel->PANEL_FORM, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + NULL + ); + + Panel->FORM = XtVaCreateManagedWidget( "", + xmFormWidgetClass, + Panel->FRAME, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , Fraction, + NULL + ); + Button = Panel->LIST; + + for ( Counter = 0; + Button[ Counter ].LABEL != NULL; + Counter++ ) + { + X1 = Button[ Counter ].X * Panel->ROW; + Y1 = Button[ Counter ].Y * Panel->COLUMN; + X2 = X1 + Button[ Counter ].DX * Panel->ROW; + Y2 = Y1 + Button[ Counter ].DY * Panel->COLUMN; + + if ( *Button[ Counter ].LABEL[0] != '\0' ) + { + Label = *Button[ Counter ].LABEL; + } + else + { + Label = XpatPanelButtonDisable; + } + + if ( ( Button[ Counter ].TEXT != (char *)NULL ) && + ( Button[ Counter ].BITMAP != (char *)NULL ) ) + { + XtSetArg( Args[0] , XmNtopAttachment , XmATTACH_POSITION ); + XtSetArg( Args[1] , XmNtopPosition , Y1 ); + XtSetArg( Args[2] , XmNbottomAttachment , XmATTACH_POSITION ); + XtSetArg( Args[3] , XmNbottomPosition , Y2 ); + XtSetArg( Args[4] , XmNrightAttachment , XmATTACH_POSITION ); + XtSetArg( Args[5] , XmNrightPosition , X2 ); + XtSetArg( Args[6] , XmNleftAttachment , XmATTACH_POSITION ); + XtSetArg( Args[7] , XmNleftPosition , X1 ); + XtSetArg( Args[8] , XmNscrollBarDisplayPolicy, XmSTATIC ); + XtSetArg( Args[9] , XmNscrollHorizontal , True ); + XtSetArg( Args[10] , XmNscrollVertical , True ); + XtSetArg( Args[11] , XmNlistSizePolicy , XmCONSTANT ); + XtSetArg( Args[12] , XmNselectionPolicy , XmMULTIPLE_SELECT ); + + Button[ Counter ].BUTTON = + + XmCreateScrolledList( Panel->FORM, Button[ Counter ].TEXT, Args, 13 ); + + XtManageChild ( Button[ Counter ].BUTTON ); + } + else + if ( Button[ Counter ].TEXT != (char *)NULL ) + { + XtSetArg( Args[0] , XmNrows , 10 ); + XtSetArg( Args[1] , XmNeditable , False ); + XtSetArg( Args[2] , XmNeditMode , XmMULTI_LINE_EDIT ); + XtSetArg( Args[3] , XmNcursorPositionVisible, False ); + XtSetArg( Args[4] , XmNtopAttachment , XmATTACH_POSITION ); + XtSetArg( Args[5] , XmNtopPosition , Y1 ); + XtSetArg( Args[6] , XmNleftAttachment , XmATTACH_POSITION ); + XtSetArg( Args[7] , XmNleftPosition , X1 ); + XtSetArg( Args[8] , XmNbottomAttachment , XmATTACH_POSITION ); + XtSetArg( Args[9] , XmNbottomPosition , Y2 ); + XtSetArg( Args[10], XmNrightAttachment , XmATTACH_POSITION ); + XtSetArg( Args[11], XmNrightPosition , X2 ); + + Button[ Counter ].BUTTON = + + XmCreateScrolledText( Panel->FORM, Button[ Counter ].TEXT, Args, 12); + + XtManageChild ( Button[ Counter ].BUTTON ); + } + else + if ( Button[ Counter ].BITMAP != (char *)NULL ) + { + ButtonPixmap = XpatCreatePixmap( Father, + Button[ Counter ].BITMAP, + Button[ Counter ].WIDTH, + Button[ Counter ].HEIGHT ); + Button[ Counter ].BUTTON = + + XtVaCreateManagedWidget( Label, + xmPushButtonWidgetClass, + Panel->FORM, + XmNlabelType , XmPIXMAP, + XmNlabelPixmap , ButtonPixmap, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , X1, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , X2, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , Y1, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , Y2, + NULL + ); + } + else + { + Button[ Counter ].BUTTON = + + XtVaCreateManagedWidget( Label, + xmPushButtonWidgetClass, + Panel->FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , X1, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , X2, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , Y1, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , Y2, + NULL + ); + } + + + if ( Label != XpatPanelButtonDisable ) + { + if ( Button[ Counter ].FOREGROUND != NULL ) + { + XtVaSetValues ( Button[ Counter ].BUTTON , + XtVaTypedArg , XmNforeground, + XmRString , + *Button[ Counter ].FOREGROUND , + strlen ( *Button[ Counter ].FOREGROUND ) + 1, + NULL + ); + } + + if ( Button[ Counter ].BACKGROUND != NULL ) + { + XtVaSetValues ( Button[ Counter ].BUTTON , + XtVaTypedArg , XmNbackground, + XmRString , + *Button[ Counter ].BACKGROUND , + strlen ( *Button[ Counter ].BACKGROUND ) + 1, + NULL + ); + } + + if ( Button[ Counter ].CALLBACK != NULL ) + { + if ( ( Button[ Counter ].TEXT != (char *)NULL ) && + ( Button[ Counter ].BITMAP != (char *)NULL ) ) + { + XtAddCallback( Button[ Counter ].BUTTON, + XmNdefaultActionCallback, + Button[ Counter ].CALLBACK, + (XtPointer)NULL ); + + XtAddCallback( Button[ Counter ].BUTTON, + XmNmultipleSelectionCallback, + Button[ Counter ].CALLBACK, + Button[ Counter ].CALLDATA ); + + } + else + { + XtAddCallback( Button[ Counter ].BUTTON, + XmNactivateCallback, + Button[ Counter ].CALLBACK, + Button[ Counter ].CALLDATA ); + } + } + } + else + { + Button[ Counter ].BUTTON = NULL; + } + } + + XtVaSetValues( Panel->PANEL , + XmNresizable , False, + XmNx , Panel->X, + XmNy , Panel->Y, + XmNheight , Panel->HEIGHT, + XmNwidth , Panel->WIDTH, + NULL ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatEnterPanel | +| | +\------------------------------------------------------------*/ + +void XpatEnterPanel( Panel ) + + XpatPanelItem *Panel; +{ + autbegin(); + + XtManageChild( Panel->PANEL ); + + if ( Panel->COMPUTE == 1 ) + { + XtVaSetValues( Panel->PANEL , + XmNresizable , False, + XmNx , Panel->X, + XmNy , Panel->Y, + XmNheight , Panel->HEIGHT, + XmNwidth , Panel->WIDTH, + NULL ); + + Panel->COMPUTE = 0; + } + + Panel->MANAGED = 1; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatExitPanel | +| | +\------------------------------------------------------------*/ + +void XpatExitPanel( Panel ) + + XpatPanelItem *Panel; +{ + autbegin(); + + XtUnmanageChild( Panel->PANEL ); + + Panel->MANAGED = 0; + + autend(); +} diff --git a/alliance/src/xpat/src/XTB_panel.h b/alliance/src/xpat/src/XTB_panel.h new file mode 100644 index 00000000..a83940ef --- /dev/null +++ b/alliance/src/xpat/src/XTB_panel.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_XTB_PANEL +# define XPAT_XTB_PANEL + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xpat/src/XTB_pixmap.c b/alliance/src/xpat/src/XTB_pixmap.c new file mode 100644 index 00000000..3a16b651 --- /dev/null +++ b/alliance/src/xpat/src/XTB_pixmap.c @@ -0,0 +1,106 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : Pixmap.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +# include +# include +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XTB.h" +# include "XSB.h" + +# include "XTB_pixmap.h" + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatCreatePixmap | +| | +\------------------------------------------------------------*/ + +Pixmap XpatCreatePixmap( MainWidget, IconBits, IconWidth, IconHeight ) + + Widget MainWidget; + char *IconBits; + int IconWidth; + int IconHeight; +{ + Pixel Foreground; + Pixel Background; + Pixmap IconPixmap; + + autbegin(); + + XtVaGetValues( MainWidget, XmNforeground, &Foreground, + XmNbackground, &Background, NULL ); + + IconPixmap = XCreatePixmapFromBitmapData( XtDisplay( MainWidget ), + RootWindowOfScreen( XtScreen( MainWidget ) ), + IconBits, IconWidth, IconHeight, + Foreground, Background, + DefaultDepthOfScreen( XtScreen( MainWidget ) ) ); + + autend(); + return( IconPixmap ); +} + diff --git a/alliance/src/xpat/src/XTB_pixmap.h b/alliance/src/xpat/src/XTB_pixmap.h new file mode 100644 index 00000000..f52e3b42 --- /dev/null +++ b/alliance/src/xpat/src/XTB_pixmap.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : pixmap.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_XTB_PIXMAP +# define XPAT_XTB_PIXMAP + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xpat/src/xpat.c b/alliance/src/xpat/src/xpat.c new file mode 100644 index 00000000..3d676958 --- /dev/null +++ b/alliance/src/xpat/src/xpat.c @@ -0,0 +1,161 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : xpat.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +# ident "@(#)XPAT ver 1.01 January 1996" + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "pat.h" +# include "XSB.h" +# include "XPT.h" +# include "XMX.h" + +# include "xpat.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| present | +| | +\------------------------------------------------------------*/ + +void XpatPresent() +{ + alliancebanner_with_contrib( "Xpat", XPAT_VERSION, + "Graphic Pattern Viewer", "1999", + ALLIANCE_VERSION, "Ludovic Jacomme", "Julien Dunoyer" ); +} + +/*------------------------------------------------------------\ +| | +| main | +| | +\------------------------------------------------------------*/ + +int main( argc, argv ) + + int argc; + char *argv[]; +{ + char Debug = 0; + int Index; + + XpatPresent(); + + mbkenv(); + autenv(); + + for ( Index = 1; + Index < argc; + Index++ ) + { + if ( ! strcmp( argv[ Index ], "-l" ) ) + { + if ( ( Index + 1 ) < argc ) + { + Index = Index + 1; + XpatFirstFileName = argv[ Index ]; + } + } + else + if ( ! strcmp( argv[ Index ], "-debug" ) ) + { + Debug = 1; + } + else + if ( ! strcmp( argv[ Index ], "-xor" ) ) + { + XPAT_XOR_CURSOR = XPAT_TRUE; + } + else + if ( ! strcmp( argv[ Index ], "-force" ) ) + { + XPAT_FORCE_DISPLAY = XPAT_TRUE; + } + else + if ( ! strcmp( argv[ Index ], "-install" ) ) + { + XPAT_SWITCH_COLOR_MAP = XPAT_TRUE; + } + } + + if ( Debug ) autdebug(); + + autbegin(); + + Xpatgetenv(); + XpatLoadParameters(); + + XpatInitializeRessources( &argc, argv ); + XpatInitializeErrorMessage( Debug ); + + XtAppMainLoop( XpatApplication ); + + autend(); + + return( 0 ); +} diff --git a/alliance/src/xpat/src/xpat.h b/alliance/src/xpat/src/xpat.h new file mode 100644 index 00000000..4b8b53f1 --- /dev/null +++ b/alliance/src/xpat/src/xpat.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XPAT | +| | +| File : xpat.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XPAT_XPAT +# define XPAT_XPAT + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XpatInitializeRessources | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xsch/Makefile.am b/alliance/src/xsch/Makefile.am new file mode 100644 index 00000000..5fcaa0d3 --- /dev/null +++ b/alliance/src/xsch/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src man1 diff --git a/alliance/src/xsch/configure.in b/alliance/src/xsch/configure.in new file mode 100644 index 00000000..cb4068de --- /dev/null +++ b/alliance/src/xsch/configure.in @@ -0,0 +1,36 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(src/xsch.c) + +XSCH_MAJOR_VERSION=1 +XSCH_MINOR_VERSION=4 +XSCH_VERSION=$XSCH_MAJOR_VERSION.$XSCH_MINOR_VERSION + +AC_SUBST(XSCH_MAJOR_VERSION) +AC_SUBST(XSCH_MINOR_VERSION) +AC_SUBST(XSCH_VERSION) + +# For automake. +VERSION=$XSCH_VERSION +PACKAGE=xsch + +dnl Initialize automake stuff +AM_INIT_AUTOMAKE($PACKAGE, $VERSION) + +dnl Checks for programs. +AC_PROG_CC +AM_PROG_LEX +AC_PROG_YACC +AC_PROG_RANLIB +AC_PROG_MAKE_SET +AC_FIND_MOTIF + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST + +AM_ALLIANCE + +AC_OUTPUT([ +Makefile +src/Makefile +man1/Makefile +]) diff --git a/alliance/src/xsch/etc/xsch.par b/alliance/src/xsch/etc/xsch.par new file mode 100644 index 00000000..81dae574 --- /dev/null +++ b/alliance/src/xsch/etc/xsch.par @@ -0,0 +1,457 @@ +# /*------------------------------------------------------------\ +# | | +# | Title : Parameters File for Xsch | +# | | +# | Author : Ludovic Jacomme | +# | | +# | Date : 03.29.2000 | +# | | +# \------------------------------------------------------------*/ +# /*------------------------------------------------------------\ +# | | +# | Unit | +# | | +# \------------------------------------------------------------*/ + +DEFINE XSCH_UNIT 64 + +# /*------------------------------------------------------------\ +# | | +# | Lower Grid Step in pixel by unit | +# | | +# \------------------------------------------------------------*/ + +DEFINE XSCH_LOWER_GRID_STEP 50 + +# /*------------------------------------------------------------\ +# | | +# | Xsch Color | +# | | +# \------------------------------------------------------------*/ + +DEFINE XSCH_CURSOR_COLOR_NAME Black +DEFINE XSCH_BACKGROUND_COLOR_NAME Black +DEFINE XSCH_FOREGROUND_COLOR_NAME White +DEFINE XSCH_ACCEPT_COLOR_NAME magenta +DEFINE XSCH_CONNECT_COLOR_NAME magenta + +# /*------------------------------------------------------------\ +# | | +# | Xsch Cursor Size in pixel | +# | | +# \------------------------------------------------------------*/ + +DEFINE XSCH_CURSOR_SIZE 10 + +# /*------------------------------------------------------------\ +# | | +# | Xsch Layer Color | +# | | +# \------------------------------------------------------------*/ + +TABLE XSCH_LAYER_NAME + + 0 Gates cyan Black 0070ff + 1 Inputs red Black ff0000 + 2 Outputs light_blue Black 00ff00 + 3 Signals pink Black 0000ff + 4 Debug spring_green Black 00a000 + 5 Layer_0 #0000ff Black 0000ff + 6 Layer_1 #0020ff Black 0020ff + 7 Layer_2 #0040ff Black 0040ff + 8 Layer_3 #0060ff Black 0060ff + 9 Layer_4 #0080ff Black 0080ff + 10 Layer_5 #00a0ff Black 00a0ff + 11 Layer_6 #00c0ff Black 00c0ff + 12 Layer_7 #00e0ff Black 00e0ff + 13 Layer_8 #00ffff Black 00ffff + 14 Layer_9 #00ffe0 Black 00ffe0 + 15 Layer_10 #00ffc0 Black 00ffc0 + 16 Layer_11 #00ffa0 Black 00ffa0 + 17 Layer_12 #00ff80 Black 00ff80 + 18 Layer_13 #00ff60 Black 00ff60 + 19 Layer_14 #00ff40 Black 00ff40 + 20 Layer_15 #00ff20 Black 00ff20 + 21 Layer_16 #00ff00 Black 00ff00 + 22 Layer_17 #20ff00 Black 20ff00 + 23 Layer_18 #40ff00 Black 40ff00 + 24 Layer_19 #60ff00 Black 60ff00 + 25 Layer_20 #80ff00 Black 80ff00 + 26 Layer_21 #a0ff00 Black a0ff00 + 27 Layer_22 #c0ff00 Black c0ff00 + 28 Layer_23 #e0ff00 Black e0ff00 + 29 Layer_24 #ffff00 Black ffff00 + 30 Layer_25 #ffe000 Black ffe000 + 31 Layer_26 #ffc000 Black ffc000 + 32 Layer_27 #ffa000 Black ffa000 + 33 Layer_28 #ff8000 Black ff8000 + 34 Layer_29 #ff6000 Black ff6000 + 35 Layer_30 #ff4000 Black ff4000 + 36 Layer_31 #ff2000 Black ff2000 + 37 Layer_32 #ff0000 Black ff0000 + +END + +# /*------------------------------------------------------------\ +# | | +# | Xsch Icon Cell Buffer | +# | | +# \------------------------------------------------------------*/ + +TABLE XSCH_ICON_CELL_BUFFER + +# model inputs output not_in not_out + +# SXLIB + + buf_x2 i q 0 0 + buf_x4 i q 0 0 + buf_x8 i q 0 0 + + inv_x1 i nq 0 1 + inv_x2 i nq 0 1 + inv_x4 i nq 0 1 + inv_x8 i nq 0 1 + +# SCLIB + + b1_y i t 0 0 + d1_y i t 0 0 + p1_y i t 0 0 + + n1_y i f 0 1 + np1_y i f 0 1 + ndrv_y i f 0 1 + ndrvp_y i f 0 1 + +# DP_SXLIB + + dp_rom2_buf i nix 0 1 + +# RFLIB + + rf_out_buf_2 nck xcks 0 1 + rf_out_buf_4 nck xcks 0 1 + rf_dec_nbuf i nq 0 1 + +END + +# /*------------------------------------------------------------\ +# | | +# | Xsch Icon Cell And | +# | | +# \------------------------------------------------------------*/ + +TABLE XSCH_ICON_CELL_AND + +# model inputs output number_in not_in not_out + +# SXLIB + + a2_x2 i0,i1 q 2 0 0 + a2_x4 i0,i1 q 2 0 0 + a3_x2 i0,i1,i2 q 3 0 0 + a3_x4 i0,i1,i2 q 3 0 0 + a4_x2 i0,i1,i2,i3 q 4 0 0 + a4_x4 i0,i1,i2,i3 q 4 0 0 + + na2_x1 i0,i1 nq 2 0 1 + na2_x4 i0,i1 nq 2 0 1 + na3_x1 i0,i1,i2 nq 3 0 1 + na3_x4 i0,i1,i2 nq 3 0 1 + na4_x1 i0,i1,i2,i3 nq 4 0 1 + na4_x4 i0,i1,i2,i3 nq 4 0 1 + + an12_x1 i0,i1 q 2 2 0 + an12_x4 i0,i1 q 2 2 0 + +# SCLIB + + a2_y i0,i1 t 2 0 0 + a2p_y i0,i1 t 2 0 0 + a3_y i0,i1,i2 t 3 0 0 + a3p_y i0,i1,i2 t 3 0 0 + a4_y i0,i1,i2,i3 t 4 0 0 + a4p_y i0,i1,i2,i3 t 4 0 0 + + na2_y i0,i1 f 2 0 1 + na2p_y i0,i1 f 2 0 1 + na3_y i0,i1,i2 f 3 0 1 + na3p_y i0,i1,i2 f 3 0 1 + na4_y i0,i1,i2,i3 f 4 0 1 + na4p_y i0,i1,i2,i3 f 4 0 1 + +# RFLIB + + rf_dec_nand2 i0,i1 nq 2 0 1 + rf_dec_nand3 i0,i1,i2 nq 3 0 1 + rf_dec_nand4 i0,i1,i2,i3 nq 4 0 1 + +END + +# /*------------------------------------------------------------\ +# | | +# | Xsch Icon Cell Or | +# | | +# \------------------------------------------------------------*/ + +TABLE XSCH_ICON_CELL_OR + +# model inputs output number_in not_in not_out + +# SXLIB + + o2_x2 i0,i1 q 2 0 0 + o2_x4 i0,i1 q 2 0 0 + o3_x2 i0,i1,i2 q 3 0 0 + o3_x4 i0,i1,i2 q 3 0 0 + o4_x2 i0,i1,i2,i3 q 4 0 0 + o4_x4 i0,i1,i2,i3 q 4 0 0 + + no2_x1 i0,i1 nq 2 0 1 + no2_x4 i0,i1 nq 2 0 1 + no3_x1 i0,i1,i2 nq 3 0 1 + no3_x4 i0,i1,i2 nq 3 0 1 + no4_x1 i0,i1,i2,i3 nq 4 0 1 + no4_x4 i0,i1,i2,i3 nq 4 0 1 + + on12_x1 i0,i1 q 2 2 0 + on12_x4 i0,i1 q 2 2 0 + +# SCLIB + + o2_y i0,i1 t 2 0 0 + op2_y i0,i1 t 2 0 0 + o3_y i0,i1,i2 t 3 0 0 + op3_y i0,i1,i2 t 3 0 0 + + no2_y i0,i1 f 2 0 1 + nop2_y i0,i1 f 2 0 1 + no3_y i0,i1,i2 f 3 0 1 + nop3_y i0,i1,i2 f 3 0 1 + +# RFLIB + + rf_dec_nor3 i0,i1,i2 nq 3 0 1 + rf_fifo_inc ckm,nreset,nval inc 3 1 0 + +END + +# /*------------------------------------------------------------\ +# | | +# | Xsch Icon Cell Xor | +# | | +# \------------------------------------------------------------*/ + +TABLE XSCH_ICON_CELL_XOR + +# model inputs output number_in not_in not_out + +# SXLIB + + xr2_x1 i0,i1 q 2 0 0 + xr2_x4 i0,i1 q 2 0 0 + + nxr2_x1 i0,i1 nq 2 0 1 + nxr2_x4 i0,i1 nq 2 0 1 + +# SCLIB + + xr2_y i0,i1 t 2 0 0 + nxr2_y i0,i1 f 2 0 1 + +END + +# /*------------------------------------------------------------\ +# | | +# | Xsch Icon Cell Tristate | +# | | +# \------------------------------------------------------------*/ + +TABLE XSCH_ICON_CELL_TRISTATE + +# model inputs output not_in not_out + +# SXLIB + + nts_x1 cmd,i nq 0 1 + nts_x2 cmd,i nq 0 1 + + ts_x4 cmd,i q 0 0 + ts_x8 cmd,i q 0 0 + +# SCLIB + + ts_y v,i t 0 0 + tsp_y v,i t 0 0 + + tsn_y v,i f 0 1 + +END + +# /*------------------------------------------------------------\ +# | | +# | Xsch Icon Cell Register | +# | | +# \------------------------------------------------------------*/ + +TABLE XSCH_ICON_CELL_REGISTER + +# model inputs output number_in not_in clock_in not_out edge + +# SXLIB + + sff1_x4 i,ck q 2 0 1 0 1 + sff2_x4 cmd,i0,i1,ck q 4 0 1 0 1 + sff3_x4 cmd0,cmd1,i0,i1,i2,ck q 6 0 1 0 1 + +# SCLIB + + ms_y i,l t 2 0 1 0 2 + msdp2_y di,ck t 2 0 1 0 2 + msdp4_y di,ck t 2 0 1 0 2 + + ms2dp2_y di,si,se,ck t 4 0 1 0 2 + ms2dp4_y di,si,se,ck t 4 0 1 0 2 + +# RFLIB + + rf_out_mem rbus,xcks dataout 2 0 1 0 0 + +END + +# /*------------------------------------------------------------\ +# | | +# | Xsch Icon Cell One | +# | | +# \------------------------------------------------------------*/ + +TABLE XSCH_ICON_CELL_CONSTANT + +# model outputs number_out value + +# SXLIB + one_x0 q 1 1 + zero_x0 nq 1 0 + +# SCLIB + one_y t 1 1 + zero_y f 1 0 + +END + +# /*------------------------------------------------------------\ +# | | +# | Xsch Icon Cell Or_And | +# | | +# \------------------------------------------------------------*/ + +TABLE XSCH_ICON_CELL_ORAND + +# model inputs output number_in not_in not_out + +# SXLIB + + ao22_x2 i0,i1,i2 q 3 0 0 + ao22_x4 i0,i1,i2 q 3 0 0 + ao2o22_x2 i0,i1,i2,i3 q 4 0 0 + ao2o22_x4 i0,i1,i2,i3 q 4 0 0 + + nao22_x1 i0,i1,i2 nq 3 0 1 + nao22_x4 i0,i1,i2 nq 3 0 1 + nao2o22_x1 i0,i1,i2,i3 nq 4 0 1 + nao2o22_x4 i0,i1,i2,i3 nq 4 0 1 + +# SCLIB + + mx2_y i0,l0,i1,l1 t 4 0 0 + mx2p_y i0,l0,i1,l1 t 4 0 0 + mx3_y i0,l0,i1,l1,i2,l2 t 6 0 0 + mx4_y i0,l0,i1,l1,i2,l2,i3,l3 t 8 0 0 + nmx2_y j0,i0,j1,i1 t 4 0 1 + nao3_y i0,i1,i2 f 3 0 1 + +# RFLIB + + rf_dec_nao3 i0,i1,i2 nq 3 0 1 + +END + +# /*------------------------------------------------------------\ +# | | +# | Xsch Icon Cell And_Or | +# | | +# \------------------------------------------------------------*/ + +TABLE XSCH_ICON_CELL_ANDOR + +# model inputs output number_in not_in not_out + +# SXLIB + + noa22_x1 i0,i1,i2 nq 3 0 1 + noa22_x4 i0,i1,i2 nq 3 0 1 + noa2a22_x1 i0,i1,i2,i3 nq 4 0 1 + noa2a22_x4 i0,i1,i2,i3 nq 4 0 1 + noa2a2a23_x1 i0,i1,i2,i3,i4,i5 nq 6 0 1 + noa2a2a23_x4 i0,i1,i2,i3,i4,i5 nq 6 0 1 + noa2a2a2a24_x1 i0,i1,i2,i3,i4,i5,i6,i7 nq 8 0 1 + noa2a2a2a24_x4 i0,i1,i2,i3,i4,i5,i6,i7 nq 8 0 1 + + oa22_x2 i0,i1,i2 q 3 0 0 + oa22_x4 i0,i1,i2 q 3 0 0 + oa2a22_x2 i0,i1,i2,i3 q 4 0 0 + oa2a22_x4 i0,i1,i2,i3 q 4 0 0 + oa2a2a23_x2 i0,i1,i2,i3,i4,i5 q 6 0 0 + oa2a2a23_x4 i0,i1,i2,i3,i4,i5 q 6 0 0 + oa2a2a2a24_x2 i0,i1,i2,i3,i4,i5,i6,i7 q 8 0 0 + oa2a2a2a24_x4 i0,i1,i2,i3,i4,i5,i6,i7 q 8 0 0 + + +# SCLIB + + noa3_y i0,i1,i2 f 3 0 1 + annup_y i1,i2,i3,i4 f 4 0 1 + +# RFLIB + + rf_fifo_orand4 a0,b0,a1,b1 rippleout 4 0 0 + rf_fifo_orand5 a0,b0,a1,b1,ripplein rippleout 5 0 0 + +END + +# /*------------------------------------------------------------\ +# | | +# | Xsch Icon Cell Mux | +# | | +# \------------------------------------------------------------*/ + +TABLE XSCH_ICON_CELL_MUX + +# model inputs output number_sel number_in not_in not_out + +# SXLIB + + mx2_x2 cmd,i0,i1 q 1 2 0 0 + mx2_x4 cmd,i0,i1 q 1 2 0 0 + + mx3_x2 cmd0,cmd1,i0,i1,i2 q 2 3 0 0 + mx3_x4 cmd0,cmd1,i0,i1,i2 q 2 3 0 0 + + nmx2_x1 cmd,i0,i1 nq 1 2 0 1 + nmx2_x4 cmd,i0,i1 nq 1 2 0 1 + + nmx3_x1 cmd0,cmd1,i0,i1,i2 nq 2 3 0 1 + nmx3_x4 cmd0,cmd1,i0,i1,i2 nq 2 3 0 1 + +# DP_SXLIB + + dp_mux_x2 sel0,sel1,i0,i1 q 2 2 0 0 + dp_mux_x4 sel0,sel1,i0,i1 q 2 2 0 0 + dp_nmux_x1 sel0,sel1,i0,i1 nq 2 2 0 1 + +# RFLIB + + rf_inmux_mem sel0,sel1,datain0,datain1 dinx 2 2 0 0 + +END diff --git a/alliance/src/xsch/man1/Makefile.am b/alliance/src/xsch/man1/Makefile.am new file mode 100644 index 00000000..bae81103 --- /dev/null +++ b/alliance/src/xsch/man1/Makefile.am @@ -0,0 +1,2 @@ +man_MANS = xsch.1 +EXTRA_DIST = $(man_MANS) diff --git a/alliance/src/xsch/man1/xsch.1 b/alliance/src/xsch/man1/xsch.1 new file mode 100644 index 00000000..d355519c --- /dev/null +++ b/alliance/src/xsch/man1/xsch.1 @@ -0,0 +1,135 @@ +.TH XSCH 1 "September 1, 2000" "ASIM/LIP6" "ALLIANCE Reference Manual" +.SH NAME +xsch \- graphical schematic viewer +.SH SYNOPSIS +.B xsch +[\-l file_name] +[\-xor] +[\-install] +[\-force] +[\-I input_format] +[\-slide file_name ...] +.br +.so man1/alc_origin.1 +.SH DESCRIPTION +.B Xsch +is a graphical schematic viewer. All functionnalities can be +accessed through different menus. +.B Xsch +works under Motif and X11r6. +When entering +.B Xsch, +the main window appears and shows 5 different +menus on the top bar. These menus can be entered by simply clicking on the +mouse left button. Here is the description of these menus. + +.TP 10 +.B File +\f4Open\fP : load an existing file. Note that a file with the same name +and the extention .xsc can be used to attach special +colors and comments to all displayed objects (see below for details). +.fi +.br +\f4Quit\fP : quit xsch. + +.TP 10 +.B Edit +\f4Identify\fP : identify a selected object. +.br +\f4Connected\fP : highlight a selected object. +.br +\f4Search\fP : search an object by its name. + +.TP 10 +.B View +\f4Zoom\fP : perform zoom in, zoom out, center, fit, refresh on figure. +.br +\f4Layer\fP : select types of layers displayed. +.br +\f4Map\fP : show cursor position in the entire figure. +.br +\f4Arrows\fP : show arrows for moving at the grid step. +.br +\f4Grid\fP : Set the X,Y step of the grid if displayed. + +.TP 10 +.B Tools +\f4Hierarchy\fP : enable user to browse into the design hierarchy. +.br +\f4Message\fP : display the last error messages + +.TP 10 +.B Setup +Save or load a user defined configuration of default displayed menus. + +.SH SPECIAL KEYS +.TP ++/- +Next or previous file in slide mode. + +.SH OPTIONS +.TP +\-l file_name +Load the file file_name (with or without extention) +.TP +\-xor +Two graphic cursor methods can be used, invert or xor. +.TP +\-force +this option force all graphical objects to be displayed. +.TP +\-install +Switch to a private color map. +.TP +\-I input_format +Specifies the input format (vst(5), al(5), vbe(5)) +.TP +\-slide file_name ... +Enables slide mode, all specifies files will be displayed one by one +using keys +/- in the graphic window. + +.SH XSC FILE FORMAT +.nf +# Example of .xsc file +# +# To attach a particular color and comment to a box : +# B:box_name:color:comment +# color is an integer from 0 to 32, or -1 for no_color +# comment is a string +B:my_box:0:this box should be blue +B:another_box:-1:this won't change the box color +# +# To attach a particular color and comment to a net : +# N:net_name:color:comment +N:my_net:15:this net should be green +# +# To attach a particular color and comment to a connector : +# C:connector_name:color:comment +C:my_con:32:this connector should be red +# +# To attach a particular color and comment to a path : +# P:from_name:net_name:to_name:color:comment +P:my_con:my_net:my_box:15:this path should be green + + +.SH ENVIRONMENT VARIABLES +.TP +.B MBK_CATA_LIB +indicates the path to the read only libraries to be used. +.TP +.B MBK_WORK_LIB +indicates the path to the read directory for the session. +.TP +.B MBK_IN_LO +indicates the file format to be used. +.TP +.B XSCH_PARAM_NAME (optionnal) +indicates the path to the parameter file used by Xsch. +.TP + +.SH SEE ALSO +mbk(1), MBK_CATA_LIB(1), MBK_WORK_LIB(1), PAT(5), asimut(1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/xsch/motif.m4 b/alliance/src/xsch/motif.m4 new file mode 100644 index 00000000..d0325a71 --- /dev/null +++ b/alliance/src/xsch/motif.m4 @@ -0,0 +1,196 @@ +dnl +dnl +dnl AC_FIND_MOTIF : find OSF/Motif or LessTif, and provide variables +dnl to easily use them in a Makefile. +dnl +dnl Adapted from a macro by Andreas Zeller. +dnl +dnl The variables provided are : +dnl LINK_MOTIF (e.g. -L/usr/lesstif/lib -lXm) +dnl INCLUDE_MOTIF (e.g. -I/usr/lesstif/lib) +dnl MOTIF_LIBRARIES (e.g. /usr/lesstif/lib) +dnl MOTIF_INCLUDES (e.g. /usr/lesstif/include) +dnl +dnl The LINK_MOTIF and INCLUDE_MOTIF variables should be fit to put on +dnl your application's link line in your Makefile. +dnl +dnl Oleo CVS $Id: motif.m4,v 1.1 2002/03/29 17:41:37 ludo Exp $ +dnl +AC_DEFUN(AC_FIND_MOTIF, +[ + +AC_REQUIRE([AC_PATH_XTRA]) + +MOTIF_INCLUDES= +MOTIF_LIBRARIES= + +dnl AC_ARG_WITH(motif, +dnl [ --without-motif do not use Motif widgets]) +dnl Treat --without-motif like +dnl --without-motif-includes --without-motif-libraries. +dnl if test "$with_motif" = "no" +dnl then +dnl MOTIF_INCLUDES=none +dnl MOTIF_LIBRARIES=none +dnl fi + +AC_ARG_WITH(motif-includes, +[ --with-motif-includes=DIR Motif include files are in DIR], +MOTIF_INCLUDES="$withval") + +AC_ARG_WITH(motif-libraries, +[ --with-motif-libraries=DIR Motif libraries are in DIR], +MOTIF_LIBRARIES="$withval") + +AC_MSG_CHECKING(for Motif) + +# +# +# Search the include files. +# +if test "$MOTIF_INCLUDES" = ""; then +AC_CACHE_VAL(ac_cv_motif_includes, +[ +ac_motif_save_LIBS="$LIBS" +ac_motif_save_CFLAGS="$CFLAGS" +ac_motif_save_CPPFLAGS="$CPPFLAGS" +ac_motif_save_LDFLAGS="$LDFLAGS" +# +LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS" +CFLAGS="$X_CFLAGS $CFLAGS" +CPPFLAGS="$X_CFLAGS $CPPFLAGS" +LDFLAGS="$X_LIBS $LDFLAGS" +# +ac_cv_motif_includes="none" +AC_TRY_COMPILE([#include ],[int a;], +[ +# Xm/Xm.h is in the standard search path. +ac_cv_motif_includes= +], +[ +# Xm/Xm.h is not in the standard search path. +# Locate it and put its directory in `MOTIF_INCLUDES' +# +# /usr/include/Motif* are used on HP-UX (Motif). +# /usr/include/X11* are used on HP-UX (X and Athena). +# /usr/dt is used on Solaris (Motif). +# /usr/openwin is used on Solaris (X and Athena). +# Other directories are just guesses. +for dir in "$x_includes" "${prefix}/include" /usr/include /usr/local/include \ + /usr/include/Motif2.0 /usr/include/Motif1.2 /usr/include/Motif1.1 \ + /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 \ + /usr/dt/include /usr/openwin/include \ + /usr/dt/*/include /opt/*/include /usr/include/Motif* \ + "${prefix}"/*/include /usr/*/include /usr/local/*/include \ + "${prefix}"/include/* /usr/include/* /usr/local/include/*; do +if test -f "$dir/Xm/Xm.h"; then +ac_cv_motif_includes="$dir" +break +fi +done +]) +# +LIBS="$ac_motif_save_LIBS" +CFLAGS="$ac_motif_save_CFLAGS" +CPPFLAGS="$ac_motif_save_CPPFLAGS" +LDFLAGS="$ac_motif_save_LDFLAGS" +]) +MOTIF_INCLUDES="$ac_cv_motif_includes" +fi +# +# +# Now for the libraries. +# +if test "$MOTIF_LIBRARIES" = ""; then +AC_CACHE_VAL(ac_cv_motif_libraries, +[ +ac_motif_save_LIBS="$LIBS" +ac_motif_save_CFLAGS="$CFLAGS" +ac_motif_save_CPPFLAGS="$CPPFLAGS" +ac_motif_save_LDFLAGS="$LDFLAGS" +# +LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS" +CFLAGS="$X_CFLAGS $CFLAGS" +CPPFLAGS="$X_CFLAGS $CPPFLAGS" +LDFLAGS="$X_LIBS $LDFLAGS" +# +ac_cv_motif_libraries="none" +AC_TRY_LINK([#include ],[XtToolkitInitialize();], +[ +# libXm.a is in the standard search path. +ac_cv_motif_libraries= +], +[ +# libXm.a is not in the standard search path. +# Locate it and put its directory in `MOTIF_LIBRARIES' +# +# /usr/lib/Motif* are used on HP-UX (Motif). +# /usr/lib/X11* are used on HP-UX (X and Athena). +# /usr/dt is used on Solaris (Motif). +# /usr/lesstif is used on Linux (Lesstif). +# /usr/openwin is used on Solaris (X and Athena). +# Other directories are just guesses. +for dir in "$x_libraries" "${prefix}/lib" /usr/lib /usr/local/lib \ + /usr/lib/Motif2.0 /usr/lib/Motif1.2 /usr/lib/Motif1.1 \ + /usr/lib/X11R6 /usr/lib/X11R5 /usr/lib/X11R4 /usr/lib/X11 \ + /usr/dt/lib /usr/openwin/lib \ + /usr/dt/*/lib /opt/*/lib /usr/lib/Motif* \ + /usr/lesstif*/lib /usr/lib/Lesstif* \ + "${prefix}"/*/lib /usr/*/lib /usr/local/*/lib \ + "${prefix}"/lib/* /usr/lib/* /usr/local/lib/*; do +if test -d "$dir" && test "`ls $dir/libXm.* 2> /dev/null`" != ""; then +ac_cv_motif_libraries="$dir" +break +fi +done +]) +# +LIBS="$ac_motif_save_LIBS" +CFLAGS="$ac_motif_save_CFLAGS" +CPPFLAGS="$ac_motif_save_CPPFLAGS" +LDFLAGS="$ac_motif_save_LDFLAGS" +]) +# +MOTIF_LIBRARIES="$ac_cv_motif_libraries" +fi +# +# Provide an easier way to link +# +if test "$MOTIF_INCLUDES" = "none" -o "$MOTIF_LIBRARIES" = "none"; then + with_motif="no" +else + with_motif="yes" +fi + +if test "$with_motif" != "no"; then + if test "$MOTIF_LIBRARIES" = ""; then + LINK_MOTIF="-lXm" + MOTIF_LIBS="-lXm" + else + LINK_MOTIF="-L$MOTIF_LIBRARIES -lXm" + MOTIF_LIBS="-L$MOTIF_LIBRARIES -lXm" + fi + if test "$MOTIF_INCLUDES" != ""; then + INCLUDE_MOTIF="-I$MOTIF_INCLUDES" + MOTIF_CFLAGS="-I$MOTIF_INCLUDES" + fi + AC_DEFINE(HAVE_MOTIF) +else + with_motif="no" +fi +# +AC_SUBST(LINK_MOTIF) +AC_SUBST(INCLUDE_MOTIF) +# +# +# +motif_libraries_result="$MOTIF_LIBRARIES" +motif_includes_result="$MOTIF_INCLUDES" +test "$motif_libraries_result" = "" && motif_libraries_result="in default path" +test "$motif_includes_result" = "" && motif_includes_result="in default path" +test "$motif_libraries_result" = "none" && motif_libraries_result="(none)" +test "$motif_includes_result" = "none" && motif_includes_result="(none)" +AC_MSG_RESULT( + [libraries $motif_libraries_result, headers $motif_includes_result]) +])dnl + diff --git a/alliance/src/xsch/src/LIP6bw.h b/alliance/src/xsch/src/LIP6bw.h new file mode 100644 index 00000000..cfecd995 --- /dev/null +++ b/alliance/src/xsch/src/LIP6bw.h @@ -0,0 +1,293 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +#define LIP6bw_width 164 +#define LIP6bw_height 150 +static char LIP6bw_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x70, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, + 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x70, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0xfc, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x01, + 0xe0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x7f, 0x00, 0xc0, 0xff, 0x7f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x3f, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xe0, + 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xe0, 0x01, 0xff, 0xff, + 0x01, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x01, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, + 0x01, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, + 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x03, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0xf0, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, + 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0xf9, 0xff, 0xff, + 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0x20, 0xc0, 0xff, 0xff, 0x07, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0x00, 0x80, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0x00, + 0x00, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, + 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x03, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0xe0, 0x00, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xe0, + 0x01, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, + 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x03, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, + 0x01, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, + 0x01, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x01, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0xe0, 0x01, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x3f, 0xc0, + 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x3f, 0x00, 0x80, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x7f, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x03, + 0xf0, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x1f, 0xff, 0xff, 0x1f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; diff --git a/alliance/src/xsch/src/Makefile.am b/alliance/src/xsch/src/Makefile.am new file mode 100644 index 00000000..8963417f --- /dev/null +++ b/alliance/src/xsch/src/Makefile.am @@ -0,0 +1,35 @@ +## Process this file with automake to produce Makefile.in + +bin_PROGRAMS = xsch +CFLAGS = @CFLAGS@ @X_CFLAGS@ -DXSCH_VERSION=\"@XSCH_VERSION@\" \ + -DXSCH_TOOL_NAME=\"xsch\" \ + -DXSCH_DEFAULT_PARAM_NAME=\"${ALLIANCE_TOP}/etc/xsch.par\" \ + -DXMS_FILE_NAME=\".xsch.cfg\" + +xsch_LDADD = @LIBS@ @X_LIBS@ @LINK_MOTIF@ \ + -lScl -lMlu -lMal -lMcl -lMel -lMhl -lMsl -lMvl -lMgl -lMlo -lMut -lMgl -lAbv -lAbe \ + -lBdd -lAbl -lAut -lRcn -lm + +INCLUDES = @INCLUDES@ @INCLUDE_MOTIF@ + +xsch_SOURCES = \ +LIP6bw.h XME_dialog.c XME_dialog.h XME_edit.c XME_edit.h XME.h XME_menu.c XME_menu.h \ +XME_message.c XME_message.h XME_panel.c XME_panel.h XME_search.c XME_search.h \ +XME_select.c XME_select.h XMF_dialog.c XMF_dialog.h XMF_file.c XMF_file.h XMF.h \ +XMF_menu.c XMF_menu.h XMF_panel.c XMF_panel.h XMH.h XMH_help.c XMH_help.h \ +XMH_menu.c XMH_menu.h XMH_panel.c XMH_panel.h XMS_dialog.c XMS_dialog.h XMS.h \ +XMS_menu.c XMS_menu.h XMS_panel.c XMS_panel.h XMS_setup.c XMS_setup.h \ +XMT_dialog.c XMT_dialog.h XMT.h XMT_menu.c XMT_menu.h XMT_message.c \ +XMT_message.h XMT_panel.c XMT_panel.h XMT_tools.c XMT_tools.h XMV_dialog.c \ +XMV_dialog.h XMV.h XMV_map.c XMV_map.h XMV_menu.c XMV_menu.h XMV_message.c \ +XMV_message.h XMV_panel.c XMV_panel.h XMV_view.c XMV_view.h XMX_color.c \ +XMX_color.h XMX_cursor.c XMX_cursor.h XMX_dialog.c XMX_dialog.h XMX_event.c \ +XMX_event.h XMX_graphic.c XMX_graphic.h XMX_grid.c XMX_grid.h XMX.h XMX_icon.c \ +XMX_icon.h XMX_menu.c XMX_menu.h XMX_message.c XMX_message.h XMX_motif.c \ +XMX_motif.h XMX_panel.c XMX_panel.h XMX_view.c XMX_view.h XSB_error.c \ +XSB_error.h XSB.h XSB_parse.c XSB_parse.h XSB_share.c XSB_share.h XSC_bound.c \ +XSC_bound.h XSC_error.c XSC_error.h XSC.h xsch.c xsch.h XSC_object.c \ +XSC_object.h XSC_place.c XSC_place.h XSC_schem.c XSC_schem.h XSC_select.c \ +XSC_select.h XTB_cursor.c XTB_cursor.h XTB_dialog.c XTB_dialog.h XTB.h \ +XTB_icon.c XTB_icon.h XTB_menu.c XTB_menu.h XTB_panel.c XTB_panel.h \ +XTB_pixmap.c XTB_pixmap.h diff --git a/alliance/src/xsch/src/XME.h b/alliance/src/xsch/src/XME.h new file mode 100644 index 00000000..fa5e47ad --- /dev/null +++ b/alliance/src/xsch/src/XME.h @@ -0,0 +1,88 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : XME.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_XME +# define XSCH_XME + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XschMenuItem XschEditMenu[]; + + extern XschPanelItem XschEditSearchViewPanel; + extern XschPanelItem XschEditSelectPanel; + extern XschPanelItem XschEditIdentifyPanel; + + extern int XschEditSearchViewDefaultValues[ 5 ]; + extern int XschEditIdentifyDefaultValues[ 5 ]; + extern int XschEditSelectDefaultValues[ 5 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschBuildEditDialog(); + + extern void XschEditSearch(); + extern void XschEditIdentify(); + extern void XschEditConnected(); + extern void XschEditUnselectAll(); + + extern void XschDisplayEditIdentify(); + + extern void XschToolsSelectHierarchyDown(); + + +# endif diff --git a/alliance/src/xsch/src/XME_dialog.c b/alliance/src/xsch/src/XME_dialog.c new file mode 100644 index 00000000..bae8265f --- /dev/null +++ b/alliance/src/xsch/src/XME_dialog.c @@ -0,0 +1,186 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "scl.h" +# include "XSB.h" +# include "XSC.h" +# include "XMX.h" +# include "XTB.h" +# include "XME.h" + +# include "XME_dialog.h" +# include "XME_edit.h" +# include "XME_search.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Search Dialog | +| | +\------------------------------------------------------------*/ + + XschDialogItem XschSearchObjectDialog = + + { + "Object name", + XSCH_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackSearchObjectOk, + (XtPointer)NULL, + (void *)CallbackSearchObjectCancel, + (XtPointer)NULL + }; + + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschBuildEditDialog | +| | +\------------------------------------------------------------*/ + +void XschBuildEditDialog() + +{ + autbegin(); + + XschBuildDialog( XschMainWindow, &XschSearchObjectDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Search Callback | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback For Object | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackSearchObjectOk | +| | +\------------------------------------------------------------*/ + +void CallbackSearchObjectOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *NameSet; + + autbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &NameSet ); + + XtUnmanageChild( XschSearchObjectDialog.WIDGET ); + + XschExitDialog(); + + NameSet = XschPostTreatString( NameSet ); + + if ( NameSet != (char *)NULL ) + { + NameSet = namealloc( NameSet ); + + XschEditSearchObject( NameSet ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSearchObjectCancel | +| | +\------------------------------------------------------------*/ + +void CallbackSearchObjectCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + autbegin(); + + XtUnmanageChild( XschSearchObjectDialog.WIDGET ); + + XschExitDialog(); + + autend(); +} diff --git a/alliance/src/xsch/src/XME_dialog.h b/alliance/src/xsch/src/XME_dialog.h new file mode 100644 index 00000000..52538b67 --- /dev/null +++ b/alliance/src/xsch/src/XME_dialog.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_EDIT_DIALOG +# define XSCH_EDIT_DIALOG + + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XschDialogItem XschSearchObjectDialog; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackSearchObjectOk(); + extern void CallbackSearchObjectCancel(); + +# endif diff --git a/alliance/src/xsch/src/XME_edit.c b/alliance/src/xsch/src/XME_edit.c new file mode 100644 index 00000000..aafd82d7 --- /dev/null +++ b/alliance/src/xsch/src/XME_edit.c @@ -0,0 +1,408 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Edit.c | +| | +| Authors : Jacomme Ludovic | +| Miramond Benoit | +| Picault Stephane | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "mlo.h" +# include "abe.h" + +# include "scl.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XSC.h" +# include "XME.h" +# include "XMV.h" + +# include "XME_edit.h" +# include "XME_select.h" +# include "XME_panel.h" +# include "XME_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Identify Buffer | +| | +\------------------------------------------------------------*/ + +static char XschIdentifyMessage[XSCH_IDENTIFY_MESSAGE_SIZE]; +static char XschIdentifyBuffer[XSCH_IDENTIFY_BUFFER_SIZE]; + + +static char *XschScanIdentify; +static long XschIdentifyLength; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschAddIdentify | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschAddIdentify | +| | +\------------------------------------------------------------*/ + +short XschAddIdentify(Obj) + + xschobj_list *Obj; +{ + schbox_list *SchBox; + schnet_list *SchNet; + schcon_list *SchCon; + loins_list *LoIns; + losig_list *LoSig; + lotrs_list *LoTrs; + locon_list *LoCon; + beaux_list *BeAux; + beout_list *BeOut; + bereg_list *BeReg; + biabl_list *BiAbl; + chain_list *ScanChain; + char *Scan; + char *Comment; + long Length; + + autbegin(); + + XschIdentifyBuffer[0] = '\0'; + Comment = (char *)0; + + if ( IsXschSchBox( Obj ) ) + { + SchBox = (schbox_list *)Obj->USER; + Comment = SchBox->USER; + + if ( SchBox->SOURCE_TYPE == SCH_SOURCE_LOINS ) + { + LoIns = (loins_list *)SchBox->SOURCE; + + sprintf( XschIdentifyBuffer, + "Instance :\n> Name %s\n> Model %s\n\n", + LoIns->INSNAME, LoIns->FIGNAME ); + } + else + if ( SchBox->SOURCE_TYPE == SCH_SOURCE_LOTRS ) + { + LoTrs = (lotrs_list *)SchBox->SOURCE; + + sprintf( XschIdentifyBuffer, + "Transistor :\n> Type %s\n> Name %s\n> X,Y %.3f,%.3f\n", + ( LoTrs->TYPE == TRANSN ) ? "NTRANS" : "PTRANS", + ( LoTrs->TRNAME == NULL ) ? "none" : LoTrs->TRNAME, + (float)LoTrs->X / (float)SCALE_X, + (float)LoTrs->Y / (float)SCALE_X ); + } + else + if ( SchBox->SOURCE_TYPE == SCH_SOURCE_BEAUX ) + { + BeAux = (beaux_list *)SchBox->SOURCE; + + sprintf( XschIdentifyBuffer, + "BeAux :\n> Name %s\n> Abl %s\n\n", + BeAux->NAME, viewablexprstr( BeAux->ABL, ABL_VIEW_VHDL ) ); + } + else + if ( SchBox->SOURCE_TYPE == SCH_SOURCE_BEOUT ) + { + BeOut = (beout_list *)SchBox->SOURCE; + + sprintf( XschIdentifyBuffer, + "BeOut :\n> Name %s\n> Abl %s\n\n", + BeOut->NAME, viewablexprstr( BeOut->ABL, ABL_VIEW_VHDL ) ); + } + else + if ( SchBox->SOURCE_TYPE == SCH_SOURCE_BEREG ) + { + BeReg = (bereg_list *)SchBox->SOURCE; + + Scan = XschIdentifyBuffer; + sprintf( XschIdentifyBuffer, "BeReg :\n> Name %s\n\n", BeReg->NAME ); + Scan += strlen( Scan ); + + for ( BiAbl = BeReg->BIABL; + BiAbl != (biabl_list *)0; + BiAbl = BiAbl->NEXT ) + { + sprintf( Scan, "> Cond %s\n", + viewablexprstr( BiAbl->CNDABL, ABL_VIEW_VHDL ) ); + Scan += strlen( Scan ); + sprintf( Scan, "> Value %s\n", + viewablexprstr( BiAbl->VALABL, ABL_VIEW_VHDL ) ); + Scan += strlen( Scan ); + } + + strcpy( Scan, "\n" ); + } + } + else + if ( IsXschSchCon( Obj ) ) + { + SchCon = (schcon_list *) Obj->USER; + Comment = SchCon->USER; + + if ( SchCon->SOURCE_TYPE == SCH_SOURCE_LOCON ) + { + LoCon = (locon_list *)SchCon->SOURCE; + + sprintf( XschIdentifyBuffer, "Connector :\n> Name %s\n\n", LoCon->NAME ); + } + else + { + sprintf( XschIdentifyBuffer, "Connector :\n> Name %s\n\n", SchCon->NAME ); + } + } + else + if ( IsXschSchNet( Obj ) ) + { + SchNet = (schnet_list *)Obj->USER; + Comment = SchNet->USER; + + if ( SchNet->SOURCE_TYPE == SCH_SOURCE_LOSIG ) + { + LoSig = (losig_list *)SchNet->SOURCE; + + Scan = XschIdentifyBuffer; + strcpy( Scan, "Signal :\n\n"); + Scan += strlen( Scan ); + sprintf( Scan, "> Index %ld\n> Name ", LoSig->INDEX ); + Scan += strlen( Scan ); + + for ( ScanChain = LoSig->NAMECHAIN; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + strcpy( Scan, (char *)ScanChain->DATA ); + Scan += strlen( Scan ); + strcpy( Scan, " " ); + Scan += strlen( Scan ); + } + + strcpy( Scan, "\n" ); + Scan += strlen( Scan ); + + for ( ScanChain = SchNet->CON_NET; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + SchCon = (schcon_list *)ScanChain->DATA; + + if ( SchCon->ROOT_TYPE == SCH_ROOT_CON_BOX ) + { + SchBox = (schbox_list *)SchCon->ROOT; + + if ( ( ! IsSchBoxTransparence( SchBox ) ) && + ( ! IsSchBoxClusterNet( SchBox ) ) ) + { + sprintf( Scan, "> Port %s of %s\n", SchCon->NAME, SchBox->NAME ); + Scan += strlen(Scan); + } + } + } + } + else + { + sprintf( XschIdentifyBuffer, "Net :\n" ); + } + } + + Length = strlen( XschIdentifyBuffer ); + + if ( Comment != (char *)0 ) + { + Scan = XschIdentifyBuffer + Length; + sprintf( Scan, "[%s]\n", Comment ); + + Length += strlen( Scan ); + } + + if ( ( XschIdentifyLength + Length ) < (XSCH_IDENTIFY_MESSAGE_SIZE - 1)) + { + strcpy( XschScanIdentify, XschIdentifyBuffer ); + + XschScanIdentify += Length; + XschIdentifyLength += Length; + + autend(); + return ( XSCH_TRUE ); + } + + autend(); + return ( XSCH_FALSE ); +} + +/*------------------------------------------------------------\ +| | +| XschEditIdentify | +| | +\------------------------------------------------------------*/ + +void XschEditIdentify( X1, Y1 ) + + long X1; + long Y1; +{ + xschselect_list *Select; + + strcpy( XschIdentifyMessage, "No element found !" ); + + XschScanIdentify = XschIdentifyMessage; + XschIdentifyLength = 0; + + XschEditSelectPoint( X1, Y1 ); + + for ( Select = XschHeadSelect; + Select != (xschselect_list *)0; + Select = Select->NEXT ) + { + if ( ! XschAddIdentify( Select->OBJECT ) ) break; + } + + XschDelSelect(); + + XschDisplayEditIdentify( XschIdentifyMessage ); + XschEnterPanel( &XschEditIdentifyPanel ); +} + +/*------------------------------------------------------------\ +| | +| XschEditConnected | +| | +\------------------------------------------------------------*/ + +void XschEditConnected( X1, Y1 ) + + long X1; + long Y1; +{ + xschselect_list *Select; + xschobj_list *Obj; + + if ( XschHeadConnect != (xschselect_list *)NULL ) + { + XschDelConnect(); + XschZoomRefresh(); + } + + XschEditSelectPoint( X1, Y1 ); + + XschDisplaySelectList( (char *)NULL ); + + for ( Select = XschHeadSelect; + Select != (xschselect_list *)NULL; + Select = Select->NEXT) + { + XschAddSelectList( Select->OBJECT ); + } + + if ( XschHeadSelect == (xschselect_list *)NULL ) + { + XschWarningMessage(XschMainWindow, "No element found !"); + } + else + { + if ( XschHeadSelect->NEXT != (xschselect_list *)NULL ) + { + XschEnterPanel(&XschEditSelectPanel); + XschLimitedLoop(XschEditSelectPanel.PANEL); + } + else + { + XschAcceptObject(XschHeadSelect->OBJECT); + XschDisplayObject(XschHeadSelect->OBJECT); + } + } + + XschPurgeSelect(); + + for ( Select = XschHeadSelect; + Select != (xschselect_list *)NULL; + Select = Select->NEXT ) + { + XschAddConnect( Select->OBJECT ); + } + + if ( XschHeadSelect != (xschselect_list *)NULL ) + { + if ( XschHeadSelect->NEXT == (xschselect_list *)NULL ) + { + Obj = XschHeadSelect->OBJECT; + XschDelSelect(); + XschDisplayObject(Obj); + } + else + { + XschDelSelect(); + XschZoomRefresh(); + } + } +} diff --git a/alliance/src/xsch/src/XME_edit.h b/alliance/src/xsch/src/XME_edit.h new file mode 100644 index 00000000..6cba5baf --- /dev/null +++ b/alliance/src/xsch/src/XME_edit.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Edit.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_EDIT +# define XSCH_EDIT + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XSCH_IDENTIFY_BUFFER_SIZE 64000 +# define XSCH_IDENTIFY_LOCOUT_SIZE 64000 +# define XSCH_IDENTIFY_MESSAGE_SIZE 64000 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xsch/src/XME_menu.c b/alliance/src/xsch/src/XME_menu.c new file mode 100644 index 00000000..8d06228a --- /dev/null +++ b/alliance/src/xsch/src/XME_menu.c @@ -0,0 +1,196 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "scl.h" +# include "XSB.h" +# include "XTB.h" +# include "XSC.h" +# include "XMV.h" +# include "XME.h" +# include "XMX.h" + +# include "XME_menu.h" +# include "XME_dialog.h" +# include "XME_edit.h" +# include "XME_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XschMenuItem XschEditMenu[] = + + { + { + "Identify", + 'I', + "CtrlI", + "Ctrl I", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditIdentify, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XschMenuItem *)NULL + } + , + { + "Connected", + 'C', + "CtrlC", + "Ctrl C", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditConnected, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XschMenuItem *)NULL + } + , + { + "Search ", + 'S', + "CtrlS", + "Ctrl S", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditSearch, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XschMenuItem *)NULL + } + , + NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackEditIdentify | +| | +\------------------------------------------------------------*/ + +void CallbackEditIdentify( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschChangeEditMode( XSCH_EDIT_IDENTIFY, + XschPromptEditIdentify ); + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditConnected | +| | +\------------------------------------------------------------*/ + +void CallbackEditConnected( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschChangeEditMode( XSCH_EDIT_CONNECTED, + XschPromptEditConnected ); + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditSearch | +| | +\------------------------------------------------------------*/ + +void CallbackEditSearch( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschEnterDialog( &XschSearchObjectDialog ); + + autend(); +} diff --git a/alliance/src/xsch/src/XME_menu.h b/alliance/src/xsch/src/XME_menu.h new file mode 100644 index 00000000..f2368c20 --- /dev/null +++ b/alliance/src/xsch/src/XME_menu.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_MENU +# define XSCH_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackEditIdentify(); + extern void CallbackEditConnected(); + extern void CallbackEditSearch(); + +# endif diff --git a/alliance/src/xsch/src/XME_message.c b/alliance/src/xsch/src/XME_message.c new file mode 100644 index 00000000..319f66a6 --- /dev/null +++ b/alliance/src/xsch/src/XME_message.c @@ -0,0 +1,116 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Message.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "scl.h" +# include "XSB.h" +# include "XSC.h" +# include "XMX.h" +# include "XTB.h" +# include "XME.h" +# include "XME_edit.h" +# include "XME_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschPromptEditIdentify | +| | +\------------------------------------------------------------*/ + +void XschPromptEditIdentify() + +{ + autbegin(); + + XschDisplayMessage( XSCH_MESSAGE_MODE , "Identify" ); + XschDisplayMessage( XSCH_MESSAGE_INFO , "Select object" ); + XschDisplayMessage( XSCH_MESSAGE_PROMPT, "Enter select point" ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschPromptEditConnected | +| | +\------------------------------------------------------------*/ + +void XschPromptEditConnected() + +{ + autbegin(); + + XschDisplayMessage( XSCH_MESSAGE_MODE , "Connected" ); + XschDisplayMessage( XSCH_MESSAGE_INFO , "Select object" ); + XschDisplayMessage( XSCH_MESSAGE_PROMPT, "Enter select point" ); + + autend(); +} diff --git a/alliance/src/xsch/src/XME_message.h b/alliance/src/xsch/src/XME_message.h new file mode 100644 index 00000000..cfe291eb --- /dev/null +++ b/alliance/src/xsch/src/XME_message.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Message.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_MESSAGE +# define XSCH_MESSAGE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschPromptEditIdentify(); + extern void XschPromptEditConnected(); + +# endif diff --git a/alliance/src/xsch/src/XME_panel.c b/alliance/src/xsch/src/XME_panel.c new file mode 100644 index 00000000..89ae5d81 --- /dev/null +++ b/alliance/src/xsch/src/XME_panel.c @@ -0,0 +1,499 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "scl.h" +# include "XSB.h" +# include "XSC.h" +# include "XMX.h" +# include "XTB.h" +# include "XME.h" + +# include "XME_panel.h" +# include "XME_message.h" +# include "XME_dialog.h" +# include "XME_edit.h" +# include "XME_search.h" +# include "XME_select.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Search View Panel | +| | +\------------------------------------------------------------*/ + + static char *XschEditSearchViewButtonName[] = + + { + "Continue", + "Abort" + }; + + static XschPanelButtonItem XschEditSearchViewButton[] = + + { + { + &XschEditSearchViewButtonName[0], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackEditSearchViewContinue, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschEditSearchViewButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 1, + 1, 1, + CallbackEditSearchViewAbort, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XschPanelItem XschEditSearchViewPanel = + + { + "View search", + 1, + 0, + XSCH_EDIT_VIEW_SEARCH_X, + XSCH_EDIT_VIEW_SEARCH_Y, + 100, + 50, + 1, + 2, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XschEditSearchViewButton + }; + + int XschEditSearchViewDefaultValues[ 5 ] = + + { + XSCH_EDIT_VIEW_SEARCH_X, + XSCH_EDIT_VIEW_SEARCH_Y, + 100, 50, 0 + }; + +/*------------------------------------------------------------\ +| | +| Panel Identify | +| | +\------------------------------------------------------------*/ + + static char *XschPanelIdentifyButtonName[] = + + { + "Text", + "Close" + }; + + XschPanelButtonItem XschEditIdentifyButton[] = + + { + { + &XschPanelIdentifyButtonName[0], + "Nothing", NULL, 0, 0, + NULL, + NULL, + 0, 0, + 8, 9, + NULL, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelIdentifyButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 3, 9, + 2, 1, + CallbackEditCloseIdentify, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XschPanelItem XschEditIdentifyPanel = + + { + "Identify", + 1, + 0, + XSCH_EDIT_IDENTIFY_X, + XSCH_EDIT_IDENTIFY_Y, + 360, + 250, + 8, + 10, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XschEditIdentifyButton + }; + + int XschEditIdentifyDefaultValues[ 5 ] = + + { + XSCH_EDIT_IDENTIFY_X, + XSCH_EDIT_IDENTIFY_Y, + 360, 250, 0 + }; + +/*------------------------------------------------------------\ +| | +| Select Panel | +| | +\------------------------------------------------------------*/ + + static char *XschEditSelectButtonName[] = + + { + "Select", + "Accept", + "Cancel" + }; + + XschPanelButtonItem XschEditSelectButton[] = + + { + { + &XschEditSelectButtonName[0], + "List", + "List", 0, 0, + NULL, + NULL, + 0, 0, + 8, 9, + CallbackEditSelectList, + (XtPointer)1, + (Widget)NULL + } + , + { + &XschEditSelectButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 1, 9, + 2, 1, + CallbackEditSelectAccept, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschEditSelectButtonName[2], + NULL, NULL, 0, 0, + NULL, + NULL, + 5, 9, + 2, 1, + CallbackEditSelectCancel, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XschPanelItem XschEditSelectPanel = + + { + "Select", + 1, + 0, + XSCH_EDIT_SELECT_X, + XSCH_EDIT_SELECT_Y, + 360, + 250, + 8, + 10, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XschEditSelectButton + }; + + int XschEditSelectDefaultValues[ 5 ] = + + { + XSCH_EDIT_SELECT_X, + XSCH_EDIT_SELECT_Y, + 360, 250, 0 + }; + +/*------------------------------------------------------------\ +| | +| Callback For View Search | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackEditSearchViewContinue | +| | +\------------------------------------------------------------*/ + +void CallbackEditSearchViewContinue( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditSearchViewAbort | +| | +\------------------------------------------------------------*/ + +void CallbackEditSearchViewAbort( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschSearchAbort = XSCH_TRUE; + + XschExitDialog(); + + autbegin(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Identify | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackEditCloseIdentify | +| | +\------------------------------------------------------------*/ + +void CallbackEditCloseIdentify( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschExitPanel( &XschEditIdentifyPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschDisplayEditIdentify | +| | +\------------------------------------------------------------*/ + +void XschDisplayEditIdentify( Message ) + + char *Message; +{ + autbegin(); + + XmTextSetString( XschEditIdentifyButton[0].BUTTON, Message ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Select | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackEditSelectList | +| | +\------------------------------------------------------------*/ + +void CallbackEditSelectList( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmListCallbackStruct *CallData; +{ + autbegin(); + + if ( ClientData == (caddr_t)NULL ) + { + CallbackEditSelectAccept( MyWidget, (caddr_t)NULL, (caddr_t)NULL ); + } + else + { + XschEditSelectObject( CallData->item_position - 1 ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditSelectAccept | +| | +\------------------------------------------------------------*/ + +void CallbackEditSelectAccept( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschExitPanel( &XschEditSelectPanel ); + + XschExitDialog(); + + XschEditSelectAccept(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditSelectCancel | +| | +\------------------------------------------------------------*/ + +void CallbackEditSelectCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschExitPanel( &XschEditSelectPanel ); + + XschExitDialog(); + + XschEditSelectCancel(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschDisplaySelectList | +| | +\------------------------------------------------------------*/ + +void XschDisplaySelectList( Message ) + + char *Message; +{ + XmString Label; + + autbegin(); + + if ( Message == (char *)NULL ) + { + XmListDeleteAllItems( XschEditSelectButton[ 0 ].BUTTON ); + } + else + { + Label = XmStringCreateSimple( Message ); + XmListAddItem( XschEditSelectButton[ 0 ].BUTTON , Label , NULL ); + XmStringFree( Label ); + } + + autend(); +} diff --git a/alliance/src/xsch/src/XME_panel.h b/alliance/src/xsch/src/XME_panel.h new file mode 100644 index 00000000..03ebf1db --- /dev/null +++ b/alliance/src/xsch/src/XME_panel.h @@ -0,0 +1,90 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_EDIT_PANEL +# define XSCH_EDIT_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XSCH_EDIT_VIEW_SEARCH_X 790 +# define XSCH_EDIT_VIEW_SEARCH_Y 450 + +# define XSCH_EDIT_IDENTIFY_X 330 +# define XSCH_EDIT_IDENTIFY_Y 280 + +# define XSCH_EDIT_SELECT_X 330 +# define XSCH_EDIT_SELECT_Y 280 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackEditSearchViewContinue(); + extern void CallbackEditSearchViewAbort(); + + extern void CallbackEditCloseIdentify(); + + extern void CallbackEditSelectList(); + extern void CallbackEditSelectAccept(); + extern void CallbackEditSelectCancel(); + + extern void XschDisplaySelectList(); + +# endif diff --git a/alliance/src/xsch/src/XME_search.c b/alliance/src/xsch/src/XME_search.c new file mode 100644 index 00000000..f9b7c3c6 --- /dev/null +++ b/alliance/src/xsch/src/XME_search.c @@ -0,0 +1,231 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Search.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "scl.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XSC.h" +# include "XME.h" +# include "XMV.h" + +# include "XME_search.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + char XschSearchAbort; + int XschSearchNumber; + char *XschSearchString; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschEditInitializeSearch | +| | +\------------------------------------------------------------*/ + +void XschEditInitializeSearch( Name ) + + char *Name; +{ + char *Star; + + autbegin(); + + Star = strrchr( Name, '*' ); + + if ( Star != (char *)NULL ) + { + XschSearchNumber = (int)(Star - Name); + } + else + { + XschSearchNumber = 0; + } + + XschSearchString = Name; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschEditSearchCompare | +| | +\------------------------------------------------------------*/ + +int XschEditSearchCompare( Name ) + + char *Name; +{ + if ( Name != (char *)NULL ) + { + if ( XschSearchNumber ) + { + return( ! strncmp( XschSearchString, Name, XschSearchNumber ) ); + } + else + { + return( Name == XschSearchString ); + } + } + + return( 0 ); +} + +/*------------------------------------------------------------\ +| | +| XschEditSearchObject | +| | +\------------------------------------------------------------*/ + +void XschEditSearchObject( ObjectName ) + + char *ObjectName; +{ + xschobj_list *Obj; + xschselect_list *Search; + short Layer; + long X1; + long Y1; + + autbegin(); + + if ( XschHeadConnect != (xschselect_list *)NULL ) + { + XschDelConnect(); + XschZoomRefresh(); + } + + XschEditInitializeSearch( ObjectName ); + + for ( Layer = 0; Layer < XSCH_MAX_LAYER; Layer++ ) + { + if ( XSCH_ACTIVE_LAYER_TABLE[ Layer ] == 0 ) continue; + + for ( Obj = XschFigure->OBJECT[ Layer ]; + Obj != (xschobj_list *)NULL; + Obj = Obj->NEXT ) + { + if ( ( Obj->NAME != (char *)0 ) && + ( ! IsXschSelect( Obj ) ) ) + { + if ( XschEditSearchCompare( Obj->NAME ) ) + { + XschAddSelect( Obj ); + } + } + } + } + + for ( Search = XschHeadSelect; + Search != (xschselect_list *)NULL; + Search = Search->NEXT ) + { + XschUnselectObject( Search->OBJECT ); + } + + if ( XschHeadSelect == (xschselect_list *)NULL ) + { + XschWarningMessage( XschMainWindow, "No object found !" ); + } + else + { + XschSearchAbort = XSCH_FALSE; + + for ( Search = XschHeadSelect; + Search != (xschselect_list *)NULL; + Search = Search->NEXT ) + { + Obj = Search->OBJECT; + + XschAddConnect( Obj ); + + if ( XschSearchAbort ) continue; + + X1 = ( Obj->X + ( Obj->DX >> 1 ) ) / XSCH_UNIT; + Y1 = ( Obj->Y + ( Obj->DY >> 1 ) ) / XSCH_UNIT; + + XschZoomCenter( X1, Y1 ); + + if ( Search->NEXT != (xschselect_list *)NULL ) + { + XschEnterPanel( &XschEditSearchViewPanel ); + XschLimitedLoop( XschEditSearchViewPanel.PANEL ); + } + } + + XschDelSelect(); + + XschExitPanel( &XschEditSearchViewPanel ); + } + + autend(); +} diff --git a/alliance/src/xsch/src/XME_search.h b/alliance/src/xsch/src/XME_search.h new file mode 100644 index 00000000..27ee741a --- /dev/null +++ b/alliance/src/xsch/src/XME_search.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Search.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_SEARCH +# define XSCH_SEARCH + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char XschSearchAbort; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschEditSearchObject(); + +# endif diff --git a/alliance/src/xsch/src/XME_select.c b/alliance/src/xsch/src/XME_select.c new file mode 100644 index 00000000..3860b8f3 --- /dev/null +++ b/alliance/src/xsch/src/XME_select.c @@ -0,0 +1,534 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Edit.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "scl.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XSC.h" +# include "XME.h" +# include "XMV.h" + +# include "XME_select.h" +# include "XME_panel.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Select Buffer | +| | +\------------------------------------------------------------*/ + + static char XschSelectBuffer [ XSCH_SELECT_BUFFER_SIZE ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschAddSelectList | +| | +\------------------------------------------------------------*/ + +void XschAddSelectList( Obj ) + + xschobj_list *Obj; +{ + loins_list *LoIns; + losig_list *LoSig; + schbox_list *SchBox; + schnet_list *SchNet; + schcon_list *SchCon; + autbegin(); + + XschSelectBuffer[0] = '\0'; + + if ( IsXschSchBox( Obj ) ) + { + SchBox = (schbox_list *)Obj->USER; + + if ( SchBox->SOURCE_TYPE == SCH_SOURCE_LOINS ) + { + LoIns = (loins_list *)SchBox->SOURCE; + sprintf( XschSelectBuffer, " Instance %s (%s)", LoIns->INSNAME, LoIns->FIGNAME ); + } + else + { + sprintf( XschSelectBuffer, " Box %s", SchBox->NAME ); + } + } + else + if ( IsXschSchCon( Obj ) ) + { + SchCon = (schcon_list *) Obj->USER; + sprintf( XschSelectBuffer, " Connector %s", SchCon->NAME ); + } + else + if ( IsXschSchNet( Obj ) ) + { + SchNet = (schnet_list *)Obj->USER; + + if ( SchNet->SOURCE_TYPE == SCH_SOURCE_LOSIG ) + { + LoSig = (losig_list *)SchNet->SOURCE; + + if ( LoSig->NAMECHAIN == (chain_list *)0 ) + { + sprintf( XschSelectBuffer, " Signal %ld", LoSig->INDEX ); + } + else + { + sprintf( XschSelectBuffer, " Signal %s", (char *)LoSig->NAMECHAIN->DATA ); + } + } + else + { + strcpy( XschSelectBuffer, " Net" ); + } + } + + XschDisplaySelectList( XschSelectBuffer ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschEditSelectObject | +| | +\------------------------------------------------------------*/ + +void XschEditSelectObject( Number ) + + int Number; +{ + xschselect_list *Select; + int Counter; + + autbegin(); + + Select = XschHeadSelect; + + for ( Counter = 0; Counter < Number; Counter++ ) + { + Select = Select->NEXT; + } + + if ( IsXschAccept( Select->OBJECT ) ) + { + XschRejectObject( Select->OBJECT ); + } + else + { + XschAcceptObject( Select->OBJECT ); + } + + XschDisplayObject( Select->OBJECT ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschEditSelectAccept | +| | +\------------------------------------------------------------*/ + +void XschEditSelectAccept() +{ + autbegin(); + + XschPurgeSelect(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschEditSelectCancel | +| | +\------------------------------------------------------------*/ + +void XschEditSelectCancel() +{ + autbegin(); + + XschEditUnselectAll(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Select Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschEditUnselectAll | +| | +\------------------------------------------------------------*/ + +void XschEditUnselectAll() +{ + xschobj_list *Obj; + + autbegin(); + + if ( XschHeadSelect != (xschselect_list *)NULL ) + { + if ( XschHeadSelect->NEXT == (xschselect_list *)NULL ) + { + Obj = XschHeadSelect->OBJECT; + XschDelSelect(); + XschDisplayObject( Obj ); + } + else + { + XschDelSelect(); + XschZoomRefresh(); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XpatEditObjectNearPoint | +| | +\------------------------------------------------------------*/ + +# define XSCH_SNAP_TOLERANCE (float)(XSCH_UNIT * 8.0) + +char XschEditObjectNearPoint( Obj, X1, Y1 ) + + xschobj_list *Obj; + long X1; + long Y1; +{ + short Type; + long X1r; + long Y1r; + long X2r; + long Y2r; + long Delta; + float VectorX; + float VectorY; + float LineX; + float LineY; + float Norm; + float Distance; + + Type = GetXschObjectType( Obj ); + + if ( ( Type == XSCH_OBJECT_LINE ) || + ( Type == XSCH_OBJECT_ARROW ) ) + { + if ( IsXschLineLeft( Obj ) ) + { + X1r = Obj->X + Obj->DX; + X2r = Obj->X; + } + else + { + X1r = Obj->X; + X2r = Obj->X + Obj->DX; + } + + if ( IsXschLineDown( Obj ) ) + { + Y1r = Obj->Y + Obj->DY; + Y2r = Obj->Y; + } + else + { + Y1r = Obj->Y; + Y2r = Obj->Y + Obj->DY; + } + } + else + { + X1r = Obj->X; + X2r = Obj->X + Obj->DX; + Y1r = Obj->Y; + Y2r = Obj->Y + Obj->DY; + } + + if ( Obj->DY == 0 ) + { + if ( X1r < X2r ) + { + if ( ( X1 < X1r ) || + ( X1 > X2r ) ) return ( XSCH_FALSE ); + } + else + { + if ( ( X1 < X2r ) || + ( X1 > X1r ) ) return ( XSCH_FALSE ); + } + + Delta = Y1 - Y1r; + if ( Delta < 0 ) Delta = - Delta; + + if ( ( (float)Delta * XschUnitGridStep ) < XSCH_SNAP_TOLERANCE ) + { + return( XSCH_TRUE ); + } + + return( XSCH_FALSE ); + } + else + if ( Obj->DX == 0 ) + { + if ( Y1r < Y2r ) + { + if ( ( Y1 < Y1r ) || + ( Y1 > Y2r ) ) return ( XSCH_FALSE ); + } + else + { + if ( ( Y1 < Y2r ) || + ( Y1 > Y1r ) ) return ( XSCH_FALSE ); + } + + Delta = X1 - X1r; + if ( Delta < 0 ) Delta = - Delta; + + if ( ( (float)Delta * XschUnitGridStep ) < XSCH_SNAP_TOLERANCE ) + { + return( XSCH_TRUE ); + } + + return( XSCH_FALSE ); + } + else + if ( ( X1r > X1 ) || + ( Y1r > Y1 ) || + ( X2r < X1 ) || + ( Y2r < Y1 ) ) + { + return( XSCH_FALSE ); + } + + if ( ( Type == XSCH_OBJECT_LINE ) || + ( Type == XSCH_OBJECT_ARROW ) ) + { + if ( ( Obj->DX == 0 ) && + ( Obj->DY == 0 ) ) + { + if ( ( Obj->X == X1 ) && + ( Obj->Y == Y1 ) ) + { + return( XSCH_TRUE ); + } + } + else + { + LineX = (float)( X2r - X1r ); + LineY = (float)( Y2r - Y1r ); + Norm = sqrt( ( LineX * LineX ) + ( LineY * LineY ) ); + LineX /= Norm; + LineY /= Norm; + + VectorX = (float)( X2r - X1 ); + VectorY = (float)( Y2r - Y1 ); + + Distance = fabs( ( VectorX * LineY ) - ( VectorY * LineX ) ); + Distance = sqrt( Distance ); + + if ( ( Distance * XschUnitGridStep ) < XSCH_SNAP_TOLERANCE ) + { + return( XSCH_TRUE ); + } + } + } + else + { + return( XSCH_TRUE ); + } + + return( XSCH_FALSE ); +} + +/*------------------------------------------------------------\ +| | +| XschEditSelectPoint | +| | +\------------------------------------------------------------*/ + +void XschEditSelectPoint( X1, Y1 ) + + long X1; + long Y1; +{ + xschobj_list *Obj; + xschselect_list *Select; + int Layer; + + X1 = X1 * XSCH_UNIT; + Y1 = Y1 * XSCH_UNIT; + + for ( Layer = 0; Layer < XSCH_MAX_LAYER; Layer++ ) + { + if ( XSCH_ACTIVE_LAYER_TABLE[ Layer ] == 0 ) continue; + + for ( Obj = XschFigure->OBJECT[ Layer ]; + Obj != (xschobj_list *)NULL; + Obj = Obj->NEXT ) + { + if ( XSCH_ACTIVE_LAYER_TABLE[ Obj->LAYER ] == 0 ) continue; + + if ( ! IsXschSelect( Obj ) ) + { + if ( XschEditObjectNearPoint( Obj, X1, Y1 ) ) + { + XschAddSelect( Obj ); + } + } + } + } + + for ( Select = XschHeadSelect; + Select != (xschselect_list *)NULL; + Select = Select->NEXT ) + { + XschUnselectObject( Select->OBJECT ); + } +} + +/*------------------------------------------------------------\ +| | +| XschToolsSelectHierarchyDown | +| | +\------------------------------------------------------------*/ + +void XschToolsSelectHierarchyDown( X1, Y1 ) + + long X1; + long Y1; +{ + xschselect_list *Select; + xschselect_list *DelSelect; + xschselect_list **Previous; + + autbegin(); + + XschEditSelectPoint( X1, Y1 ); + + XschDisplaySelectList( (char *)NULL ); + + Previous = &XschHeadSelect; + Select = XschHeadSelect; + + while ( Select != (xschselect_list *)NULL ) + { + if ( ! IsXschSchBox( Select->OBJECT ) ) + { + DelSelect = Select; + Select = Select->NEXT; + *Previous = Select; + + XschFreeSelect( DelSelect ); + } + else + { + XschAddSelectList( Select->OBJECT ); + + Previous = &Select->NEXT; + Select = Select->NEXT; + } + } + + if ( XschHeadSelect == (xschselect_list *)NULL ) + { + XschWarningMessage( XschMainWindow, "No instance found !" ); + } + else + { + if ( XschHeadSelect->NEXT != (xschselect_list *)NULL ) + { + XschEnterPanel( &XschEditSelectPanel ); + XschLimitedLoop( XschEditSelectPanel.PANEL ); + } + else + { + XschAcceptObject( XschHeadSelect->OBJECT ); + XschDisplayObject( XschHeadSelect->OBJECT ); + } + + if ( XschHeadSelect != (xschselect_list *)NULL ) + { + XschToolsHierarchyDown(); + } + } + + autend(); +} diff --git a/alliance/src/xsch/src/XME_select.h b/alliance/src/xsch/src/XME_select.h new file mode 100644 index 00000000..eb75fc01 --- /dev/null +++ b/alliance/src/xsch/src/XME_select.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Select.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_SELECT +# define XSCH_SELECT + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XSCH_SELECT_BUFFER_SIZE 256 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschEditSelectObject(); + extern void XschEditSelectPoint(); + extern void XschAddSelectList(); + extern void XschEditSelectAccept(); + extern void XschEditSelectCancel(); + +# endif diff --git a/alliance/src/xsch/src/XMF.h b/alliance/src/xsch/src/XMF.h new file mode 100644 index 00000000..8d7f9dbd --- /dev/null +++ b/alliance/src/xsch/src/XMF.h @@ -0,0 +1,80 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : XMF.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_XMF +# define XSCH_XMF + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XschMenuItem XschFileMenu []; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschBuildFileDialog(); + extern void XschBuildPanelLibrary(); + + extern void XschFileAddSlide(); + extern void XschFileNextSlide(); + extern void XschFilePrevSlide(); + +# endif diff --git a/alliance/src/xsch/src/XMF_dialog.c b/alliance/src/xsch/src/XMF_dialog.c new file mode 100644 index 00000000..0690dbd4 --- /dev/null +++ b/alliance/src/xsch/src/XMF_dialog.c @@ -0,0 +1,237 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "scl.h" +# include "XSB.h" +# include "XSC.h" +# include "XMX.h" +# include "XTB.h" +# include "XMF.h" + +# include "XMF_dialog.h" +# include "XMF_file.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| File Dialog | +| | +\------------------------------------------------------------*/ + + XschDialogItem XschFileOpenDialog = + + { + "Open File", + XSCH_DIALOG_FILE, + (Widget)NULL, + (void *)CallbackFileOpenOk, + (XtPointer)NULL, + (void *)CallbackFileOpenCancel, + (XtPointer)NULL + }; + + XschDialogItem XschFileQuitDialog = + + { + "Do you really want to quit Xsch ?", + XSCH_DIALOG_WARNING, + (Widget)NULL, + (void *)CallbackFileQuitOk, + (XtPointer)NULL, + (void *)CallbackFileQuitCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschBuildFileDialog | +| | +\------------------------------------------------------------*/ + +void XschBuildFileDialog() + +{ + autbegin(); + + XschBuildDialog( XschMainWindow, &XschFileOpenDialog ); + XschBuildDialog( XschMainWindow, &XschFileQuitDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileQuitOk | +| | +\------------------------------------------------------------*/ + +void CallbackFileQuitOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschExitDialog(); + + XtCloseDisplay( XtDisplay( XtParent( MyWidget ) ) ); + XschExitErrorMessage( 0 ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileQuitCancel | +| | +\------------------------------------------------------------*/ + +void CallbackFileQuitCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileOpenOk | +| | +\------------------------------------------------------------*/ + +void CallbackFileOpenOk( MyWidget, ClientData, FileStruct ) + + Widget MyWidget; + caddr_t ClientData; + XmFileSelectionBoxCallbackStruct *FileStruct; +{ + char *FileName; + + autbegin(); + + XtUnmanageChild( XschFileOpenDialog.WIDGET ); + + XschExitDialog(); + + if ( FileStruct->value != NULL ) + { + XmStringGetLtoR( FileStruct->value, + XmSTRING_DEFAULT_CHARSET, + &FileName + ); + + FileName = XschPostTreatString( FileName ); + + if ( FileName != (char *)NULL ) + { + XschFileOpen( FileName, 1 ); + + XschChangeEditMode( XSCH_EDIT_MEASURE, + XschPromptEditMeasure ); + } + else + { + XschErrorMessage( XschMainWindow, "Unable to load this file !" ); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileOpenCancel | +| | +\------------------------------------------------------------*/ + +void CallbackFileOpenCancel( MyWidget, ClientData, FileStruct ) + + Widget MyWidget; + caddr_t ClientData; + XmFileSelectionBoxCallbackStruct *FileStruct; +{ + autbegin(); + + XtUnmanageChild( XschFileOpenDialog.WIDGET ); + + XschExitDialog(); + + autend(); +} diff --git a/alliance/src/xsch/src/XMF_dialog.h b/alliance/src/xsch/src/XMF_dialog.h new file mode 100644 index 00000000..ed689795 --- /dev/null +++ b/alliance/src/xsch/src/XMF_dialog.h @@ -0,0 +1,79 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_FILE_DIALOG +# define XSCH_FILE_DIALOG + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XschDialogItem XschFileOpenDialog; + extern XschDialogItem XschFileQuitDialog; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackFileQuitOk(); + extern void CallbackFileQuitCancel(); + extern void CallbackFileOpenOk(); + extern void CallbackFileOpenCancel(); + +# endif diff --git a/alliance/src/xsch/src/XMF_file.c b/alliance/src/xsch/src/XMF_file.c new file mode 100644 index 00000000..c489b3e7 --- /dev/null +++ b/alliance/src/xsch/src/XMF_file.c @@ -0,0 +1,271 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : File.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "scl.h" +# include "XSB.h" +# include "XSC.h" +# include "XMX.h" +# include "XTB.h" +# include "XMF.h" +# include "XMV.h" +# include "XMT.h" + +# include "XMF_file.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static xschslide_list *XSCH_HEAD_SLIDE = (xschslide_list *)0; + static xschslide_list *XSCH_LAST_SLIDE = (xschslide_list *)0; + static xschslide_list *XSCH_CURRENT_SLIDE = (xschslide_list *)0; + + char XschFileFilter[ 10 ] = "*."; + char XschFileExtention[ 10 ] = "."; + + char XschFileBuffer[ 128 ]; + char XschDirectoryBuffer[ 512 ]; + + char *XSCH_WORK_LIB = (char *)NULL; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschFileOpen | +| | +\------------------------------------------------------------*/ + +void XschFileOpen( FileName, DisplayFigure ) + + char *FileName; + int DisplayFigure; +{ + int Index; + char *SWAP_WORK_LIB = WORK_LIB; + + autbegin(); + + XschSetMouseCursor( XschGraphicWindow, XSCH_WATCH_CURSOR ); + XschUndisplayCursor(); + + XschDelConnect(); + XschDelFigure(); + + XschRecomputeBound = XSCH_TRUE; + + if ( XSCH_WORK_LIB == (char *)NULL ) + { + XSCH_WORK_LIB = WORK_LIB; + } + + if ( XschFileFilter[2] == '\0' ) + { + strcat( XschFileFilter, XSCH_IN_SCHEM ); + strcat( XschFileExtention, XSCH_IN_SCHEM ); + } + + for ( Index = strlen( FileName ); Index >= 0; Index-- ) + { + if ( FileName[ Index ] == '/' ) break; + } + + if ( Index >= 0 ) + { + strcpy( XschDirectoryBuffer, FileName ); + strcpy( XschFileBuffer, FileName + Index + 1); + + XschDirectoryBuffer[ Index + 1 ] = '\0'; + + WORK_LIB = XschDirectoryBuffer; + } + else + { + strcpy( XschFileBuffer, FileName ); + + WORK_LIB = XSCH_WORK_LIB; + } + + Index = strlen( XschFileBuffer ) - strlen( XschFileExtention ); + + if ( Index >= 0 ) + { + if ( ! strcmp( XschFileBuffer + Index, XschFileExtention ) ) + { + XschFileBuffer[ Index ] = '\0'; + } + } + + XschLoadFigure( XschFileBuffer ); + + if ( XschFigure != (xschfig_list *)NULL ) + { + XschChangeTopLevelTitle( XschFileBuffer ); + } + else + { + XschChangeTopLevelTitle( (char *)NULL ); + } + + XschDisplayToolsMessage(); + + XschInitializeZoom(); + + if ( DisplayFigure ) + { + XschDisplayFigure( 0, 0, XschGraphicDx, XschGraphicDy ); + + XschRefreshGraphicWindow( 0, 0, + XschGraphicDx, XschGraphicDy ); + } + + XschSetMouseCursor( XschGraphicWindow, XSCH_NORMAL_CURSOR ); + XschDisplayCursor(); + + WORK_LIB = SWAP_WORK_LIB; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschFileAddSlide | +| | +\------------------------------------------------------------*/ + +void XschFileAddSlide( FileName ) + + char *FileName; +{ + xschslide_list *Slide; + + Slide = (xschslide_list *)autallocheap( sizeof( xschslide_list ) ); + + if ( XSCH_HEAD_SLIDE == (xschslide_list *)0 ) + { + XSCH_HEAD_SLIDE = Slide; + XSCH_LAST_SLIDE = Slide; + } + else + { + XSCH_LAST_SLIDE->NEXT = Slide; + Slide->PREV = XSCH_LAST_SLIDE; + + XSCH_LAST_SLIDE = Slide; + } + + Slide->NAME = mbkstrdup( FileName ); +} + +/*------------------------------------------------------------\ +| | +| XschFileNextSlide | +| | +\------------------------------------------------------------*/ + +void XschFileNextSlide() +{ + if ( XSCH_HEAD_SLIDE == (xschslide_list *)0 ) return; + + if ( ( XSCH_CURRENT_SLIDE == (xschslide_list *)0 ) || + ( XSCH_CURRENT_SLIDE->NEXT == (xschslide_list *)0 ) ) + { + XSCH_CURRENT_SLIDE = XSCH_HEAD_SLIDE; + } + else + { + XSCH_CURRENT_SLIDE = XSCH_CURRENT_SLIDE->NEXT; + } + + XschFileOpen( XSCH_CURRENT_SLIDE->NAME, 1 ); +} + +/*------------------------------------------------------------\ +| | +| XschFilePrevSlide | +| | +\------------------------------------------------------------*/ + +void XschFilePrevSlide() +{ + if ( XSCH_HEAD_SLIDE == (xschslide_list *)0 ) return; + + if ( ( XSCH_CURRENT_SLIDE == (xschslide_list *)0 ) || + ( XSCH_CURRENT_SLIDE->PREV == (xschslide_list *)0 ) ) + { + XSCH_CURRENT_SLIDE = XSCH_LAST_SLIDE; + } + else + { + XSCH_CURRENT_SLIDE = XSCH_CURRENT_SLIDE->PREV; + } + + XschFileOpen( XSCH_CURRENT_SLIDE->NAME, 1 ); +} diff --git a/alliance/src/xsch/src/XMF_file.h b/alliance/src/xsch/src/XMF_file.h new file mode 100644 index 00000000..3c00e11b --- /dev/null +++ b/alliance/src/xsch/src/XMF_file.h @@ -0,0 +1,85 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : File.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_FILE +# define XSCH_FILE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct xschslide_list + { + struct xschslide_list *NEXT; + struct xschslide_list *PREV; + char *NAME; + + } xschslide_list; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char XschFileFilter[ 10 ]; + extern char XschFileExtention[ 10 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschFileOpen(); + +# endif diff --git a/alliance/src/xsch/src/XMF_menu.c b/alliance/src/xsch/src/XMF_menu.c new file mode 100644 index 00000000..88c55cb4 --- /dev/null +++ b/alliance/src/xsch/src/XMF_menu.c @@ -0,0 +1,189 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "scl.h" +# include "XSB.h" +# include "XSC.h" +# include "XMX.h" +# include "XTB.h" +# include "XMF.h" + +# include "XMF_menu.h" +# include "XMF_dialog.h" +# include "XMF_file.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static XschFirstFileOpen = 1; + +/*------------------------------------------------------------\ +| | +| Menu | +| | +\------------------------------------------------------------*/ + + XschMenuItem XschFileMenu[] = + + { + { + "Open", + 'O', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackFileOpen, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XschMenuItem *)NULL + } + , + { + "Quit ", + 'Q', + "CtrlQ", + "Ctrl Q", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackFileQuit, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XschMenuItem *)NULL + } + , + NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackFileOpen | +| | +\------------------------------------------------------------*/ + +void CallbackFileOpen( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + XmString Filter; + + autbegin(); + + if ( XschFirstFileOpen ) + { + XschFirstFileOpen = 0; + + if ( XschFileFilter[2] == '\0' ) + { + strcat( XschFileFilter, XSCH_IN_SCHEM); + strcat( XschFileExtention, XSCH_IN_SCHEM); + } + + Filter = XmStringCreateSimple( XschFileFilter ); + + XtVaSetValues( XschFileOpenDialog.WIDGET, + XmNpattern, Filter, NULL); + + XmStringFree( Filter ); + } + + XschEnterDialog( &XschFileOpenDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileQuit | +| | +\------------------------------------------------------------*/ + +void CallbackFileQuit( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschEnterDialog( &XschFileQuitDialog ); + + autend(); +} diff --git a/alliance/src/xsch/src/XMF_menu.h b/alliance/src/xsch/src/XMF_menu.h new file mode 100644 index 00000000..aa56e5c1 --- /dev/null +++ b/alliance/src/xsch/src/XMF_menu.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_FILE_MENU +# define XSCH_FILE_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackFileOpen(); + extern void CallbackFileQuit(); + +# endif diff --git a/alliance/src/xsch/src/XMF_panel.c b/alliance/src/xsch/src/XMF_panel.c new file mode 100644 index 00000000..1a88b7cd --- /dev/null +++ b/alliance/src/xsch/src/XMF_panel.c @@ -0,0 +1,825 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "scl.h" +# include "XSB.h" +# include "XSC.h" +# include "XMX.h" +# include "XTB.h" +# include "XMF.h" + +# include "XMF_panel.h" +# include "XMF_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XschPanelItem XschLibraryPanel = + + { + "Library", + 1, + 0, + XSCH_LIBRARY_X, + XSCH_LIBRARY_Y, + 250, + 375, + 0, + 0, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (XschPanelButtonItem *)NULL + }; + + int XschLibraryDefaultValues[ 5 ] = + + { + XSCH_LIBRARY_X, + XSCH_LIBRARY_Y, + 250, 375, 0 + }; + + static char **XSCH_CATA_LIB = (char **)NULL; + static char *XSCH_WORK_LIB = (char *)NULL; + static char *XSCH_DEFAULT_LIB = (char *)NULL; + + static char XschFirstLibrary = 1; + +/*------------------------------------------------------------\ +| | +| Buffer | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Widget For Library Panel | +| | +\------------------------------------------------------------*/ + + Widget XschLibraryListLabel; + Widget XschLibraryList; + + Widget XschLibraryButtonOk; + Widget XschLibraryButtonUpdate; + Widget XschLibraryButtonCancel; + + Widget XschLibraryCataLabel; + Widget XschLibraryCata; + + Widget XschLibraryWorkLabel; + Widget XschLibraryWork; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschIsDirectory | +| | +\------------------------------------------------------------*/ + +char XschIsDirectory( FileName ) + + char *FileName; +{ + struct stat Buffer; + + autbegin(); + + if ( stat( FileName, &Buffer ) != -1 ) + { + if ( ( Buffer.st_mode & S_IFMT ) == S_IFDIR ) + { + autend(); + return( 1 ); + } + } + + autend(); + return( 0 ); +} + +/*------------------------------------------------------------\ +| | +| XschSetLibraryList | +| | +\------------------------------------------------------------*/ + +void XschSetLibraryList() +{ + int Index; + XmString Label; + + autbegin(); + + XmListDeleteAllItems( XschLibraryList ); + + for ( Index = 0; + XSCH_CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + Label = XmStringCreateSimple( XSCH_CATA_LIB[ Index ] ); + XmListAddItem( XschLibraryList , Label , NULL ); + XmStringFree( Label ); + } + + Label = XmStringCreateSimple( XSCH_WORK_LIB ); + XmListAddItem( XschLibraryList , Label , NULL ); + XmStringFree( Label ); + + XSCH_DEFAULT_LIB = (char *)NULL; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschSetWorkLibrary | +| | +\------------------------------------------------------------*/ + +void XschSetWorkLibrary() +{ + autbegin(); + + XmTextSetString( XschLibraryWork, XSCH_WORK_LIB ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschSetCataLibrary | +| | +\------------------------------------------------------------*/ + +void XschSetCataLibrary() +{ + int Index; + long Length; + char *Buffer; + char *Scan; + + autbegin(); + + for ( Index = 0, Length = 0; + XSCH_CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + Length = Length + strlen( XSCH_CATA_LIB[ Index ] ) + 1; + } + + Buffer = (char *)autallocblock( Length + 1 ); + Buffer[ 0 ] = '\0'; + Scan = Buffer; + + for ( Index = 0; + XSCH_CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + strcpy( Scan, XSCH_CATA_LIB[ Index ] ); + strcat( Scan, "\n" ); + + Scan = Scan + strlen( Scan ); + } + + XmTextSetString( XschLibraryCata, Buffer ); + + autfreeblock( Buffer ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschInitializeLibrary | +| | +\------------------------------------------------------------*/ + +void XschInitializeLibrary() +{ + int Index; + + autbegin(); + + for ( Index = 0; CATA_LIB[ Index ] != (char *)NULL; Index++ ); + + XSCH_CATA_LIB = (char **)autallocblock( sizeof(char *) * ( Index + 1 )); + + for ( Index = 0; + CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + XSCH_CATA_LIB[ Index ] = autallocblock( strlen( CATA_LIB[ Index ] ) + 1 ); + strcpy( XSCH_CATA_LIB[ Index ], CATA_LIB[ Index ] ); + } + + XSCH_CATA_LIB[ Index ] = (char *)NULL; + + XSCH_WORK_LIB = autallocblock( strlen( WORK_LIB ) + 1 ); + strcpy( XSCH_WORK_LIB, WORK_LIB ); + + XschSetCataLibrary(); + XschSetWorkLibrary(); + XschSetLibraryList(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschGetCataLibrary | +| | +\------------------------------------------------------------*/ + + void XschGetCataLibrary() + { + char *NewCata; + char *Scan; + int Index; + int Count; + int Length; + + autbegin(); + + for ( Index = 0; + XSCH_CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + autfreeblock( XSCH_CATA_LIB[ Index ] ); + } + + autfreeblock( XSCH_CATA_LIB ); + + NewCata = XmTextGetString( XschLibraryCata ); + + Count = 1; + + for ( Index = 0; NewCata[ Index ] != '\0'; Index++ ) + { + if ( NewCata[ Index ] == '\n' ) + { + Count = Count + 1; + } + } + + XSCH_CATA_LIB = (char **)autallocblock( sizeof(char *) * ( Count + 1 )); + + Count = 0; + Scan = NewCata; + + for ( Index = 0; NewCata[ Index ] != '\0'; Index++ ) + { + if ( NewCata[ Index ] == '\n' ) + { + NewCata[ Index ] = '\0'; + + Length = strlen( Scan ); + + if ( ( Length > 0 ) && + ( XschIsDirectory( Scan ) ) ) + { + XSCH_CATA_LIB[ Count ] = autallocblock( Length + 1 ); + strcpy( XSCH_CATA_LIB[ Count ], Scan ); + Count = Count + 1; + } + + Scan = NewCata + Index + 1; + } + else + if ( NewCata[ Index ] == ' ' ) + { + NewCata[ Index ] = '\0'; + } + } + + Length = strlen( Scan ); + + if ( Length > 0 ) + { + XSCH_CATA_LIB[ Count ] = autallocblock( Length + 1 ); + strcpy( XSCH_CATA_LIB[ Count ], Scan ); + Count = Count + 1; + } + + XSCH_CATA_LIB[ Count ] = (char *)NULL; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschGetWorkLibrary | +| | +\------------------------------------------------------------*/ + +void XschGetWorkLibrary() +{ + char *NewWork; + + autbegin(); + + autfreeblock( XSCH_WORK_LIB ); + + NewWork = XmTextGetString( XschLibraryWork ); + + if ( XschIsDirectory( NewWork ) ) + { + XSCH_WORK_LIB = autallocblock( strlen( NewWork ) + 1 ); + strcpy( XSCH_WORK_LIB, NewWork ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLibraryList | +| | +\------------------------------------------------------------*/ + +void CallbackLibraryList( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmListCallbackStruct *CallData; +{ + autbegin(); + + XSCH_DEFAULT_LIB = XSCH_CATA_LIB[ CallData->item_position - 1 ]; + + if ( XSCH_DEFAULT_LIB == (char *)NULL ) + { + XSCH_DEFAULT_LIB = XSCH_WORK_LIB; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLibraryOk | +| | +\------------------------------------------------------------*/ + +void CallbackLibraryOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + XmString Label; + int Index; + + autbegin(); + + XschExitPanel( &XschLibraryPanel ); + + XschExitDialog(); + + if ( XschFirstLibrary == 0 ) + { + for ( Index = 0; + CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + autfreeblock( CATA_LIB[ Index ] ); + } + + autfreeblock( CATA_LIB ); + autfreeblock( WORK_LIB ); + } + + XschFirstLibrary = 0; + + CATA_LIB = XSCH_CATA_LIB; + WORK_LIB = XSCH_WORK_LIB; + + if ( XSCH_DEFAULT_LIB != (char *)NULL ) + { + Label = XmStringCreateSimple( XSCH_DEFAULT_LIB ); + + XtVaSetValues( XschFileOpenDialog.WIDGET, + XmNdirectory, Label, NULL ); + + XmStringFree( Label ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLibraryUpdate | +| | +\------------------------------------------------------------*/ + +void CallbackLibraryUpdate( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschGetCataLibrary(); + XschGetWorkLibrary(); + XschSetLibraryList(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLibraryCancel | +| | +\------------------------------------------------------------*/ + +void CallbackLibraryCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + int Index; + + autbegin(); + + for ( Index = 0; + XSCH_CATA_LIB[ Index ] != (char *)NULL; + Index++ ) + { + autfreeblock( XSCH_CATA_LIB[ Index ] ); + } + + autfreeblock( XSCH_CATA_LIB ); + autfreeblock( XSCH_WORK_LIB ); + + XschExitPanel( &XschLibraryPanel ); + + XschExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEnterLibrary | +| | +\------------------------------------------------------------*/ + +void CallbackEnterLibrary( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschInitializeLibrary(); + + XschEnterPanel( &XschLibraryPanel ); + XschLimitedLoop( XschLibraryPanel.PANEL ); + XschReEnterDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschBuildPanelLibrary | +| | +\------------------------------------------------------------*/ + +void XschBuildPanelLibrary() +{ + Arg Args[15]; + XmString Label; + + autbegin(); + + XtSetArg( Args[0], XmNshadowType , XmSHADOW_ETCHED_IN ); + XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING ); + XtSetArg( Args[2], XmNtitle , XschLibraryPanel.TITLE ); + + XschLibraryPanel.PANEL = + + XmCreateFormDialog( XschMainWindow, "XschLibraryPanel", Args, 3); + + XtAddCallback( XschLibraryPanel.PANEL, XmNdestroyCallback, + XschDestroyDialogCallback, NULL ); + + XschLibraryPanel.PANEL_FORM = + + XtVaCreateManagedWidget( "XschLibraryPanelForm", + xmFormWidgetClass, + XschLibraryPanel.PANEL, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , 10, + NULL + ); + + XschLibraryPanel.FRAME = + + XtVaCreateManagedWidget( "XschLibraryFrame", + xmFrameWidgetClass, + XschLibraryPanel.PANEL_FORM, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + NULL + ); + + XschLibraryPanel.FORM = + + XtVaCreateManagedWidget( "XschLibraryForm", + xmFormWidgetClass, + XschLibraryPanel.FRAME, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , 120, + NULL + ); + + XschLibraryButtonUpdate = + + XtVaCreateManagedWidget( "Update", + xmPushButtonWidgetClass, + XschLibraryPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 10, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 40, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 105, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 115, + NULL + ); + + XschLibraryButtonOk = + + XtVaCreateManagedWidget( "Ok", + xmPushButtonWidgetClass, + XschLibraryPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 50, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 70, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 105, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 115, + NULL + ); + + XschLibraryButtonCancel = + + XtVaCreateManagedWidget( "Cancel", + xmPushButtonWidgetClass, + XschLibraryPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 80, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 110, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 105, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 115, + NULL + ); + + Label = XmStringCreateSimple( "Directories" ); + + XschLibraryListLabel = + + XtVaCreateManagedWidget( "XschLibraryListLabel", + xmLabelGadgetClass , + XschLibraryPanel.FORM, + XmNlabelString , Label, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 5, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 5, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 10, + NULL ); + + XmStringFree( Label ); + + XtSetArg( Args[0] , XmNtopAttachment , XmATTACH_POSITION ); + XtSetArg( Args[1] , XmNtopPosition , 10 ); + XtSetArg( Args[2] , XmNbottomAttachment , XmATTACH_POSITION ); + XtSetArg( Args[3] , XmNbottomPosition , 40 ); + XtSetArg( Args[4] , XmNrightAttachment , XmATTACH_POSITION ); + XtSetArg( Args[5] , XmNrightPosition , 115 ); + XtSetArg( Args[6] , XmNleftAttachment , XmATTACH_POSITION ); + XtSetArg( Args[7] , XmNleftPosition , 5 ); + XtSetArg( Args[8] , XmNscrollBarDisplayPolicy, XmSTATIC ); + XtSetArg( Args[9] , XmNscrollHorizontal , True ); + XtSetArg( Args[10] , XmNscrollVertical , True ); + XtSetArg( Args[11] , XmNlistSizePolicy , XmCONSTANT ); + + XschLibraryList = + + XmCreateScrolledList( XschLibraryPanel.FORM, + "XschLibraryList", Args, 12 ); + + Label = XmStringCreateSimple( "Catalog libraries" ); + + XschLibraryCataLabel = + + XtVaCreateManagedWidget( "XschLibraryCataLabel", + xmLabelGadgetClass , + XschLibraryPanel.FORM, + XmNlabelString , Label, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 5, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 45, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 50, + NULL ); + + XmStringFree( Label ); + + XtSetArg( Args[0] , XmNrows , 4 ); + XtSetArg( Args[1] , XmNeditable , True ); + XtSetArg( Args[2] , XmNcursorPositionVisible , True ); + XtSetArg( Args[3] , XmNscrollHorizontal , True ); + XtSetArg( Args[4] , XmNscrollVertical , True ); + XtSetArg( Args[5] , XmNeditMode , XmMULTI_LINE_EDIT ); + XtSetArg( Args[6] , XmNtopAttachment , XmATTACH_POSITION ); + XtSetArg( Args[7] , XmNtopPosition , 50 ); + XtSetArg( Args[8] , XmNleftAttachment , XmATTACH_POSITION ); + XtSetArg( Args[9] , XmNleftPosition , 5 ); + XtSetArg( Args[10] , XmNrightAttachment , XmATTACH_POSITION ); + XtSetArg( Args[11] , XmNrightPosition , 115 ); + XtSetArg( Args[12] , XmNbottomAttachment , XmATTACH_POSITION ); + XtSetArg( Args[13] , XmNbottomPosition , 80 ); + + XschLibraryCata = + + XmCreateScrolledText( XschLibraryPanel.FORM, + "XschLibraryCata", Args, 14 ); + + Label = XmStringCreateSimple( "Work library" ); + + XschLibraryWorkLabel = + + XtVaCreateManagedWidget( "XschLibraryWorkLabel", + xmLabelGadgetClass , + XschLibraryPanel.FORM, + XmNlabelString , Label, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 5, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 85, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 90, + NULL ); + XmStringFree( Label ); + + XtSetArg( Args[0] , XmNrows , 1 ); + XtSetArg( Args[1] , XmNeditable , True ); + XtSetArg( Args[2] , XmNeditMode , XmSINGLE_LINE_EDIT ); + XtSetArg( Args[3] , XmNscrollHorizontal , False ); + XtSetArg( Args[4] , XmNscrollVertical , False ); + XtSetArg( Args[5] , XmNcursorPositionVisible , True ); + XtSetArg( Args[6] , XmNtopAttachment , XmATTACH_POSITION ); + XtSetArg( Args[7] , XmNtopPosition , 90 ); + XtSetArg( Args[8] , XmNleftAttachment , XmATTACH_POSITION ); + XtSetArg( Args[9] , XmNleftPosition , 5 ); + XtSetArg( Args[10] , XmNrightAttachment , XmATTACH_POSITION ); + XtSetArg( Args[11] , XmNrightPosition , 115 ); + XtSetArg( Args[12] , XmNbottomAttachment , XmATTACH_POSITION ); + XtSetArg( Args[13] , XmNbottomPosition , 100 ); + + XschLibraryWork = + + XmCreateText( XschLibraryPanel.FORM, + "XschLibraryWork", Args, 14 ); + + XtManageChild( XschLibraryWork ); + XtManageChild( XschLibraryList ); + XtManageChild( XschLibraryCata ); + + XtAddCallback( XschLibraryList, + XmNdefaultActionCallback, + CallbackLibraryList, NULL ); + + XtAddCallback( XschLibraryButtonOk, + XmNactivateCallback, + CallbackLibraryOk, NULL ); + + XtAddCallback( XschLibraryButtonCancel, + XmNactivateCallback, + CallbackLibraryCancel, NULL ); + + XtAddCallback( XschLibraryButtonUpdate, + XmNactivateCallback, + CallbackLibraryUpdate, NULL ); + + XtVaSetValues( XschLibraryPanel.PANEL, + XmNheight, XschLibraryPanel.HEIGHT, + XmNwidth , XschLibraryPanel.WIDTH, + XmNx , XschLibraryPanel.X, + XmNy , XschLibraryPanel.Y, + NULL ); + + Label = XmStringCreateSimple( "Library" ); + + XtVaSetValues( XmFileSelectionBoxGetChild( XschFileOpenDialog.WIDGET, + XmDIALOG_HELP_BUTTON ), + XmNlabelString, Label, NULL ); + + XmStringFree( Label ); + + XtAddCallback( XmFileSelectionBoxGetChild( XschFileOpenDialog.WIDGET, + XmDIALOG_HELP_BUTTON ), + XmNactivateCallback, + CallbackEnterLibrary, NULL ); + + autend(); +} diff --git a/alliance/src/xsch/src/XMF_panel.h b/alliance/src/xsch/src/XMF_panel.h new file mode 100644 index 00000000..e693be29 --- /dev/null +++ b/alliance/src/xsch/src/XMF_panel.h @@ -0,0 +1,79 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_FILE_PANEL +# define XSCH_FILE_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XSCH_LIBRARY_X 100 +# define XSCH_LIBRARY_Y 230 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackLibraryList(); + extern void CallbackLibraryOk(); + extern void CallbackLibraryUpdate(); + extern void CallbackLibraryCancel(); + extern void CallbackEnterLibrary(); + +# endif diff --git a/alliance/src/xsch/src/XMH.h b/alliance/src/xsch/src/XMH.h new file mode 100644 index 00000000..18180779 --- /dev/null +++ b/alliance/src/xsch/src/XMH.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : XMH101.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_XMH +# define XSCH_XMH + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XschMenuItem XschHelpMenu[]; + extern XschPanelItem XschHelpPresentPanel; + + extern int XschHelpPresentDefaultValues[5]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschBuildPresentPanel(); + extern void XschEnterPresentPanel(); + +# endif diff --git a/alliance/src/xsch/src/XMH_help.c b/alliance/src/xsch/src/XMH_help.c new file mode 100644 index 00000000..305e0292 --- /dev/null +++ b/alliance/src/xsch/src/XMH_help.c @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Help.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XTB.h" +# include "XMH.h" +# include "XMX.h" + +# include "XMH_help.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ diff --git a/alliance/src/xsch/src/XMH_help.h b/alliance/src/xsch/src/XMH_help.h new file mode 100644 index 00000000..8f11c6ba --- /dev/null +++ b/alliance/src/xsch/src/XMH_help.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Help.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_HELP +# define XSCH_HELP + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xsch/src/XMH_menu.c b/alliance/src/xsch/src/XMH_menu.c new file mode 100644 index 00000000..0463e756 --- /dev/null +++ b/alliance/src/xsch/src/XMH_menu.c @@ -0,0 +1,125 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XTB.h" +# include "XSB.h" +# include "XMH.h" +# include "XMX.h" + +# include "XMH_menu.h" +# include "XMH_panel.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Help Menu | +| | +\------------------------------------------------------------*/ + + XschMenuItem XschHelpMenu[] = + + { + { + "About Xsch", + 'G', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackHelpAbout, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XschMenuItem *)NULL + } + , + NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackHelpAbout | +| | +\------------------------------------------------------------*/ + +void CallbackHelpAbout( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschEnterPresentPanel(); + + autend(); +} diff --git a/alliance/src/xsch/src/XMH_menu.h b/alliance/src/xsch/src/XMH_menu.h new file mode 100644 index 00000000..9689a6e7 --- /dev/null +++ b/alliance/src/xsch/src/XMH_menu.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_HELP_MENU +# define XSCH_HELP_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackHelpAbout(); + +# endif diff --git a/alliance/src/xsch/src/XMH_panel.c b/alliance/src/xsch/src/XMH_panel.c new file mode 100644 index 00000000..dec1095e --- /dev/null +++ b/alliance/src/xsch/src/XMH_panel.c @@ -0,0 +1,321 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XMH.h" + +# include "XMH_panel.h" +# include "LIP6bw.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XschPanelItem XschHelpPresentPanel = + + { + "Xsch present", + 1, + 0, + XSCH_HELP_PRESENT_X, + XSCH_HELP_PRESENT_Y, + 700, + 360, + 0, + 0, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (XschPanelButtonItem *)NULL + }; + + int XschHelpPresentDefaultValues[ 5 ] = + + { + XSCH_HELP_PRESENT_X, + XSCH_HELP_PRESENT_Y, + 700, 360, 0 + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschBuildPresentPanel | +| | +\------------------------------------------------------------*/ + +void XschBuildPresentPanel() + +{ + Widget PanelLabel; + Widget PanelButton; + Pixmap PanelPixmap; + XmString PanelString; + XmString PanelString1; + XmString PanelString2; + XmFontList PanelFontList; + XFontStruct *PanelFont; + Display *PanelDisplay; + char Buffer[ 64 ]; + Arg Args[3]; + + autbegin(); + + PanelDisplay = XtDisplay( XschMainWindow ); + PanelFont = XLoadQueryFont( PanelDisplay, "-*-helvetica-bold-o-*--24-*" ); + PanelFontList = XmFontListCreate( PanelFont, "Panel_charset1" ); + PanelFont = XLoadQueryFont( PanelDisplay, "-*-helvetica-bold-r-*--18-*" ); + PanelFontList = XmFontListAdd( PanelFontList, PanelFont, "Panel_charset2" ); + PanelFont = XLoadQueryFont( PanelDisplay, "-*-helvetica-bold-r-*--12-*" ); + PanelFontList = XmFontListAdd( PanelFontList, PanelFont, "Panel_charset4" ); + + XtSetArg( Args[0], XmNshadowType , XmSHADOW_ETCHED_IN ); + XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING ); + XtSetArg( Args[2], XmNtitle , "Xsch present" ); + + XschHelpPresentPanel.PANEL = + + XmCreateFormDialog( XschMainWindow, XschHelpPresentPanel.TITLE, Args, 3); + + XtAddCallback( XschHelpPresentPanel.PANEL, XmNdestroyCallback, + XschDestroyDialogCallback, NULL ); + + XschHelpPresentPanel.PANEL_FORM = + + XtVaCreateManagedWidget( "", + xmFormWidgetClass, + XschHelpPresentPanel.PANEL, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + NULL + ); + + XschHelpPresentPanel.FRAME = + + XtVaCreateManagedWidget( "", + xmFrameWidgetClass, + XschHelpPresentPanel.PANEL_FORM, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 05, + XmNbottomAttachment, XmATTACH_POSITION, + XmNbottomPosition , 95, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 05, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 95, + NULL + ); + + XschHelpPresentPanel.FORM = + + XtVaCreateManagedWidget( "", + xmFormWidgetClass, + XschHelpPresentPanel.FRAME, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 05, + XmNbottomAttachment, XmATTACH_POSITION, + XmNbottomPosition , 95, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 05, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 95, + NULL + ); + + PanelPixmap = XschCreatePixmap( XschMainWindow, + LIP6bw_bits, + LIP6bw_width, + LIP6bw_height); + + PanelLabel = XtVaCreateManagedWidget( "", + xmLabelGadgetClass, + XschHelpPresentPanel.FORM, + XmNlabelType , XmPIXMAP, + XmNlabelPixmap , PanelPixmap, + NULL + ); + + sprintf( Buffer, "ALLIANCE CAD SYSTEM %s\n", ALLIANCE_VERSION ); + + PanelString = XmStringCreateLtoR( Buffer, "Panel_charset2" ); + + PanelLabel = XtVaCreateManagedWidget( "", + xmLabelWidgetClass, + XschHelpPresentPanel.FORM, + XmNfontList , PanelFontList, + XmNlabelString , PanelString, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 15, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 75, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 25, + NULL + ); + XmStringFree( PanelString ); + + PanelString1 = XmStringCreateLtoR( "Xsch" , "Panel_charset1" ); + PanelString2 = XmStringCreateLtoR( "\n( Touch Me )", "Panel_charset4" ); + PanelString = XmStringConcat( PanelString1, PanelString2 ); + + PanelButton = XtVaCreateManagedWidget( "", + xmPushButtonWidgetClass, + XschHelpPresentPanel.FORM, + XmNfontList , PanelFontList, + XmNlabelString , PanelString, + XmNshadowThickness , 3, + XmNtopAttachment , XmATTACH_WIDGET, + XmNtopWidget , PanelLabel, + XmNtopOffset , 5, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 60, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 40, + NULL + ); + XmStringFree( PanelString ); + XmStringFree( PanelString1 ); + XmStringFree( PanelString2 ); + + XtAddCallback( PanelButton, + XmNactivateCallback, + XschExitDialogCallback, NULL ); + + sprintf( Buffer, "\nGraphic Schematic Viewer\nVersion %s", XSCH_VERSION ); + + PanelString = XmStringCreateLtoR( Buffer, "Panel_charset2" ); + + PanelLabel = XtVaCreateManagedWidget( "", + xmLabelWidgetClass, + XschHelpPresentPanel.FORM, + XmNfontList , PanelFontList, + XmNlabelString , PanelString, + XmNtopAttachment , XmATTACH_WIDGET, + XmNtopWidget , PanelButton, + XmNtopOffset , 5, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 75, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 25, + NULL + ); + XmStringFree( PanelString ); + + PanelString = XmStringCreateLtoR( "copyright \251 1996-2000 ASIM, \ +CAO-VLSI Team\nWritten by Ludovic Jacomme\nE-mail support: alliance-support@asim.lip6.fr", "Panel_charset4" ); + + PanelLabel = XtVaCreateManagedWidget( "", + xmLabelWidgetClass, + XschHelpPresentPanel.FORM, + XmNfontList , PanelFontList, + XmNlabelString , PanelString, + XmNtopAttachment , XmATTACH_WIDGET, + XmNtopWidget , PanelLabel, + XmNtopOffset , 5, + XmNrightAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + NULL + ); + XmStringFree( PanelString ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschEnterPresentPanel | +| | +\------------------------------------------------------------*/ + +void XschEnterPresentPanel() + +{ + autbegin(); + + XschEnterPanel( &XschHelpPresentPanel ); + + XschLimitedLoop( XschHelpPresentPanel.PANEL ); + + XschExitPanel( &XschHelpPresentPanel ); + + autend(); +} diff --git a/alliance/src/xsch/src/XMH_panel.h b/alliance/src/xsch/src/XMH_panel.h new file mode 100644 index 00000000..7ab1e9c3 --- /dev/null +++ b/alliance/src/xsch/src/XMH_panel.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_HELP_PANEL +# define XSCH_HELP_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XSCH_PRESENT_PIXMAP_WIDTH 164 +# define XSCH_PRESENT_PIXMAP_HEIGHT 150 + +# define XSCH_HELP_PRESENT_X 180 +# define XSCH_HELP_PRESENT_Y 200 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xsch/src/XMS.h b/alliance/src/xsch/src/XMS.h new file mode 100644 index 00000000..579450ae --- /dev/null +++ b/alliance/src/xsch/src/XMS.h @@ -0,0 +1,79 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : XMS.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_XMS +# define XSCH_XMS + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XschMenuItem XschSetupMenu[]; + extern XschPanelItem XschSetupInformationsPanel; + + extern int XschSetupInformationsDefaultValues[ 5 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackSetupLoadConfig(); + extern void CallbackSetupSaveConfig(); + extern void CallbackSetupDefaultConfig(); + extern void CallbackSetupInformations(); + + extern void XschLoadConfig(); + extern void XschLoadTopLevelConfig(); + +# endif diff --git a/alliance/src/xsch/src/XMS_dialog.c b/alliance/src/xsch/src/XMS_dialog.c new file mode 100644 index 00000000..a4c1a026 --- /dev/null +++ b/alliance/src/xsch/src/XMS_dialog.c @@ -0,0 +1,83 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "scl.h" +# include "XSB.h" +# include "XSC.h" +# include "XMX.h" +# include "XTB.h" +# include "XMS.h" + +# include "XMS_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ diff --git a/alliance/src/xsch/src/XMS_dialog.h b/alliance/src/xsch/src/XMS_dialog.h new file mode 100644 index 00000000..2d0bb9cf --- /dev/null +++ b/alliance/src/xsch/src/XMS_dialog.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_SETUP_DIALOG +# define XSCH_SETUP_DIALOG + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xsch/src/XMS_menu.c b/alliance/src/xsch/src/XMS_menu.c new file mode 100644 index 00000000..672eeafd --- /dev/null +++ b/alliance/src/xsch/src/XMS_menu.c @@ -0,0 +1,232 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XSB.h" +# include "XTB.h" +# include "XMS.h" + +# include "XMS_menu.h" +# include "XMS_panel.h" +# include "XMS_setup.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XschMenuItem XschSetupMenu[] = + + { + { + "Default Config", + 'D', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackSetupDefaultConfig, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XschMenuItem *)NULL + } + , + { + "Load Config", + 'L', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackSetupLoadConfig, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XschMenuItem *)NULL + } + , + { + "Save Config", + 'S', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackSetupSaveConfig, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XschMenuItem *)NULL + } + , + { + "Informations", + 'I', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackSetupInformations, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XschMenuItem *)NULL + } + , + NULL + }; + + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackSetupLoadConfig | +| | +\------------------------------------------------------------*/ + +void CallbackSetupLoadConfig( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschLoadConfig( XSCH_TRUE ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSetupSaveConfig | +| | +\------------------------------------------------------------*/ + +void CallbackSetupSaveConfig( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschSaveConfig(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSetupDefaultConfig | +| | +\------------------------------------------------------------*/ + +void CallbackSetupDefaultConfig( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschDefaultConfig(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSetupInformations | +| | +\------------------------------------------------------------*/ + +void CallbackSetupInformations( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschDisplayInformations(); + + autend(); +} + diff --git a/alliance/src/xsch/src/XMS_menu.h b/alliance/src/xsch/src/XMS_menu.h new file mode 100644 index 00000000..654657f4 --- /dev/null +++ b/alliance/src/xsch/src/XMS_menu.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_SETUP_MENU +# define XSCH_SETUP_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xsch/src/XMS_panel.c b/alliance/src/xsch/src/XMS_panel.c new file mode 100644 index 00000000..434d9b5d --- /dev/null +++ b/alliance/src/xsch/src/XMS_panel.c @@ -0,0 +1,184 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "scl.h" +# include "XSB.h" +# include "XTB.h" +# include "XSC.h" +# include "XMS.h" + +# include "XMS_panel.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Panel | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Panel Informations | +| | +\------------------------------------------------------------*/ + + static char *XschPanelInformationsButtonName[] = + + { + "Text", + "Close" + }; + + XschPanelButtonItem XschSetupInformationsButton[] = + + { + { + &XschPanelInformationsButtonName[0], + "Nothing", NULL, 0, 0, + NULL, + NULL, + 0, 0, + 8, 9, + NULL, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelInformationsButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 3, 9, + 2, 1, + XschExitDialogCallback, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XschPanelItem XschSetupInformationsPanel = + + { + "Informations", + 1, + 0, + XSCH_SETUP_INFORMATIONS_X, + XSCH_SETUP_INFORMATIONS_Y, + 360, + 250, + 8, + 10, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XschSetupInformationsButton + }; + + int XschSetupInformationsDefaultValues[ 5 ] = + + { + XSCH_SETUP_INFORMATIONS_X, + XSCH_SETUP_INFORMATIONS_Y, + 360, 250, 0 + }; + +/*------------------------------------------------------------\ +| | +| Callback For Informations | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschDisplayInformations | +| | +\------------------------------------------------------------*/ + +void XschDisplayInformations() + +{ + char *Message; + + autbegin(); + + Message = XschGetInformations(); + + XmTextSetString( XschSetupInformationsButton[0].BUTTON, Message ); + + XschEnterPanel( &XschSetupInformationsPanel ); + + XschLimitedLoop( XschSetupInformationsPanel.PANEL ); + + XschExitPanel( &XschSetupInformationsPanel ); + + autend(); +} diff --git a/alliance/src/xsch/src/XMS_panel.h b/alliance/src/xsch/src/XMS_panel.h new file mode 100644 index 00000000..6abe3444 --- /dev/null +++ b/alliance/src/xsch/src/XMS_panel.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_SETUP_PANEL +# define XSCH_SETUP_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XSCH_SETUP_INFORMATIONS_X 330 +# define XSCH_SETUP_INFORMATIONS_Y 280 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschDisplayInformations(); + +# endif diff --git a/alliance/src/xsch/src/XMS_setup.c b/alliance/src/xsch/src/XMS_setup.c new file mode 100644 index 00000000..5f93c756 --- /dev/null +++ b/alliance/src/xsch/src/XMS_setup.c @@ -0,0 +1,524 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Setup.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XMF.h" +# include "XME.h" +# include "XMV.h" +# include "XMT.h" +# include "XMS.h" +# include "XMH.h" + +# include "XMS_setup.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static FILE *FileConfig; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Set Panel New Values | +| | +\------------------------------------------------------------*/ + +void XschSetPanelValues( Panel, Values ) + + XschPanelItem *Panel; + int *Values; +{ + autbegin(); + + Panel->COMPUTE = 1; + Panel->X = Values[0]; + Panel->Y = Values[1]; + Panel->WIDTH = Values[2]; + Panel->HEIGHT = Values[3]; + Panel->MANAGED = Values[4]; + + XtVaSetValues( Panel->PANEL, + XmNx , Values[0], + XmNy , Values[1], + XmNwidth , Values[2], + XmNheight , Values[3], + NULL ); + + if ( Panel->MANAGED ) + { + XschEnterPanel( Panel ); + } + else + { + XtUnmanageChild( Panel->PANEL ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Write TopLevel Values | +| | +\------------------------------------------------------------*/ + +void XschWriteTopLevelValues() + +{ + Dimension Values[5]; + + autbegin(); + + XtVaGetValues( XschTopLevel, + XmNx , &Values[0], + XmNy , &Values[1], + XmNwidth , &Values[2], + XmNheight , &Values[3], + NULL ); + + Values[0] = Values[0] - XSCH_TOPLEVEL_TRANSLATE_X; + Values[1] = Values[1] - XSCH_TOPLEVEL_TRANSLATE_Y; + Values[4] = 1; + + fprintf( FileConfig, "VERSION: %s\n", XSCH_VERSION ); + fprintf( FileConfig, "X: %d, Y: %d, WIDTH: %d, HEIGHT: %d, MANAGED: %d\n", + Values[0], Values[1], Values[2], Values[3], Values[4] ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Write Panel Values | +| | +\------------------------------------------------------------*/ + +void XschWritePanelValues( Panel ) + + XschPanelItem *Panel; +{ + Dimension Values[5]; + + autbegin(); + + if ( Panel->COMPUTE == 0 ) + { + XtVaGetValues( Panel->PANEL, + XmNx , &Values[0], + XmNy , &Values[1], + XmNwidth , &Values[2], + XmNheight , &Values[3], + NULL ); + + Values[0] = Values[0] - XSCH_PANEL_TRANSLATE_X; + Values[1] = Values[1] - XSCH_PANEL_TRANSLATE_Y; + } + else + { + Values[0] = Panel->X; + Values[1] = Panel->Y; + Values[2] = Panel->WIDTH; + Values[3] = Panel->HEIGHT; + } + + Values[4] = Panel->MANAGED; + + fprintf( FileConfig, "X: %d, Y: %d, WIDTH: %d, HEIGHT: %d, MANAGED: %d\n", + Values[0], Values[1], Values[2], Values[3], Values[4] ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Read Panel Values | +| | +\------------------------------------------------------------*/ + +void XschReadPanelValues( Panel ) + + XschPanelItem *Panel; +{ + int Values[5]; + + autbegin(); + + fscanf( FileConfig, "X: %d, Y: %d, WIDTH: %d, HEIGHT: %d, MANAGED: %d\n", + &Values[0], &Values[1], &Values[2], &Values[3], &Values[4] ); + + XschSetPanelValues( Panel, Values ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Read Panel Values | +| | +\------------------------------------------------------------*/ + +char XschReadTopLevelValues() + +{ + int Values[5]; + char Version[64]; + + autbegin(); + + fscanf( FileConfig, "VERSION: %s\n", Version ); + + if ( strcmp( Version, XSCH_VERSION ) ) + { + autend(); + return( 0 ); + } + + fscanf( FileConfig, "X: %d, Y: %d, WIDTH: %d, HEIGHT: %d, MANAGED: %d\n", + &Values[0], &Values[1], &Values[2], &Values[3], &Values[4] ); + + XtVaSetValues( XschTopLevel, + XmNx , Values[0], + XmNy , Values[1], + XmNwidth , Values[2], + XmNheight , Values[3], + NULL ); + autend(); + return( 1 ); +} + +/*------------------------------------------------------------\ +| | +| ReadActiveLayers | +| | +\------------------------------------------------------------*/ + +void XschReadActiveLayers() + +{ + short Layer; + int Value; + + autbegin(); + + for ( Layer = 0; Layer < XSCH_MAX_LAYER; Layer++ ) + { + fscanf( FileConfig, "ACTIVE: %d\n", &Value ); + + XSCH_ACTIVE_LAYER_TABLE[ Layer ] = Value; + } + + for ( Layer = 0; Layer < XSCH_MAX_ACTIVE_NAME; Layer++ ) + { + fscanf( FileConfig, "ACTIVE: %d\n", &Value ); + + XSCH_ACTIVE_NAME_TABLE[ Layer ] = Value; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| WriteActiveLayers | +| | +\------------------------------------------------------------*/ + +void XschWriteActiveLayers() + +{ + int Layer; + + autbegin(); + + for ( Layer = 0; Layer < XSCH_MAX_LAYER; Layer++ ) + { + fprintf( FileConfig, "ACTIVE: %d\n", + XSCH_ACTIVE_LAYER_TABLE[ Layer ] ); + } + + for ( Layer = 0; Layer < XSCH_MAX_ACTIVE_NAME; Layer++ ) + { + fprintf( FileConfig, "ACTIVE: %d\n", + XSCH_ACTIVE_NAME_TABLE[ Layer ] ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschDefaultTopLevelValues | +| | +\------------------------------------------------------------*/ + +void XschDefaultTopLevelValues() + +{ + autbegin(); + + XtVaSetValues( XschTopLevel, + XmNheight , XSCH_TOPLEVEL_HEIGHT, + XmNwidth , XSCH_TOPLEVEL_WIDTH, + XmNx , XSCH_TOPLEVEL_X, + XmNy , XSCH_TOPLEVEL_Y, + NULL + ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschDefaultConfig | +| | +\------------------------------------------------------------*/ + +void XschDefaultConfig() + +{ + short Layer; + + autbegin(); + + XschDefaultTopLevelValues(); + + XschSetPanelValues( &XschViewArrowsPanel, + XschViewArrowsDefaultValues ); + XschSetPanelValues( &XschViewZoomPanel, + XschViewZoomDefaultValues ); + XschSetPanelValues( &XschViewGridPanel, + XschViewGridDefaultValues ); + XschSetPanelValues( &XschViewLayerPanel, + XschViewLayerDefaultValues ); + XschSetPanelValues( &XschViewMapPanel, + XschViewMapDefaultValues ); + XschSetPanelValues( &XschEditSearchViewPanel, + XschEditSearchViewDefaultValues ); + XschSetPanelValues( &XschEditSelectPanel, + XschEditSelectDefaultValues ); + XschSetPanelValues( &XschEditIdentifyPanel, + XschEditIdentifyDefaultValues ); + XschSetPanelValues( &XschToolsMessagePanel, + XschToolsMessageDefaultValues ); + XschSetPanelValues( &XschToolsHierarchyPanel, + XschToolsHierarchyDefaultValues ); + XschSetPanelValues( &XschSetupInformationsPanel, + XschSetupInformationsDefaultValues ); + XschSetPanelValues( &XschHelpPresentPanel, + XschHelpPresentDefaultValues ); + + for ( Layer = 0; Layer < XSCH_MAX_LAYER; Layer++ ) + { + XSCH_ACTIVE_LAYER_TABLE[ Layer ] = 1; + } + + XSCH_ACTIVE_LAYER_TABLE[ XSCH_CONSTRUCTION_LAYER ] = 0; + + for ( Layer = 0; Layer < XSCH_MAX_ACTIVE_NAME; Layer++ ) + { + XSCH_ACTIVE_NAME_TABLE[ Layer ] = 1; + } + + XschInitializeLayer(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschLoadTopLevelConfig | +| | +\------------------------------------------------------------*/ + +void XschLoadTopLevelConfig() + +{ + autbegin(); + + FileConfig = fopen( XSCH_XMS_FILE_NAME, "r" ); + + if ( FileConfig == (FILE *)NULL ) + { + XschDefaultTopLevelValues(); + } + else + { + if ( ! XschReadTopLevelValues() ) + { + XschDefaultTopLevelValues(); + } + + fclose( FileConfig ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschLoadConfig | +| | +\------------------------------------------------------------*/ + +void XschLoadConfig( Message ) + + char Message; +{ + autbegin(); + + FileConfig = fopen( XSCH_XMS_FILE_NAME, "r" ); + + if ( FileConfig == (FILE *)NULL ) + { + if ( Message ) + { + XschErrorMessage( XschMainWindow, + "Unable to open config file !" ); + } + else + { + XschDefaultConfig(); + } + } + else + { + if ( XschReadTopLevelValues() ) + { + XschReadPanelValues( &XschViewArrowsPanel ); + XschReadPanelValues( &XschViewZoomPanel ); + XschReadPanelValues( &XschViewGridPanel ); + XschReadPanelValues( &XschViewLayerPanel ); + XschReadPanelValues( &XschViewMapPanel ); + XschReadPanelValues( &XschEditSearchViewPanel ); + XschReadPanelValues( &XschEditSelectPanel ); + XschReadPanelValues( &XschEditIdentifyPanel ); + XschReadPanelValues( &XschToolsMessagePanel ); + XschReadPanelValues( &XschToolsHierarchyPanel ); + XschReadPanelValues( &XschSetupInformationsPanel ); + XschReadPanelValues( &XschHelpPresentPanel ); + + XschReadActiveLayers(); + XschInitializeLayer(); + } + else + if ( Message ) + { + XschErrorMessage( XschMainWindow, + "Bad version, unable to open config file !" ); + } + + fclose( FileConfig ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschSaveConfig | +| | +\------------------------------------------------------------*/ + +void XschSaveConfig() + +{ + autbegin(); + + FileConfig = fopen( XSCH_XMS_FILE_NAME, "w" ); + + if ( FileConfig == (FILE *)NULL ) + { + XschErrorMessage( XschMainWindow, + "Unable to open config file !" ); + } + else + { + XschWriteTopLevelValues(); + + XschWritePanelValues( &XschViewArrowsPanel ); + XschWritePanelValues( &XschViewZoomPanel ); + XschWritePanelValues( &XschViewGridPanel ); + XschWritePanelValues( &XschViewLayerPanel ); + XschWritePanelValues( &XschViewMapPanel ); + XschWritePanelValues( &XschEditSearchViewPanel ); + XschWritePanelValues( &XschEditSelectPanel ); + XschWritePanelValues( &XschEditIdentifyPanel ); + XschWritePanelValues( &XschToolsMessagePanel ); + XschWritePanelValues( &XschToolsHierarchyPanel ); + XschWritePanelValues( &XschSetupInformationsPanel ); + XschWritePanelValues( &XschHelpPresentPanel ); + + XschWriteActiveLayers(); + + fclose( FileConfig ); + } + + autend(); +} diff --git a/alliance/src/xsch/src/XMS_setup.h b/alliance/src/xsch/src/XMS_setup.h new file mode 100644 index 00000000..87e01917 --- /dev/null +++ b/alliance/src/xsch/src/XMS_setup.h @@ -0,0 +1,85 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Setup.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_SETUP +# define XSCH_SETUP + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XSCH_TOPLEVEL_TRANSLATE_X 8 +# define XSCH_TOPLEVEL_TRANSLATE_Y 25 +# define XSCH_PANEL_TRANSLATE_X 0 +# define XSCH_PANEL_TRANSLATE_Y 0 + +# define XSCH_TOPLEVEL_X 50 +# define XSCH_TOPLEVEL_Y 50 +# define XSCH_TOPLEVEL_WIDTH 1024 +# define XSCH_TOPLEVEL_HEIGHT 768 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschDefaultConfig(); + extern void XschSaveConfig(); + extern void XschLoadConfig(); + +# endif diff --git a/alliance/src/xsch/src/XMT.h b/alliance/src/xsch/src/XMT.h new file mode 100644 index 00000000..bbd73f1b --- /dev/null +++ b/alliance/src/xsch/src/XMT.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : XMT.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_XMT +# define XSCH_XMT + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XschMenuItem XschToolsMenu[]; + extern XschPanelItem XschToolsMessagePanel; + extern XschPanelItem XschToolsHierarchyPanel; + + extern int XschToolsMessageDefaultValues[ 5 ]; + extern int XschToolsHierarchyDefaultValues[ 5 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschDisplayToolsMessage(); + extern void XschToolsHierarchyDown(); + extern void XschBuildToolsDialog(); + +# endif diff --git a/alliance/src/xsch/src/XMT_dialog.c b/alliance/src/xsch/src/XMT_dialog.c new file mode 100644 index 00000000..61700bb8 --- /dev/null +++ b/alliance/src/xsch/src/XMT_dialog.c @@ -0,0 +1,164 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "scl.h" +# include "XSB.h" +# include "XSC.h" +# include "XMX.h" +# include "XTB.h" +# include "XMT.h" + +# include "XMT_dialog.h" +# include "XMT_tools.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XschDialogItem XschToolsSaveXfigDialog = + + { + "Save Xfig file As", + XSCH_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackToolsSaveXfigOk, + (XtPointer)NULL, + (void *)CallbackToolsSaveXfigCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Function | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschBuildToolsDialog | +| | +\------------------------------------------------------------*/ + +void XschBuildToolsDialog() + +{ + autbegin(); + + XschBuildDialog( XschMainWindow, &XschToolsSaveXfigDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsSaveXfigOk | +| | +\------------------------------------------------------------*/ + +void CallbackToolsSaveXfigOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *FileName; + + autbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &FileName ); + + FileName = XschPostTreatString( FileName ); + + XtUnmanageChild( XschToolsSaveXfigDialog.WIDGET ); + + XschExitDialog(); + + XschToolsSaveXfig( FileName ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsSaveXfigCancel | +| | +\------------------------------------------------------------*/ + +void CallbackToolsSaveXfigCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + autbegin(); + + XtUnmanageChild( XschToolsSaveXfigDialog.WIDGET ); + + XschExitDialog(); + + autend(); +} diff --git a/alliance/src/xsch/src/XMT_dialog.h b/alliance/src/xsch/src/XMT_dialog.h new file mode 100644 index 00000000..c7063204 --- /dev/null +++ b/alliance/src/xsch/src/XMT_dialog.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_TOOLS_DIALOG +# define XSCH_TOOLS_DIALOG + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XschDialogItem XschToolsSaveXfigDialog; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackToolsSaveXfigOk(); + extern void CallbackToolsSaveXfigCancel(); + +# endif diff --git a/alliance/src/xsch/src/XMT_menu.c b/alliance/src/xsch/src/XMT_menu.c new file mode 100644 index 00000000..a3eb5f78 --- /dev/null +++ b/alliance/src/xsch/src/XMT_menu.c @@ -0,0 +1,205 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "scl.h" +# include "XSB.h" +# include "XTB.h" +# include "XSC.h" +# include "XMV.h" +# include "XMT.h" +# include "XMX.h" + +# include "XMT_menu.h" +# include "XMT_tools.h" +# include "XMT_dialog.h" +# include "XMT_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XschMenuItem XschToolsMenu[] = + + { + { + "Hierarchy", + 'H', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackToolsHierarchy, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XschMenuItem *)NULL + } + , + { + "Save Xfig file", + 'S', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackToolsSaveXfig, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XschMenuItem *)NULL + } + , + { + "Message", + 'M', + "CtrlM", + "Ctrl M", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackToolsMessage, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XschMenuItem *)NULL + } + , + NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackToolsMessage | +| | +\------------------------------------------------------------*/ + +void CallbackToolsMessage( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschEnterPanel( &XschToolsMessagePanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsHierarchy | +| | +\------------------------------------------------------------*/ + +void CallbackToolsHierarchy( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschEnterPanel( &XschToolsHierarchyPanel ); + + XschChangeEditMode( XSCH_TOOLS_HIERARCHY_DOWN, + XschPromptToolsHierarchyDown ); + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsSaveXfig | +| | +\------------------------------------------------------------*/ + +void CallbackToolsSaveXfig( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + if ( XschFigure != (xschfig_list *)NULL ) + { + XschEnterDialog( &XschToolsSaveXfigDialog ); + } + else + { + XschErrorMessage( XschMainWindow, "No current figure !" ); + } + + autend(); +} diff --git a/alliance/src/xsch/src/XMT_menu.h b/alliance/src/xsch/src/XMT_menu.h new file mode 100644 index 00000000..085d6246 --- /dev/null +++ b/alliance/src/xsch/src/XMT_menu.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_MENU +# define XSCH_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackToolsMessage(); + extern void CallbackToolsHierarchy(); + extern void CallbackToolsSaveXfig(); + +# endif diff --git a/alliance/src/xsch/src/XMT_message.c b/alliance/src/xsch/src/XMT_message.c new file mode 100644 index 00000000..c50c184b --- /dev/null +++ b/alliance/src/xsch/src/XMT_message.c @@ -0,0 +1,97 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Message.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "scl.h" +# include "XSB.h" +# include "XSC.h" +# include "XMX.h" +# include "XTB.h" +# include "XMT.h" +# include "XMT_tools.h" +# include "XMT_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschPromptToolsHierarchyDown | +| | +\------------------------------------------------------------*/ + +void XschPromptToolsHierarchyDown() +{ + autbegin(); + + XschDisplayMessage( XSCH_MESSAGE_MODE, "Go down" ); + XschDisplayMessage( XSCH_MESSAGE_INFO, "Select instance" ); + XschDisplayMessage( XSCH_MESSAGE_PROMPT, "Enter select point" ); + + autend(); +} diff --git a/alliance/src/xsch/src/XMT_message.h b/alliance/src/xsch/src/XMT_message.h new file mode 100644 index 00000000..8a98c253 --- /dev/null +++ b/alliance/src/xsch/src/XMT_message.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Message.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_MESSAGE +# define XSCH_MESSAGE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschPromptToolsHierarchyDown(); + +# endif diff --git a/alliance/src/xsch/src/XMT_panel.c b/alliance/src/xsch/src/XMT_panel.c new file mode 100644 index 00000000..7d689fcc --- /dev/null +++ b/alliance/src/xsch/src/XMT_panel.c @@ -0,0 +1,383 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "scl.h" +# include "XSB.h" +# include "XSC.h" +# include "XMX.h" +# include "XTB.h" +# include "XMT.h" + +# include "XMT_panel.h" +# include "XMT_message.h" +# include "XMT_dialog.h" +# include "XMT_tools.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Panel Message | +| | +\------------------------------------------------------------*/ + + static char *XschPanelMessageButtonName[] = + + { + "Text", + "Close" + }; + + XschPanelButtonItem XschToolsMessageButton[] = + + { + { + &XschPanelMessageButtonName[0], + "Nothing", NULL, 0, 0, + NULL, + NULL, + 0, 0, + 8, 9, + NULL, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelMessageButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 3, 9, + 2, 1, + CallbackToolsCloseMessage, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XschPanelItem XschToolsMessagePanel = + + { + "Message", + 1, + 0, + XSCH_TOOLS_MESSAGE_X, + XSCH_TOOLS_MESSAGE_Y, + 360, + 250, + 8, + 10, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XschToolsMessageButton + }; + + int XschToolsMessageDefaultValues[ 5 ] = + + { + XSCH_TOOLS_MESSAGE_X, + XSCH_TOOLS_MESSAGE_Y, + 360, 250, 0 + }; + +/*------------------------------------------------------------\ +| | +| Hierarchy Panel | +| | +\------------------------------------------------------------*/ + + static char *XschPanelHierarchyButtonName[] = + + { + "Go up", + "Go down", + "Reload", + "Close" + }; + + XschPanelButtonItem XschToolsHierarchyButton[] = + + { + { + &XschPanelHierarchyButtonName[0], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackToolsHierarchyUp, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelHierarchyButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 1, + 1, 1, + CallbackToolsHierarchyDown, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelHierarchyButtonName[2], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 2, + 1, 1, + CallbackToolsHierarchyReload, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelHierarchyButtonName[3], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 3, + 1, 1, + CallbackToolsCloseHierarchy, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XschPanelItem XschToolsHierarchyPanel = + + { + "Hierarchy", + 1, + 0, + XSCH_TOOLS_HIERARCHY_X, + XSCH_TOOLS_HIERARCHY_Y, + 100, + 100, + 1, + 4, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XschToolsHierarchyButton + }; + + int XschToolsHierarchyDefaultValues[ 5 ] = + + { + XSCH_TOOLS_HIERARCHY_X, + XSCH_TOOLS_HIERARCHY_Y, + 100, 100, 0 + }; + +/*------------------------------------------------------------\ +| | +| Callback For Message | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackToolsCloseMessage | +| | +\------------------------------------------------------------*/ + +void CallbackToolsCloseMessage( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschExitPanel( &XschToolsMessagePanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschDisplayToolsMessage | +| | +\------------------------------------------------------------*/ + +void XschDisplayToolsMessage() +{ + char *Message; + + autbegin(); + + Message = XschGetErrorMessage(); + + if ( Message != (char *)NULL ) + { + XmTextSetString( XschToolsMessageButton[0].BUTTON, Message ); + + XschEnterPanel( &XschToolsMessagePanel ); + } + else + { + XmTextSetString( XschToolsMessageButton[0].BUTTON, "" ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Hierarchy | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackToolsHierarchyUp | +| | +\------------------------------------------------------------*/ + +void CallbackToolsHierarchyUp( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschToolsHierarchyUp(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsHierarchyDown | +| | +\------------------------------------------------------------*/ + +void CallbackToolsHierarchyDown( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschChangeEditMode( XSCH_TOOLS_HIERARCHY_DOWN, + XschPromptToolsHierarchyDown ); + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsHierarchyReload | +| | +\------------------------------------------------------------*/ + +void CallbackToolsHierarchyReload( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschToolsHierarchyReload(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsCloseHierarchy | +| | +\------------------------------------------------------------*/ + +void CallbackToolsCloseHierarchy( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschToolsDelAllHierarchy(); + XschExitPanel( &XschToolsHierarchyPanel ); + + autend(); +} + diff --git a/alliance/src/xsch/src/XMT_panel.h b/alliance/src/xsch/src/XMT_panel.h new file mode 100644 index 00000000..41eb59a3 --- /dev/null +++ b/alliance/src/xsch/src/XMT_panel.h @@ -0,0 +1,84 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_TOOLS_PANEL +# define XSCH_TOOLS_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XSCH_TOOLS_MESSAGE_X 330 +# define XSCH_TOOLS_MESSAGE_Y 280 + +# define XSCH_TOOLS_HIERARCHY_X 890 +# define XSCH_TOOLS_HIERARCHY_Y 80 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackToolsCloseMessage(); + + extern void CallbackToolsHierarchyUp(); + extern void CallbackToolsHierarchyDown(); + extern void CallbackToolsHierarchyReload(); + extern void CallbackToolsCloseHierarchy(); + +# endif diff --git a/alliance/src/xsch/src/XMT_tools.c b/alliance/src/xsch/src/XMT_tools.c new file mode 100644 index 00000000..d4e669ad --- /dev/null +++ b/alliance/src/xsch/src/XMT_tools.c @@ -0,0 +1,2083 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Tools.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "scl.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XSC.h" +# include "XMT.h" + +# include "XMT_tools.h" +# include "XMT_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + xschhierarchy *XschHeadHierarchy = (xschhierarchy *)0; + + char XschToolsFilter[ 10 ] = "*."; + char XschToolsExtention[ 10 ] = "."; + + char XschToolsBuffer[ 128 ]; + char XschToolsDirectoryBuffer[ 512 ]; + + static FILE *XschXfigFile = (FILE *)0; + static int XschXfigColor = 0; + static int XschXfigDepth = 0; + static long XschXfigDy = 0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschAllocHierarchy | +| | +\------------------------------------------------------------*/ + +xschhierarchy *XschAllocHierarchy () + +{ + return ( (xschhierarchy *)autallocheap( sizeof ( xschhierarchy ) )); +} + +/*------------------------------------------------------------\ +| | +| XschFreeHierarchy | +| | +\------------------------------------------------------------*/ + +void XschFreeHierarchy ( FreeHierarchy ) + + xschhierarchy *FreeHierarchy; + +{ + autfreeheap( (char *)FreeHierarchy, sizeof(FreeHierarchy) ); +} + +/*------------------------------------------------------------\ +| | +| XschAddHierarchy | +| | +\------------------------------------------------------------*/ + +void XschAddHierarchy( Name ) + + char *Name; +{ + xschhierarchy *XschHierarchy; + + autbegin(); + + XschHierarchy = XschAllocHierarchy (); + XschHierarchy->NAME = Name; + XschHierarchy->X = XschUnitGridX; + XschHierarchy->Y = XschUnitGridY; + XschHierarchy->DX = XschUnitGridDx; + XschHierarchy->DY = XschUnitGridDy; + XschHierarchy->NEXT = XschHeadHierarchy; + XschHeadHierarchy = XschHierarchy; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschDelHierarchy | +| | +\------------------------------------------------------------*/ + +char XschDelHierarchy() + +{ + xschhierarchy *XschHierarchy; + + if ( XschHeadHierarchy != (xschhierarchy *) NULL ) + { + autbegin(); + + XschHierarchy = XschHeadHierarchy; + XschHeadHierarchy = XschHeadHierarchy->NEXT; + XschFreeHierarchy( XschHierarchy ); + + autend(); + return( XSCH_TRUE ); + } + + return( XSCH_FALSE ); +} + +/*------------------------------------------------------------\ +| | +| XschToolsHierarchyDown | +| | +\------------------------------------------------------------*/ + +void XschToolsHierarchyDown() +{ + xschselect_list *Select; + xschobj_list *Obj; + schbox_list *SchBox; + loins_list *LoIns; + char *ModelName; + + autbegin(); + + if ( XschHeadSelect != (xschselect_list *)0 ) + { + Obj = XschHeadSelect->OBJECT; + XschDelSelect(); + + XschDisplayObject( Obj ); + + if ( IsXschSchBox( Obj ) ) + { + SchBox = (schbox_list *)Obj->USER; + + if ( SchBox->SOURCE_TYPE == SCH_SOURCE_LOINS ) + { + LoIns = (loins_list *)SchBox->SOURCE; + ModelName = LoIns->FIGNAME; + + XschAddHierarchy( XschFigureSch->NAME ); + + XschFileOpen( ModelName, 1 ); + } + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschToolsHierarchyUp | +| | +\------------------------------------------------------------*/ + +void XschToolsHierarchyUp() +{ + if ( XschHeadHierarchy == (xschhierarchy *)0 ) + { + XschErrorMessage( XschMainWindow, "No previous model !" ); + } + else + { + XschFileOpen( XschHeadHierarchy->NAME, 0 ); + + XschUnitGridX = XschHeadHierarchy->X; + XschUnitGridY = XschHeadHierarchy->Y; + XschUnitGridDx = XschHeadHierarchy->DX; + XschUnitGridDy = XschHeadHierarchy->DY; + + XschComputeUnitGrid(); + XschComputeAndDisplayMap(); + + XschZoomRefresh(); + XschDelHierarchy(); + } +} + +/*------------------------------------------------------------\ +| | +| XschToolsHierarchyReload | +| | +\------------------------------------------------------------*/ + +void XschToolsHierarchyReload() +{ + long SaveUnitGridX; + long SaveUnitGridY; + long SaveUnitGridDx; + long SaveUnitGridDy; + + if ( XschFigureSch != (schfig_list *)NULL ) + { + SaveUnitGridX = XschUnitGridX; + SaveUnitGridY = XschUnitGridY; + SaveUnitGridDx = XschUnitGridDx; + SaveUnitGridDy = XschUnitGridDy; + + XschFileOpen( XschFigureSch->NAME, 0 ); + + XschUnitGridX = SaveUnitGridX; + XschUnitGridY = SaveUnitGridY; + XschUnitGridDx = SaveUnitGridDx; + XschUnitGridDy = SaveUnitGridDy; + + XschComputeUnitGrid(); + XschComputeAndDisplayMap(); + + XschZoomRefresh(); + } +} + +/*------------------------------------------------------------\ +| | +| XschToolsDelAllHierarchy | +| | +\------------------------------------------------------------*/ + +void XschToolsDelAllHierarchy() +{ + while ( XschHeadHierarchy != (xschhierarchy *)0 ) + { + XschDelHierarchy(); + } +} + +/*------------------------------------------------------------\ +| | +| XschToolsSaveXfigLine | +| | +\------------------------------------------------------------*/ + +static void XschToolsSaveXfigLine( X1r, Y1r, X2r, Y2r ) + + long X1r; + long Y1r; + long X2r; + long Y2r; +{ + fprintf( XschXfigFile, + "2 1 0 1 %d 0 %d 0 -1 0.000 0 0 -1 0 0 2\n", XschXfigColor, XschXfigDepth ); + /* ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ + * | | | | | | | | | | | | | | | + Number Points + * | | | | | | | | | | | | | | + Backward Arrow + * | | | | | | | | | | | | | + Forward Arrow + * | | | | | | | | | | | | + Radius + * | | | | | | | | | | | + Cap style + * | | | | | | | | | | + Join style + * | | | | | | | | | + Style Val + * | | | | | | | | + Area Fill + * | | | | | | | + Pen Style + * | | | | | | + Depth + * | | | | | + Fill Color + * | | | | + Pen Color + * | | | + Width + * | | + Line Style + * | + Poly Line + * + Poly Line + */ + + fprintf( XschXfigFile, " %ld %ld %ld %dl\n", X1r, XschXfigDy - Y1r, + X2r, XschXfigDy - Y2r ); +} + +/*------------------------------------------------------------\ +| | +| XschToolsSaveXfigRectangle | +| | +\------------------------------------------------------------*/ + +static void XschToolsSaveXfigRectangle( X1r, Y1r, X2r, Y2r ) + + long X1r; + long Y1r; + long X2r; + long Y2r; +{ + fprintf( XschXfigFile, + "2 2 0 1 %d 0 %d 0 -1 0.000 0 0 -1 0 0 5\n", XschXfigColor, XschXfigDepth ); + /* ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ + * | | | | | | | | | | | | | | | + Number Points + * | | | | | | | | | | | | | | + Backward Arrow + * | | | | | | | | | | | | | + Forward Arrow + * | | | | | | | | | | | | + Radius + * | | | | | | | | | | | + Cap style + * | | | | | | | | | | + Join style + * | | | | | | | | | + Style Val + * | | | | | | | | + Area Fill + * | | | | | | | + Pen Style + * | | | | | | + Depth + * | | | | | + Fill Color + * | | | | + Pen Color + * | | | + Width + * | | + Line Style + * | + Poly Line + * + Poly Line + */ + + fprintf( XschXfigFile, "%ld %ld %ld %ld %ld %ld %ld %ld %ld %ld\n", + X1r, XschXfigDy - Y1r, + X2r, XschXfigDy - Y1r, + X2r, XschXfigDy - Y2r, + X1r, XschXfigDy - Y2r, + X1r, XschXfigDy - Y1r ); +} + +/*------------------------------------------------------------\ +| | +| XschToolsSaveXfigCircle | +| | +\------------------------------------------------------------*/ + +static void XschToolsSaveXfigCircle( X1r, Y1r, Dx, Dy ) + + long X1r; + long Y1r; + long Dx; + long Dy; +{ + long Xc; + long Yc; + long Radx; + long Rady; + + Xc = X1r + ( Dx / 2 ); + Yc = Y1r + ( Dy / 2 ); + Radx = Dx / 2; + Rady = Dy / 2; + + fprintf( XschXfigFile, + "1 3 0 1 %d 0 %d 0 -1 0.000 1 0.000 %d %d %d %d %d %d %d %d\n", + /* ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ + * | | | | | | | | | | | | | | | | | | | + end_y + * | | | | | | | | | | | | | | | | | | + end_x + * | | | | | | | | | | | | | | | | | + start_y + * | | | | | | | | | | | | | | | | + start_x + * | | | | | | | | | | | | | | | + rad_y + * | | | | | | | | | | | | | | + rad_x + * | | | | | | | | | | | | | + Cy + * | | | | | | | | | | | | + Cx + * | | | | | | | | | | | + Angle + * | | | | | | | | | | + Direction + * | | | | | | | | | + Style Val + * | | | | | | | | + Area Fill + * | | | | | | | + Pen Style + * | | | | | | + Depth + * | | | | | + Fill Color + * | | | | + Pen Color + * | | | + Width + * | | + Line Style + * | + Poly Line + * + Poly Line + */ + XschXfigColor, XschXfigDepth, Xc, XschXfigDy - Yc, Radx, Rady, + Xc, XschXfigDy - Yc, + Xc + Radx, XschXfigDy - Yc ); +} + +/*------------------------------------------------------------\ +| | +| XschToolsSaveXfigArc | +| | +\------------------------------------------------------------*/ + +# if 0 +static void XschToolsSaveXfigArc( X1r, Y1r, Dx, Dy, AngleFrom, AngleTo ) + + long X1r; + long Y1r; + long Dx; + long Dy; + long AngleFrom; + long AngleTo; +{ + long MiddleAngle; + long Xc; + long Yc; + long Width; + long Height; + long X1; + long Y1; + long X2; + long Y2; + long X3; + long Y3; + double Rad; + + Width = Dx / 2; + Height = Dy / 2; + Xc = X1r + Width; + Yc = Y1r + Height; + + Rad = ( (double) AngleFrom * M_PI ) / ( 64.0 * 180.0 ); + + X1 = Xc + (long)( (double)Width * cos( Rad ) ); + Y1 = Yc + (long)( (double)Height * sin( Rad ) ); + + Rad = ( (double) ( AngleTo + AngleFrom ) * M_PI ) / ( 64.0 * 180.0 ); + + X3 = Xc + (long)( (double)Width * cos( Rad ) ); + Y3 = Yc + (long)( (double)Height * sin( Rad ) ); + + Rad = ( (double)( AngleTo + ( AngleFrom / 2 ) ) * M_PI ) / ( 2.0 * 64.0 * 180.0 ); + + X2 = Xc + (long)( (double)Width * cos( Rad ) ); + Y2 = Yc + (long)( (double)Height * sin( Rad ) ); + + fprintf( XschXfigFile, + "5 1 0 1 %d 0 %d 0 -1 0.000 0 1 0 0 %f %f %ld %ld %ld %ld %ld %ld\n", + /* ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ + * | | | | | | | | | | | | | | | | + Second Third + * | | | | | | | | | | | | | | | + 1st Point + * | | | | | | | | | | | | | | + Center + * | | | | | | | | | | | | | + Backward Arrow + * | | | | | | | | | | | | + Forward Arrow + * | | | | | | | | | | | + Direction + * | | | | | | | | | | + Cap style + * | | | | | | | | | + Style Val + * | | | | | | | | + Area Fill + * | | | | | | | + Pen Style + * | | | | | | + Depth + * | | | | | + Fill Color + * | | | | + Pen Color + * | | | + Width + * | | + Line Style + * | + Arc + * + Arc + */ + XschXfigColor, XschXfigDepth, + (float)Xc, (float)Yc, X1, Y1, X2, Y2, X3, Y3 ); +} +# endif + +static void XschToolsSaveXfigArc( X1r, Y1r, Dx, Dy, AngleFrom, AngleTo ) + + long X1r; + long Y1r; + long Dx; + long Dy; + long AngleFrom; + long AngleTo; +{ + long MiddleAngle; + long Xc; + long Yc; + long Width; + long Height; + long X1; + long Y1; + long X2; + long Y2; + long X3; + long Y3; + double Rad; + + Width = Dx / 2; + Height = Dy / 2; + Xc = X1r + Width; + Yc = Y1r + Height; + + Rad = ( (double) AngleFrom * M_PI ) / ( 64.0 * 180.0 ); + + X1 = Xc + (long)( (double)Width * cos( Rad ) ); + Y1 = Yc + (long)( (double)Height * sin( Rad ) ); + + Rad = ( (double) ( AngleFrom + AngleTo ) * M_PI ) / ( 64.0 * 180.0 ); + + X3 = Xc + (long)( (double)Width * cos( Rad ) ); + Y3 = Yc + (long)( (double)Height * sin( Rad ) ); + + Rad = ( (double)( AngleFrom + ( AngleTo / 2 ) ) * M_PI ) / ( 2.0 * 64.0 * 180.0 ); + + X2 = Xc + (long)( (double)Width * cos( Rad ) ); + Y2 = Yc + (long)( (double)Height * sin( Rad ) ); + + fprintf( XschXfigFile, + "3 4 0 1 %d 0 %d 0 -1 0.000 0 0 0 3\n", XschXfigColor, XschXfigDepth ); + /* ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ + * | | | | | | | | | | | | | | + * | | | | | | | | | | | | | | + * | | | | | | | | | | | | | + Number points + * | | | | | | | | | | | | + Backward Arrow + * | | | | | | | | | | | + Forward Arrow + * | | | | | | | | | | + Cap style + * | | | | | | | | | + Style Val + * | | | | | | | | + Area Fill + * | | | | | | | + Pen Style + * | | | | | | + Depth + * | | | | | + Fill Color + * | | | | + Pen Color + * | | | + Width + * | | + Line Style + * | + Arc + * + Arc + */ + + fprintf( XschXfigFile, " %ld %ld %ld %ld %ld %ld\n", + X1, XschXfigDy - Y1, + X2, XschXfigDy - Y2, + X3, XschXfigDy - Y3 ); + + fprintf( XschXfigFile, " 0.000 -1.000 0.000\n" ); +} + +/*------------------------------------------------------------\ +| | +| XschToolsSaveXfigBuffer | +| | +\------------------------------------------------------------*/ + +static void XschToolsSaveXfigBuffer( X1r, Y1r, X2r, Y2r, Ycr, Obj ) + + long X1r; + long Y1r; + long X2r; + long Y2r; + long Ycr; + xschobj_list *Obj; +{ +/* +** Fred Petrot (The King ) has initially written those lines ! +** Ludo Jacomme (The Slave) has modified them :-) +*/ + long gs; + long is_x; + long is_y; + long cs; + long x, y1; + long DeltaX; + long DeltaY; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + + gs = DeltaX; + is_x = ( 5 * DeltaX ) / 16; + is_y = ( 5 * DeltaY ) / 8; + cs = DeltaX / 8; + + y1 = Ycr; + x = X1r + cs; + + XschToolsSaveXfigLine( x, y1 - is_y/2, x, y1 + is_y/2); + XschToolsSaveXfigLine( x , y1 - is_y/2, x + is_x, y1); + XschToolsSaveXfigLine( x , y1 + is_y/2, x + is_x, y1); + + if ( ( Obj->ARG1 ) == 0 ) + { + /* input line : centered vertically */ + XschToolsSaveXfigLine( x - cs, y1, x , y1 ); + } + else + { + /* Input circle */ + XschToolsSaveXfigCircle( x - cs, y1 - cs/2, cs, cs ); + } + + if ( ( Obj->ARG2 ) == 0 ) + { + /* Output line : centered vertically */ + XschToolsSaveXfigLine( x + is_x , y1, x + is_x + cs, y1 ); + } + else + { + /* Output circle */ + XschToolsSaveXfigCircle( x + is_x, y1 - cs/2, cs, cs ); + } + + XschToolsSaveXfigLine( x + is_x + cs, y1, X2r, y1 ); +} + + +/*------------------------------------------------------------\ +| | +| XschToolsSaveXfigTristate | +| | +\------------------------------------------------------------*/ + +static void XschToolsSaveXfigTristate( X1r, Y1r, X2r, Y2r, Ycr, Obj ) + + long X1r; + long Y1r; + long X2r; + long Y2r; + long Ycr; + xschobj_list *Obj; +{ +/* +** Fred Petrot (The King ) has initially written those lines ! +** Ludo Jacomme (The Slave) has modified them :-) +*/ + long gs; + long is_x; + long is_y; + long cs; + long csm; + long x, x1, y1, y2,y0; + long DeltaX; + long DeltaY; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + + gs = DeltaX; + is_x = ( 5 * DeltaX ) / 16; + is_y = ( 5 * DeltaY ) / 16; + cs = DeltaX / 8; + csm = DeltaX / 10; + + y1 = Ycr; + x1 = (X2r + X1r) / 2; + x = X1r + cs; + + XschToolsSaveXfigLine( x, y1 - is_y/2, x, y1 + is_y/2); + + XschToolsSaveXfigLine( x , y1 - is_y/2, x + is_x, y1); + XschToolsSaveXfigLine( x , y1 + is_y/2, x + is_x, y1); + + y0 = Obj->Y + ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + y0 -= XschBoundYmin; + + y2 = Obj->Y + ( SCP_BOX_CON_BASE_Y + SCP_BOX_CON_STEP_Y ) * XSCH_UNIT; + y2 -= XschBoundYmin; + + if ( ( Obj->ARG1 & 1) == 0 ) + { + /* data line : centered vertically */ + XschToolsSaveXfigLine( x - cs, y1, x , y1 ); + } + else + { + /* Data circle */ + XschToolsSaveXfigCircle( x - cs, y1 - cs/2, cs, cs ); + } + + /* Data Line */ + + XschToolsSaveXfigLine( x - cs, y0, x - cs, y1 ); + + if ( ( Obj->ARG1 & 2) == 0 ) + { + /* Command Line */ + XschToolsSaveXfigLine( x - cs, y2, x + is_x/2, y2 ); + + XschToolsSaveXfigLine( x + is_x/2, y2, x + is_x/2, y1 - is_y/4 ); + } + else + { + /* Command circle */ + XschToolsSaveXfigCircle( x + is_x/2 - csm/2, y1 - is_y/2 - csm/4, csm, csm ); + + /* Command Line */ + XschToolsSaveXfigLine( x - cs, y2, x + is_x/2, y2 ); + + XschToolsSaveXfigLine( x + is_x/2, y2, x + is_x/2, y2 + csm ); + } + + if ( ( Obj->ARG2 ) == 0 ) + { + /* Output line : centered vertically */ + XschToolsSaveXfigLine( x + is_x , y1, x + is_x + cs, y1 ); + } + else + { + /* Output circle */ + XschToolsSaveXfigCircle( x + is_x, y1 - cs/2, cs, cs ); + } + + XschToolsSaveXfigLine( x + is_x + cs, y1, X2r, y1 ); +} + +/*------------------------------------------------------------\ +| | +| XschToolsSaveXfigConstant | +| | +\------------------------------------------------------------*/ + +static void XschToolsSaveXfigConstant( X1r, Y1r, X2r, Y2r, Ycr, Obj ) + + long X1r; + long Y1r; + long X2r; + long Y2r; + long Ycr; + xschobj_list *Obj; +{ + long is_x; + long is_y; + long cs; + long x, yc, y1,y2,y3; + long DeltaX; + long DeltaY; + int i; + int n; + + n = Obj->ARG1; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + + cs = DeltaX / 8; + x = X1r + cs; + + y1 = Obj->Y + ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + y1 -= XschBoundYmin; + + for ( i = 0; i < n; i++ ) + { + yc = y1; + + if (( Obj->ARG2 & (1 << i)) == 0) + { + y2 = yc + cs; + y3 = y2 + cs; + + XschToolsSaveXfigLine( + x, yc, x, y2 ); + + XschToolsSaveXfigLine( x - cs, y2, x + cs, y2 ); + + XschToolsSaveXfigLine( x - cs, y2, x, y3 ); + + XschToolsSaveXfigLine( x + cs, y2, x, y3 ); + } + else + { + y2 = yc - cs; + y3 = y2 - cs; + + XschToolsSaveXfigLine( + x, yc, x, y2 ); + + XschToolsSaveXfigLine( + x, y2, x - cs, y3 ); + + XschToolsSaveXfigLine( + x, y2, x + cs, y3 ); + } + + XschToolsSaveXfigLine( x, yc, X2r, yc ); + + y1 += ( SCP_BOX_CON_STEP_Y * XSCH_UNIT ); + } +} + +/*------------------------------------------------------------\ +| | +| XschToolsSaveXfigTransistor | +| | +\------------------------------------------------------------*/ + +static void XschToolsSaveXfigTransistor( X1r, Y1r, X2r, Y2r, Ycr, Obj ) + + long X1r; + long Y1r; + long X2r; + long Y2r; + long Ycr; + xschobj_list *Obj; +{ +/* +** Fred Petrot (The King ) has initially written those lines ! +** Ludo Jacomme (The Slave) has modified them :-) +*/ + long gs; + long is_x; + long is_y; + long cs; + long csm; + long x, x1, y1, y2,y0; + long DeltaX; + long DeltaY; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + + gs = DeltaX; + is_x = ( 5 * DeltaX ) / 16; + is_y = ( 5 * DeltaY ) / 16; + cs = DeltaX / 8; + + y0 = Obj->Y + ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + y0 -= XschBoundYmin; + + y2 = Obj->Y + ( SCP_BOX_CON_BASE_Y + SCP_BOX_CON_STEP_Y ) * XSCH_UNIT; + y2 -= XschBoundYmin; + + y1 = Ycr; + /* + x1 = X2r - cs; + */ + x1 = X1r + 3 * cs; + x = X1r; + + XschToolsSaveXfigLine( x, y0, x, y0 - cs ); + + XschToolsSaveXfigLine( x, y0 - cs, x1 - cs, y0 - cs ); + + XschToolsSaveXfigLine( x1 - cs, y0 - cs, x1 - cs, y2 + cs ); + + XschToolsSaveXfigLine( x1 - cs, y2 + cs, x, y2 + cs ); + + XschToolsSaveXfigLine( x, y2 + cs, x, y2 ); + + XschToolsSaveXfigLine( x1, y0 - cs, x1, y2 + cs ); + + if ( ( Obj->ARG1 ) == 0 ) + { + /* Output line : centered vertically */ + XschToolsSaveXfigLine( x1, y1, x1 + cs, y1 ); + } + else + { + /* Output circle */ + XschToolsSaveXfigCircle( x1, y1 - cs/2, cs, cs ); + } + + XschToolsSaveXfigLine( x1 + cs, y1, X2r, y1 ); +} + +/*------------------------------------------------------------\ +| | +| XschToolsSaveXfigAnd | +| | +\------------------------------------------------------------*/ + +static void XschToolsSaveXfigAnd( X1r, Y1r, X2r, Y2r, Ycr, Obj ) + + long X1r; + long Y1r; + long X2r; + long Y2r; + long Ycr; + xschobj_list *Obj; +{ +/* +** Fred Petrot (The King ) has initially written those lines ! +** Ludo Jacomme (The Slave) has modified them :-) +*/ + long gs_y; + long gs_x; + long cs; + int i; + int n; + long x, y; + long yc; + long y1; + long DeltaX; + long DeltaY; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + + gs_y = ( 7 * DeltaY ) / 8; + gs_x = ( 6 * DeltaX ) / 8; + cs = DeltaX / 8; + + yc = Ycr; + y = Ycr - gs_y/2; + x = X1r + cs; + n = Obj->ARG1; + + /* And shape alone */ + + XschToolsSaveXfigLine( x, y, x + gs_x/2, y ); + + XschToolsSaveXfigLine( x , y + gs_y, x + gs_x/2, y + gs_y ); + + XschToolsSaveXfigArc( x, y, gs_x, gs_y, 90 * 64, -180 * 64); + + if ( Obj->ARG3 == 0 ) + { + /* Output line : centered vertically */ + XschToolsSaveXfigLine( x + gs_x, yc, x + gs_x + cs, yc ); + } + else + { + /* Output circle (for a NAND) */ + XschToolsSaveXfigCircle( x + gs_x, yc - cs/2, cs, cs ); + } + + /* Input lines */ + XschToolsSaveXfigLine( x, y, x, y + gs_y); + + y1 = Obj->Y + ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + y1 -= XschBoundYmin; + + /* Circle for inversion */ + for (i = 0; i < n; i++) + { + yc = y1; + + if (( Obj->ARG2 & (1 << i)) == 0) + { + XschToolsSaveXfigLine( x - cs, yc, x, yc ); + } + else + { + XschToolsSaveXfigCircle( x - cs, yc - cs/2, cs, cs ); + } + + y1 += ( SCP_BOX_CON_STEP_Y * XSCH_UNIT ); + } +} + +/*------------------------------------------------------------\ +| | +| XschToolsSaveXfigRegister | +| | +\------------------------------------------------------------*/ + +static void XschToolsSaveXfigRegister( X1r, Y1r, X2r, Y2r, Ycr, Obj ) + + long X1r; + long Y1r; + long X2r; + long Y2r; + long Ycr; + xschobj_list *Obj; +{ +/* +** Fred Petrot (The King ) has initially written those lines ! +** Ludo Jacomme (The Slave) has modified them :-) +*/ + long gs_y; + long gs_x; + long cs; + long es_x; + long es_y; + int i; + int ni; + long x, y; + long yc; + long xc; + long y1; + long DeltaX; + long DeltaY; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + + gs_y = ( 7 * DeltaY ) / 8; + gs_x = ( 6 * DeltaX ) / 8; + cs = DeltaX / 8; + + es_y = DeltaX / 4; + es_x = DeltaX / 8; + + yc = Ycr; + y = Ycr - gs_y/2; + x = X1r + cs; + xc = (X2r + X1r) /2; + ni = Obj->ARG1; + + /* shape alone */ + + XschToolsSaveXfigRectangle( x, y, x + gs_x, y + gs_y ); + +/* +** Rising/Falling Edge +*/ + if ( ( Obj->ARG5 == 1 ) || + ( Obj->ARG5 == 2 ) ) + { + XschToolsSaveXfigLine( xc, yc - es_y, xc, yc + es_y ); + +/* +** Rising +*/ + if ( Obj->ARG5 == 1 ) + { + XschToolsSaveXfigLine( xc, yc + es_y, xc - es_x, yc + es_y ); + + XschToolsSaveXfigLine( xc, yc - es_y, xc + es_x, yc - es_y ); + } + else +/* +** Falling +*/ + { + XschToolsSaveXfigLine( xc, yc - es_y, xc - es_x, yc - es_y ); + + XschToolsSaveXfigLine( xc, yc + es_y, xc + es_x, yc + es_y ); + } + } + + if ( Obj->ARG4 == 0 ) + { + /* Output line : centered vertically */ + XschToolsSaveXfigLine( x + gs_x, yc, x + gs_x + cs, yc ); + } + else + { + /* Output circle */ + XschToolsSaveXfigCircle( x + gs_x, yc - cs/2, cs, cs ); + } + + + /* Input lines */ + /* Circle for inversion */ + + y1 = Obj->Y + ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + y1 -= XschBoundYmin; + + for (i = 0; i < ni; i++) + { + yc = y1; + + if (( Obj->ARG2 & (1 << i)) == 0) + { + XschToolsSaveXfigLine( x - cs, yc, x, yc ); + } + else + { + XschToolsSaveXfigCircle( x - cs, yc - cs/2, cs, cs ); + } + + /* Clock */ + + if (( Obj->ARG3 & (1 << i)) != 0) + { + XschToolsSaveXfigLine( x, yc - cs/2, x + cs, yc ); + + XschToolsSaveXfigLine( x + cs, yc, x, yc + cs/2 ); + } + + y1 += ( SCP_BOX_CON_STEP_Y * XSCH_UNIT ); + } +} + +/*------------------------------------------------------------\ +| | +| XschToolsSaveXfigOr | +| | +\------------------------------------------------------------*/ + +static void XschToolsSaveXfigOr( X1r, Y1r, X2r, Y2r, Ycr, Obj ) + + long X1r; + long Y1r; + long X2r; + long Y2r; + long Ycr; + xschobj_list *Obj; +{ +/* +** Fred Petrot (The King ) has initially written those lines ! +** Ludo Jacomme (The Slave) has modified them :-) +*/ + long gs_y; + long gs_x; + long cs; + long Radius; + int i; + int n; + long x, y; + long yc; + long y1; + long DeltaX; + long DeltaY; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + + gs_y = ( 7 * DeltaY ) / 8; + gs_x = ( 6 * DeltaX ) / 8; + cs = DeltaX / 8; + + yc = Ycr; + y = Ycr - gs_y/2; + x = X1r + cs; + n = Obj->ARG1; + + /* Or shape alone */ + + XschToolsSaveXfigLine( x, y, x + gs_x/2, y ); + + XschToolsSaveXfigLine( x , y + gs_y, x + gs_x/2, y + gs_y ); + + XschToolsSaveXfigArc( x, y, gs_x, gs_y, 90 * 64, -180 * 64); + + Radius = (float)(gs_y) * 0.707106781185; + + XschToolsSaveXfigArc( + x - (Radius * 5 / 3), yc - Radius, + Radius * 2, Radius * 2, 45 * 64, -90 * 64); + + if ( Obj->ARG3 == 0 ) + { + /* Output line : centered vertically */ + XschToolsSaveXfigLine( x + gs_x, yc, x + gs_x + cs, yc ); + } + else + { + /* Output circle */ + XschToolsSaveXfigCircle( x + gs_x, yc - cs/2, cs, cs ); + } + + /* Input lines */ + + y1 = Obj->Y + ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + y1 -= XschBoundYmin; + + /* Circle for inversion */ + for (i = 0; i < n; i++) + { + yc = y1; + + if (( Obj->ARG2 & (1 << i)) == 0) + { + XschToolsSaveXfigLine( x - cs, yc, x, yc ); + } + else + { + XschToolsSaveXfigCircle( x - cs, yc - cs/2, cs, cs ); + } + + y1 += ( SCP_BOX_CON_STEP_Y * XSCH_UNIT ); + } +} + +/*------------------------------------------------------------\ +| | +| XschToolsSaveXfigXor | +| | +\------------------------------------------------------------*/ + +static void XschToolsSaveXfigXor( X1r, Y1r, X2r, Y2r, Ycr, Obj ) + + long X1r; + long Y1r; + long X2r; + long Y2r; + long Ycr; + xschobj_list *Obj; +{ +/* +** Fred Petrot (The King ) has initially written those lines ! +** Ludo Jacomme (The Slave) has modified them :-) +*/ + long gs_y; + long gs_x; + long cs; + long Radius; + int i; + int n; + long x, y; + long yc; + long y1; + long DeltaX; + long DeltaY; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + + gs_y = ( 7 * DeltaY ) / 8; + gs_x = ( 6 * DeltaX ) / 8; + cs = DeltaX / 8; + + yc = Ycr; + y = Ycr - gs_y/2; + x = X1r + cs; + n = Obj->ARG1; + + /* Xor shape alone */ + + XschToolsSaveXfigLine( x + gs_x/4, y, x + gs_x/2, y ); + + XschToolsSaveXfigLine( x + gs_x/4, y + gs_y, x + gs_x/2, y + gs_y ); + + XschToolsSaveXfigArc( x, y, gs_x, gs_y, 90 * 64, -180 * 64); + + Radius = (float)(gs_y) * 0.707106781185; /* sqrt(2) */ + + XschToolsSaveXfigArc( x - (Radius * 5 / 3), yc - Radius, + Radius * 2, Radius * 2, 45 * 64, -90 * 64); + + XschToolsSaveXfigArc( x - (Radius * 4 / 3), yc - Radius, + Radius * 2, Radius * 2, 45 * 64, -90 * 64); + + if ( Obj->ARG3 == 0 ) + { + /* Output line : centered vertically */ + XschToolsSaveXfigLine( x + gs_x, yc, x + gs_x + cs, yc ); + } + else + { + /* Output circle */ + XschToolsSaveXfigCircle( x + gs_x, yc - cs/2, cs, cs ); + } + + /* Input lines */ + + y1 = Obj->Y + ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + y1 -= XschBoundYmin; + + /* Circle for inversion */ + for (i = 0; i < n; i++) + { + yc = y1; + + if (( Obj->ARG2 & (1 << i)) == 0) + { + XschToolsSaveXfigLine( x - cs, yc, x, yc ); + } + else + { + XschToolsSaveXfigCircle( x - cs, yc - cs/2, cs, cs ); + } + + y1 += ( SCP_BOX_CON_STEP_Y * XSCH_UNIT ); + } +} + +/*------------------------------------------------------------\ +| | +| XschToolsSaveXfigAndOr | +| | +\------------------------------------------------------------*/ + +static void XschToolsSaveXfigAndOr( X1r, Y1r, X2r, Y2r, Ycr, Obj ) + + long X1r; + long Y1r; + long X2r; + long Y2r; + long Ycr; + xschobj_list *Obj; +{ + long gs_y; + long gs_x; + long cs; + int i; + int n; + int na; + long gos_y; + long gos_x; + long gas_y; + long gas_x; + long Radius; + + long x, y; + long yc; + long y1; + long DeltaX; + long DeltaY; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + + n = Obj->ARG1; + + gs_y = ( 7 * DeltaY ) / 8; + gs_x = ( 6 * DeltaX ) / 8; + cs = DeltaX / 8; + + yc = Ycr; + y = Ycr - gs_y/2; + x = X1r + cs; + + if ( Obj->ARG3 == 0 ) + { + /* Output line : centered vertically */ + XschToolsSaveXfigLine( x + gs_x, yc, x + gs_x + cs, yc ); + } + else + { + /* Output circle */ + XschToolsSaveXfigCircle( x + gs_x, yc - cs/2, cs, cs ); + } + +/* +** Input connectors +*/ + y1 = Obj->Y + ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + y1 -= XschBoundYmin; + + /* Circle for inversion */ + for (i = 0; i < n; i++) + { + yc = y1; + + if (( Obj->ARG2 & (1 << i)) == 0) + { + XschToolsSaveXfigLine( x - cs, yc, x, yc ); + } + else + { + XschToolsSaveXfigCircle( x - cs, yc - cs/2, cs, cs ); + } + + y1 += ( SCP_BOX_CON_STEP_Y * XSCH_UNIT ); + } +/* +** ToolsSaveXfig Input And gates +*/ + na = n / 2; + + if ( n & 1 ) gas_y = 7 * DeltaY / ( 8 * ( na + 1 ) ); + else gas_y = 7 * DeltaY / ( 8 * na ); + + gas_x = gs_x / 3; + + y1 = Obj->Y + Obj->DY - ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + y1 -= XschBoundYmin; + y1 -= SCP_BOX_CON_STEP_Y * XSCH_UNIT / 2; + + for ( i = 0; i < na; i++ ) + { + yc = y1; + + XschToolsSaveXfigLine( x, yc - gas_y /2, x, yc + gas_y/2); + + /* And Shape */ + + XschToolsSaveXfigLine( + x, yc - gas_y/2, x + gas_x/2, yc - gas_y/2 ); + + XschToolsSaveXfigLine( + x , yc + gas_y/2, + x + gas_x/2, yc + gas_y/2 ); + + XschToolsSaveXfigArc( x, yc - gas_y/2, gas_x, gas_y -1, 90 * 64, -180 * 64); + + y1 -= 2 * ( SCP_BOX_CON_STEP_Y * XSCH_UNIT ); + } + + if ( n & 1 ) + { + y1 = y1 + ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + yc = y1; + + XschToolsSaveXfigLine( x , yc, x + gas_x, yc ); + + + } +/* +** ToolsSaveXfig Output Or gate +*/ + /* Or shape alone */ + gos_y = 2 * DeltaY / 3; + gos_x = ( 2 * gs_x ) / 3; + yc = Ycr; + y = yc + gos_y /2; + x = x + gas_x; + + XschToolsSaveXfigLine( + x, y, x + gos_x/2, y ); + + XschToolsSaveXfigLine( + x , y - gos_y, + x + gos_x/2, y - gos_y ); + + XschToolsSaveXfigArc( x, y - gos_y, gos_x, gos_y, 90 * 64, -180 * 64); + + Radius = (float)(gos_y) * 0.707106781185; + + XschToolsSaveXfigArc( x - (Radius * 5 / 3), yc - Radius, + Radius * 2, Radius * 2, 45 * 64, -90 * 64); +} + +/*------------------------------------------------------------\ +| | +| XschToolsSaveXfigMux | +| | +\------------------------------------------------------------*/ + +static void XschToolsSaveXfigMux( X1r, Y1r, X2r, Y2r, Ycr, Obj ) + + long X1r; + long Y1r; + long X2r; + long Y2r; + long Ycr; + xschobj_list *Obj; +{ + long gs_y; + long gs_x; + long ms_x; + long ms_y; + long cs; + int i; + int ni; + int ns; + + long x, y; + long yc; + long y1; + long y2; + long y3; + long x3; + long DeltaX; + long DeltaY; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + + ns = Obj->ARG1; + ni = Obj->ARG2; + + gs_y = ( 7 * DeltaY ) / 8; + gs_x = ( 6 * DeltaX ) / 8; + cs = DeltaX / 8; + + yc = Ycr; + x = X1r + cs; + +/* +** ToolsSaveXfig Mux Rectangle +*/ + ms_x = gs_x / 2; + + y1 = Obj->Y + (2 * SCP_BOX_CON_BASE_Y + (ni - 1) * SCP_BOX_CON_STEP_Y) * XSCH_UNIT; + y1 -= XschBoundYmin; + + ms_y = y2 - Y1r; + + y2 = y2; + + XschToolsSaveXfigRectangle( x, y2, ms_x, ms_y ); + + XschToolsSaveXfigLine( x, y2, x + ms_x, y2 + ms_y / 2 ); + + XschToolsSaveXfigLine( x + ms_x, y2 + ms_y/2, x, y2 + ms_y ); + + if ( Obj->ARG4 == 0 ) + { + /* Output line : centered vertically */ + XschToolsSaveXfigLine( x + ms_x, y2 + ms_y/2, x + ms_x + cs, y2 + ms_y/2 ); + } + else + { + /* Output circle */ + XschToolsSaveXfigCircle( x + ms_x, y2 + ms_y/2 - cs/2, cs, cs ); + } + + y3 = y2 + ms_y/2; + + XschToolsSaveXfigLine( x + ms_x + cs, y3, x + gs_x + cs, y3 ); + + XschToolsSaveXfigLine( x + gs_x + cs, y3, x + gs_x + cs, yc ); +/* +** Input connectors +*/ + y1 = Obj->Y + ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + y1 -= XschBoundYmin; + + /* Circle for inversion */ + for (i = 0; i < ni; i++) + { + if (( Obj->ARG3 & (1 << i)) == 0) + { + XschToolsSaveXfigLine( x - cs, y3, x, y3 ); + } + else + { + XschToolsSaveXfigCircle( x - cs, y3 - cs/2, cs, cs ); + } + + y1 += ( SCP_BOX_CON_STEP_Y * XSCH_UNIT ); + } + + x3 = x; +/* +** Select connectors +*/ + for (i = 0; i < ns; i++) + { + x3 += ms_x / ( ns + 1 ); + + XschToolsSaveXfigLine( x - cs, y3, x3, y3 ); + + XschToolsSaveXfigLine( x3, y3, x3, y2 ); + + y1 += ( SCP_BOX_CON_STEP_Y * XSCH_UNIT ); + } +} + + +/*------------------------------------------------------------\ +| | +| XschToolsSaveXfigOrAnd | +| | +\------------------------------------------------------------*/ + +static void XschToolsSaveXfigOrAnd( X1r, Y1r, X2r, Y2r, Ycr, Obj ) + + long X1r; + long Y1r; + long X2r; + long Y2r; + long Ycr; + xschobj_list *Obj; +{ + long gs_y; + long gs_x; + long cs; + int i; + int n; + int no; + long gos_y; + long gos_x; + long gas_y; + long gas_x; + long Radius; + + long x, y; + long yc; + long y1; + long DeltaX; + long DeltaY; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + + n = Obj->ARG1; + + gs_y = ( 7 * DeltaY ) / 8; + gs_x = ( 6 * DeltaX ) / 8; + cs = DeltaX / 8; + + yc = Ycr; + y = Ycr - gs_y/2; + x = X1r + cs; + + if ( Obj->ARG3 == 0 ) + { + /* Output line : centered vertically */ + XschToolsSaveXfigLine( x + gs_x, yc, x + gs_x + cs, yc ); + } + else + { + /* Output circle */ + XschToolsSaveXfigCircle( x + gs_x, yc - cs/2, cs, cs ); + } + +/* +** Input connectors +*/ + y1 = Obj->Y + ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + y1 -= XschBoundYmin; + + /* Circle for inversion */ + for (i = 0; i < n; i++) + { + yc = y1; + + if (( Obj->ARG2 & (1 << i)) == 0) + { + XschToolsSaveXfigLine( x - cs, yc, x, yc ); + } + else + { + XschToolsSaveXfigCircle( x - cs, yc - cs/2, cs, cs ); + } + + y1 += ( SCP_BOX_CON_STEP_Y * XSCH_UNIT ); + } +/* +** ToolsSaveXfig Input Or gates +*/ + no = n / 2; + + if ( n & 1 ) gos_y = 7 * DeltaY / ( 8 * ( no + 1 ) ); + else gos_y = 7 * DeltaY / ( 8 * no ); + + gos_x = gs_x / 3; + + y1 = Obj->Y + Obj->DY - ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + y1 -= XschBoundYmin; + y1 -= SCP_BOX_CON_STEP_Y * XSCH_UNIT / 2; + + for ( i = 0; i < no; i++ ) + { + yc = y1; + + /* Or shape alone */ + XschToolsSaveXfigLine( x , yc + gos_y/2, x + gos_x/2, yc + gos_y/2 ); + + XschToolsSaveXfigLine( x , yc - gos_y/2, x + gos_x/2, yc - gos_y/2 ); + + XschToolsSaveXfigArc( x, yc - gos_y/2, gos_x, gos_y-1, 90 * 64, -180 * 64); + + Radius = (float)(gos_y) * 0.707106781185; + + XschToolsSaveXfigArc( x - (Radius * 5 / 3), yc - Radius, + Radius * 2, Radius * 2, 45 * 64, -90 * 64); + + + y1 -= 2 * ( SCP_BOX_CON_STEP_Y * XSCH_UNIT ); + } + + if ( n & 1 ) + { + y1 = y1 + ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + yc = y1; + + XschToolsSaveXfigLine( x , yc, x + gos_x, yc ); + + } + + /* ToolsSaveXfig output And Gate */ + gas_y = 2 * DeltaY / 3; + gas_x = ( 2 * gs_x ) / 3; + yc = Ycr; + y = yc + gas_y /2; + x = x + gos_x; + + XschToolsSaveXfigLine( x, yc - gas_y /2, x, yc + gas_y/2); + + + XschToolsSaveXfigLine( x, yc - gas_y/2, x + gas_x/2, yc - gas_y/2 ); + + XschToolsSaveXfigLine( x , yc + gas_y/2, x + gas_x/2, yc + gas_y/2 ); + + XschToolsSaveXfigArc( x, yc - gas_y/2, gas_x, gas_y -1, 90 * 64, -180 * 64); +} + +/*------------------------------------------------------------\ +| | +| XschToolsSaveXfigPentagon | +| | +\------------------------------------------------------------*/ + +void XschToolsSaveXfigPentagon( X1, Y1, X2, Y2, Obj ) + + long X1; + long Y1; + long X2; + long Y2; + xschobj_list *Obj; +{ + long StepX; + long StepY; + + StepY = ( Y2 - Y1 ) >> 1; + StepX = StepY >> 1; + + if ( StepY <= 0 ) StepY = 1; + if ( StepX <= 0 ) StepX = 1; + + fprintf( XschXfigFile, + "2 3 0 1 %d 0 %d 0 -1 0.000 0 0 -1 0 0 7\n", XschXfigColor, XschXfigDepth ); + /* ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ + * | | | | | | | | | | | | | | | + Number Points + * | | | | | | | | | | | | | | + Backward Arrow + * | | | | | | | | | | | | | + Forward Arrow + * | | | | | | | | | | | | + Radius + * | | | | | | | | | | | + Cap style + * | | | | | | | | | | + Join style + * | | | | | | | | | + Style Val + * | | | | | | | | + Area Fill + * | | | | | | | + Pen Style + * | | | | | | + Depth + * | | | | | + Fill Color + * | | | | + Pen Color + * | | | + Width + * | | + Line Style + * | + Poly Line + * + Poly Line + */ + + fprintf( XschXfigFile, " %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld\n", + X1 , XschXfigDy - Y1, + X1 , XschXfigDy - Y2, + X1 , XschXfigDy - Y2, + X2 - StepX, XschXfigDy - Y2, + X2 , XschXfigDy - ( Y1 + StepY ), + X2 - StepX, XschXfigDy - Y1, + X1 , XschXfigDy - Y1 ); +} + +/*------------------------------------------------------------\ +| | +| XschToolsSaveXfigString | +| | +\------------------------------------------------------------*/ + +void XschToolsSaveXfigString( X1, Y1, Text, Justified ) + + long X1; + long Y1; + char *Text; + int Justified; +{ + fprintf( XschXfigFile, + "4 %d %d %d 0 0 0.0 0.0 0 0.0 0.0 %ld %ld %s\\001\n", + /* ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ + * | | | | | | | | | | | | | + String + * | | | | | | | | | | | | + Y + * | | | | | | | | | | | + X + * | | | | | | | | | | + Length + * | | | | | | | | | + Height + * | | | | | | | | + Font flags + * | | | | | | | + Font Angle + * | | | | | | + Font size + * | | | | | + Font + * | | | | + Pen Style + * | | | + Depth + * | | + Pen Color + * | + Justified + * + String + */ + Justified, XschXfigColor, XschXfigDepth, X1, XschXfigDy - Y1, Text ); +} + +/*------------------------------------------------------------\ +| | +| XschToolsSaveXfigObject | +| | +\------------------------------------------------------------*/ + +void XschToolsSaveXfigObject( Obj ) + + xschobj_list *Obj; +{ + int Index; + long X1r; + long X2r; + long Y1r; + long Y2r; + long Ycr; + long DeltaX; + long DeltaY; + short ObjType; + long Length; + long WidthText; + long HeightText; + + if ( IsXschLineLeft( Obj ) ) + { + X1r = Obj->X + Obj->DX; + X2r = Obj->X; + } + else + { + X1r = Obj->X; + X2r = Obj->X + Obj->DX; + } + + if ( IsXschLineDown( Obj ) ) + { + Y1r = Obj->Y + Obj->DY; + Y2r = Obj->Y; + } + else + { + Y1r = Obj->Y; + Y2r = Obj->Y + Obj->DY; + } + + X1r -= XschBoundXmin; + X2r -= XschBoundXmin; + Y1r -= XschBoundYmin; + Y2r -= XschBoundYmin; + + Ycr = (float)( ( Y2r + Y1r) >> 1 ); + X1r = (float)( X1r ); + Y1r = (float)( Y1r ); + X2r = (float)( X2r ); + Y2r = (float)( Y2r ); + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + + ObjType = GetXschObjectType( Obj ); + + if ( ( ObjType >= XSCH_OBJECT_BUFFER ) && + ( ObjType <= XSCH_OBJECT_MUX ) ) + { + if ( ( DeltaX < 5 ) || + ( DeltaY < 5 ) ) ObjType = XSCH_OBJECT_RECTANGLE; + } + + if ( ObjType >= XSCH_OBJECT_CROSS_BOX ) + { + fprintf( XschXfigFile, "6 %ld %ld %ld %ld\n", + X1r, XschXfigDy - Y1r, + X2r, XschXfigDy - Y2r ); + } + + switch ( ObjType ) + { + case XSCH_OBJECT_LINE : + + XschToolsSaveXfigLine( X1r, Y1r, X2r, Y2r ); + + break; + + case XSCH_OBJECT_PENTAGON : + + XschToolsSaveXfigPentagon( X1r, Y1r, X2r, Y2r, Obj ); + + break; + + case XSCH_OBJECT_RECTANGLE : + + XschToolsSaveXfigRectangle( X1r, Y1r, X2r, Y2r ); + + break; + + case XSCH_OBJECT_CROSS_BOX : + + XschToolsSaveXfigRectangle( X1r, Y1r, X2r, Y2r ); + XschToolsSaveXfigLine( X1r, Y1r, X2r, Y2r ); + XschToolsSaveXfigLine( X1r, Y2r, X2r, Y1r ); + + break; + + case XSCH_OBJECT_BUFFER : + + XschToolsSaveXfigBuffer( X1r, Y1r, X2r, Y2r, Ycr, Obj ); + + break; + + case XSCH_OBJECT_AND : + + XschToolsSaveXfigAnd( X1r, Y1r, X2r, Y2r, Ycr, Obj ); + + break; + + case XSCH_OBJECT_OR : + + XschToolsSaveXfigOr( X1r, Y1r, X2r, Y2r, Ycr, Obj ); + + break; + + case XSCH_OBJECT_XOR : + + XschToolsSaveXfigXor( X1r, Y1r, X2r, Y2r, Ycr, Obj ); + + break; + + case XSCH_OBJECT_TRISTATE : + + XschToolsSaveXfigTristate( X1r, Y1r, X2r, Y2r, Ycr, Obj ); + + break; + + case XSCH_OBJECT_REGISTER : + + XschToolsSaveXfigRegister( X1r, Y1r, X2r, Y2r, Ycr, Obj ); + + break; + + case XSCH_OBJECT_TRANSISTOR : + + XschToolsSaveXfigTransistor( X1r, Y1r, X2r, Y2r, Ycr, Obj ); + + break; + + case XSCH_OBJECT_CONSTANT : + + XschToolsSaveXfigConstant( X1r, Y1r, X2r, Y2r, Ycr, Obj ); + + break; + + case XSCH_OBJECT_ANDOR : + + XschToolsSaveXfigAndOr( X1r, Y1r, X2r, Y2r, Ycr, Obj ); + + break; + + case XSCH_OBJECT_ORAND : + + XschToolsSaveXfigOrAnd( X1r, Y1r, X2r, Y2r, Ycr, Obj ); + + break; + + case XSCH_OBJECT_MUX : + + XschToolsSaveXfigMux( X1r, Y1r, X2r, Y2r, Ycr, Obj ); + + break; + } + + if ( Obj->NAME != (char *)0 ) + { + if ( ( ( IsXschSchCon( Obj ) ) && + ( ( ( IsXschSchConExt( Obj ) ) && + ( XSCH_ACTIVE_NAME_TABLE[ XSCH_CONNECTOR_NAME ] ) ) || + ( ( ! IsXschSchConExt( Obj ) ) && + ( XSCH_ACTIVE_NAME_TABLE[ XSCH_INS_CON_NAME ] ) ) ) ) || + ( ( IsXschSchBox( Obj ) && + XSCH_ACTIVE_NAME_TABLE[ XSCH_INSTANCE_NAME ] ) ) || + ( ( IsXschSchNet( Obj ) && + XSCH_ACTIVE_NAME_TABLE[ XSCH_NET_NAME ] ) ) ) + { + Length = strlen( Obj->NAME ); + WidthText = Length * 15; + HeightText = 15; + + if ( Obj->TYPE == XSCH_OBJECT_TEXT_RIGHT ) + { + /* Left */ + XschToolsSaveXfigString( X1r, Y1r, Obj->NAME, 0 ); + } + else + if ( Obj->TYPE == XSCH_OBJECT_TEXT_LEFT ) + { + /* Right */ + XschToolsSaveXfigString( X2r, Y1r, Obj->NAME, 2 ); + } + else + { + /* Center */ + XschToolsSaveXfigString( ( X2r + X1r ) >> 1, Y1r, Obj->NAME, 1 ); + } + } + } + + if ( ObjType >= XSCH_OBJECT_CROSS_BOX ) + { + fprintf( XschXfigFile, "-6\n" ); + } +} + +/*------------------------------------------------------------\ +| | +| XschToolsSaveXfig | +| | +\------------------------------------------------------------*/ + +void XschToolsSaveXfig( FileName ) + + char *FileName; +{ + xschobj_list *Obj; + char *NewFileName; + int Layer; + + + FileName = autbasename( FileName, "fig" ); + + XschXfigFile = mbkfopen( FileName, "fig", "w" ); + + if ( XschXfigFile == (FILE *)0 ) + { + XschErrorMessage( XschMainWindow, "Unable to save fig file !" ); + + return; + } + + XschSetMouseCursor( XschGraphicWindow, XSCH_WATCH_CURSOR ); + + XschXfigDy = XschBoundYmax - XschBoundYmin; +/* +** Xfig header file +*/ + fprintf( XschXfigFile, + "#FIG 3.2\nLandscape\nCenter\nMetric\nA4\n100.00\nSingle\n-2\n1200 2\n" ); + + for ( Layer = 0; Layer < XSCH_MAX_LAYER; Layer++ ) + { + fprintf( XschXfigFile, "0 %d #%06x\n", Layer + 32, XSCH_LAYER_XFIG_COLOR[ Layer ] ); + } + + for ( Layer = 0; Layer < XSCH_MAX_LAYER; Layer++ ) + { + if ( XSCH_ACTIVE_LAYER_TABLE[ Layer ] == 0 ) continue; + + XschXfigDepth = Layer; + XschXfigColor = 32 + Layer; + + if ( ( XschXfigColor == 0 ) || ( XschXfigColor == 8 ) ) XschXfigColor++; + + for ( Obj = XschFigure->OBJECT[ Layer ]; + Obj != (xschobj_list *)NULL; + Obj = Obj->NEXT ) + { + if ( XSCH_ACTIVE_LAYER_TABLE[ Obj->LAYER ] == 0 ) continue; + + XschToolsSaveXfigObject( Obj ); + + } + } + + fclose( XschXfigFile ); + + XschSetMouseCursor( XschGraphicWindow, XSCH_NORMAL_CURSOR ); +} diff --git a/alliance/src/xsch/src/XMT_tools.h b/alliance/src/xsch/src/XMT_tools.h new file mode 100644 index 00000000..89616fe5 --- /dev/null +++ b/alliance/src/xsch/src/XMT_tools.h @@ -0,0 +1,87 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Tools.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_TOOLS +# define XSCH_TOOLS + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct xschhierarchy + { + struct xschhierarchy *NEXT; + char *NAME; + long X; + long Y; + long DX; + long DY; + + } xschhierarchy; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschToolsDelAllHierarchy(); + extern void XschToolsHierarchyUp(); + extern void XschToolsHierarchyReload(); + extern void XschToolsSaveXfig(); + +# endif diff --git a/alliance/src/xsch/src/XMV.h b/alliance/src/xsch/src/XMV.h new file mode 100644 index 00000000..e7fffb3a --- /dev/null +++ b/alliance/src/xsch/src/XMV.h @@ -0,0 +1,124 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : XMV.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_XMV +# define XSCH_XMV + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char XschFirstViewLayer; + +/*------------------------------------------------------------\ +| | +| Panel And Menu | +| | +\------------------------------------------------------------*/ + + extern XschMenuItem XschViewMenu[]; + extern XschPanelItem XschViewArrowsPanel; + extern XschPanelItem XschViewZoomPanel; + extern XschPanelItem XschViewGridPanel; + extern XschPanelItem XschViewLayerPanel; + extern XschPanelItem XschViewMapPanel; + + extern int XschPercentZoom; + extern int XschPercentMoveX; + extern int XschPercentMoveY; + + extern int XschViewArrowsDefaultValues[5]; + extern int XschViewZoomDefaultValues[5]; + extern int XschViewLayerDefaultValues[5]; + extern int XschViewGridDefaultValues[5]; + extern int XschViewMapDefaultValues[5]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Values | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Zoom | +| | +\------------------------------------------------------------*/ + + extern void XschComputeAndDisplayMap(); + extern void XschInitializeZoom(); + extern void XschBuildViewDialog(); + extern void XschBuildPanelMap(); + extern void XschBuildPanelLayer(); + extern void XschInitializeMapEvent(); + + extern void XschZoomCenter(); + extern void XschZoomRefresh(); + extern void XschZoomIn(); + extern void XschZoomPan(); + + extern void XschPromptZoomIn(); + extern void XschPromptZoomPan(); + extern void XschPromptZoomCenter(); + + extern void XschInitializeLayer(); + +# endif diff --git a/alliance/src/xsch/src/XMV_dialog.c b/alliance/src/xsch/src/XMV_dialog.c new file mode 100644 index 00000000..5e84e7b2 --- /dev/null +++ b/alliance/src/xsch/src/XMV_dialog.c @@ -0,0 +1,541 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XMV.h" + +# include "XMV_dialog.h" +# include "XMV_view.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Dialog Box | +| | +\------------------------------------------------------------*/ + + XschDialogItem XschViewZoomSetDialog = + + { + "Zoom set", + XSCH_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackViewZoomSetOk, + (XtPointer)NULL, + (void *)CallbackViewZoomSetCancel, + (XtPointer)NULL + }; + + XschDialogItem XschViewZoomGotoDialog = + + { + "Goto X,Y", + XSCH_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackViewZoomGotoOk, + (XtPointer)NULL, + (void *)CallbackViewZoomGotoCancel, + (XtPointer)NULL + }; + + XschDialogItem XschViewMoveSetDialog = + + { + "Move set dx,dy", + XSCH_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackViewMoveSetOk, + (XtPointer)NULL, + (void *)CallbackViewMoveSetCancel, + (XtPointer)NULL + }; + + XschDialogItem XschViewGridXDialog = + + { + "Grid X", + XSCH_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackViewGridXOk, + (XtPointer)NULL, + (void *)CallbackViewGridXCancel, + (XtPointer)NULL + }; + + XschDialogItem XschViewGridYDialog = + + { + "Grid Y", + XSCH_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackViewGridYOk, + (XtPointer)NULL, + (void *)CallbackViewGridYCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Build Dialog Box | +| | +\------------------------------------------------------------*/ + +void XschBuildViewDialog() + +{ + autbegin(); + + XschBuildDialog( XschMainWindow, &XschViewZoomSetDialog ); + XschBuildDialog( XschMainWindow, &XschViewZoomGotoDialog ); + XschBuildDialog( XschMainWindow, &XschViewMoveSetDialog ); + XschBuildDialog( XschMainWindow, &XschViewGridXDialog ); + XschBuildDialog( XschMainWindow, &XschViewGridYDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Dialog | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackViewZoomSetOk | +| | +\------------------------------------------------------------*/ + +void CallbackViewZoomSetOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *ZoomSet; + int ZoomPercent; + + autbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &ZoomSet ); + + XtUnmanageChild( XschViewZoomSetDialog.WIDGET ); + + XschExitDialog(); + + if ( ZoomSet != (char *)NULL ) + { + ZoomPercent = atoi( ZoomSet ); + + if ( ( ZoomPercent < XSCH_PERCENT_ZOOM_MIN ) || + ( ZoomPercent > XSCH_PERCENT_ZOOM_MAX ) ) + { + XschErrorMessage( XschMainWindow, "The value must be between 5% and 95% !" ); + } + else + { + XschPercentZoom = ZoomPercent; + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewZoomSetCancel | +| | +\------------------------------------------------------------*/ + +void CallbackViewZoomSetCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + autbegin(); + + XtUnmanageChild( XschViewZoomSetDialog.WIDGET ); + + XschExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewZoomGotoOk | +| | +\------------------------------------------------------------*/ + +void CallbackViewZoomGotoOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *ZoomGoto; + int Index; + long GotoX; + long GotoY; + + autbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &ZoomGoto ); + + XtUnmanageChild( XschViewZoomGotoDialog.WIDGET ); + + XschExitDialog(); + + if ( ZoomGoto != (char *)NULL ) + { + for ( Index = 0; ZoomGoto[ Index ]; Index++ ) + { + if ( ZoomGoto[ Index ] == ',' ) + { + ZoomGoto[ Index ] = '\0'; + + if ( Index == 0 ) + { + GotoX = XschUnitGridX + ( XschUnitGridDx >> 1 ); + } + else + { + GotoX = atoi( ZoomGoto ); + } + + if ( ZoomGoto[ Index + 1 ] == '\0' ) + { + GotoY = XschUnitGridY + ( XschUnitGridDy >> 1 ); + } + else + { + GotoY = atoi( ZoomGoto + Index + 1 ); + } + + ZoomGoto = (char *)NULL; + + XschZoomCenter( GotoX, GotoY ); + + break; + } + } + + if ( ZoomGoto != (char *)NULL ) + { + XschErrorMessage( XschMainWindow, "A coordinate must be specified !" ); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewZoomGotoCancel | +| | +\------------------------------------------------------------*/ + +void CallbackViewZoomGotoCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + autbegin(); + + XtUnmanageChild( XschViewZoomGotoDialog.WIDGET ); + + XschExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewMoveSetOk | +| | +\------------------------------------------------------------*/ + +void CallbackViewMoveSetOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *MoveSet; + int MovePercentX; + int MovePercentY; + int Index; + + autbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &MoveSet ); + + XtUnmanageChild( XschViewMoveSetDialog.WIDGET ); + + XschExitDialog(); + + if ( MoveSet != (char *)NULL ) + { + for ( Index = 0; MoveSet[ Index ]; Index++ ) + { + if ( MoveSet[ Index ] == ',' ) + { + MoveSet[ Index ] = '\0'; + + MovePercentX = atoi( MoveSet ); + MovePercentY = atoi( MoveSet + Index + 1 ); + MoveSet = (char *)NULL; + + break; + } + } + + if ( MoveSet != (char *)NULL ) + { + MovePercentY = MovePercentX = atoi( MoveSet ); + } + + if ( ( MovePercentX < XSCH_PERCENT_MOVE_MIN ) || + ( MovePercentX > XSCH_PERCENT_MOVE_MAX ) || + ( MovePercentY < XSCH_PERCENT_MOVE_MIN ) || + ( MovePercentY > XSCH_PERCENT_MOVE_MAX ) ) + { + XschErrorMessage( XschMainWindow, "The values must be between 5% and 95% !" ); + } + else + { + XschPercentMoveX = MovePercentX; + XschPercentMoveY = MovePercentY; + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewMoveSetCancel | +| | +\------------------------------------------------------------*/ + +void CallbackViewMoveSetCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + autbegin(); + + XtUnmanageChild( XschViewMoveSetDialog.WIDGET ); + + XschExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewGridXOk | +| | +\------------------------------------------------------------*/ + +void CallbackViewGridXOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *GridSet; + int GridPercent; + + autbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &GridSet ); + + XtUnmanageChild( XschViewGridXDialog.WIDGET ); + + XschExitDialog(); + + if ( GridSet != (char *)NULL ) + { + GridPercent = atoi( GridSet ); + + if ( GridPercent < 2 ) + { + XschErrorMessage( XschMainWindow, "The value must be greater than one !" ); + } + else + { + XschUnitUserGridDx = GridPercent; + XschZoomRefresh(); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewGridXCancel | +| | +\------------------------------------------------------------*/ + +void CallbackViewGridXCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + autbegin(); + + XtUnmanageChild( XschViewGridXDialog.WIDGET ); + + XschExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewGridYOk | +| | +\------------------------------------------------------------*/ + +void CallbackViewGridYOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *GridSet; + int GridPercent; + + autbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &GridSet ); + + XtUnmanageChild( XschViewGridYDialog.WIDGET ); + + XschExitDialog(); + + if ( GridSet != (char *)NULL ) + { + GridPercent = atoi( GridSet ); + + if ( GridPercent < 2 ) + { + XschErrorMessage( XschMainWindow, "The value must be greater than one !" ); + } + else + { + XschUnitUserGridDy = GridPercent; + XschZoomRefresh(); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewGridYCancel | +| | +\------------------------------------------------------------*/ + +void CallbackViewGridYCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + autbegin(); + + XtUnmanageChild( XschViewGridYDialog.WIDGET ); + + XschExitDialog(); + + autend(); +} diff --git a/alliance/src/xsch/src/XMV_dialog.h b/alliance/src/xsch/src/XMV_dialog.h new file mode 100644 index 00000000..3555b0a3 --- /dev/null +++ b/alliance/src/xsch/src/XMV_dialog.h @@ -0,0 +1,93 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_VIEW_DIALOG +# define XSCH_VIEW_DIALOG + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XschDialogItem XschViewZoomSetDialog; + extern XschDialogItem XschViewZoomGotoDialog; + extern XschDialogItem XschViewMoveSetDialog; + extern XschDialogItem XschViewGridXDialog; + extern XschDialogItem XschViewGridYDialog; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback View Dialog | +| | +\------------------------------------------------------------*/ + + extern void CallbackViewZoomGotoOk(); + extern void CallbackViewZoomGotoCancel(); + extern void CallbackViewZoomSetOk(); + extern void CallbackViewZoomSetCancel(); + extern void CallbackViewMoveSetOk(); + extern void CallbackViewMoveSetCancel(); + extern void CallbackViewGridXOk(); + extern void CallbackViewGridXCancel(); + extern void CallbackViewGridYOk(); + extern void CallbackViewGridYCancel(); + +# endif diff --git a/alliance/src/xsch/src/XMV_map.c b/alliance/src/xsch/src/XMV_map.c new file mode 100644 index 00000000..bd09e5b1 --- /dev/null +++ b/alliance/src/xsch/src/XMV_map.c @@ -0,0 +1,756 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Map.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "scl.h" +# include "XSB.h" +# include "XSC.h" +# include "XTB.h" +# include "XMX.h" +# include "XMV.h" + +# include "XMV_map.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XschPanelItem XschViewMapPanel = + + { + "Map", + 1, + 0, + XSCH_VIEW_MAP_X, + XSCH_VIEW_MAP_Y, + 190, + 200, + 0, + 0, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (XschPanelButtonItem *)NULL + }; + + int XschViewMapDefaultValues[ 5 ] = + + { + XSCH_VIEW_MAP_X, + XSCH_VIEW_MAP_Y, + 190, 200, 0 + }; + +/*------------------------------------------------------------\ +| | +| Graphic Map Window | +| | +\------------------------------------------------------------*/ + + Widget XschMapWindow; + Widget XschMapButtonCompute; + Widget XschMapButtonClose; + + Dimension XschMapDx = 0; + Dimension XschMapDy = 0; + + static char XschFirstEnterMap = XSCH_TRUE; + static char XschFirstExpose = XSCH_TRUE; + +/*------------------------------------------------------------\ +| | +| Unit Map | +| | +\------------------------------------------------------------*/ + + float XschUnitMapStep; + + long XschUnitMapX; + long XschUnitMapY; + long XschUnitMapDx; + long XschUnitMapDy; + + long XschBoundMapX; + long XschBoundMapY; + long XschBoundMapDx; + long XschBoundMapDy; + + long XschPixelMapX; + long XschPixelMapY; + +/*------------------------------------------------------------\ +| | +| Expose | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Translation | +| | +\------------------------------------------------------------*/ + + static String XschMapEventTranslation = + + ": CallbackMapEvent( 0 )\n\ + : CallbackMapEvent( 1 )\n\ + : CallbackMapEvent( 2 )"; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Event Callback | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackCloseMap | +| | +\------------------------------------------------------------*/ + +void CallbackCloseMap( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschExitPanel( &XschViewMapPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackMapCompute | +| | +\------------------------------------------------------------*/ + +void CallbackMapCompute( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschComputeAndDisplayMap(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackMapEvent | +| | +\------------------------------------------------------------*/ + +void CallbackMapEvent ( MyWidget, Event, Args, Argc ) + + Widget MyWidget; + XButtonEvent *Event; + String *Args; + int *Argc; +{ + Display *EventDisplay; + char MouseEvent; + long X; + long Y; + + autbegin(); + + EventDisplay = Event->display; + MouseEvent = Args[ 0 ][ 0 ] - '0'; + + X = Event->x; + Y = XschMapDy - Event->y; + + X = X + XschPixelMapX; + Y = Y + XschPixelMapY; + + if ( X < 0 ) + { + X = ((float)(X) / XschUnitMapStep) - 0.5 ; + } + else + { + X = ((float)(X) / XschUnitMapStep) + 0.5 ; + } + + if ( Y < 0 ) + { + Y = ((float)(Y) / XschUnitMapStep) - 0.5 ; + } + else + { + Y = ((float)(Y) / XschUnitMapStep) + 0.5 ; + } + + switch ( MouseEvent ) + { + case XSCH_B1UP : + case XSCH_B2UP : + case XSCH_B3UP : + + XschZoomCenter( X, Y ); + + break; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackMapResize | +| | +\------------------------------------------------------------*/ + +void CallbackMapResize( MyWidget, ClientData, CallData ) + + Widget MyWidget; + XtPointer ClientData; + XmDrawingAreaCallbackStruct *CallData; +{ + if ( ! XschFirstExpose ) + { + autbegin(); + + XschSetMouseCursor( XschGraphicWindow, XSCH_WATCH_CURSOR ); + XschResizeMapWindow(); + XschSetMouseCursor( XschGraphicWindow, XSCH_NORMAL_CURSOR ); + + autend(); + } +} + +/*------------------------------------------------------------\ +| | +| CallbackMapExpose | +| | +\------------------------------------------------------------*/ + +void CallbackMapExpose( MyWidget, ClientData, CallData ) + + Widget MyWidget; + XtPointer ClientData; + XmDrawingAreaCallbackStruct *CallData; +{ + XExposeEvent *ExposeEvent; + + autbegin(); + + ExposeEvent = (XExposeEvent *)CallData->event; + + if ( XschFirstExpose ) + { + XschFirstExpose = XSCH_FALSE; + + XschInitializeMapWindow(); + } + + XschRefreshMapWindow(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Initialize Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschsnitializeMapWindow | +| | +\------------------------------------------------------------*/ + +void XschInitializeMapWindow() + +{ + autbegin(); + + XtVaGetValues( XschMapWindow, + XmNwidth , &XschMapDx, + XmNheight, &XschMapDy, + NULL + ); + + XschInitializeUnitMap(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Graphic Window Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschRefreshMapWindow | +| | +\------------------------------------------------------------*/ + +void XschRefreshMapWindow() +{ + autbegin(); + + XschClearMapWindow(); + XschDisplayUnitMap(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschClearMapWindow | +| | +\------------------------------------------------------------*/ + +void XschClearMapWindow() + +{ + XFillRectangle( XtDisplay( XschMapWindow ), + XtWindow( XschMapWindow ), + XschBackgroundGC, + 0, 0, XschMapDx, XschMapDy ); +} + +/*------------------------------------------------------------\ +| | +| XschResizeMapWindow | +| | +\------------------------------------------------------------*/ + +void XschResizeMapWindow() + +{ + autbegin(); + + XtVaGetValues( XschMapWindow, + XmNwidth, &XschMapDx, + XmNheight, &XschMapDy, + NULL + ); + + XschComputeAndDisplayMap(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschInitializeMapEvent | +| | +\------------------------------------------------------------*/ + +void XschInitializeMapEvent() + +{ + XtActionsRec NewActions; + + autbegin(); + + XtVaSetValues( XschMapWindow, + XmNtranslations, + XtParseTranslationTable( XschMapEventTranslation ), + NULL + ); + + NewActions.string = "CallbackMapEvent"; + NewActions.proc = CallbackMapEvent; + + XtAppAddActions( XschApplication, &NewActions, 1 ); + + XtAddCallback( XschMapWindow, + XmNresizeCallback, + CallbackMapResize, NULL ); + + XtAddCallback( XschMapWindow, + XmNexposeCallback, + CallbackMapExpose, NULL ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Unit Map Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschInitializeUnitMap | +| | +\------------------------------------------------------------*/ + +void XschInitializeUnitMap() + +{ + autbegin(); + + if ( ! XschComputeBound() ) + { + XschBoundMapX = XSCH_DEFAULT_MAP_X; + XschBoundMapY = XSCH_DEFAULT_MAP_Y; + XschBoundMapDx = XSCH_DEFAULT_MAP_DX; + XschBoundMapDy = XSCH_DEFAULT_MAP_DY; + } + else + { + XschBoundMapX = XschBoundXmin / XSCH_UNIT; + XschBoundMapY = XschBoundYmin / XSCH_UNIT; + XschBoundMapDx = XschBoundXmax / XSCH_UNIT; + XschBoundMapDy = XschBoundYmax / XSCH_UNIT; + XschBoundMapDx = XschBoundMapDx - XschBoundMapX; + XschBoundMapDy = XschBoundMapDy - XschBoundMapY; + } + + XschUnitMapX = XschBoundMapX - 2; + XschUnitMapY = XschBoundMapY - 2; + XschUnitMapDx = XschBoundMapDx + 4; + XschUnitMapDy = XschBoundMapDy + 4; + + XschComputeUnitMap(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschComputeUnitMap | +| | +\------------------------------------------------------------*/ + +void XschComputeUnitMap() + +{ + long Delta; + float StepX; + float StepY; + + autbegin(); + + StepX = (float)(XschMapDx) / (float)(XschUnitMapDx); + StepY = (float)(XschMapDy) / (float)(XschUnitMapDy); + + if ( StepX < StepY ) + { + XschUnitMapStep = StepX; + Delta = XschUnitMapDy; + XschUnitMapDy = 1 + ( XschMapDy / StepX ); + Delta = ( XschUnitMapDy - Delta ) >> 1; + XschUnitMapY = XschUnitMapY - Delta; + } + else + { + XschUnitMapStep = StepY; + Delta = XschUnitMapDx; + XschUnitMapDx = 1 + ( XschMapDx / StepY ); + Delta = ( XschUnitMapDx - Delta ) >> 1; + XschUnitMapX = XschUnitMapX - Delta; + } + + XschPixelMapX = (float)(XschUnitMapX) * XschUnitMapStep; + XschPixelMapY = (float)(XschUnitMapY) * XschUnitMapStep; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschDisplayUnitMap | +| | +\------------------------------------------------------------*/ + +void XschDisplayUnitMap() +{ + long X1; + long Y1; + long X2; + long Y2; + + autbegin(); + + X1 = (float)( XschBoundMapX ) * XschUnitMapStep; + Y1 = (float)( XschBoundMapY ) * XschUnitMapStep; + X2 = (float)( XschBoundMapX + XschBoundMapDx ) * XschUnitMapStep; + Y2 = (float)( XschBoundMapY + XschBoundMapDy ) * XschUnitMapStep; + + X1 = X1 - XschPixelMapX; + X2 = X2 - XschPixelMapX; + Y1 = Y1 - XschPixelMapY; + Y2 = Y2 - XschPixelMapY; + + XDrawRectangle( XtDisplay( XschMapWindow ), + XtWindow( XschMapWindow ), + XschLargeTextGC, + X1, XschMapDy - Y2, + X2 - X1, Y2 - Y1 ); + + X1 = XschUnitGridX + ( XschUnitGridDx >> 1 ); + Y1 = XschUnitGridY + ( XschUnitGridDy >> 1 ); + X1 = (float)( X1 ) * XschUnitMapStep; + Y1 = (float)( Y1 ) * XschUnitMapStep; + + X1 = X1 - XschPixelMapX; + Y1 = Y1 - XschPixelMapY; + Y1 = XschMapDy - Y1; + + if ( ( X1 > 0 ) && + ( Y1 > 0 ) && + ( X1 < XschMapDx ) && + ( Y1 < XschMapDy ) ) + { + XDrawLine( XtDisplay( XschMapWindow ), + XtWindow( XschMapWindow ), + XschLargeTextGC, + X1 - 2, Y1, + X1 + 2, Y1 ); + + XDrawLine( XtDisplay( XschMapWindow ), + XtWindow( XschMapWindow ), + XschLargeTextGC, + X1, Y1 - 2, + X1, Y1 + 2 ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschBuildPanelMap | +| | +\------------------------------------------------------------*/ + +void XschBuildPanelMap() +{ + Arg Args[3]; + + autbegin(); + + XtSetArg( Args[0], XmNshadowType , XmSHADOW_ETCHED_IN ); + XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING ); + XtSetArg( Args[2], XmNtitle , XschViewMapPanel.TITLE ); + + XschViewMapPanel.PANEL = + + XmCreateFormDialog( XschMainWindow, "XschViewMapPanel", Args, 3); + + XtAddCallback( XschViewMapPanel.PANEL, XmNdestroyCallback, + XschDestroyDialogCallback, NULL ); + + XschViewMapPanel.PANEL_FORM = + + XtVaCreateManagedWidget( "XschViewMapPanelForm", + xmFormWidgetClass, + XschViewMapPanel.PANEL, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , 100, + NULL + ); + + XschViewMapPanel.FRAME = + + XtVaCreateManagedWidget( "XschViewMapFrame", + xmFrameWidgetClass, + XschViewMapPanel.PANEL_FORM, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + NULL + ); + + XschViewMapPanel.FORM = + + XtVaCreateManagedWidget( "XschViewMapForm", + xmFormWidgetClass, + XschViewMapPanel.FRAME, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , 100, + NULL + ); + + XschMapButtonCompute = + + XtVaCreateManagedWidget( "Compute", + xmPushButtonWidgetClass, + XschViewMapPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 1, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 44, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 89, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 99, + NULL + ); + XschMapButtonClose = + + XtVaCreateManagedWidget( "Close", + xmPushButtonWidgetClass, + XschViewMapPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 45, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 99, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 89, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 99, + NULL + ); + + XschMapWindow = + + XtVaCreateManagedWidget( "XschMapWindow", + xmDrawingAreaWidgetClass, + XschViewMapPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 1, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 99, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 1, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 88, + XmNbackground , 1, + XmNforeground , 0, + NULL + ); + + XtAddCallback( XschMapButtonCompute, + XmNactivateCallback, + CallbackMapCompute, NULL ); + + XtAddCallback( XschMapButtonClose, + XmNactivateCallback, + CallbackCloseMap, NULL ); + + XtVaSetValues( XschViewMapPanel.PANEL, + XmNheight, XschViewMapPanel.HEIGHT, + XmNwidth , XschViewMapPanel.WIDTH, + XmNx , XschViewMapPanel.X, + XmNy , XschViewMapPanel.Y, + NULL ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschEnterMapPanel | +| | +\------------------------------------------------------------*/ + +void XschEnterMapPanel() + +{ + autbegin(); + + XschFirstEnterMap = XSCH_FALSE; + + XschEnterPanel( &XschViewMapPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschComputeAndDisplayMap | +| | +\------------------------------------------------------------*/ + +void XschComputeAndDisplayMap() + +{ + + if ( ! XschFirstEnterMap ) + { + autbegin(); + + XschInitializeUnitMap(); + XschClearMapWindow(); + XschDisplayUnitMap(); + + autend(); + } +} diff --git a/alliance/src/xsch/src/XMV_map.h b/alliance/src/xsch/src/XMV_map.h new file mode 100644 index 00000000..5720c823 --- /dev/null +++ b/alliance/src/xsch/src/XMV_map.h @@ -0,0 +1,102 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Map.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_MAP +# define XSCH_MAP + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XSCH_B1UP 0 +# define XSCH_B2UP 1 +# define XSCH_B3UP 2 + +# define XSCH_VIEW_MAP_X 25 +# define XSCH_VIEW_MAP_Y 520 + +# define XSCH_DEFAULT_MAP_X 0 +# define XSCH_DEFAULT_MAP_Y 0 +# define XSCH_DEFAULT_MAP_DX 40 +# define XSCH_DEFAULT_MAP_DY 40 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern Widget XschMapPanel; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschComputeUnitMap(); + extern void XschInitializeUnitMap(); + extern void XschDisplayUnitMap(); + + extern void XschEnterMapPanel(); + extern void XschClearMapWindow(); + extern void XschResizeMapWindow(); + extern void XschRefreshMapWindow(); + extern void XschInitializeMapWindow(); + + extern void CallbackCloseMap(); + extern void CallbackMapCompute(); + extern void CallbackMapResize(); + extern void CallbackMapExpose(); + extern void CallbackMapEvent(); + +# endif diff --git a/alliance/src/xsch/src/XMV_menu.c b/alliance/src/xsch/src/XMV_menu.c new file mode 100644 index 00000000..1b4e983c --- /dev/null +++ b/alliance/src/xsch/src/XMV_menu.c @@ -0,0 +1,284 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XMV.h" + +# include "XMV_menu.h" +# include "XMV_dialog.h" +# include "XMV_view.h" +# include "XMV_map.h" +# include "XMV_panel.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + char XschFirstViewLayer = 1; + +/*------------------------------------------------------------\ +| | +| Menu | +| | +\------------------------------------------------------------*/ + + XschMenuItem XschViewMenu[] = + + { + { + "Zoom", + 'Z', + "MetaZ", + "Meta Z", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackViewZoom, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XschMenuItem *)NULL + } + , + { + "Layers ", + 'L', + "MetaL", + "Meta L", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackViewLayer, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XschMenuItem *)NULL + } + , + { + "Map", + 'M', + "MetaP", + "Meta P", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackViewMap, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XschMenuItem *)NULL + } + , + { + "Arrows ", + 'A', + "MetaA", + "Meta A", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackViewArrows, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XschMenuItem *)NULL + } + , + { + "Grid ", + 'G', + "MetaG", + "Meta G", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackViewGrid, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XschMenuItem *)NULL + } + , + NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback For Menu | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackViewLayer | +| | +\------------------------------------------------------------*/ + +void CallbackViewLayer( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + if ( XschFirstViewLayer ) + { + XschFirstViewLayer = 0; + + XschInitializeLayer(); + } + + XschEnterPanel( &XschViewLayerPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewGrid | +| | +\------------------------------------------------------------*/ + +void CallbackViewGrid( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschEnterPanel( &XschViewGridPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewArrows | +| | +\------------------------------------------------------------*/ + +void CallbackViewArrows( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschEnterPanel( &XschViewArrowsPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewZoom | +| | +\------------------------------------------------------------*/ + +void CallbackViewZoom( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschEnterPanel( &XschViewZoomPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewMap | +| | +\------------------------------------------------------------*/ + +void CallbackViewMap( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschEnterMapPanel(); + + autend(); +} diff --git a/alliance/src/xsch/src/XMV_menu.h b/alliance/src/xsch/src/XMV_menu.h new file mode 100644 index 00000000..dffef3f8 --- /dev/null +++ b/alliance/src/xsch/src/XMV_menu.h @@ -0,0 +1,82 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_VIEW_MENU +# define XSCH_VIEW_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback View Menu | +| | +\------------------------------------------------------------*/ + + + extern void CallbackViewZoom(); + extern void CallbackViewGrid(); + extern void CallbackViewLayer(); + extern void CallbackViewMap(); + extern void CallbackViewArrows(); + +# endif diff --git a/alliance/src/xsch/src/XMV_message.c b/alliance/src/xsch/src/XMV_message.c new file mode 100644 index 00000000..f0b43c55 --- /dev/null +++ b/alliance/src/xsch/src/XMV_message.c @@ -0,0 +1,158 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Message.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "scl.h" +# include "XSB.h" +# include "XSC.h" +# include "XMX.h" +# include "XTB.h" +# include "XMV.h" +# include "XMV_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschPromptZoomIn | +| | +\------------------------------------------------------------*/ + +void XschPromptZoomIn() + +{ + autbegin(); + + XschDisplayMessage( XSCH_MESSAGE_MODE, "Zoom In" ); + XschDisplayMessage( XSCH_MESSAGE_INFO, "Select window" ); + + switch ( XschCountEventZoom ) + { + case 0 : + + XschDisplayMessage( XSCH_MESSAGE_PROMPT, "Enter first corner" ); + + break; + + case 1 : + + XschDisplayMessage( XSCH_MESSAGE_PROMPT, "Enter second corner" ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschPromptZoomPan | +| | +\------------------------------------------------------------*/ + +void XschPromptZoomPan() + +{ + autbegin(); + + XschDisplayMessage( XSCH_MESSAGE_MODE, "Zoom Pan" ); + XschDisplayMessage( XSCH_MESSAGE_INFO, "Select line" ); + + switch ( XschCountEventZoom ) + { + case 0 : + + XschDisplayMessage( XSCH_MESSAGE_PROMPT, "Enter source point" ); + + break; + + case 1 : + + XschDisplayMessage( XSCH_MESSAGE_PROMPT, "Enter target point" ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschPromptZoomCenter | +| | +\------------------------------------------------------------*/ + +void XschPromptZoomCenter() + +{ + autbegin(); + + XschDisplayMessage( XSCH_MESSAGE_MODE, "Zoom Center" ); + XschDisplayMessage( XSCH_MESSAGE_INFO, "Select point" ); + XschDisplayMessage( XSCH_MESSAGE_PROMPT, "Enter center point" ); + + autend(); +} + diff --git a/alliance/src/xsch/src/XMV_message.h b/alliance/src/xsch/src/XMV_message.h new file mode 100644 index 00000000..a5acaa8d --- /dev/null +++ b/alliance/src/xsch/src/XMV_message.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Message.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_MESSAGE +# define XSCH_MESSAGE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschPromptZoomIn(); + extern void XschPromptZoomCenter(); + extern void XschPromptZoomPan(); + +# endif diff --git a/alliance/src/xsch/src/XMV_panel.c b/alliance/src/xsch/src/XMV_panel.c new file mode 100644 index 00000000..84167502 --- /dev/null +++ b/alliance/src/xsch/src/XMV_panel.c @@ -0,0 +1,2859 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XMV.h" + +# include "XMV_panel.h" +# include "XMV_dialog.h" +# include "XMV_view.h" +# include "XMV_message.h" +# include "XMX_color.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Panel Pixmap | +| | +\------------------------------------------------------------*/ + + static char XschPixmapDownArrow[] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xfe, 0xff, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, + 0x00, 0x02, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, + 0x00, 0x02, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, + 0xf0, 0x03, 0x80, 0x1f, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, + 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x20, 0x00, 0x00, 0x08, + 0x40, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, + 0x00, 0x02, 0x80, 0x00, 0x00, 0x04, 0x40, 0x00, 0x00, 0x08, 0x20, 0x00, + 0x00, 0x10, 0x10, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x40, 0x04, 0x00, + 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + static char XschPixmapLeftArrow[] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x0f, 0x00, 0x00, 0x40, 0x08, 0x00, 0x00, 0x20, 0x08, 0x00, + 0x00, 0x10, 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x04, 0xf8, 0x1f, + 0x00, 0x02, 0x00, 0x10, 0x00, 0x01, 0x00, 0x10, 0x80, 0x00, 0x00, 0x10, + 0x40, 0x00, 0x00, 0x10, 0x20, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, + 0x08, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x20, 0x00, 0x00, 0x10, + 0x40, 0x00, 0x00, 0x10, 0x80, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00, 0x10, + 0x00, 0x02, 0x00, 0x10, 0x00, 0x04, 0xf8, 0x1f, 0x00, 0x08, 0x08, 0x00, + 0x00, 0x10, 0x08, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x40, 0x08, 0x00, + 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + static char XschPixmapRightArrow[] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xf0, 0x01, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x10, 0x04, 0x00, + 0x00, 0x10, 0x08, 0x00, 0x00, 0x10, 0x10, 0x00, 0xf8, 0x1f, 0x20, 0x00, + 0x08, 0x00, 0x40, 0x00, 0x08, 0x00, 0x80, 0x00, 0x08, 0x00, 0x00, 0x01, + 0x08, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x04, 0x08, 0x00, 0x00, 0x08, + 0x08, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x04, + 0x08, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x01, 0x08, 0x00, 0x80, 0x00, + 0x08, 0x00, 0x40, 0x00, 0xf8, 0x1f, 0x20, 0x00, 0x00, 0x10, 0x10, 0x00, + 0x00, 0x10, 0x08, 0x00, 0x00, 0x10, 0x04, 0x00, 0x00, 0x10, 0x02, 0x00, + 0x00, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + static char XschPixmapUpArrow[] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x20, 0x02, 0x00, + 0x00, 0x10, 0x04, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x04, 0x10, 0x00, + 0x00, 0x02, 0x20, 0x00, 0x00, 0x01, 0x40, 0x00, 0x80, 0x00, 0x80, 0x00, + 0x40, 0x00, 0x00, 0x01, 0x20, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x04, + 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x08, + 0x08, 0x00, 0x00, 0x08, 0xf8, 0x01, 0xc0, 0x0f, 0x00, 0x01, 0x40, 0x00, + 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x40, 0x00, + 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x40, 0x00, + 0x00, 0x01, 0x40, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + +/*------------------------------------------------------------\ +| | +| Panel Arrows | +| | +\------------------------------------------------------------*/ + + static char *XschPanelArrowsButtonName[] = + + { + "Left", + "Up", + "Down", + "Right", + "Move Set", + "Close" + }; + + static XschPanelButtonItem XschViewArrowsButton[] = + + { + { + &XschPanelArrowsButtonName[0], + NULL, XschPixmapLeftArrow, 32, 32, + NULL, + NULL, + 0, 0, + 1, 2, + CallbackLeftArrow, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelArrowsButtonName[1], + NULL, XschPixmapUpArrow, 32, 32, + NULL, + NULL, + 1, 0, + 1, 2, + CallbackUpArrow, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelArrowsButtonName[2], + NULL, XschPixmapDownArrow, 32, 32, + NULL, + NULL, + 0, 2, + 1, 2, + CallbackDownArrow, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelArrowsButtonName[3], + NULL, XschPixmapRightArrow, 32, 32, + NULL, + NULL, + 1, 2, + 1, 2, + CallbackRightArrow, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelArrowsButtonName[4], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 4, + 2, 1, + CallbackMoveSet, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelArrowsButtonName[5], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 5, + 2, 1, + CallbackCloseArrows, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XschPanelItem XschViewArrowsPanel = + + { + "Arrows", + 1, + 0, + XSCH_VIEW_ARROWS_X, + XSCH_VIEW_ARROWS_Y, + 100, + 125, + 2, + 6, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XschViewArrowsButton + }; + + int XschViewArrowsDefaultValues[ 5 ] = + + { + XSCH_VIEW_ARROWS_X, + XSCH_VIEW_ARROWS_Y, + 100, 125 , 1 + }; + +/*------------------------------------------------------------\ +| | +| Panel Zoom | +| | +\------------------------------------------------------------*/ + + static char *XschPanelZoomButtonName[] = + + { + "Refresh", + "UnZoom", + "Zoom", + "Mooz", + "Zoom Set", + "Zoom In", + "Center", + "Goto", + "Pan", + "Fit", + "Close" + }; + + + XschPanelButtonItem XschViewZoomButton[] = + + { + { + &XschPanelZoomButtonName[0], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackZoomRefresh, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelZoomButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 1, + 1, 1, + CallbackZoomPrevious, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelZoomButtonName[2], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 2, + 1, 1, + CallbackZoomMore, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelZoomButtonName[3], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 3, + 1, 1, + CallbackZoomLess, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelZoomButtonName[4], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 4, + 1, 1, + CallbackZoomSet, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelZoomButtonName[5], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 5, + 1, 1, + CallbackZoomIn, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelZoomButtonName[6], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 6, + 1, 1, + CallbackZoomCenter, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelZoomButtonName[7], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 7, + 1, 1, + CallbackZoomGoto, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelZoomButtonName[8], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 8, + 1, 1, + CallbackZoomPan, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelZoomButtonName[9], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 9, + 1, 1, + CallbackZoomFit, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelZoomButtonName[10], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 10, + 1, 1, + CallbackCloseZoom, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XschPanelItem XschViewZoomPanel = + + { + "Zoom", + 1, + 0, + XSCH_VIEW_ZOOM_X, + XSCH_VIEW_ZOOM_Y, + 100, + 275, + 1, + 11, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XschViewZoomButton + }; + + int XschViewZoomDefaultValues[ 5 ] = + + { + XSCH_VIEW_ZOOM_X, + XSCH_VIEW_ZOOM_Y, + 100, 275, 1 + }; + +/*------------------------------------------------------------\ +| | +| Panel Grid | +| | +\------------------------------------------------------------*/ + + static char *XschPanelGridButtonName[] = + + { + "Grid X", + "Grid Y", + "Grid Off", + "Close" + }; + + + XschPanelButtonItem XschViewGridButton[] = + + { + { + &XschPanelGridButtonName[0], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackSetGridX, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelGridButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 1, + 1, 1, + CallbackSetGridY, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelGridButtonName[2], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 2, + 1, 1, + CallbackGridOnOff, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelGridButtonName[3], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 3, + 1, 1, + CallbackCloseGrid, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XschPanelItem XschViewGridPanel = + + { + "Grid", + 1, + 0, + XSCH_VIEW_GRID_X, + XSCH_VIEW_GRID_Y, + 100, + 100, + 1, + 4, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XschViewGridButton + }; + + int XschViewGridDefaultValues[ 5 ] = + + { + XSCH_VIEW_GRID_X, + XSCH_VIEW_GRID_Y, + 100, 100, 0 + }; + +/*------------------------------------------------------------\ +| | +| Panel Layer | +| | +\------------------------------------------------------------*/ + + static char *XschViewLayerButtonBackground = "Black"; + static char *XschViewLayerButtonForeground = "White"; + + static char *XschPanelLayerButtonName[] = + + { + "All visible", + "All invisible", + "I/O", + "Gate", + "I/O gate", + "Net", + "Apply", + "Close" + }; + + static char *XschViewLayerCursorType[] = + + { + "Invert", + "Xor" + }; + + static char *XschViewLayerForceDisplay[] = + + { + "Quick display", + "Force display" + }; + + XschPanelButtonItem XschViewLayerButton[] = + + { + { + &XschPanelLayerButtonName[0], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 2, 1, + CallbackLayerAllVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelLayerButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 2, 0, + 2, 1, + CallbackLayerAllInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + NULL, + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + &XschPanelLayerButtonName[2], + NULL, NULL, 0, 0, + &XschViewLayerButtonForeground, + &XschViewLayerButtonBackground, + 0, 0, + 1, 1, + CallbackNameVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + &XschPanelLayerButtonName[2], + NULL, NULL, 0, 0, + &XschViewLayerButtonForeground, + &XschViewLayerButtonBackground, + 0, 0, + 1, 1, + CallbackNameInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + &XschPanelLayerButtonName[3], + NULL, NULL, 0, 0, + &XschViewLayerButtonForeground, + &XschViewLayerButtonBackground, + 0, 0, + 1, 1, + CallbackNameVisible, + (XtPointer)1, + (Widget)NULL + } + , + { + &XschPanelLayerButtonName[3], + NULL, NULL, 0, 0, + &XschViewLayerButtonForeground, + &XschViewLayerButtonBackground, + 0, 0, + 1, 1, + CallbackNameInvisible, + (XtPointer)1, + (Widget)NULL + } + , + { + &XschPanelLayerButtonName[4], + NULL, NULL, 0, 0, + &XschViewLayerButtonForeground, + &XschViewLayerButtonBackground, + 0, 0, + 1, 1, + CallbackNameVisible, + (XtPointer)2, + (Widget)NULL + } + , + { + &XschPanelLayerButtonName[4], + NULL, NULL, 0, 0, + &XschViewLayerButtonForeground, + &XschViewLayerButtonBackground, + 0, 0, + 1, 1, + CallbackNameInvisible, + (XtPointer)2, + (Widget)NULL + } + , + { + &XschPanelLayerButtonName[5], + NULL, NULL, 0, 0, + &XschViewLayerButtonForeground, + &XschViewLayerButtonBackground, + 0, 0, + 1, 1, + CallbackNameVisible, + (XtPointer)3, + (Widget)NULL + } + , + { + &XschPanelLayerButtonName[5], + NULL, NULL, 0, 0, + &XschViewLayerButtonForeground, + &XschViewLayerButtonBackground, + 0, 0, + 1, 1, + CallbackNameInvisible, + (XtPointer)3, + (Widget)NULL + } + , + { + &XschViewLayerCursorType[0], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 8, + 2, 1, + CallbackLayerCursor, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschViewLayerForceDisplay[0], + NULL, NULL, 0, 0, + NULL, + NULL, + 2, 8, + 2, 1, + CallbackLayerForceDisplay, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelLayerButtonName[6], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 9, + 2, 1, + CallbackLayerApply, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XschPanelLayerButtonName[7], + NULL, NULL, 0, 0, + NULL, + NULL, + 2, 9, + 2, 1, + CallbackCloseLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + NULL + }; + + XschPanelItem XschViewLayerPanel = + + { + "Layer", + 1, + 0, + XSCH_VIEW_LAYER_X, + XSCH_VIEW_LAYER_Y, + 300, + 500, + 4, + 45, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XschViewLayerButton + }; + + int XschViewLayerDefaultValues[ 5 ] = + + { + XSCH_VIEW_LAYER_X, + XSCH_VIEW_LAYER_Y, + 300, 500, 0 + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschBuildPanelLayer | +| | +\------------------------------------------------------------*/ + +void XschBuildPanelLayer() +{ + XschPanelButtonItem *Button; + unsigned char Visible; + long Layer; + unsigned char Index; + unsigned char X1; + unsigned char Y1; + + X1 = 0; + Y1 = 1; + Index = 2; + + for ( Layer = 0; Layer < XSCH_MAX_LAYER; Layer++ ) + { + for ( Visible = 0; Visible < 2; Visible++ ) + { + Button = &XschViewLayerButton[ Index + Visible ]; + + Button->LABEL = &XSCH_LAYER_NAME_TABLE[ Layer ][ 0 ]; + Button->FOREGROUND = &XSCH_LAYER_NAME_TABLE[ Layer ][ 1 ]; + Button->BACKGROUND = &XSCH_LAYER_NAME_TABLE[ Layer ][ 2 ]; + + Button->X = X1; + Button->Y = Y1; + Button->CALLDATA = (XtPointer)Layer; + + if ( X1 == 3 ) + { + X1 = 0; Y1 = Y1 + 1; + } + else + { + X1 = X1 + 1; + } + } + + Index = Index + 2; + } + + if ( X1 > 0 ) + { + X1 = 0; + Y1 = Y1 + 1; + } + + for ( Layer = 0; Layer < 4; Layer++ ) + { + for ( Visible = 0; Visible < 2; Visible++ ) + { + Button = &XschViewLayerButton[ Index + Visible ]; + + Button->X = X1; + Button->Y = Y1; + + Button->CALLDATA = (XtPointer)Layer; + + if ( X1 == 3 ) + { + X1 = 0; Y1 = Y1 + 1; + } + else + { + X1 = X1 + 1; + } + } + + Index = Index + 2; + } + + if ( X1 > 0 ) + { + X1 = 0; + Y1 = Y1 + 1; + } + + for ( Layer = 0; Layer < 3; Layer++ ) + { + XschViewLayerButton[ Index ].Y = Y1;; + XschViewLayerButton[ Index + 1 ].Y = Y1;; + + Index = Index + 2; + Y1 = Y1 + 1; + } + + XschViewLayerPanel.ROW = Y1 - 1; + XschViewLayerDefaultValues[ 3 ] = ( Y1 - 1 ) * 25; +} + +/*------------------------------------------------------------\ +| | +| Callback For Arrows | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackLeftArrow | +| | +\------------------------------------------------------------*/ + +void CallbackLeftArrow( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschZoomLeft(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackRightArrow | +| | +\------------------------------------------------------------*/ + +void CallbackRightArrow( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschZoomRight(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackUpArrow | +| | +\------------------------------------------------------------*/ + +void CallbackUpArrow( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschZoomUp(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackDownArrow | +| | +\------------------------------------------------------------*/ + +void CallbackDownArrow( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschZoomDown(); + + autend(); +} + + +/*------------------------------------------------------------\ +| | +| CallbackMoveSet | +| | +\------------------------------------------------------------*/ + +void CallbackMoveSet( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschEnterDialog( &XschViewMoveSetDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCloseArrows | +| | +\------------------------------------------------------------*/ + +void CallbackCloseArrows( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschExitPanel( &XschViewArrowsPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Zoom Callback | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackZoomRefresh | +| | +\------------------------------------------------------------*/ + +void CallbackZoomRefresh( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschZoomRefresh(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomPrevious | +| | +\------------------------------------------------------------*/ + +void CallbackZoomPrevious( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschZoomUndo(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomLess | +| | +\------------------------------------------------------------*/ + +void CallbackZoomLess( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschZoomLess(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomMore | +| | +\------------------------------------------------------------*/ + +void CallbackZoomMore( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschZoomMore(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomSet | +| | +\------------------------------------------------------------*/ + +void CallbackZoomSet( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschEnterDialog( &XschViewZoomSetDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCloseZoom | +| | +\------------------------------------------------------------*/ + +void CallbackCloseZoom( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschExitPanel( &XschViewZoomPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomIn | +| | +\------------------------------------------------------------*/ + +void CallbackZoomIn( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschChangeEditMode( XSCH_ZOOM_IN, + XschPromptZoomIn ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomCenter | +| | +\------------------------------------------------------------*/ + +void CallbackZoomCenter( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschChangeEditMode( XSCH_ZOOM_CENTER, + XschPromptZoomCenter ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomGoto | +| | +\------------------------------------------------------------*/ + +void CallbackZoomGoto( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschEnterDialog( &XschViewZoomGotoDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomPan | +| | +\------------------------------------------------------------*/ + +void CallbackZoomPan( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschChangeEditMode( XSCH_ZOOM_PAN, + XschPromptZoomPan ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomFit | +| | +\------------------------------------------------------------*/ + +void CallbackZoomFit( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschZoomFit(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Grid | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackSetGridX | +| | +\------------------------------------------------------------*/ + +void CallbackSetGridX( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschEnterDialog( &XschViewGridXDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSetGridY | +| | +\------------------------------------------------------------*/ + +void CallbackSetGridY( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschEnterDialog( &XschViewGridYDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackGridOnOff | +| | +\------------------------------------------------------------*/ + +void CallbackGridOnOff( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + XmString Label; + + autbegin(); + + XschUnitUserGrid = ! XschUnitUserGrid; + + if ( XschUnitUserGrid == XSCH_FALSE ) + { + Label = XmStringCreateSimple( "Grid Off" ); + } + else + { + Label = XmStringCreateSimple( "Grid On" ); + } + + XtVaSetValues( MyWidget, XmNlabelString, Label, + XmNresizable , False, + NULL ); + XmStringFree( Label ); + + XschZoomRefresh(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCloseGrid | +| | +\------------------------------------------------------------*/ + +void CallbackCloseGrid( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschExitPanel( &XschViewGridPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Layer | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackLayerAllVisible | +| | +\------------------------------------------------------------*/ + +void CallbackLayerAllVisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschLayerAllVisible(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerAllInvisible | +| | +\------------------------------------------------------------*/ + +void CallbackLayerAllInvisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschLayerAllInvisible(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerVisible | +| | +\------------------------------------------------------------*/ + +void CallbackLayerVisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + if ( XSCH_ACTIVE_LAYER_TABLE[ (int)ClientData ] == 0 ) + { + XschSetLayerVisible( (int)ClientData ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerInvisible | +| | +\------------------------------------------------------------*/ + +void CallbackLayerInvisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + if ( XSCH_ACTIVE_LAYER_TABLE[ (int)ClientData ] ) + { + XschSetLayerInvisible( (int)ClientData ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackNameVisible | +| | +\------------------------------------------------------------*/ + +void CallbackNameVisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + if ( XSCH_ACTIVE_NAME_TABLE[ (int)ClientData ] == 0 ) + { + XschSetNameVisible( ClientData ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackNameInvisible | +| | +\------------------------------------------------------------*/ + +void CallbackNameInvisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + if ( XSCH_ACTIVE_NAME_TABLE[ (int)ClientData ] ) + { + XschSetNameInvisible( ClientData ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerCursor | +| | +\------------------------------------------------------------*/ + +void CallbackLayerCursor( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XSCH_XOR_CURSOR = ! XSCH_XOR_CURSOR; + XschChangeCursor( XSCH_XOR_CURSOR ); + + XschChangeCursorContext(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerForceDisplay | +| | +\------------------------------------------------------------*/ + +void CallbackLayerForceDisplay( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XSCH_FORCE_DISPLAY = ! XSCH_FORCE_DISPLAY; + XschChangeForceDisplay( XSCH_FORCE_DISPLAY ); + + autend(); +} + + +/*------------------------------------------------------------\ +| | +| XschChangeCursor | +| | +\------------------------------------------------------------*/ + +void XschChangeCursor( Type ) + + char Type; +{ + int Pos; + XmString Label; + + autbegin(); + + Pos = 2 + ( ( XSCH_MAX_LAYER + XSCH_MAX_ACTIVE_NAME ) << 1 ); + Label = XmStringCreateSimple( XschViewLayerCursorType[ Type ] ); + + XtVaSetValues( XschViewLayerButton[ Pos ].BUTTON, + XmNlabelString, Label, + XmNresizable , False, + NULL ); + + XmStringFree( Label ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschChangeForceDisplay | +| | +\------------------------------------------------------------*/ + +void XschChangeForceDisplay( Index ) + + char Index; +{ + int Pos; + XmString Label; + + autbegin(); + + Pos = 3 + ( ( XSCH_MAX_LAYER + XSCH_MAX_ACTIVE_NAME ) << 1 ); + Label = XmStringCreateSimple( XschViewLayerForceDisplay[ Index ] ); + + XtVaSetValues( XschViewLayerButton[ Pos ].BUTTON, + XmNlabelString, Label, + XmNresizable , False, + NULL ); + + XmStringFree( Label ); + + autend(); +} + + +/*------------------------------------------------------------\ +| | +| CallbackLayerApply | +| | +\------------------------------------------------------------*/ + +void CallbackLayerApply( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschZoomRefresh(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCloseLayer | +| | +\------------------------------------------------------------*/ + +void CallbackCloseLayer( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XschExitPanel( &XschViewLayerPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschSetLayerVisible | +| | +\------------------------------------------------------------*/ + +void XschSetLayerVisible( Layer ) + + int Layer; +{ + int Index; + char *Background; + char *Foreground; + + autbegin(); + + Index = ( Layer << 1 ) + 2; + + if ( XschViewLayerButton[ Index ].BUTTON != NULL ) + { + XSCH_ACTIVE_LAYER_TABLE[ Layer ] = 1; + + XtVaSetValues( XschViewLayerButton[ Index + 1 ].BUTTON, + XtVaTypedArg , + XmNbackground , + XmRString , + XSCH_BLACK_COLOR_NAME , + strlen( XSCH_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + XtVaSetValues( XschViewLayerButton[ Index + 1 ].BUTTON, + XtVaTypedArg , + XmNforeground , + XmRString , + XSCH_BLACK_COLOR_NAME , + strlen( XSCH_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + Background = *XschViewLayerButton[ Index ].BACKGROUND; + Foreground = *XschViewLayerButton[ Index ].FOREGROUND; + + XtVaSetValues( XschViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNbackground , + XmRString , + Background , + strlen( Background ) + 1, + NULL + ); + + XtVaSetValues( XschViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNforeground , + XmRString , + Foreground , + strlen( Foreground ) + 1, + NULL + ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschSetNameVisible | +| | +\------------------------------------------------------------*/ + +void XschSetNameVisible( Name ) + + int Name; +{ + int Index; + char *Background; + char *Foreground; + + autbegin(); + + Index = 2 + ( ( XSCH_MAX_LAYER + Name ) << 1 ); + + if ( XschViewLayerButton[ Index ].BUTTON != NULL ) + { + XSCH_ACTIVE_NAME_TABLE[ Name ] = 1; + + XtVaSetValues( XschViewLayerButton[ Index + 1 ].BUTTON, + XtVaTypedArg , + XmNbackground , + XmRString , + XSCH_BLACK_COLOR_NAME , + strlen( XSCH_BLACK_COLOR_NAME ) + 1, + NULL + ); + + XtVaSetValues( XschViewLayerButton[ Index + 1 ].BUTTON, + XtVaTypedArg , + XmNforeground , + XmRString , + XSCH_BLACK_COLOR_NAME , + strlen( XSCH_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + Background = *XschViewLayerButton[ Index ].BACKGROUND; + Foreground = *XschViewLayerButton[ Index ].FOREGROUND; + + XtVaSetValues( XschViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNbackground , + XmRString , + Background , + strlen( Background ) + 1, + NULL + ); + + XtVaSetValues( XschViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNforeground , + XmRString , + Foreground , + strlen( Foreground ) + 1, + NULL + ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschSetLayerInvisible | +| | +\------------------------------------------------------------*/ + +void XschSetLayerInvisible( Layer ) + + int Layer; +{ + int Index; + char *Background; + char *Foreground; + + autbegin(); + + Index = 3 + ( Layer << 1 ); + + if ( XschViewLayerButton[ Index ].BUTTON != NULL ) + { + XSCH_ACTIVE_LAYER_TABLE[ Layer ] = 0; + + XtVaSetValues( XschViewLayerButton[ Index - 1 ].BUTTON, + XtVaTypedArg , + XmNbackground , + XmRString , + XSCH_BLACK_COLOR_NAME , + strlen( XSCH_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + XtVaSetValues( XschViewLayerButton[ Index - 1 ].BUTTON, + XtVaTypedArg , + XmNforeground , + XmRString , + XSCH_BLACK_COLOR_NAME , + strlen( XSCH_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + Background = *XschViewLayerButton[ Index ].BACKGROUND; + Foreground = *XschViewLayerButton[ Index ].FOREGROUND; + + XtVaSetValues( XschViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNbackground , + XmRString , + Background , + strlen( Background ) + 1 , + NULL + ); + + XtVaSetValues( XschViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNforeground , + XmRString , + Foreground , + strlen( Foreground ) + 1 , + NULL + ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschSetNameInvisible | +| | +\------------------------------------------------------------*/ + +void XschSetNameInvisible( Name ) + + int Name; +{ + int Index; + char *Background; + char *Foreground; + + autbegin(); + + Index = 3 + ( ( XSCH_MAX_LAYER + Name ) << 1 ); + + if ( XschViewLayerButton[ Index ].BUTTON != NULL ) + { + XSCH_ACTIVE_NAME_TABLE[ Name ] = 0; + + XtVaSetValues( XschViewLayerButton[ Index - 1 ].BUTTON, + XtVaTypedArg , + XmNbackground , + XmRString , + XSCH_BLACK_COLOR_NAME , + strlen( XSCH_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + XtVaSetValues( XschViewLayerButton[ Index - 1 ].BUTTON, + XtVaTypedArg , + XmNforeground , + XmRString , + XSCH_BLACK_COLOR_NAME , + strlen( XSCH_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + Background = *XschViewLayerButton[ Index ].BACKGROUND; + Foreground = *XschViewLayerButton[ Index ].FOREGROUND; + + XtVaSetValues( XschViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNbackground , + XmRString , + Background , + strlen( Background ) + 1 , + NULL + ); + + XtVaSetValues( XschViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNforeground , + XmRString , + Foreground , + strlen( Foreground ) + 1 , + NULL + ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschLayerAllVisible | +| | +\------------------------------------------------------------*/ + +void XschLayerAllVisible() + +{ + int Index; + + autbegin(); + + for ( Index = 0; Index < XSCH_MAX_LAYER; Index++ ) + { + XschSetLayerVisible( Index ); + } + + for ( Index = 0; Index < XSCH_MAX_ACTIVE_NAME; Index++ ) + { + XschSetNameVisible( Index ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschInitializeLayer | +| | +\------------------------------------------------------------*/ + +void XschInitializeLayer() + +{ + int Index; + + autbegin(); + + for ( Index = 0; Index < XSCH_MAX_LAYER; Index++ ) + { + if ( XSCH_ACTIVE_LAYER_TABLE[ Index ] == 0 ) + { + XschSetLayerInvisible( Index ); + } + else + { + XschSetLayerVisible( Index ); + } + } + + for ( Index = 0; Index < XSCH_MAX_ACTIVE_NAME; Index++ ) + { + if ( XSCH_ACTIVE_NAME_TABLE[ Index ] == 0 ) + { + XschSetNameInvisible( Index ); + } + else + { + XschSetNameVisible( Index ); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschLayerAllInvisible | +| | +\------------------------------------------------------------*/ + +void XschLayerAllInvisible() + +{ + int Index; + + autbegin(); + + for ( Index = 0; Index < XSCH_MAX_LAYER; Index++ ) + { + XschSetLayerInvisible( Index ); + } + + for ( Index = 0; Index < XSCH_MAX_ACTIVE_NAME; Index++ ) + { + XschSetNameInvisible( Index ); + } + + autend(); +} diff --git a/alliance/src/xsch/src/XMV_panel.h b/alliance/src/xsch/src/XMV_panel.h new file mode 100644 index 00000000..44819faf --- /dev/null +++ b/alliance/src/xsch/src/XMV_panel.h @@ -0,0 +1,130 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_VIEW_PANEL +# define XSCH_VIEW_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XSCH_VIEW_ARROWS_X 990 +# define XSCH_VIEW_ARROWS_Y 80 +# define XSCH_VIEW_ZOOM_X 990 +# define XSCH_VIEW_ZOOM_Y 230 +# define XSCH_VIEW_GRID_X 470 +# define XSCH_VIEW_GRID_Y 330 +# define XSCH_VIEW_LAYER_X 350 +# define XSCH_VIEW_LAYER_Y 110 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback View Panel | +| | +\------------------------------------------------------------*/ + + extern void CallbackLeftArrow(); + extern void CallbackRightArrow(); + extern void CallbackUpArrow(); + extern void CallbackDownArrow(); + extern void CallbackMoveSet(); + extern void CallbackCloseArrows(); + + extern void CallbackZoomRefresh(); + extern void CallbackZoomPrevious(); + extern void CallbackZoomLess(); + extern void CallbackZoomMore(); + extern void CallbackZoomSet(); + extern void CallbackZoomIn(); + extern void CallbackZoomFit(); + extern void CallbackZoomCenter(); + extern void CallbackZoomGoto(); + extern void CallbackZoomPan(); + extern void CallbackCloseZoom(); + + extern void CallbackSetGridX(); + extern void CallbackSetGridY(); + extern void CallbackGridOnOff(); + extern void CallbackCloseGrid(); + + extern void CallbackLayerAllVisible(); + extern void CallbackLayerAllInvisible(); + extern void CallbackLayerVisible(); + extern void CallbackLayerInvisible(); + extern void CallbackNameVisible(); + extern void CallbackNameInvisible(); + extern void CallbackLayerCursor(); + extern void CallbackLayerForceDisplay(); + extern void CallbackLayerApply(); + extern void CallbackCloseLayer(); + + extern void XschChangeForceDisplay(); + extern void XschChangeCursor(); + + extern void XschSetLayerVisible(); + extern void XschSetLayerInvisible(); + extern void XschSetNameVisible(); + extern void XschSetNameInvisible(); + extern void XschLayerAllVisible(); + extern void XschLayerAllInvisible(); + +# endif diff --git a/alliance/src/xsch/src/XMV_view.c b/alliance/src/xsch/src/XMV_view.c new file mode 100644 index 00000000..f0893ac7 --- /dev/null +++ b/alliance/src/xsch/src/XMV_view.c @@ -0,0 +1,672 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : View.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XSB.h" +# include "scl.h" +# include "XSC.h" +# include "XTB.h" +# include "XMX.h" +# include "XMV.h" + +# include "XMV_view.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + xschzoom *XschHeadZoom = (xschzoom *)NULL; + + int XschPercentZoom = XSCH_PERCENT_ZOOM; + int XschPercentMoveX = XSCH_PERCENT_MOVE; + int XschPercentMoveY = XSCH_PERCENT_MOVE; + +/*------------------------------------------------------------\ +| | +| Menu | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschAllocZoom | +| | +\------------------------------------------------------------*/ + +xschzoom *XschAllocZoom () + +{ + return ( (xschzoom *) autalloc( sizeof ( xschzoom ), 1)); +} + +/*------------------------------------------------------------\ +| | +| XschFreeZoom | +| | +\------------------------------------------------------------*/ + +void XschFreeZoom ( FreeZoom ) + + xschzoom *FreeZoom; + +{ + autfree( (char *)FreeZoom, sizeof(FreeZoom) ); +} + +/*------------------------------------------------------------\ +| | +| XschAddZoom | +| | +\------------------------------------------------------------*/ + +void XschAddZoom () + +{ + xschzoom *XschZoom; + + autbegin(); + + XschZoom = XschAllocZoom (); + XschZoom->X = XschUnitGridX; + XschZoom->Y = XschUnitGridY; + XschZoom->DX = XschUnitGridDx; + XschZoom->DY = XschUnitGridDy; + XschZoom->NEXT = XschHeadZoom; + XschHeadZoom = XschZoom; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschDelZoom | +| | +\------------------------------------------------------------*/ + +char XschDelZoom() + +{ + xschzoom *XschZoom; + + if ( XschHeadZoom != (xschzoom *) NULL ) + { + autbegin(); + + XschZoom = XschHeadZoom; + XschHeadZoom = XschHeadZoom->NEXT; + XschFreeZoom( XschZoom ); + + autend(); + return( XSCH_TRUE ); + } + + return( XSCH_FALSE ); +} + +/*------------------------------------------------------------\ +| | +| XschInitializeZoom | +| | +\------------------------------------------------------------*/ + +void XschInitializeZoom() + +{ + autbegin(); + + while( XschDelZoom() != XSCH_FALSE ); + + if ( XschComputeBound() == XSCH_FALSE ) + { + XschInitializeUnitGrid(); + } + else + { + XschUnitGridX = ( XschBoundXmin / XSCH_UNIT ) - 1; + XschUnitGridY = ( XschBoundYmin / XSCH_UNIT ) - 1; + XschUnitGridDx = ( XschBoundXmax / XSCH_UNIT ); + XschUnitGridDy = ( XschBoundYmax / XSCH_UNIT ); + XschUnitGridDx = XschUnitGridDx - XschUnitGridX + 1; + XschUnitGridDy = XschUnitGridDy - XschUnitGridY + 1; + + XschComputeUnitGrid(); + } + + XschComputeAndDisplayMap(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschZoomUndo | +| | +\------------------------------------------------------------*/ + +void XschZoomUndo() + +{ + autbegin(); + + if ( XschHeadZoom == (xschzoom *)NULL ) + { + XschErrorMessage( XschMainWindow, "No previous zoom !" ); + } + else + { + XschSetMouseCursor( XschGraphicWindow, XSCH_WATCH_CURSOR ); + + XschUnitGridX = XschHeadZoom->X; + XschUnitGridY = XschHeadZoom->Y; + XschUnitGridDx = XschHeadZoom->DX; + XschUnitGridDy = XschHeadZoom->DY; + + XschComputeUnitGrid(); + XschComputeAndDisplayMap(); + + XschDisplayFigure( 0, 0, + XschGraphicDx, XschGraphicDy ); + + XschRefreshGraphicWindow( 0, 0, + XschGraphicDx, XschGraphicDy); + + XschSetMouseCursor( XschGraphicWindow, XSCH_NORMAL_CURSOR ); + + XschDelZoom(); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschZoomRight | +| | +\------------------------------------------------------------*/ + +void XschZoomRight() + +{ + long Delta; + long Offset; + long XschOldPixelGridX; + + autbegin(); + + XschSetMouseCursor( XschGraphicWindow, XSCH_WATCH_CURSOR ); + + Delta = ( XschPercentMoveX * XschUnitGridDx ) / 100; + + if ( Delta == 0 ) Delta = 1; + + XschUnitGridX = XschUnitGridX + Delta; + XschOldPixelGridX = XschPixelGridX; + XschPixelGridX = (float)(XschUnitGridX) * XschUnitGridStep; + Offset = XschPixelGridX - XschOldPixelGridX; + + XCopyArea( XschGraphicDisplay, + XschGraphicPixmap, + XschGraphicPixmap, + XschBackgroundGC, + Offset, 0, + XschGraphicDx - Offset, + XschGraphicDy, + 0, 0 + ); + + XschComputeAndDisplayMap(); + XschDisplayFigure( XschGraphicDx - Offset, 0, + XschGraphicDx, XschGraphicDy ); + XschRefreshGraphicWindow( 0, 0, + XschGraphicDx, XschGraphicDy); + + XschSetMouseCursor( XschGraphicWindow, XSCH_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschZoomLeft | +| | +\------------------------------------------------------------*/ + +void XschZoomLeft() + +{ + long Delta; + long Offset; + long XschOldPixelGridX; + + autbegin(); + + XschSetMouseCursor( XschGraphicWindow, XSCH_WATCH_CURSOR ); + + Delta = ( XschPercentMoveX * XschUnitGridDx ) / 100; + + if ( Delta == 0 ) Delta = 1; + + XschUnitGridX = XschUnitGridX - Delta; + XschOldPixelGridX = XschPixelGridX; + XschPixelGridX = (float)(XschUnitGridX) * XschUnitGridStep; + Offset = XschOldPixelGridX - XschPixelGridX; + + XCopyArea( XschGraphicDisplay, + XschGraphicPixmap, + XschGraphicPixmap, + XschBackgroundGC, + 0, 0, + XschGraphicDx - Offset, + XschGraphicDy, + Offset, 0 + ); + + XschComputeAndDisplayMap(); + XschDisplayFigure( 0, 0, Offset, XschGraphicDy ); + XschRefreshGraphicWindow( 0, 0, XschGraphicDx, XschGraphicDy); + + XschSetMouseCursor( XschGraphicWindow, XSCH_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschZoomDown | +| | +\------------------------------------------------------------*/ + +void XschZoomDown() + +{ + long Delta; + long Offset; + long XschOldPixelGridY; + + autbegin(); + + XschSetMouseCursor( XschGraphicWindow, XSCH_WATCH_CURSOR ); + + Delta = ( XschPercentMoveY * XschUnitGridDy ) / 100; + + if ( Delta == 0 ) Delta = 1; + + XschUnitGridY = XschUnitGridY - Delta; + XschOldPixelGridY = XschPixelGridY; + XschPixelGridY = (float)(XschUnitGridY) * XschUnitGridStep; + Offset = XschOldPixelGridY - XschPixelGridY; + + XCopyArea( XschGraphicDisplay, + XschGraphicPixmap, + XschGraphicPixmap, + XschBackgroundGC, + 0, Offset, + XschGraphicDx, + XschGraphicDy - Offset, + 0, 0 + ); + + XschComputeAndDisplayMap(); + XschDisplayFigure( 0, 0, XschGraphicDx, Offset ); + XschRefreshGraphicWindow( 0, 0, XschGraphicDx, XschGraphicDy); + + XschSetMouseCursor( XschGraphicWindow, XSCH_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschZoomUp | +| | +\------------------------------------------------------------*/ + +void XschZoomUp() + +{ + long Delta; + long Offset; + long XschOldPixelGridY; + + autbegin(); + + XschSetMouseCursor( XschGraphicWindow, XSCH_WATCH_CURSOR ); + + Delta = ( XschPercentMoveY * XschUnitGridDy ) / 100; + + if ( Delta == 0 ) Delta = 1; + + XschUnitGridY = XschUnitGridY + Delta; + XschOldPixelGridY = XschPixelGridY; + XschPixelGridY = (float)(XschUnitGridY) * XschUnitGridStep; + Offset = XschPixelGridY - XschOldPixelGridY; + + XCopyArea( XschGraphicDisplay, + XschGraphicPixmap, + XschGraphicPixmap, + XschBackgroundGC, + 0, 0, + XschGraphicDx, + XschGraphicDy - Offset, + 0, Offset + ); + + XschComputeAndDisplayMap(); + XschDisplayFigure( 0, XschGraphicDy - Offset, + XschGraphicDx, XschGraphicDy ); + XschRefreshGraphicWindow( 0, 0, XschGraphicDx, XschGraphicDy); + + XschSetMouseCursor( XschGraphicWindow, XSCH_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschZoomMore | +| | +\------------------------------------------------------------*/ + +void XschZoomMore() + +{ + long DeltaX; + long DeltaY; + + autbegin(); + + XschSetMouseCursor( XschGraphicWindow, XSCH_WATCH_CURSOR ); + + DeltaX = ( XschPercentZoom * XschUnitGridDx ) / 100; + DeltaY = ( XschPercentZoom * XschUnitGridDy ) / 100; + + if ( ( DeltaX >= 2 ) && + ( DeltaY >= 2 ) ) + { + XschAddZoom(); + + XschUnitGridX = XschUnitGridX + (DeltaX >> 1); + XschUnitGridY = XschUnitGridY + (DeltaY >> 1); + XschUnitGridDx = XschUnitGridDx - DeltaX; + XschUnitGridDy = XschUnitGridDy - DeltaY; + + XschComputeUnitGrid(); + XschComputeAndDisplayMap(); + XschDisplayFigure( 0, 0, XschGraphicDx, XschGraphicDy ); + XschRefreshGraphicWindow( 0, 0, XschGraphicDx, XschGraphicDy ); + } + + XschSetMouseCursor( XschGraphicWindow, XSCH_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschZoomLess | +| | +\------------------------------------------------------------*/ + +void XschZoomLess() + +{ + long DeltaX; + long DeltaY; + + autbegin(); + + XschSetMouseCursor( XschGraphicWindow, XSCH_WATCH_CURSOR ); + + DeltaX = 100 * XschUnitGridDx / ( 100 - XschPercentZoom ); + DeltaY = 100 * XschUnitGridDy / ( 100 - XschPercentZoom ); + + XschAddZoom(); + + XschUnitGridX = XschUnitGridX - ((DeltaX - XschUnitGridDx) >> 1); + XschUnitGridY = XschUnitGridY - ((DeltaY - XschUnitGridDy) >> 1); + XschUnitGridDx = DeltaX; + XschUnitGridDy = DeltaY; + + XschComputeUnitGrid(); + XschComputeAndDisplayMap(); + XschDisplayFigure( 0, 0, XschGraphicDx, XschGraphicDy ); + XschRefreshGraphicWindow( 0, 0, XschGraphicDx, XschGraphicDy ); + + XschSetMouseCursor( XschGraphicWindow, XSCH_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschZoomFit | +| | +\------------------------------------------------------------*/ + +void XschZoomFit() + +{ + autbegin(); + + XschSetMouseCursor( XschGraphicWindow, XSCH_WATCH_CURSOR ); + + if ( XschComputeBound() == XSCH_FALSE ) + { + XschErrorMessage( XschMainWindow, "No element to display !" ); + } + else + { + XschAddZoom(); + + XschUnitGridX = ( XschBoundXmin / XSCH_UNIT ) - 1; + XschUnitGridY = ( XschBoundYmin / XSCH_UNIT ) - 1; + XschUnitGridDx = XschBoundXmax / XSCH_UNIT; + XschUnitGridDy = XschBoundYmax / XSCH_UNIT; + XschUnitGridDx = XschUnitGridDx - XschUnitGridX + 1; + XschUnitGridDy = XschUnitGridDy - XschUnitGridY + 1; + + XschComputeUnitGrid(); + XschComputeAndDisplayMap(); + XschDisplayFigure( 0, 0, XschGraphicDx, XschGraphicDy ); + XschRefreshGraphicWindow( 0, 0, XschGraphicDx, XschGraphicDy ); + } + + XschSetMouseCursor( XschGraphicWindow, XSCH_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschZoomCenter | +| | +\------------------------------------------------------------*/ + +void XschZoomCenter( UnitX, UnitY ) + + long UnitX; + long UnitY; +{ + autbegin(); + + XschSetMouseCursor( XschGraphicWindow, XSCH_WATCH_CURSOR ); + + XschUnitGridX = UnitX - ( XschUnitGridDx >> 1 ); + XschUnitGridY = UnitY - ( XschUnitGridDy >> 1 ); + + XschComputeUnitGrid(); + XschComputeAndDisplayMap(); + XschDisplayFigure( 0, 0, XschGraphicDx, XschGraphicDy ); + XschRefreshGraphicWindow( 0, 0, XschGraphicDx, XschGraphicDy ); + + XschSetMouseCursor( XschGraphicWindow, XSCH_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschZoomIn | +| | +\------------------------------------------------------------*/ + +void XschZoomIn( UnitX1, UnitY1, UnitX2, UnitY2 ) + + long UnitX1; + long UnitY1; + long UnitX2; + long UnitY2; +{ + long Swap; + + autbegin(); + + if ( ( UnitX1 != UnitX2 ) && + ( UnitY1 != UnitY2 ) ) + { + if ( UnitX1 > UnitX2 ) + { + Swap = UnitX1; UnitX1 = UnitX2; UnitX2 = Swap; + } + + if ( UnitY1 > UnitY2 ) + { + Swap = UnitY1; UnitY1 = UnitY2; UnitY2 = Swap; + } + + XschSetMouseCursor( XschGraphicWindow, XSCH_WATCH_CURSOR ); + + XschAddZoom(); + + XschUnitGridX = UnitX1; + XschUnitGridY = UnitY1; + XschUnitGridDx = UnitX2 - UnitX1; + XschUnitGridDy = UnitY2 - UnitY1; + + XschComputeUnitGrid(); + XschComputeAndDisplayMap(); + XschDisplayFigure( 0, 0, XschGraphicDx, XschGraphicDy ); + XschRefreshGraphicWindow( 0, 0, XschGraphicDx, XschGraphicDy ); + + XschSetMouseCursor( XschGraphicWindow, XSCH_NORMAL_CURSOR ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschZoomPan | +| | +\------------------------------------------------------------*/ + +void XschZoomPan( UnitX1, UnitY1, UnitX2, UnitY2 ) + + long UnitX1; + long UnitY1; + long UnitX2; + long UnitY2; +{ + if ( ( UnitX1 != UnitX2 ) || + ( UnitY1 != UnitY2 ) ) + { + autbegin(); + + XschSetMouseCursor( XschGraphicWindow, XSCH_WATCH_CURSOR ); + + XschUnitGridX = XschUnitGridX + ( UnitX1 - UnitX2 ); + XschUnitGridY = XschUnitGridY + ( UnitY1 - UnitY2 ); + + XschComputeUnitGrid(); + XschComputeAndDisplayMap(); + XschDisplayFigure( 0, 0, XschGraphicDx, XschGraphicDy ); + XschRefreshGraphicWindow( 0, 0, XschGraphicDx, XschGraphicDy ); + + XschSetMouseCursor( XschGraphicWindow, XSCH_NORMAL_CURSOR ); + + autend(); + } +} + +/*------------------------------------------------------------\ +| | +| XschZoomRefresh | +| | +\------------------------------------------------------------*/ + +void XschZoomRefresh() + +{ + autbegin(); + + XschSetMouseCursor( XschGraphicWindow, XSCH_WATCH_CURSOR ); + + XschDisplayFigure( 0, 0, XschGraphicDx, XschGraphicDy ); + XschRefreshGraphicWindow( 0, 0, XschGraphicDx, XschGraphicDy ); + + XschSetMouseCursor( XschGraphicWindow, XSCH_NORMAL_CURSOR ); + + autend(); +} diff --git a/alliance/src/xsch/src/XMV_view.h b/alliance/src/xsch/src/XMV_view.h new file mode 100644 index 00000000..5dd4a446 --- /dev/null +++ b/alliance/src/xsch/src/XMV_view.h @@ -0,0 +1,111 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : View.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_VIEW +# define XSCH_VIEW + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XSCH_PERCENT_ZOOM 30 +# define XSCH_PERCENT_ZOOM_MIN 5 +# define XSCH_PERCENT_ZOOM_MAX 95 + +# define XSCH_PERCENT_MOVE 30 +# define XSCH_PERCENT_MOVE_MIN 5 +# define XSCH_PERCENT_MOVE_MAX 95 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct xschzoom + { + struct xschzoom *NEXT; + + long X; + long Y; + long DX; + long DY; + + } xschzoom; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern int XschPercentZoom; + extern int XschPercentMove; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschZoomUndo(); + extern void XschZoomRefresh(); + + extern void XschZoomLeft(); + extern void XschZoomRight(); + extern void XschZoomUp(); + extern void XschZoomDown(); + + extern void XschZoomMore(); + extern void XschZoomLess(); + + extern void XschZoomFit(); + + extern void XschInitializeZoom(); + extern void XschInitializeUnitGrid(); + +# endif diff --git a/alliance/src/xsch/src/XMX.h b/alliance/src/xsch/src/XMX.h new file mode 100644 index 00000000..443d0891 --- /dev/null +++ b/alliance/src/xsch/src/XMX.h @@ -0,0 +1,274 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : XMX.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_XMX +# define XSCH_XMX + +/*------------------------------------------------------------\ +| | +| Graphic Context | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Colors Define | +| | +\------------------------------------------------------------*/ + +# define XSCH_BLACK_COLOR_NAME "Black" + +/*------------------------------------------------------------\ +| | +| Xsch Message | +| | +\------------------------------------------------------------*/ + +# define XSCH_MAX_MESSAGE 7 + +# define XSCH_MESSAGE_X 0 +# define XSCH_MESSAGE_Y 1 +# define XSCH_MESSAGE_DX 2 +# define XSCH_MESSAGE_DY 3 +# define XSCH_MESSAGE_MODE 4 +# define XSCH_MESSAGE_INFO 5 +# define XSCH_MESSAGE_PROMPT 6 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Xsch Widget | +| | +\------------------------------------------------------------*/ + + extern XtAppContext XschApplication; + extern Widget XschTopLevel; + extern Widget XschMainWindow; + extern Widget XschMainForm; + + extern Widget XschMenuBar; + + extern Widget XschGraphicFrame; + extern Widget XschGraphicWindow; + extern Display *XschGraphicDisplay; + + extern Widget XschMessageMainPaned; + extern Widget XschMessageMainForm; + extern Widget XschMessageForm [ XSCH_MAX_MESSAGE ]; + extern Widget XschMessageText [ XSCH_MAX_MESSAGE ]; + extern Widget XschMessageLabel [ XSCH_MAX_MESSAGE ]; + extern Widget XschMessageFrame [ XSCH_MAX_MESSAGE ]; + +/*------------------------------------------------------------\ +| | +| Xsch Graphic Context | +| | +\------------------------------------------------------------*/ + + extern GC XschBackgroundGC; + extern GC XschGridGC; + extern GC XschXorGC; + extern GC XschAcceptDrawGC; + extern GC XschConnectDrawGC; + extern GC XschLayerDrawGC[ XSCH_MAX_LAYER ]; + extern GC XschSmallTextGC; + extern GC XschMediumTextGC; + extern GC XschLargeTextGC; + + extern XFontStruct *XschSmallTextFont; + extern XFontStruct *XschLargeTextFont; + extern XFontStruct *XschMediumTextFont; + +/*------------------------------------------------------------\ +| | +| Xsch Graphic Pixmap | +| | +\------------------------------------------------------------*/ + + extern Pixmap XschGraphicPixmap; + +/*------------------------------------------------------------\ +| | +| Xsch Graphic Size | +| | +\------------------------------------------------------------*/ + + extern Dimension XschOldGraphicDx; + extern Dimension XschOldGraphicDy; + extern Dimension XschGraphicDx; + extern Dimension XschGraphicDy; + +/*------------------------------------------------------------\ +| | +| Xsch Unit Grid | +| | +\------------------------------------------------------------*/ + + extern float XschUnitGridStep; + extern long XschUnitGridX; + extern long XschUnitGridY; + extern long XschUnitGridDx; + extern long XschUnitGridDy; + extern long XschPixelGridX; + extern long XschPixelGridY; + +/*------------------------------------------------------------\ +| | +| User Unit Grid | +| | +\------------------------------------------------------------*/ + + extern long XschUnitUserGridDx; + extern long XschUnitUserGridDy; + extern int XschUnitUserGrid; + +/*------------------------------------------------------------\ +| | +| Xsch Cursor | +| | +\------------------------------------------------------------*/ + + extern long XschUnitCursorX; + extern long XschUnitCursorY; + +/*------------------------------------------------------------\ +| | +| Xsch Event | +| | +\------------------------------------------------------------*/ + + extern int XschCountEventZoom; + extern int XschCountEventEdit; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschInitializeRessources | +| | +\------------------------------------------------------------*/ + + extern void XschInitializeRessources(); + +/*------------------------------------------------------------\ +| | +| Xsch Change Title | +| | +\------------------------------------------------------------*/ + + extern void XschChangeTopLevelTitle(); + +/*------------------------------------------------------------\ +| | +| Xsch Edit Mode | +| | +\------------------------------------------------------------*/ + + extern void XschChangeEditMode(); + extern void XschContinueEditMode(); + +/*------------------------------------------------------------\ +| | +| XschDisplayMessage | +| | +\------------------------------------------------------------*/ + + extern void XschDisplayMessage(); + extern void XschPromptEditMeasure(); + +/*------------------------------------------------------------\ +| | +| Xsch Graphic Window | +| | +\------------------------------------------------------------*/ + + extern void XschClearGraphicWindow(); + extern void XschResizeGraphicWindow(); + extern void XschRefreshGraphicWindow(); + +/*------------------------------------------------------------\ +| | +| Xsch Unit Grid | +| | +\------------------------------------------------------------*/ + + extern void XschComputeUnitGrid(); + extern void XschResizeUnitGrid(); + +/*------------------------------------------------------------\ +| | +| Xsch Display Figure | +| | +\------------------------------------------------------------*/ + + extern void XschDisplayFigure(); + extern void XschDisplayObject(); + +/*------------------------------------------------------------\ +| | +| Xsch Cursor | +| | +\------------------------------------------------------------*/ + + extern void XschDisplayCursor(); + extern void XschUndisplayCursor(); + +# endif diff --git a/alliance/src/xsch/src/XMX_color.c b/alliance/src/xsch/src/XMX_color.c new file mode 100644 index 00000000..75040ea3 --- /dev/null +++ b/alliance/src/xsch/src/XMX_color.c @@ -0,0 +1,344 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Colors.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XSB.h" +# include "XMX.h" +# include "XMX_color.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + GC XschBackgroundGC; + GC XschGridGC; + GC XschAcceptDrawGC; + GC XschConnectDrawGC; + GC XschLayerDrawGC[ XSCH_MAX_LAYER ]; + + GC XschSmallTextGC; + GC XschMediumTextGC; + GC XschLargeTextGC; + GC XschXorGCXor; + GC XschXorGCInvert; + GC XschXorGC; + + XFontStruct *XschLargeTextFont; + XFontStruct *XschMediumTextFont; + XFontStruct *XschSmallTextFont; + + Colormap XschColorMap; + +/*------------------------------------------------------------\ +| | +| Layer Color Define | +| | +\------------------------------------------------------------*/ + + static char **XschColorName[ 5 ] = + + { + &XSCH_BACKGROUND_COLOR_NAME, + &XSCH_FOREGROUND_COLOR_NAME, + &XSCH_CURSOR_COLOR_NAME, + &XSCH_ACCEPT_COLOR_NAME, + &XSCH_CONNECT_COLOR_NAME + }; + + static int XschColor[ XSCH_MAX_COLOR ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschSwitchColormap | +| | +\------------------------------------------------------------*/ + +void XschInitializeColorMap() +{ + Display *ADisplay; + Screen *AScreen; + + ADisplay = XtDisplay( XschTopLevel ); + AScreen = XtScreen( XschTopLevel ); + XschColorMap = DefaultColormapOfScreen( AScreen ); + + if ( XSCH_SWITCH_COLOR_MAP ) + { + XschColorMap = XCopyColormapAndFree( ADisplay, XschColorMap ); + XInstallColormap( ADisplay, XschColorMap ); + XtVaSetValues( XschTopLevel, XmNcolormap, XschColorMap, NULL ); + } +} + +/*------------------------------------------------------------\ +| | +| XschInitializeColors | +| | +\------------------------------------------------------------*/ + +void XschInitializeColors() + +{ + XColor ForgetIt; + XColor GetIt; + int Counter; + char Error; + char *ColorName; + + autbegin(); + + Error = False; + + for ( Counter = 0; Counter < XSCH_MAX_COLOR; Counter++ ) + { + if ( Counter < 5 ) + { + ColorName = *XschColorName[ Counter ]; + } + else + { + ColorName = XSCH_LAYER_NAME_TABLE[ Counter - 5 ][ 1 ]; + } + + if ( ColorName != (char *)NULL ) + { + if ( ! XAllocNamedColor( XschGraphicDisplay, + XschColorMap, ColorName, + &GetIt, &ForgetIt ) ) + { + fprintf ( stderr, "\nXmx: Unable to allocate color '%s' !\n", + ColorName ); + + Error = True; + } + + XschColor[ Counter ] = GetIt.pixel; + } + else + { + XschColor[ Counter ] = XschColor[ 0 ]; + } + } + + if ( Error == True ) exit( 1 ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschChangeCursorContext | +| | +\------------------------------------------------------------*/ + +void XschChangeCursorContext() +{ + if ( XSCH_XOR_CURSOR == XSCH_TRUE ) + { + XschXorGC = XschXorGCXor; + } + else + { + XschXorGC = XschXorGCInvert; + } +} + +/*------------------------------------------------------------\ +| | +| XschInitializeGraphicContext | +| | +\------------------------------------------------------------*/ + +void XschInitializeGraphicContext() + +{ + XGCValues GraphicValue; + int Counter; + Window Root; + + autbegin(); + + XschLargeTextFont = XLoadQueryFont( XschGraphicDisplay, + XSCH_LARGE_TEXT_FONT_NAME ); + + XschMediumTextFont = XLoadQueryFont( XschGraphicDisplay, + XSCH_MEDIUM_TEXT_FONT_NAME ); + + XschSmallTextFont = XLoadQueryFont( XschGraphicDisplay, + XSCH_SMALL_TEXT_FONT_NAME ); + + GraphicValue.foreground = XschColor[ 0 ]; /* Black */ + GraphicValue.background = XschColor[ 0 ]; + GraphicValue.plane_mask = AllPlanes; + + Root = RootWindowOfScreen ( XtScreen ( XschGraphicWindow ) ), + + XschBackgroundGC = XCreateGC ( XschGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + GraphicValue.foreground = XschColor[ 1 ]; /* White */ + + XschGridGC = XCreateGC ( XschGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + GraphicValue.foreground = XschColor[ 1 ]; /* Text */ + + XschSmallTextGC = XCreateGC ( XschGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + XschMediumTextGC = XCreateGC ( XschGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + XschLargeTextGC = XCreateGC ( XschGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + XSetFont( XschGraphicDisplay, + XschSmallTextGC, XschSmallTextFont->fid ); + + XSetFont( XschGraphicDisplay, + XschMediumTextGC, XschMediumTextFont->fid ); + + XSetFont( XschGraphicDisplay, + XschLargeTextGC, XschLargeTextFont->fid ); + + GraphicValue.background = XschColor[ 2 ]; /* Xor Color */ + GraphicValue.foreground = XschColor[ 2 ]; /* Xor Color */ + GraphicValue.function = GXxor; + + XschXorGCXor = XCreateGC ( XschGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCFunction | + GCPlaneMask ), + &GraphicValue ); + + GraphicValue.function = GXinvert; + + XschXorGCInvert = XCreateGC ( XschGraphicDisplay, + Root, + ( GCFunction | + GCPlaneMask ), + &GraphicValue ); + + XschChangeCursorContext(); + + GraphicValue.background = XschColor[ 0 ]; /* Black */ + GraphicValue.foreground = XschColor[ 3 ]; /* Accept Color */ + + XschAcceptDrawGC = XCreateGC ( XschGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + GraphicValue.foreground = XschColor[ 4 ]; /* Connect Color */ + + XschConnectDrawGC = XCreateGC ( XschGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + for ( Counter = 0; Counter < XSCH_MAX_LAYER; Counter++ ) + { + GraphicValue.foreground = XschColor[ Counter + 5 ]; + + XschLayerDrawGC[ Counter ] = + + XCreateGC ( XschGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + } + + autend(); +} diff --git a/alliance/src/xsch/src/XMX_color.h b/alliance/src/xsch/src/XMX_color.h new file mode 100644 index 00000000..beaaaaaa --- /dev/null +++ b/alliance/src/xsch/src/XMX_color.h @@ -0,0 +1,87 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Color.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_COLOR +# define XSCH_COLOR + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Pattern | +| | +\------------------------------------------------------------*/ + +# define XSCH_MAX_COLOR ( 5 + XSCH_MAX_LAYER ) + +# define XSCH_LARGE_TEXT_FONT_NAME "9x15" +# define XSCH_MEDIUM_TEXT_FONT_NAME "7x13" +# define XSCH_SMALL_TEXT_FONT_NAME "5x8" + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschInitializeGraphicContext(); + extern void XschInitializeColors(); + extern void XschChangeCursorContext(); + extern void XschInitializeColorMap(); + +# endif diff --git a/alliance/src/xsch/src/XMX_cursor.c b/alliance/src/xsch/src/XMX_cursor.c new file mode 100644 index 00000000..cc8aaa48 --- /dev/null +++ b/alliance/src/xsch/src/XMX_cursor.c @@ -0,0 +1,515 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Cursor.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XSB.h" +# include "XMX.h" +# include "XMX_grid.h" +# include "XMX_cursor.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Buffer | +| | +\------------------------------------------------------------*/ + + static char XschCursorBuffer[ XSCH_MAX_CURSOR_BUFFER ]; + +/*------------------------------------------------------------\ +| | +| Coordinates | +| | +\------------------------------------------------------------*/ + + Position XschCursorX = 0; + Position XschCursorY = 0; + Position XschCursorSaveX = 0; + Position XschCursorSaveY = 0; + int XschCursorSaved = XSCH_FALSE; + int XschCursorInside = XSCH_FALSE; + int XschCursorType = XSCH_INPUT_HALF_BOX; + + long XschUnitCursorX = 0; + long XschUnitCursorY = 0; + long XschPixelCursorX = 0; + long XschPixelCursorY = 0; + + long XschUnitCursorSaveX[ 2 ] = { 0, 0 }; + long XschUnitCursorSaveY[ 2 ] = { 0, 0 }; + int XschCursorIndex = 0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschComputeCursor | +| | +\------------------------------------------------------------*/ + +void XschComputeCursor( X, Y ) + + Position X; + Position Y; +{ + autbegin(); + + Y = XschGraphicDy - Y; + + XschUnitCursorX = X + XschPixelGridX; + XschUnitCursorY = Y + XschPixelGridY; + + if ( XschUnitCursorX < 0 ) + { + XschUnitCursorX = ((float)(XschUnitCursorX) / XschUnitGridStep) - 0.5 ; + } + else + { + XschUnitCursorX = ((float)(XschUnitCursorX) / XschUnitGridStep) + 0.5 ; + } + + if ( XschUnitCursorY < 0 ) + { + XschUnitCursorY = ((float)(XschUnitCursorY) / XschUnitGridStep) - 0.5 ; + } + else + { + XschUnitCursorY = ((float)(XschUnitCursorY) / XschUnitGridStep) + 0.5 ; + } + + XschPixelCursorX = ((float)(XschUnitCursorX) * XschUnitGridStep); + XschPixelCursorY = ((float)(XschUnitCursorY) * XschUnitGridStep); + + XschCursorX = XschPixelCursorX - XschPixelGridX; + XschCursorY = XschPixelCursorY - XschPixelGridY; + XschCursorY = XschGraphicDy - XschCursorY; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschDisplayCoordinates | +| | +\------------------------------------------------------------*/ + +void XschDisplayCoordinates() + +{ + autbegin(); + + sprintf( XschCursorBuffer, "%ld", XschUnitCursorX ); + XschDisplayMessage( XSCH_MESSAGE_X, XschCursorBuffer ); + + sprintf( XschCursorBuffer, "%ld", XschUnitCursorY ); + XschDisplayMessage( XSCH_MESSAGE_Y, XschCursorBuffer ); + + sprintf( XschCursorBuffer, "%ld", XschUnitCursorX - XschUnitCursorSaveX[0] ); + XschDisplayMessage( XSCH_MESSAGE_DX, XschCursorBuffer ); + + sprintf( XschCursorBuffer, "%ld", XschUnitCursorY - XschUnitCursorSaveY[0] ); + XschDisplayMessage( XSCH_MESSAGE_DY, XschCursorBuffer ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschPointCursor | +| | +\------------------------------------------------------------*/ + +void XschPointCursor() + +{ + autbegin(); + + XschUndisplayCursor(); + + XschUnitCursorSaveX[ XschCursorIndex ] = XschUnitCursorX; + XschUnitCursorSaveY[ XschCursorIndex ] = XschUnitCursorY; + + XschCursorIndex = XschCursorIndex + 1; + + XschDisplayCursor(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschResetCursor | +| | +\------------------------------------------------------------*/ + +void XschResetCursor() + +{ + autbegin(); + + XschUndisplayCursor(); + + XschCursorIndex = XschCursorIndex - 1; + + XschDisplayCursor(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschChangeCursor | +| | +\------------------------------------------------------------*/ + +void XschChangeCursorType( ArrayX, ArrayY, Index, Type ) + + long *ArrayX; + long *ArrayY; + int Index; + int Type; +{ + autbegin(); + + XschUndisplayCursor(); + + XschCursorType = Type; + XschCursorIndex = Index; + + if ( Index != 0 ) + { + XschUnitCursorSaveX[ 0 ] = ArrayX[0]; + XschUnitCursorSaveY[ 0 ] = ArrayY[0]; + XschUnitCursorSaveX[ 1 ] = ArrayX[1]; + XschUnitCursorSaveY[ 1 ] = ArrayY[1]; + } + + XschDisplayCursor(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschDrawCursor | +| | +\------------------------------------------------------------*/ + +void XschDrawCursor() + +{ + long X1; + long Y1; + long X2; + long Y2; + long DeltaX; + long DeltaY; + long Swap; + int DrawLine; + + autbegin(); + + XDrawLine( XschGraphicDisplay, + XtWindow( XschGraphicWindow ), + XschXorGC, + XschCursorSaveX - XSCH_CURSOR_SIZE, + XschCursorSaveY - XSCH_CURSOR_SIZE, + XschCursorSaveX + XSCH_CURSOR_SIZE, + XschCursorSaveY + XSCH_CURSOR_SIZE ); + + XDrawLine( XschGraphicDisplay, + XtWindow( XschGraphicWindow ), + XschXorGC, + XschCursorSaveX - XSCH_CURSOR_SIZE, + XschCursorSaveY + XSCH_CURSOR_SIZE, + XschCursorSaveX + XSCH_CURSOR_SIZE, + XschCursorSaveY - XSCH_CURSOR_SIZE ); + + if ( XschCursorIndex > 0 ) + { + X1 = (float)(XschUnitCursorSaveX[0]) * XschUnitGridStep; + Y1 = (float)(XschUnitCursorSaveY[0]) * XschUnitGridStep; + X1 = X1 - XschPixelGridX; + Y1 = Y1 - XschPixelGridY; + Y1 = XschGraphicDy - Y1; + + if ( XschCursorIndex == 1 ) + { + X2 = XschCursorSaveX; + Y2 = XschCursorSaveY; + } + else + { + X2 = (float)(XschUnitCursorSaveX[1]) * XschUnitGridStep; + Y2 = (float)(XschUnitCursorSaveY[1]) * XschUnitGridStep; + X2 = X2 - XschPixelGridX; + Y2 = Y2 - XschPixelGridY; + Y2 = XschGraphicDy - Y2; + } + + switch( XschCursorType ) + { + case XSCH_INPUT_POINT : + + break; + + case XSCH_INPUT_LINE : + + XDrawLine( XschGraphicDisplay, + XtWindow( XschGraphicWindow ), + XschXorGC, + X1, Y1, X2, Y2 ); + break; + + case XSCH_INPUT_HALF_BOX : + + XDrawLine( XschGraphicDisplay, + XtWindow( XschGraphicWindow ), + XschXorGC, + X1, Y1, X2, Y1 ); + + XDrawLine( XschGraphicDisplay, + XtWindow( XschGraphicWindow ), + XschXorGC, + X2, Y1, X2, Y2 ); + break; + + case XSCH_INPUT_ORTHO : + case XSCH_INPUT_SORTHO : + case XSCH_INPUT_LSTRING : + + DeltaX = X2 - X1; if ( DeltaX < 0 ) DeltaX = - DeltaX; + DeltaY = Y2 - Y1; if ( DeltaY < 0 ) DeltaY = - DeltaY; + + if ( DeltaX > DeltaY ) + { + Y2 = Y1; + + if ( X1 > X2 ) { Swap = X1; X1 = X2; X2 = Swap; } + + if ( X1 < 0 ) X1 = 0; + if ( X2 > XschGraphicDx ) X2 = XschGraphicDx; + + if ( ( X1 < X2 ) && + ( Y1 >= 0 ) && + ( Y1 <= XschGraphicDy ) ) + { + XDrawLine( XschGraphicDisplay, + XtWindow( XschGraphicWindow ), + XschXorGC, + X1, Y1, X2, Y2 ); + } + } + else + { + X2 = X1; + + if ( Y1 > Y2 ) { Swap = Y1; Y1 = Y2; Y2 = Swap; } + + if ( Y1 < 0 ) Y1 = 0; + if ( Y2 > XschGraphicDy ) Y2 = XschGraphicDy; + + if ( ( Y1 < Y2 ) && + ( X1 >= 0 ) && + ( X1 <= XschGraphicDx ) ) + { + XDrawLine( XschGraphicDisplay, + XtWindow( XschGraphicWindow ), + XschXorGC, + X1, Y1, X2, Y2 ); + } + } + + break; + + case XSCH_INPUT_BOX : + + if ( X1 > X2 ) { Swap = X1; X1 = X2; X2 = Swap; } + if ( Y1 > Y2 ) { Swap = Y1; Y1 = Y2; Y2 = Swap; } + + DrawLine = 0; + + if ( X1 < 0 ) { X1 = 0; DrawLine |= XSCH_WEST; } + if ( X2 > XschGraphicDx ) { X2 = XschGraphicDx; DrawLine |= XSCH_EAST; } + if ( Y1 < 0 ) { Y1 = 0; DrawLine |= XSCH_SOUTH; } + if ( Y2 > XschGraphicDy ) { Y2 = XschGraphicDy; DrawLine |= XSCH_NORTH; } + + if ( DrawLine == 0 ) + { + XDrawRectangle( XschGraphicDisplay, + XtWindow( XschGraphicWindow ), + XschXorGC, + X1, Y1, + X2 - X1, Y2 - Y1 ); + } + else + { + if ( ( DrawLine & XSCH_WEST ) == 0 ) + { + XDrawLine( XschGraphicDisplay, + XtWindow( XschGraphicWindow ), + XschXorGC, + X1, Y2, + X1, Y1 ); + } + + if ( ( DrawLine & XSCH_EAST ) == 0 ) + { + XDrawLine( XschGraphicDisplay, + XtWindow( XschGraphicWindow ), + XschXorGC, + X2, Y2, + X2, Y1 ); + } + + if ( ( DrawLine & XSCH_SOUTH ) == 0 ) + { + XDrawLine( XschGraphicDisplay, + XtWindow( XschGraphicWindow ), + XschXorGC, + X1, Y1, + X2, Y1 ); + } + + if ( ( DrawLine & XSCH_NORTH ) == 0 ) + { + XDrawLine( XschGraphicDisplay, + XtWindow( XschGraphicWindow ), + XschXorGC, + X1, Y2, + X2, Y2 ); + } + } + + break; + + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschUndisplayCursor | +| | +\------------------------------------------------------------*/ + +void XschUndisplayCursor() + +{ + autbegin(); + + if ( XschCursorInside == XSCH_TRUE ) + { + if ( XschCursorSaved == XSCH_TRUE ) + { + XschDrawCursor(); + } + + XschCursorSaved = XSCH_FALSE; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschDisplayCursor | +| | +\------------------------------------------------------------*/ + +void XschDisplayCursor() + +{ + autbegin(); + + if ( XschCursorInside == XSCH_TRUE ) + { + if ( XschCursorSaved == XSCH_TRUE ) + { + XschDrawCursor(); + + XschCursorSaved = XSCH_FALSE; + } + + if ( ( XschCursorY >= 0 ) && + ( XschCursorX <= (Position)XschGraphicDx ) ) + { + XschCursorSaveX = XschCursorX; + XschCursorSaveY = XschCursorY; + + XschDrawCursor(); + + XschCursorSaved = XSCH_TRUE; + } + } + + autend(); +} diff --git a/alliance/src/xsch/src/XMX_cursor.h b/alliance/src/xsch/src/XMX_cursor.h new file mode 100644 index 00000000..726bfd6c --- /dev/null +++ b/alliance/src/xsch/src/XMX_cursor.h @@ -0,0 +1,95 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Cursor.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_CURSOR +# define XSCH_CURSOR + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XSCH_MAX_CURSOR_BUFFER 128 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern Position XschCursorX; + extern Position XschCursorY; + extern Position XschCursorSaveX; + extern Position XschCursorSaveY; + extern int XschCursorSaved; + extern int XschCursorInside; + extern long XschLambdaCursorX; + extern long XschLambdaCursorY; + + extern long XschPixelCursorX; + extern long XschPixelCursorY; + + extern long XschPixelCursorX1; + extern long XschPixelCursorY1; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschComputeCursor(); + extern void XschChangeCursorType(); + extern void XschPointCursor(); + extern void XschResetCursor(); + extern void XschDisplayCoordinates(); + +# endif diff --git a/alliance/src/xsch/src/XMX_dialog.c b/alliance/src/xsch/src/XMX_dialog.c new file mode 100644 index 00000000..0209ecd0 --- /dev/null +++ b/alliance/src/xsch/src/XMX_dialog.c @@ -0,0 +1,104 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XSB.h" +# include "XTB.h" +# include "XMF.h" +# include "XME.h" +# include "XMV.h" +# include "XMT.h" +# include "XMS.h" +# include "XMH.h" +# include "XMX.h" + +# include "XMX_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschInitializeDialog | +| | +\------------------------------------------------------------*/ + +void XschInitializeDialog() + +{ + autbegin(); + + XschBuildFileDialog(); + XschBuildEditDialog(); + XschBuildViewDialog(); + XschBuildToolsDialog(); + + autend(); +} diff --git a/alliance/src/xsch/src/XMX_dialog.h b/alliance/src/xsch/src/XMX_dialog.h new file mode 100644 index 00000000..fd84919f --- /dev/null +++ b/alliance/src/xsch/src/XMX_dialog.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_DIALOG +# define XSCH_DIALOG + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschInitializeDialog(); + +# endif diff --git a/alliance/src/xsch/src/XMX_event.c b/alliance/src/xsch/src/XMX_event.c new file mode 100644 index 00000000..436340d3 --- /dev/null +++ b/alliance/src/xsch/src/XMX_event.c @@ -0,0 +1,805 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Event.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "scl.h" +# include "XSB.h" +# include "XSC.h" +# include "XMX.h" +# include "XTB.h" +# include "XME.h" +# include "XMF.h" +# include "XMV.h" +# include "XMS.h" +# include "XMH.h" +# include "XMX_motif.h" +# include "XMX_grid.h" +# include "XMX_cursor.h" +# include "XMX_event.h" +# include "XMX_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Translation | +| | +\------------------------------------------------------------*/ + + static String XschEventTranslation = + + ": CallbackEvent( 0 )\n\ + : CallbackEvent( 1 )\n\ + : CallbackEvent( 2 )\n\ + : CallbackEvent( 3 )\n\ + : CallbackEvent( 4 )\n\ + osfUp: CallbackEvent( 5 )\n\ + osfDown: CallbackEvent( 6 )\n\ + osfLeft: CallbackEvent( 7 )\n\ + osfRight: CallbackEvent( 8 )\n\ + Z: CallbackEvent( 9 )\n\ + M: CallbackEvent( 10 )\n\ + F: CallbackEvent( 11 )\n\ + R: CallbackEvent( 12 )\n\ + U: CallbackEvent( 13 )\n\ + I: CallbackEvent( 14 )\n\ + C: CallbackEvent( 15 )\n\ + P: CallbackEvent( 16 )\n\ + +: CallbackEvent( 17 )\n\ + -: CallbackEvent( 18 )\n"; + + +/*------------------------------------------------------------\ +| | +| Event Count | +| | +\------------------------------------------------------------*/ + + static int XschMaxEventEditTable[] = + + { + 2, /* XSCH_EDIT_MEASURE */ + 1, /* XSCH_EDIT_IDENTIFY */ + 1, /* XSCH_EDIT_CONNECTED */ + 1 /* XSCH_TOOLS_HIERARCH_DOWN */ + }; + + static int XschInputEventEditTable[] = + + { + XSCH_INPUT_HALF_BOX, /* XSCH_EDIT_MEASURE */ + XSCH_INPUT_POINT, /* XSCH_EDIT_IDENTIFY */ + XSCH_INPUT_POINT, /* XSCH_EDIT_CONNECTED */ + XSCH_INPUT_POINT /* XSCH_TOOLS_HIERARCH_DOWN */ + }; + + static int XschMaxEventZoomTable[] = + + { + 1, /* XSCH_ZOOM_CENTER */ + 2, /* XSCH_ZOOM_IN */ + 2 /* XSCH_ZOOM_PAN */ + }; + + static int XschInputEventZoomTable[] = + + { + XSCH_INPUT_POINT, /* XSCH_ZOOM_CENTER */ + XSCH_INPUT_BOX, /* XSCH_ZOOM_IN */ + XSCH_INPUT_LINE /* XSCH_ZOOM_PAN */ + }; + +/*------------------------------------------------------------\ +| | +| Translation | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Expose Edit Zoom | +| | +\------------------------------------------------------------*/ + + static long XschUnitEventZoomX[ 2 ] = { 0, 0 }; + static long XschUnitEventZoomY[ 2 ] = { 0, 0 }; + static int XschMaxEventZoom = 0; + int XschCountEventZoom = 0; + + static long XschUnitEventEditX[ 2 ] = { 0, 0 }; + static long XschUnitEventEditY[ 2 ] = { 0, 0 }; + static int XschMaxEventEdit = 2; + int XschCountEventEdit = 0; + + static int XschFirstExpose = XSCH_TRUE; + +/*------------------------------------------------------------\ +| | +| Input | +| | +\------------------------------------------------------------*/ + + static int XschInputMode = XSCH_INPUT_HALF_BOX; + static int XschSaveInputMode = XSCH_INPUT_HALF_BOX; + static int XschEditMode = XSCH_EDIT_MEASURE; + static int XschSaveEditMode = XSCH_EDIT_MEASURE; + +/*------------------------------------------------------------\ +| | +| Edit Message | +| | +\------------------------------------------------------------*/ + + static void (*XschPromptMessage)() = XschPromptEditMeasure; + static void (*XschSavePromptMessage)() = XschPromptEditMeasure; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschChangeEditMode | +| | +\------------------------------------------------------------*/ + +void XschChangeEditMode( EditMode , PromptMessage ) + + int EditMode; + void (*PromptMessage)(); +{ + autbegin(); + + if ( EditMode & XSCH_ZOOM_MARK ) + { + EditMode = EditMode & ~XSCH_ZOOM_MARK; + + XschCountEventZoom = 0; + XschMaxEventZoom = XschMaxEventZoomTable[ EditMode ]; + + if ( ! ( XschEditMode & XSCH_ZOOM_MARK ) ) + { + XschSaveEditMode = XschEditMode; + XschSaveInputMode = XschInputMode; + XschSavePromptMessage = XschPromptMessage; + } + + XschInputMode = XschInputEventZoomTable[ EditMode ]; + XschPromptMessage = PromptMessage; + XschEditMode = EditMode | XSCH_ZOOM_MARK; + + XschChangeCursorType( NULL, NULL, 0, XschInputMode ); + } + else + { + if ( XschEditMode & XSCH_ZOOM_MARK ) + { + XschSaveEditMode = EditMode; + XschSaveInputMode = XschInputEventEditTable[ EditMode ]; + XschSavePromptMessage = PromptMessage; + XschCountEventEdit = 0; + XschMaxEventEdit = XschMaxEventEditTable[ EditMode ]; + } + else + { + if ( XschEditMode != EditMode ) + { + XschCountEventEdit = 0; + XschMaxEventEdit = XschMaxEventEditTable[ EditMode ]; + XschEditMode = EditMode; + XschInputMode = XschInputEventEditTable[ EditMode ]; + XschPromptMessage = PromptMessage; + + XschChangeCursorType( NULL, NULL, 0, XschInputMode ); + } + } + + XschEditUnselectAll(); + } + + XschPromptMessage(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschContinueEditMode | +| | +\------------------------------------------------------------*/ + +void XschContinueEditMode( EditMode , PromptMessage, CountEvent ) + + int EditMode; + void (*PromptMessage)(); + int CountEvent; +{ + autbegin(); + + if ( XschEditMode & XSCH_ZOOM_MARK ) + { + XschSaveEditMode = EditMode; + XschSaveInputMode = XschInputEventEditTable[ EditMode ]; + XschSavePromptMessage = PromptMessage; + XschCountEventEdit = CountEvent; + XschMaxEventEdit = XschMaxEventEditTable[ EditMode ]; + } + else + { + XschCountEventEdit = CountEvent; + XschMaxEventEdit = XschMaxEventEditTable[ EditMode ]; + XschEditMode = EditMode; + XschInputMode = XschInputEventEditTable[ EditMode ]; + XschPromptMessage = PromptMessage; + + XschChangeCursorType( XschUnitEventEditX, + XschUnitEventEditY, + XschCountEventEdit, + XschInputMode ); + + } + + XschPromptMessage(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschTreatEventZoom | +| | +\------------------------------------------------------------*/ + +void XschTreatEventZoom() + +{ + autbegin(); + + XschChangeCursorType( XschUnitEventEditX, + XschUnitEventEditY, + XschCountEventEdit, + XschSaveInputMode ); + + switch ( XschEditMode ) + { + case XSCH_ZOOM_CENTER : + + XschZoomCenter( XschUnitEventZoomX[ 0 ], + XschUnitEventZoomY[ 0 ] ); + break; + + case XSCH_ZOOM_IN : + + XschZoomIn( XschUnitEventZoomX[ 0 ], + XschUnitEventZoomY[ 0 ], + XschUnitEventZoomX[ 1 ], + XschUnitEventZoomY[ 1 ] ); + break; + + case XSCH_ZOOM_PAN : + + XschZoomPan( XschUnitEventZoomX[ 0 ], + XschUnitEventZoomY[ 0 ], + XschUnitEventZoomX[ 1 ], + XschUnitEventZoomY[ 1 ] ); + break; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschTreatEventEdit | +| | +\------------------------------------------------------------*/ + +void XschTreatEventEdit() + +{ + long DeltaX; + long DeltaY; + long X1; + long X2; + long Y1; + long Y2; + + autbegin(); + + X1 = XschUnitEventEditX[0]; + X2 = XschUnitEventEditX[1]; + Y1 = XschUnitEventEditY[0]; + Y2 = XschUnitEventEditY[1]; + + if ( ( XschInputMode == XSCH_INPUT_LSTRING ) || + ( XschInputMode == XSCH_INPUT_ORTHO ) || + ( XschInputMode == XSCH_INPUT_SORTHO ) ) + { + DeltaX = X1 - X2; + DeltaY = Y1 - Y2; + + if ( DeltaX < 0 ) DeltaX = - DeltaX; + if ( DeltaY < 0 ) DeltaY = - DeltaY; + + if ( DeltaX > DeltaY ) + { + Y2 = Y1; + + XschUnitEventEditX[0] = X2; + XschUnitEventEditY[0] = Y2; + } + else + { + X2 = X1; + + XschUnitEventEditX[0] = X2; + XschUnitEventEditY[0] = Y2; + } + } + + if ( XschInputMode == XSCH_INPUT_LSTRING ) + { + XschChangeCursorType( XschUnitEventEditX, + XschUnitEventEditY, + 1, XschInputMode ); + + XschCountEventEdit = 1; + } + else + { + XschChangeCursorType( NULL, NULL, 0, + XschInputMode ); + + XschCountEventEdit = 0; + } + + switch ( XschEditMode ) + { + case XSCH_EDIT_MEASURE : + + break; + + case XSCH_EDIT_IDENTIFY : + + XschEditIdentify( X1, Y1 ); + + break; + + case XSCH_EDIT_CONNECTED : + + XschEditConnected( X1, Y1 ); + + break; + + case XSCH_TOOLS_HIERARCHY_DOWN : + + XschToolsSelectHierarchyDown( X1, Y1 ); + + break; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEvent | +| | +\------------------------------------------------------------*/ + +void CallbackEvent ( MyWidget, Event, Args, Argc ) + + Widget MyWidget; + XButtonEvent *Event; + String *Args; + int *Argc; +{ + Display *EventDisplay; + int MouseEvent; + Position OldUnitCursorX; + Position OldUnitCursorY; + + autbegin(); + + EventDisplay = Event->display; + + MouseEvent = atoi( Args[ 0 ] ); + + if ( MouseEvent == XSCH_LEAVE ) + { + XschUndisplayCursor(); + XschCursorInside = XSCH_FALSE; + } + else + { + OldUnitCursorX = XschUnitCursorX; + OldUnitCursorY = XschUnitCursorY; + + XschComputeCursor( Event->x, Event->y ); + + switch ( MouseEvent ) + { + case XSCH_B1DN : + + if ( XschEditMode & XSCH_ZOOM_MARK ) + { + if ( XschCountEventZoom < XschMaxEventZoom ) + { + XschUnitEventZoomX[ XschCountEventZoom ] = XschUnitCursorX; + XschUnitEventZoomY[ XschCountEventZoom ] = XschUnitCursorY; + + XschCountEventZoom = XschCountEventZoom + 1; + + XschPointCursor(); + + if ( XschCountEventZoom == XschMaxEventZoom ) + { + XschChangeCursorType( NULL, NULL, 0, XschInputMode ); + + XschTreatEventZoom(); + + XschInputMode = XschSaveInputMode; + XschEditMode = XschSaveEditMode; + XschPromptMessage = XschSavePromptMessage; + XschSaveEditMode = XSCH_EDIT_MEASURE; + XschSaveInputMode = XSCH_INPUT_HALF_BOX; + XschCountEventZoom = 0; + XschMaxEventZoom = 0; + + XschChangeCursorType( XschUnitEventEditX, + XschUnitEventEditY, + XschCountEventEdit, + XschInputMode ); + + XschComputeCursor( Event->x, Event->y ); + XschDisplayCursor(); + } + } + } + else + { + if ( XschCountEventEdit < XschMaxEventEdit ) + { + XschUnitEventEditX[ XschCountEventEdit ] = XschUnitCursorX; + XschUnitEventEditY[ XschCountEventEdit ] = XschUnitCursorY; + + XschCountEventEdit = XschCountEventEdit + 1; + + XschPointCursor(); + + if ( XschCountEventEdit == XschMaxEventEdit ) + { + XschTreatEventEdit(); + + XschDisplayCursor(); + } + } + } + + XschPromptMessage(); + + break; + + case XSCH_B3DN : + + if ( XschEditMode & XSCH_ZOOM_MARK ) + { + if ( XschCountEventZoom != 0 ) + { + XschCountEventZoom = XschCountEventZoom - 1; + + XschResetCursor(); + } + else + { + XschChangeCursorType( XschUnitEventEditX, + XschUnitEventEditY, + XschCountEventEdit, + XschSaveInputMode ); + + XschInputMode = XschSaveInputMode; + XschEditMode = XschSaveEditMode; + XschPromptMessage = XschSavePromptMessage; + XschSaveEditMode = XSCH_EDIT_MEASURE; + XschSaveInputMode = XSCH_INPUT_HALF_BOX; + XschSavePromptMessage = XschPromptEditMeasure; + XschCountEventZoom = 0; + XschMaxEventZoom = 0; + } + } + else + { + if ( XschCountEventEdit != 0 ) + { + XschCountEventEdit = XschCountEventEdit - 1; + + XschResetCursor(); + } + else + { + XschEditUnselectAll(); + + XschChangeCursorType( NULL, NULL, 0, + XSCH_INPUT_HALF_BOX ); + + XschInputMode = XSCH_INPUT_HALF_BOX; + XschEditMode = XSCH_EDIT_MEASURE; + XschPromptMessage = XschPromptEditMeasure; + XschCountEventEdit = 0; + XschMaxEventEdit = 2; + } + } + + XschPromptMessage(); + + break; + + case XSCH_MOTION : + + break; + + case XSCH_ENTER : XschCursorInside = XSCH_TRUE; + XschDisplayCursor(); + break; + + case XSCH_KEY_UP : XschZoomUp(); + + break; + + case XSCH_KEY_DN : XschZoomDown(); + + break; + + case XSCH_KEY_LEFT : XschZoomLeft(); + + break; + + case XSCH_KEY_RIGHT : XschZoomRight(); + + break; + + case XSCH_KEY_MORE : XschZoomMore(); + + break; + + case XSCH_KEY_LESS : XschZoomLess(); + + break; + + case XSCH_KEY_FIT : XschZoomFit(); + + break; + + case XSCH_KEY_REFRESH : XschZoomRefresh(); + + break; + + case XSCH_KEY_UNZOOM : XschZoomUndo(); + + break; + + case XSCH_KEY_ZOOM_IN : + + XschChangeEditMode( XSCH_ZOOM_IN, XschPromptZoomIn ); + + break; + + case XSCH_KEY_CENTER : + + XschChangeEditMode( XSCH_ZOOM_CENTER, XschPromptZoomCenter ); + + break; + + case XSCH_KEY_PAN : + + XschChangeEditMode( XSCH_ZOOM_PAN, XschPromptZoomPan ); + + break; + + case XSCH_KEY_NEXT : + + XschFileNextSlide(); + + break; + + case XSCH_KEY_PREV : + + XschFilePrevSlide(); + + break; + } + + if ( ( OldUnitCursorX != XschUnitCursorX ) || + ( OldUnitCursorY != XschUnitCursorY ) ) + { + XschDisplayCoordinates(); + XschDisplayCursor(); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackResize | +| | +\------------------------------------------------------------*/ + +void CallbackResize( MyWidget, ClientData, CallData ) + + Widget MyWidget; + XtPointer ClientData; + XmDrawingAreaCallbackStruct *CallData; +{ + if ( XschFirstExpose == XSCH_FALSE ) + { + autbegin(); + + XschSetMouseCursor( XschGraphicWindow, XSCH_WATCH_CURSOR ); + XschUndisplayCursor(); + + XschResizeGraphicWindow(); + XschRefreshGraphicWindow( 0, 0, + XschGraphicDx, XschGraphicDy ); + XschSetMouseCursor( XschGraphicWindow, XSCH_NORMAL_CURSOR ); + XschDisplayCursor(); + + autend(); + } +} + +/*------------------------------------------------------------\ +| | +| CallbackExpose | +| | +\------------------------------------------------------------*/ + +void CallbackExpose( MyWidget, ClientData, CallData ) + + Widget MyWidget; + XtPointer ClientData; + XmDrawingAreaCallbackStruct *CallData; +{ + XExposeEvent *ExposeEvent; + + ExposeEvent = (XExposeEvent *)CallData->event; + + autbegin(); + + if ( XschFirstExpose == XSCH_TRUE ) + { + XschFirstExpose = XSCH_FALSE; + + XschInitializeGraphicWindow(); + XschUndisplayCursor(); + + XschLoadConfig( XSCH_FALSE ); + + if ( XschFirstFileName != (char *)NULL ) + { + XschDisplayCursor(); + XschFileOpen( XschFirstFileName, 1 ); + + XschFirstFileName = (char *)NULL; + } + else + { + XschChangeTopLevelTitle( (char *)NULL ); + + XschRefreshGraphicWindow( 0, 0, XschGraphicDx, XschGraphicDy ); + XschDisplayCursor(); + } + + XschEnterPresentPanel(); + } + else + { + XschUndisplayCursor(); + XschRefreshGraphicWindow( ExposeEvent->x, ExposeEvent->y, + ExposeEvent->width, ExposeEvent->height ); + XschDisplayCursor(); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschInitializeEvent | +| | +\------------------------------------------------------------*/ + +void XschInitializeEvent() + +{ + XtActionsRec NewActions; + + autbegin(); + + XtVaSetValues( XschGraphicWindow, + XmNtranslations, + XtParseTranslationTable( XschEventTranslation ), + NULL + ); + + NewActions.string = "CallbackEvent"; + NewActions.proc = CallbackEvent; + + XtAppAddActions( XschApplication, &NewActions, 1 ); + + XtAddCallback( XschGraphicWindow, + XmNresizeCallback, + CallbackResize, NULL ); + + XtAddCallback( XschGraphicWindow, + XmNexposeCallback, + CallbackExpose, NULL ); + + autend(); +} diff --git a/alliance/src/xsch/src/XMX_event.h b/alliance/src/xsch/src/XMX_event.h new file mode 100644 index 00000000..c1d61068 --- /dev/null +++ b/alliance/src/xsch/src/XMX_event.h @@ -0,0 +1,114 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Event.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_EVENT +# define XSCH_EVENT + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XSCH_B1DN 0 +# define XSCH_B3DN 1 +# define XSCH_MOTION 2 +# define XSCH_ENTER 3 +# define XSCH_LEAVE 4 + +# define XSCH_KEY_UP 5 +# define XSCH_KEY_DN 6 +# define XSCH_KEY_LEFT 7 +# define XSCH_KEY_RIGHT 8 + +# define XSCH_KEY_MORE 9 +# define XSCH_KEY_LESS 10 + +# define XSCH_KEY_FIT 11 +# define XSCH_KEY_REFRESH 12 +# define XSCH_KEY_UNZOOM 13 + +# define XSCH_KEY_ZOOM_IN 14 +# define XSCH_KEY_CENTER 15 +# define XSCH_KEY_PAN 16 + +# define XSCH_KEY_NEXT 17 +# define XSCH_KEY_PREV 18 + +# define XSCH_MAX_EVENT_BUFFER 128 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschInitializeEvent(); + extern void XschDisplayEditMeasure(); + + extern void XschZoomUp(); + extern void XschZoomDown(); + extern void XschZoomLeft(); + extern void XschZoomRight(); + extern void XschZoomMore(); + extern void XschZoomLess(); + extern void XschZoomFit(); + extern void XschZoomUndo(); + + extern void XschInitializeGraphicWindow(); + extern void XschFileOpen(); + + +# endif diff --git a/alliance/src/xsch/src/XMX_graphic.c b/alliance/src/xsch/src/XMX_graphic.c new file mode 100644 index 00000000..706cc067 --- /dev/null +++ b/alliance/src/xsch/src/XMX_graphic.c @@ -0,0 +1,315 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Graphic.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" + +# include "XMX_graphic.h" +# include "XMX_grid.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + Widget XschGraphicFrame; + Widget XschGraphicWindow; + Display *XschGraphicDisplay = (Display *)NULL; + + Dimension XschGraphicDx = 0; + Dimension XschGraphicDy = 0; + Dimension XschOldGraphicDx = 0; + Dimension XschOldGraphicDy = 0; + + Pixmap XschGraphicPixmap = (Pixmap)NULL; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschInitializeGraphicWindow | +| | +\------------------------------------------------------------*/ + +void XschInitializeGraphicWindow() + +{ + autbegin(); + + XtVaGetValues( XschGraphicWindow, + XmNwidth, &XschGraphicDx, + XmNheight, &XschGraphicDy, + NULL + ); + + XschOldGraphicDx = XschGraphicDx; + XschOldGraphicDy = XschGraphicDy; + + XschGraphicPixmap = + + XCreatePixmap ( XschGraphicDisplay, + RootWindowOfScreen( XtScreen ( XschGraphicWindow ) ), + XschGraphicDx, + XschGraphicDy, + DefaultDepthOfScreen ( XtScreen ( XschGraphicWindow ) ) + ); + + XschClearGraphicWindow( 0, 0, XschGraphicDx, XschGraphicDy ); + XschInitializeUnitGrid(); + + XschSetMouseCursor( XschGraphicWindow, XSCH_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschClearGraphicWindow | +| | +\------------------------------------------------------------*/ + +void XschClearGraphicWindow( GraphicX, GraphicY, GraphicDx, GraphicDy ) + + long GraphicX; + long GraphicY; + long GraphicDx; + long GraphicDy; +{ + XFillRectangle( XschGraphicDisplay, + XschGraphicPixmap, + XschBackgroundGC, + GraphicX, GraphicY, + GraphicDx, + GraphicDy ); +} + +/*------------------------------------------------------------\ +| | +| XschRefreshGraphicWindow | +| | +\------------------------------------------------------------*/ + +void XschRefreshGraphicWindow( GraphicX, GraphicY, GraphicDx, GraphicDy ) + + Dimension GraphicX; + Dimension GraphicY; + Dimension GraphicDx; + Dimension GraphicDy; +{ + autbegin(); + + XschUndisplayCursor(); + + XCopyArea( XschGraphicDisplay, + XschGraphicPixmap, + XtWindow ( XschGraphicWindow ), + XschBackgroundGC, + GraphicX, GraphicY, + GraphicDx, GraphicDy, + GraphicX, GraphicY + ); + + XschDisplayUnitGrid( GraphicX, GraphicY, + GraphicX + GraphicDx, + GraphicY + GraphicDy ); + XschUndisplayCursor(); + + autend(); +} + + +/*------------------------------------------------------------\ +| | +| XschResizeGraphicWindow | +| | +\------------------------------------------------------------*/ + +void XschResizeGraphicWindow() + +{ + Pixmap OldPixmap; + Dimension SourceY; + Dimension TargetY; + Dimension TargetDx; + Dimension TargetDy; + + autbegin(); + + XschOldGraphicDx = XschGraphicDx; + XschOldGraphicDy = XschGraphicDy; + + XtVaGetValues( XschGraphicWindow, + XmNwidth, &XschGraphicDx, + XmNheight, &XschGraphicDy, + NULL + ); + + if ( ( XschOldGraphicDx != XschGraphicDx ) || + ( XschOldGraphicDy != XschGraphicDy ) ) + { + OldPixmap = XschGraphicPixmap; + + XschGraphicPixmap = + + XCreatePixmap ( XschGraphicDisplay, + RootWindowOfScreen( XtScreen ( XschGraphicWindow ) ), + XschGraphicDx, + XschGraphicDy, + DefaultDepthOfScreen ( XtScreen ( XschGraphicWindow ) ) + ); + + XschClearGraphicWindow( 0, 0, XschGraphicDx, XschGraphicDy ); + + XschResizeUnitGrid(); + + if ( XschOldGraphicDx < XschGraphicDx ) + { + TargetDx = XschOldGraphicDx; + + XschDisplayFigure( TargetDx, 0, + XschGraphicDx, XschGraphicDy ); + } + else + { + TargetDx = XschGraphicDx; + } + + if ( XschOldGraphicDy < XschGraphicDy ) + { + SourceY = 0; + TargetDy = XschOldGraphicDy; + TargetY = XschGraphicDy - XschOldGraphicDy; + + XschDisplayFigure( 0, TargetDy, + TargetDx, XschGraphicDy ); + } + else + { + TargetDy = XschGraphicDy; + TargetY = 0; + SourceY = XschOldGraphicDy - XschGraphicDy; + } + + XCopyArea( XschGraphicDisplay, + OldPixmap, + XschGraphicPixmap, + XschBackgroundGC, + 0, SourceY, + TargetDx, TargetDy, + 0, TargetY + ); + + XFreePixmap( XschGraphicDisplay, OldPixmap ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschInitializeGraphic | +| | +\------------------------------------------------------------*/ + +void XschInitializeGraphic() + +{ + autbegin(); + + XschGraphicFrame = XtVaCreateManagedWidget( "XschGraphicFrame", + xmFrameWidgetClass, + XschMainForm, + XmNshadowType , XmSHADOW_ETCHED_IN, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 1, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 191, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 1, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 199, + NULL ); + + XschGraphicWindow = XtVaCreateManagedWidget( + "XschGraphicWindow", + xmDrawingAreaWidgetClass, + XschGraphicFrame, + XmNtopAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNbackground, 1, + XmNforeground, 0, + NULL + ); + + XschGraphicDisplay = XtDisplay( XschGraphicWindow ); + + autend(); +} diff --git a/alliance/src/xsch/src/XMX_graphic.h b/alliance/src/xsch/src/XMX_graphic.h new file mode 100644 index 00000000..4cfa2b8a --- /dev/null +++ b/alliance/src/xsch/src/XMX_graphic.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Graphic.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_GRAPHIC +# define XSCH_GRAPHIC + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschInitializeGraphic(); + extern void XschInitializeUnitGrid(); + extern void XschDisplayUnitGrid(); + +# endif diff --git a/alliance/src/xsch/src/XMX_grid.c b/alliance/src/xsch/src/XMX_grid.c new file mode 100644 index 00000000..9660c049 --- /dev/null +++ b/alliance/src/xsch/src/XMX_grid.c @@ -0,0 +1,313 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Grid.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XSB.h" +# include "scl.h" +# include "XSC.h" +# include "XMX.h" + +# include "XMX_grid.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Unit Grid | +| | +\------------------------------------------------------------*/ + + float XschUnitGridStep; + + long XschUnitGridX; + long XschUnitGridY; + long XschUnitGridDx; + long XschUnitGridDy; + + long XschPixelGridX; + long XschPixelGridY; + +/*------------------------------------------------------------\ +| | +| User Unit Grid | +| | +\------------------------------------------------------------*/ + + long XschUnitUserGridDx; + long XschUnitUserGridDy; + int XschUnitUserGrid; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschInitializeUnitGrid | +| | +\------------------------------------------------------------*/ + +void XschInitializeUnitGrid() + +{ + autbegin(); + + XschUnitGridX = XSCH_DEFAULT_GRID_X; + XschUnitGridY = XSCH_DEFAULT_GRID_Y; + XschUnitGridDx = XSCH_DEFAULT_GRID_DX; + XschUnitGridDy = XSCH_DEFAULT_GRID_DY; + XschUnitUserGridDx = 4; + XschUnitUserGridDy = 4; + XschUnitUserGrid = XSCH_FALSE; + + XschComputeUnitGrid(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschComputeUnitGrid | +| | +\------------------------------------------------------------*/ + +void XschComputeUnitGrid() + +{ + float StepX; + float StepY; + + autbegin(); + + StepX = (float)(XschGraphicDx) / (float)(XschUnitGridDx); + StepY = (float)(XschGraphicDy) / (float)(XschUnitGridDy); + + if ( StepX < StepY ) + { + XschUnitGridStep = StepX; + XschUnitGridDy = 1 + ( XschGraphicDy / StepX ); + } + else + { + XschUnitGridStep = StepY; + XschUnitGridDx = 1 + ( XschGraphicDx / StepY ); + } + + XschPixelGridX = (float)(XschUnitGridX) * XschUnitGridStep; + XschPixelGridY = (float)(XschUnitGridY) * XschUnitGridStep; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschResizeUnitGrid | +| | +\------------------------------------------------------------*/ + +void XschResizeUnitGrid() + +{ + autbegin(); + + XschUnitGridDx = 1 + ( XschGraphicDx / XschUnitGridStep ); + XschUnitGridDy = 1 + ( XschGraphicDy / XschUnitGridStep ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschDisplayUnitGrid | +| | +\------------------------------------------------------------*/ + +int XschDisplayUnitGrid( GraphicX1, GraphicY1, GraphicX2, GraphicY2 ) + + Dimension GraphicX1; + Dimension GraphicY1; + Dimension GraphicX2; + Dimension GraphicY2; +{ + long X; + long Y; + long MaxGridX; + long MaxGridY; + long PixelX; + long PixelY; + long Xmin; + long Ymin; + int UserGrid; + int UnitGrid; + float Check; + + autbegin(); + + if ( XschUnitGridStep < XSCH_LOWER_GRID_STEP ) + { + UnitGrid = 0; + } + else + { + UnitGrid = 1; + } + + if ( XschUnitUserGrid == 1 ) + { + if ( XschUnitUserGridDx > XschUnitUserGridDy ) + { + Check = ( XSCH_LOWER_GRID_STEP * 2 / XschUnitUserGridDy ); + } + else + { + Check = ( XSCH_LOWER_GRID_STEP * 2 / XschUnitUserGridDy ); + } + + if ( XschUnitGridStep < Check ) UserGrid = 0; + else UserGrid = 1; + } + else + { + UserGrid = 0; + } + + if ( ( UserGrid == 0 ) && + ( UnitGrid == 0 ) ) + { + autend(); + return( XSCH_FALSE ); + } + + MaxGridX = XschUnitGridX + XschUnitGridDx; + MaxGridY = XschUnitGridY + XschUnitGridDy; + + if ( UnitGrid ) + { + for ( X = XschUnitGridX; X < MaxGridX; X = X + 1 ) + { + PixelX = ((float)(X) * XschUnitGridStep); + PixelX = PixelX - XschPixelGridX; + + if ( ( PixelX <= GraphicX2 ) && + ( PixelX >= GraphicX1 ) ) + + for ( Y = XschUnitGridY; Y < MaxGridY; Y = Y + 1 ) + { + PixelY = ((float)(Y) * XschUnitGridStep); + PixelY = PixelY - XschPixelGridY; + PixelY = XschGraphicDy - PixelY; + + if ( ( PixelY <= GraphicY2 ) && + ( PixelY >= GraphicY1 ) ) + { + XDrawPoint( XschGraphicDisplay, + XtWindow( XschGraphicWindow ), + XschGridGC, + PixelX, PixelY ); + } + } + } + } + + if ( UserGrid ) + { + Xmin = ( XschUnitGridX / XschUnitUserGridDx ) * XschUnitUserGridDx; + Ymin = ( XschUnitGridY / XschUnitUserGridDy ) * XschUnitUserGridDy; + + for ( X = Xmin; X < MaxGridX ; X = X + XschUnitUserGridDx ) + { + PixelX = ((float)(X) * XschUnitGridStep); + PixelX = PixelX - XschPixelGridX; + + if ( ( PixelX <= GraphicX2 ) && + ( PixelX >= GraphicX1 ) ) + + for ( Y = Ymin; Y < MaxGridY; Y = Y + XschUnitUserGridDy ) + { + PixelY = ((float)(Y) * XschUnitGridStep); + PixelY = PixelY - XschPixelGridY; + PixelY = XschGraphicDy - PixelY; + + if ( ( PixelY <= GraphicY2 ) && + ( PixelY >= GraphicY1 ) ) + { + XDrawLine( XschGraphicDisplay, + XtWindow( XschGraphicWindow ), + XschGridGC, + PixelX - 2, PixelY, + PixelX + 2, PixelY ); + + XDrawLine( XschGraphicDisplay, + XtWindow( XschGraphicWindow ), + XschGridGC, + PixelX, PixelY + 2, + PixelX, PixelY - 2 ); + } + } + } + } + + autend(); + return( XSCH_TRUE ); +} diff --git a/alliance/src/xsch/src/XMX_grid.h b/alliance/src/xsch/src/XMX_grid.h new file mode 100644 index 00000000..abfc52d9 --- /dev/null +++ b/alliance/src/xsch/src/XMX_grid.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Grid.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_GRID +# define XSCH_GRID + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XSCH_DEFAULT_GRID_X 0 +# define XSCH_DEFAULT_GRID_Y 0 +# define XSCH_DEFAULT_GRID_DX 40 +# define XSCH_DEFAULT_GRID_DY 40 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xsch/src/XMX_icon.c b/alliance/src/xsch/src/XMX_icon.c new file mode 100644 index 00000000..1ff7ebdb --- /dev/null +++ b/alliance/src/xsch/src/XMX_icon.c @@ -0,0 +1,132 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Icon.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" + +# include "XMX_icon.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static char IconBits[] = { + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x07, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x7f, + 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0xc0, 0x03, + 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, + 0x40, 0xfc, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x84, 0x00, 0x00, 0x00, + 0x40, 0x00, 0xc0, 0x83, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x80, 0x00, + 0x00, 0x00, 0x40, 0x00, 0x40, 0x80, 0xf8, 0xff, 0x00, 0x40, 0x00, 0x40, + 0x80, 0xc8, 0x80, 0x00, 0x7f, 0x00, 0x40, 0x80, 0x08, 0x83, 0x00, 0x40, + 0x00, 0x20, 0x80, 0x0f, 0x8c, 0x00, 0x40, 0x00, 0x18, 0x00, 0x08, 0xb0, + 0x00, 0xc0, 0xff, 0x07, 0x00, 0x08, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x80, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xc0, 0x00, 0xc0, 0xff, 0x07, + 0x00, 0x08, 0xb0, 0x00, 0x40, 0x00, 0x18, 0x80, 0x0f, 0x8c, 0x00, 0x7f, + 0x00, 0x20, 0x80, 0x08, 0x83, 0x00, 0x40, 0x00, 0x40, 0x80, 0xc8, 0x80, + 0x00, 0x40, 0x00, 0x40, 0x80, 0xf8, 0xff, 0x00, 0x40, 0x00, 0xc0, 0x83, + 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x84, 0x00, 0x00, 0x00, 0x40, 0x00, + 0x40, 0xfc, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x04, 0x00, 0x00, 0x00, + 0x40, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, + 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, + 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x00, 0xc0, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00 + + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschInitializeIcon | +| | +\------------------------------------------------------------*/ + +void XschInitializeIcon() + +{ + autbegin(); + + XschSetIcon( XschTopLevel, + IconBits, IconWidth, IconHeight ); + + autend(); +} diff --git a/alliance/src/xsch/src/XMX_icon.h b/alliance/src/xsch/src/XMX_icon.h new file mode 100644 index 00000000..ce3f8144 --- /dev/null +++ b/alliance/src/xsch/src/XMX_icon.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Icon.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_ICON +# define XSCH_ICON + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define IconWidth 50 +# define IconHeight 50 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschInitializeIcon(); + +# endif diff --git a/alliance/src/xsch/src/XMX_menu.c b/alliance/src/xsch/src/XMX_menu.c new file mode 100644 index 00000000..3938cda9 --- /dev/null +++ b/alliance/src/xsch/src/XMX_menu.c @@ -0,0 +1,203 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "scl.h" +# include "XSB.h" +# include "XTB.h" +# include "XMF.h" +# include "XME.h" +# include "XMV.h" +# include "XMT.h" +# include "XMS.h" +# include "XMH.h" +# include "XMX.h" + +# include "XMX_menu.h" + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + Widget XschMenuBar; + + XschMenuItem XschMainMenu[] = + + { + { + "File", + 'F', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + XschFileMenu + } + , + { + "Edit", + 'E', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + XschEditMenu + } + , + { + "View", + 'V', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + XschViewMenu + } + , + { + "Tools", + 'T', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + XschToolsMenu + } + , + { + "Setup", + 'S', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + XschSetupMenu + } + , + { + "Help", + 'H', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + True, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + XschHelpMenu + } + , + NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschInitializeMenu | +| | +\------------------------------------------------------------*/ + +void XschInitializeMenu() + +{ + autbegin(); + + XschMenuBar = XmCreateMenuBar( XschMainWindow, + "XschMenuBar", NULL, 0 ); + + XschBuildMenus( XschMenuBar, XschMainMenu ); + + XtManageChild( XschMenuBar ); + + autend(); +} + diff --git a/alliance/src/xsch/src/XMX_menu.h b/alliance/src/xsch/src/XMX_menu.h new file mode 100644 index 00000000..1fc10450 --- /dev/null +++ b/alliance/src/xsch/src/XMX_menu.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_MENU +# define XSCH_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XschMenuItem XschMainMenu[]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschInitializeMenu(); + +# endif diff --git a/alliance/src/xsch/src/XMX_message.c b/alliance/src/xsch/src/XMX_message.c new file mode 100644 index 00000000..bfb277c7 --- /dev/null +++ b/alliance/src/xsch/src/XMX_message.c @@ -0,0 +1,289 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Message.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XMX_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + Widget XschMessageMainForm; + Widget XschMessageText [ XSCH_MAX_MESSAGE ]; + Widget XschMessageLabel [ XSCH_MAX_MESSAGE ]; + Widget XschMessageFrame [ XSCH_MAX_MESSAGE ]; + Widget XschMessageForm [ XSCH_MAX_MESSAGE ]; + + static char *XschMessageLabelName [ XSCH_MAX_MESSAGE ] = + + { + "X :", + "Y :", + "Dx :", + "Dy :", + NULL, + NULL, + NULL + }; + + static char *XschMessageTextName [ XSCH_MAX_MESSAGE ] = + + { + "0", + "0", + "0", + "0", + "Measure", + "Select point", + "Enter base point" + }; + + static char *XschMessageFormName [ XSCH_MAX_MESSAGE ] = + + { + "XschMessageFormX", + "XschMessageFormY", + "XschMessageFormDx", + "XschMessageFormDy", + "XschMessageFormMode", + "XschMessageFormInfo", + "XschMessageFormPrompt" + }; + + static char *XschMessageFrameName [ XSCH_MAX_MESSAGE ] = + + { + "XschMessageFrameX", + "XschMessageFrameY", + "XschMessageFrameDx", + "XschMessageFrameDy", + "XschMessageFrameMode", + "XschMessageFrameInfo", + "XschMessageFramePrompt" + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschDisplayMessage | +| | +\------------------------------------------------------------*/ + +void XschDisplayMessage( Where, Text ) + + int Where; + char *Text; +{ + XmString TextString; + + autbegin(); + + TextString = XmStringCreateSimple( Text ); + + XtVaSetValues( XschMessageText[ Where ], XmNlabelString, TextString, NULL ); + + XmStringFree( TextString ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschPromptEditMeasure | +| | +\------------------------------------------------------------*/ + +void XschPromptEditMeasure() + +{ + autbegin(); + + XschDisplayMessage( XSCH_MESSAGE_MODE , "Measure" ); + XschDisplayMessage( XSCH_MESSAGE_PROMPT, "Enter base point" ); + XschDisplayMessage( XSCH_MESSAGE_INFO , "Select point" ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschInitializeMessage | +| | +\------------------------------------------------------------*/ + +void XschInitializeMessage() + +{ + int Counter; + int Column; + int Left; + int Width; + + autbegin(); + + XschMessageMainForm = + + XtVaCreateManagedWidget( "XschMessageMainForm", + xmFormWidgetClass , + XschMainForm , + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 193, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 199, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 0, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 200, + XmNfractionBase , 200, + NULL ); + + Column = 1; + Width = 17; + + for ( Counter = 0; Counter < XSCH_MAX_MESSAGE; Counter++ ) + { + if ( Counter == 4 ) Width = 22; + if ( Counter == 5 ) Width = 68; + if ( Counter == 6 ) Width = 40; + + XschMessageFrame[ Counter ] = + + XtVaCreateManagedWidget( XschMessageFrameName[ Counter ], + xmFrameWidgetClass, + XschMessageMainForm, + XmNshadowType , XmSHADOW_ETCHED_IN, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , Column, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , Column + Width, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + NULL + ); + + XschMessageForm[ Counter ] = + + XtVaCreateManagedWidget( XschMessageFormName[ Counter ], + xmFormWidgetClass , + XschMessageFrame[ Counter ], + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNfractionBase , 18, + NULL + ); + + if ( XschMessageLabelName[ Counter ] != (char *)NULL ) + { + XschMessageLabel [ Counter ] = + + XtVaCreateManagedWidget( XschMessageLabelName[ Counter ], + xmLabelWidgetClass, + XschMessageForm [ Counter ], + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 6, + XmNbottomAttachment , XmATTACH_FORM, + XmNtopAttachment , XmATTACH_FORM, + XmNrecomputeSize , False, + NULL + ); + Left = 6; + } + else + { + Left = 0; + } + + XschMessageText [ Counter ] = + + XtVaCreateManagedWidget( XschMessageTextName[ Counter ], + xmLabelWidgetClass, + XschMessageForm [ Counter ], + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , Left, + XmNrecomputeSize , False, + NULL + ); + + Column = Column + Width; + } + + autend(); +} diff --git a/alliance/src/xsch/src/XMX_message.h b/alliance/src/xsch/src/XMX_message.h new file mode 100644 index 00000000..26343ea8 --- /dev/null +++ b/alliance/src/xsch/src/XMX_message.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Message.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_MESSAGE +# define XSCH_MESSAGE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschInitializeMessage(); + extern void XschPromptEditMeasure(); + +# endif diff --git a/alliance/src/xsch/src/XMX_motif.c b/alliance/src/xsch/src/XMX_motif.c new file mode 100644 index 00000000..d8147c41 --- /dev/null +++ b/alliance/src/xsch/src/XMX_motif.c @@ -0,0 +1,197 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Motif.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XMS.h" + +# include "XMX_motif.h" +# include "XMX_graphic.h" +# include "XMX_event.h" +# include "XMX_message.h" +# include "XMX_menu.h" +# include "XMX_color.h" +# include "XMX_panel.h" +# include "XMX_icon.h" +# include "XMX_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XtAppContext XschApplication; + Widget XschTopLevel; + Widget XschMainWindow; + Widget XschMainForm; + + static String XschFallBacks [] = + + { + "*.XschMainWindow.iconName : Xsch", + "*XschMenuBar*fontList : -*-helvetica-bold-r-*--14-*", + "*foreground : black", + "*background : gray", + "*fontList : -*-helvetica-medium-r-*--12-*", + NULL + }; + + static char XschTopLevelTitle[ 128 ] = "Xsch : "; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschChangeTopLevelTitle | +| | +\------------------------------------------------------------*/ + +void XschChangeTopLevelTitle( Title ) + + char *Title; +{ + autbegin(); + + if ( Title != (char *)NULL ) + { + strcpy( XschTopLevelTitle + 7, Title ); + } + else + { + XschTopLevelTitle[ 7 ] = '\0'; + } + + XtVaSetValues( XschTopLevel, XmNtitle, XschTopLevelTitle, NULL ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschInitializeRessources | +| | +\------------------------------------------------------------*/ + +void XschInitializeRessources( argc, argv ) + + int *argc; + char *argv[]; +{ + Arg Args[ 2 ]; + + autbegin(); + + XschTopLevel = XtVaAppInitialize( + &XschApplication, + "xsch.xrdb", + NULL, + 0, + argc, + argv, + XschFallBacks, + NULL + ); + + XschLoadTopLevelConfig(); + + XschInitializeColorMap(); + + XschMainWindow = XtVaCreateManagedWidget( "XschMainWindow", + xmMainWindowWidgetClass, + XschTopLevel, + NULL); + + XschMainForm = XtVaCreateManagedWidget( "XschMainForm", + xmFormWidgetClass, + XschMainWindow, + XmNfractionBase, + 200, + NULL ); + + XschInitializeIcon(); + XschInitializeMenu(); + XschInitializeMessage(); + XschInitializePanel(); + XschInitializeGraphic(); + XschInitializeEvent(); + XschBuildPanelMap(); + XschInitializeMapEvent(); + XschInitializeColors(); + XschInitializeGraphicContext(); + XschInitializeDialog(); + XschBuildPanelLibrary(); + + XtSetArg( Args[0], XmNallowShellResize, True ); + XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING ); + XtSetValues( XschTopLevel, Args, 2 ); + + XtRealizeWidget( XschTopLevel ); + + autend(); +} diff --git a/alliance/src/xsch/src/XMX_motif.h b/alliance/src/xsch/src/XMX_motif.h new file mode 100644 index 00000000..7e032a05 --- /dev/null +++ b/alliance/src/xsch/src/XMX_motif.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Motif.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_MOTIF +# define XSCH_MOTIF + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschBuildPanelMap(); + extern void XschInitializeMapEvent(); + extern void XschBuildPanelLibrary(); + +# endif diff --git a/alliance/src/xsch/src/XMX_panel.c b/alliance/src/xsch/src/XMX_panel.c new file mode 100644 index 00000000..b846c7b1 --- /dev/null +++ b/alliance/src/xsch/src/XMX_panel.c @@ -0,0 +1,115 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XSB.h" +# include "XTB.h" +# include "XMF.h" +# include "XME.h" +# include "XMV.h" +# include "XMT.h" +# include "XMS.h" +# include "XMH.h" +# include "XMX.h" + +# include "XMX_panel.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschInitializePanel | +| | +\------------------------------------------------------------*/ + +void XschInitializePanel() + +{ + autbegin(); + + XschBuildPanelLayer(); + + XschBuildPanel( XschMainWindow, &XschViewArrowsPanel ); + XschBuildPanel( XschMainWindow, &XschViewZoomPanel ); + XschBuildPanel( XschMainWindow, &XschViewGridPanel ); + XschBuildPanel( XschMainWindow, &XschViewLayerPanel ); + XschBuildPanel( XschMainWindow, &XschEditSearchViewPanel ); + XschBuildPanel( XschMainWindow, &XschEditSelectPanel ); + XschBuildPanel( XschMainWindow, &XschEditIdentifyPanel ); + XschBuildPanel( XschMainWindow, &XschToolsMessagePanel ); + XschBuildPanel( XschMainWindow, &XschSetupInformationsPanel ); + XschBuildPanel( XschMainWindow, &XschToolsHierarchyPanel ); + + + XschBuildPresentPanel(); + + autend(); +} diff --git a/alliance/src/xsch/src/XMX_panel.h b/alliance/src/xsch/src/XMX_panel.h new file mode 100644 index 00000000..e7f75c53 --- /dev/null +++ b/alliance/src/xsch/src/XMX_panel.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_PANEL +# define XSCH_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschInitializePanel(); + +# endif diff --git a/alliance/src/xsch/src/XMX_view.c b/alliance/src/xsch/src/XMX_view.c new file mode 100644 index 00000000..bbab1ed2 --- /dev/null +++ b/alliance/src/xsch/src/XMX_view.c @@ -0,0 +1,2611 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : View.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "scl.h" +# include "XSB.h" +# include "XSC.h" +# include "XMX.h" + +# include "XMX_view.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static long XschGraphicX1; + static long XschGraphicX2; + static long XschGraphicY1; + static long XschGraphicY2; + static XFontStruct *XschTextFont; + static GC XschTextGC; + static GC XschDrawGC; + + static xschview_list *XschHeadView = (xschview_list *)NULL; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Alloc Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschAllocView | +| | +\------------------------------------------------------------*/ + +xschview_list *XschAllocView() +{ + return( (xschview_list *)autallocheap( sizeof( xschview_list ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Free Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschFreeView | +| | +\------------------------------------------------------------*/ + +void XschFreeView( FreeView ) + + xschview_list *FreeView; +{ + autfreeheap( (char *)FreeView, sizeof( xschview_list ) ); +} + +/*------------------------------------------------------------\ +| | +| XschAddViewLater | +| | +\------------------------------------------------------------*/ + +void XschAddViewLater( Obj ) + + xschobj_list *Obj; +{ + xschview_list *View; + + autbegin(); + + View = XschAllocView(); + + View->OBJECT = Obj; + View->NEXT = XschHeadView; + XschHeadView = View; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschDelView | +| | +\------------------------------------------------------------*/ + +void XschDelView() +{ + xschview_list *DelView; + xschview_list *View; + + autbegin(); + + View = XschHeadView; + XschHeadView = (xschview_list *)NULL; + + while( View != (xschview_list *)NULL ) + { + DelView = View; + View = View->NEXT; + + XschFreeView( DelView ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschFlushEventDisplay | +| | +\------------------------------------------------------------*/ + +void XschFlushEventDisplay() +{ + XEvent Event; + + autbegin(); + + while ( XCheckTypedEvent( XschGraphicDisplay, KeyPress, &Event ) ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschComputePentagon | +| | +\------------------------------------------------------------*/ + +char XschComputePentagon( X1, Y1, X2, Y2, Points ) + + long X1; + long Y1; + long X2; + long Y2; + XPoint *Points; +{ + long StepX; + long StepY; + + StepY = ( Y2 - Y1 ) >> 1; + StepX = StepY >> 1; + + if ( StepY <= 0 ) StepY = 1; + if ( StepX <= 0 ) StepX = 1; + + Points[ 0 ].x = X1; + Points[ 0 ].y = Y1; + Points[ 1 ].x = X1; + Points[ 1 ].y = Y2; + Points[ 2 ].x = X1; + Points[ 2 ].y = Y2; + Points[ 3 ].x = X2 - StepX; + Points[ 3 ].y = Y2; + Points[ 4 ].x = X2; + Points[ 4 ].y = Y1 + StepY; + Points[ 5 ].x = X2 - StepX; + Points[ 5 ].y = Y1; + Points[ 6 ].x = X1; + Points[ 6 ].y = Y1; + + return( XSCH_TRUE ); +} + +/*------------------------------------------------------------\ +| | +| XschDisplayArrow | +| | +\------------------------------------------------------------*/ + +char XschComputeArrow( X1, Y1, X2, Y2, Points ) + + long X1; + long Y1; + long X2; + long Y2; + XPoint *Points; +{ + float LineX; + float LineY; + float HalfX; + float HalfY; + float CrossX; + float CrossY; + float Norm; + + LineX = (float)( X2 - X1 ); + LineY = (float)( Y2 - Y1 ); + + if ( ( LineX != 0.0 ) || + ( LineY != 0.0 ) ) + { + Norm = sqrt( ( LineX * LineX ) + ( LineY * LineY ) ); + Norm = Norm / XschUnitGridStep; + LineX = LineX / Norm; + LineY = LineY / Norm; + HalfX = LineX / 2; + HalfY = LineY / 2; + CrossX = - HalfY; + CrossY = HalfX; + + Points[ 0 ].x = X1 + LineX; + Points[ 0 ].y = Y1 + LineY; + Points[ 1 ].x = Points[ 0 ].x + LineX + HalfX + CrossX; + Points[ 1 ].y = Points[ 0 ].y + LineY + HalfY + CrossY; + Points[ 2 ].x = Points[ 0 ].x + LineX + HalfX - CrossX; + Points[ 2 ].y = Points[ 0 ].y + LineY + HalfY - CrossY; + + return( XSCH_TRUE ); + } + + return( XSCH_FALSE ); +} + +/*------------------------------------------------------------\ +| | +| XschDrawTristate | +| | +\------------------------------------------------------------*/ + +static void XschDrawTristate( X1r, Y1r, X2r, Y2r, Ycr, Obj ) + + long X1r; + long Y1r; + long X2r; + long Y2r; + long Ycr; + xschobj_list *Obj; +{ +/* +** Fred Petrot (The King ) has initially written those lines ! +** Ludo Jacomme (The Slave) has modified them :-) +*/ + long gs; + long is_x; + long is_y; + long cs; + long csm; + long x, x1, y1, y2,y0; + long DeltaX; + long DeltaY; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + +# if 0 + XDrawRectangle( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + X1r, XschGraphicDy - Y2r, + DeltaX, DeltaY ); +# endif + + gs = DeltaX; + is_x = ( 5 * DeltaX ) / 16; + is_y = ( 5 * DeltaY ) / 16; + cs = DeltaX / 8; + csm = DeltaX / 10; + + y1 = XschGraphicDy - Ycr; + x1 = (X2r + X1r) / 2; + x = X1r + cs; + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, y1 - is_y/2, + x, y1 + is_y/2); + + XDrawLine(XschGraphicDisplay, XschGraphicPixmap, XschDrawGC, + x , y1 - is_y/2, + x + is_x, y1); + XDrawLine(XschGraphicDisplay, XschGraphicPixmap, XschDrawGC, + x , y1 + is_y/2, + x + is_x, y1); + + y0 = Obj->Y + ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + y0 = (float)( y0 ) * XschUnitGridStep; + y0 = ( y0 / XSCH_UNIT ) - XschPixelGridY; + y0 = XschGraphicDy - y0; + + y2 = Obj->Y + ( SCP_BOX_CON_BASE_Y + SCP_BOX_CON_STEP_Y ) * XSCH_UNIT; + y2 = (float)( y2 ) * XschUnitGridStep; + y2 = ( y2 / XSCH_UNIT ) - XschPixelGridY; + y2 = XschGraphicDy - y2; + + if ( ( Obj->ARG1 & 1) == 0 ) + { + /* data line : centered vertically */ + XDrawLine( XschGraphicDisplay, XschGraphicPixmap, XschDrawGC, + x - cs, y1, + x , y1 ); + } + else + { + /* Data circle */ + XDrawArc( XschGraphicDisplay, XschGraphicPixmap, XschDrawGC, + x - cs, y1 - cs/2, cs, cs, 0, 23040 ); + } + + /* Data Line */ + + XDrawLine( XschGraphicDisplay, XschGraphicPixmap, XschDrawGC, + x - cs, y0, x - cs, y1 ); + + if ( ( Obj->ARG1 & 2) == 0 ) + { + /* Command Line */ + XDrawLine(XschGraphicDisplay, XschGraphicPixmap, XschDrawGC, + x - cs, y2, x + is_x/2, y2 ); + + XDrawLine(XschGraphicDisplay, XschGraphicPixmap, XschDrawGC, + x + is_x/2, y2, x + is_x/2, y1 - is_y/4 ); + } + else + { + /* Command circle */ + XFillArc( XschGraphicDisplay, XschGraphicPixmap, XschDrawGC, + x + is_x/2 - csm/2, y1 - is_y/2 - csm/4, csm, csm, 0, 23040 ); + + /* Command Line */ + XDrawLine(XschGraphicDisplay, XschGraphicPixmap, XschDrawGC, + x - cs, y2, x + is_x/2, y2 ); + + XDrawLine(XschGraphicDisplay, XschGraphicPixmap, XschDrawGC, + x + is_x/2, y2, x + is_x/2, y2 + csm ); + } + + if ( ( Obj->ARG2 ) == 0 ) + { + /* Output line : centered vertically */ + XDrawLine( XschGraphicDisplay, XschGraphicPixmap, XschDrawGC, + x + is_x , y1, + x + is_x + cs, y1 ); + } + else + { + /* Output circle */ + XDrawArc( XschGraphicDisplay, XschGraphicPixmap, XschDrawGC, + x + is_x, y1 - cs/2, cs, cs, 0, 23040 ); + } + + XDrawLine( XschGraphicDisplay, XschGraphicPixmap, XschDrawGC, + x + is_x + cs, y1, + X2r, y1 ); +} + +/*------------------------------------------------------------\ +| | +| XschDrawConstant | +| | +\------------------------------------------------------------*/ + +static void XschDrawConstant( X1r, Y1r, X2r, Y2r, Ycr, Obj ) + + long X1r; + long Y1r; + long X2r; + long Y2r; + long Ycr; + xschobj_list *Obj; +{ + long is_x; + long is_y; + long cs; + long x, yc, y1,y2,y3; + long DeltaX; + long DeltaY; + int i; + int n; + + n = Obj->ARG1; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + +# if 0 + XDrawRectangle( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + X1r, XschGraphicDy - Y2r, + DeltaX, DeltaY ); +# endif + + cs = DeltaX / 8; + x = X1r + cs; + + y1 = Obj->Y + ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + + for ( i = 0; i < n; i++ ) + { + yc = (float)( y1 ) * XschUnitGridStep; + yc = ( yc / XSCH_UNIT ) - XschPixelGridY; + yc = XschGraphicDy - yc; + + if (( Obj->ARG2 & (1 << i)) == 0) + { + y2 = yc + cs; + y3 = y2 + cs; + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, yc, x, y2 ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x - cs, y2, x + cs, y2 ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x - cs, y2, x, y3 ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x + cs, y2, x, y3 ); + } + else + { + y2 = yc - cs; + y3 = y2 - cs; + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, yc, x, y2 ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, y2, x - cs, y3 ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, y2, x + cs, y3 ); + } + + XDrawLine( XschGraphicDisplay, XschGraphicPixmap, XschDrawGC, + x, yc, X2r, yc ); + + y1 += ( SCP_BOX_CON_STEP_Y * XSCH_UNIT ); + } + +# if 0 + y1 = XschGraphicDy - Ycr; + + if ( ! Obj->ARG2 ) /* constant zero */ + { + y2 = y1 + cs; + y3 = y2 + cs; + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, y1, x, y2 ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x - cs, y2, x + cs, y2 ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x - cs, y2, x, y3 ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x + cs, y2, x, y3 ); + } + else /* constant one */ + { + y2 = y1 - cs; + y3 = y2 - cs; + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, y1, x, y2 ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, y2, x - cs, y3 ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, y2, x + cs, y3 ); + } +# endif +} + +/*------------------------------------------------------------\ +| | +| XschDrawBuffer | +| | +\------------------------------------------------------------*/ + +static void XschDrawBuffer( X1r, Y1r, X2r, Y2r, Ycr, Obj ) + + long X1r; + long Y1r; + long X2r; + long Y2r; + long Ycr; + xschobj_list *Obj; +{ +/* +** Fred Petrot (The King ) has initially written those lines ! +** Ludo Jacomme (The Slave) has modified them :-) +*/ + long gs; + long is_x; + long is_y; + long cs; + long x, y1; + long DeltaX; + long DeltaY; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + +# if 0 + XDrawRectangle( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + X1r, XschGraphicDy - Y2r, + DeltaX, DeltaY ); +# endif + + gs = DeltaX; + is_x = ( 5 * DeltaX ) / 16; + is_y = ( 5 * DeltaY ) / 8; + cs = DeltaX / 8; + + y1 = XschGraphicDy - Ycr; + x = X1r + cs; + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, y1 - is_y/2, + x, y1 + is_y/2); + + XDrawLine(XschGraphicDisplay, XschGraphicPixmap, XschDrawGC, + x , y1 - is_y/2, + x + is_x, y1); + XDrawLine(XschGraphicDisplay, XschGraphicPixmap, XschDrawGC, + x , y1 + is_y/2, + x + is_x, y1); + + if ( ( Obj->ARG1 ) == 0 ) + { + /* input line : centered vertically */ + XDrawLine( XschGraphicDisplay, XschGraphicPixmap, XschDrawGC, + x - cs, y1, + x , y1 ); + } + else + { + /* Input circle */ + XDrawArc( XschGraphicDisplay, XschGraphicPixmap, XschDrawGC, + x - cs, y1 - cs/2, cs, cs, 0, 23040 ); + } + + if ( ( Obj->ARG2 ) == 0 ) + { + /* Output line : centered vertically */ + XDrawLine( XschGraphicDisplay, XschGraphicPixmap, XschDrawGC, + x + is_x , y1, + x + is_x + cs, y1 ); + } + else + { + /* Output circle */ + XDrawArc( XschGraphicDisplay, XschGraphicPixmap, XschDrawGC, + x + is_x, y1 - cs/2, cs, cs, 0, 23040 ); + } + + XDrawLine( XschGraphicDisplay, XschGraphicPixmap, XschDrawGC, + x + is_x + cs, y1, + X2r, y1 ); +} + +/*------------------------------------------------------------\ +| | +| XschDrawTransistor | +| | +\------------------------------------------------------------*/ + +static void XschDrawTransistor( X1r, Y1r, X2r, Y2r, Ycr, Obj ) + + long X1r; + long Y1r; + long X2r; + long Y2r; + long Ycr; + xschobj_list *Obj; +{ +/* +** Fred Petrot (The King ) has initially written those lines ! +** Ludo Jacomme (The Slave) has modified them :-) +*/ + long gs; + long is_x; + long is_y; + long cs; + long csm; + long x, x1, y1, y2,y0; + long DeltaX; + long DeltaY; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + + gs = DeltaX; + is_x = ( 5 * DeltaX ) / 16; + is_y = ( 5 * DeltaY ) / 16; + cs = DeltaX / 8; + + y0 = Obj->Y + ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + y0 = (float)( y0 ) * XschUnitGridStep; + y0 = ( y0 / XSCH_UNIT ) - XschPixelGridY; + y0 = XschGraphicDy - y0; + + y2 = Obj->Y + ( SCP_BOX_CON_BASE_Y + SCP_BOX_CON_STEP_Y ) * XSCH_UNIT; + y2 = (float)( y2 ) * XschUnitGridStep; + y2 = ( y2 / XSCH_UNIT ) - XschPixelGridY; + y2 = XschGraphicDy - y2; + + y1 = XschGraphicDy - Ycr; + /* + x1 = X2r - cs; + */ + x1 = X1r + 3 * cs; + x = X1r; + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, y0, x, y0 - cs ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, y0 - cs, x1 - cs, y0 - cs ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x1 - cs, y0 - cs, x1 - cs, y2 + cs ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x1 - cs, y2 + cs, x, y2 + cs ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, y2 + cs, x, y2 ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x1, y0 - cs, x1, y2 + cs ); + + if ( ( Obj->ARG1 ) == 0 ) + { + /* Output line : centered vertically */ + XDrawLine( XschGraphicDisplay, XschGraphicPixmap, XschDrawGC, + x1, y1, x1 + cs, y1 ); + } + else + { + /* Output circle */ + XDrawArc( XschGraphicDisplay, XschGraphicPixmap, XschDrawGC, + x1, y1 - cs/2, cs, cs, 0, 23040 ); + } + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x1 + cs, y1, X2r, y1 ); +} + +/*------------------------------------------------------------\ +| | +| XschDrawAnd | +| | +\------------------------------------------------------------*/ + +static void XschDrawAnd( X1r, Y1r, X2r, Y2r, Ycr, Obj ) + + long X1r; + long Y1r; + long X2r; + long Y2r; + long Ycr; + xschobj_list *Obj; +{ +/* +** Fred Petrot (The King ) has initially written those lines ! +** Ludo Jacomme (The Slave) has modified them :-) +*/ + long gs_y; + long gs_x; + long cs; + int i; + int n; + long x, y; + long yc; + long y1; + long DeltaX; + long DeltaY; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + +# if 0 +XDrawRectangle( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + X1r, XschGraphicDy - Y2r, + DeltaX, DeltaY ); +# endif + + gs_y = ( 7 * DeltaY ) / 8; + gs_x = ( 6 * DeltaX ) / 8; + cs = DeltaX / 8; + + yc = XschGraphicDy - Ycr; + y = XschGraphicDy - Ycr - gs_y/2; + x = X1r + cs; + n = Obj->ARG1; + + /* And shape alone */ + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, y, x + gs_x/2, y ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x , y + gs_y, + x + gs_x/2, y + gs_y ); + + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, y, gs_x, gs_y, 90 * 64, -180 * 64); + + if ( Obj->ARG3 == 0 ) + { + /* Output line : centered vertically */ + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x + gs_x, yc, x + gs_x + cs, yc ); + } + else + { + /* Output circle (for a NAND) */ + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x + gs_x, yc - cs/2, cs, cs, 0 * 64, 360 * 64); + } + + /* Input lines */ + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, x, y, x, y + gs_y); + + y1 = Obj->Y + ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + + /* Circle for inversion */ + for (i = 0; i < n; i++) + { + yc = (float)( y1 ) * XschUnitGridStep; + yc = ( yc / XSCH_UNIT ) - XschPixelGridY; + yc = XschGraphicDy - yc; + + if (( Obj->ARG2 & (1 << i)) == 0) + { + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x - cs, yc, x, yc ); + } + else + { + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x - cs, + yc - cs/2, + cs, cs, 0 * 64, 360 * 64); + } + + y1 += ( SCP_BOX_CON_STEP_Y * XSCH_UNIT ); + } +} + +/*------------------------------------------------------------\ +| | +| XschDrawRegister | +| | +\------------------------------------------------------------*/ + +static void XschDrawRegister( X1r, Y1r, X2r, Y2r, Ycr, Obj ) + + long X1r; + long Y1r; + long X2r; + long Y2r; + long Ycr; + xschobj_list *Obj; +{ +/* +** Fred Petrot (The King ) has initially written those lines ! +** Ludo Jacomme (The Slave) has modified them :-) +*/ + long gs_y; + long gs_x; + long cs; + long es_x; + long es_y; + int i; + int ni; + long x, y; + long yc; + long xc; + long y1; + long DeltaX; + long DeltaY; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + +# if 0 + XDrawRectangle( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + X1r, XschGraphicDy - Y2r, + DeltaX, DeltaY ); +# endif + + gs_y = ( 7 * DeltaY ) / 8; + gs_x = ( 6 * DeltaX ) / 8; + cs = DeltaX / 8; + + es_y = DeltaX / 4; + es_x = DeltaX / 8; + + yc = XschGraphicDy - Ycr; + y = XschGraphicDy - Ycr - gs_y/2; + x = X1r + cs; + xc = (X2r + X1r) /2; + ni = Obj->ARG1; + + /* shape alone */ + + XDrawRectangle( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, y, gs_x, gs_y ); + +/* +** Rising/Falling Edge +*/ + if ( ( Obj->ARG5 == 1 ) || + ( Obj->ARG5 == 2 ) ) + { + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + xc, yc - es_y, xc, yc + es_y ); + +/* +** Rising +*/ + if ( Obj->ARG5 == 1 ) + { + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + xc, yc + es_y, xc - es_x, yc + es_y ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + xc, yc - es_y, xc + es_x, yc - es_y ); + } + else +/* +** Falling +*/ + { + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + xc, yc - es_y, xc - es_x, yc - es_y ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + xc, yc + es_y, xc + es_x, yc + es_y ); + } + } + + if ( Obj->ARG4 == 0 ) + { + /* Output line : centered vertically */ + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x + gs_x, yc, x + gs_x + cs, yc ); + } + else + { + /* Output circle */ + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x + gs_x, yc - cs/2, cs, cs, 0 * 64, 360 * 64); + } + + + /* Input lines */ + /* Circle for inversion */ + + y1 = Obj->Y + ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + + for (i = 0; i < ni; i++) + { + yc = (float)( y1 ) * XschUnitGridStep; + yc = ( yc / XSCH_UNIT ) - XschPixelGridY; + yc = XschGraphicDy - yc; + + if (( Obj->ARG2 & (1 << i)) == 0) + { + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x - cs, yc, x, yc ); + } + else + { + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x - cs, + yc - cs/2, + cs, cs, 0 * 64, 360 * 64); + } + + /* Clock */ + + if (( Obj->ARG3 & (1 << i)) != 0) + { + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, yc - cs/2, x + cs, yc ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x + cs, yc, x, yc + cs/2 ); + } + + y1 += ( SCP_BOX_CON_STEP_Y * XSCH_UNIT ); + } +} + +/*------------------------------------------------------------\ +| | +| XschDrawOr | +| | +\------------------------------------------------------------*/ + +static void XschDrawOr( X1r, Y1r, X2r, Y2r, Ycr, Obj ) + + long X1r; + long Y1r; + long X2r; + long Y2r; + long Ycr; + xschobj_list *Obj; +{ +/* +** Fred Petrot (The King ) has initially written those lines ! +** Ludo Jacomme (The Slave) has modified them :-) +*/ + long gs_y; + long gs_x; + long cs; + long Radius; + int i; + int n; + long x, y; + long yc; + long y1; + long DeltaX; + long DeltaY; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + +# if 0 + XDrawRectangle( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + X1r, XschGraphicDy - Y2r, + DeltaX, DeltaY ); +# endif + + gs_y = ( 7 * DeltaY ) / 8; + gs_x = ( 6 * DeltaX ) / 8; + cs = DeltaX / 8; + + yc = XschGraphicDy - Ycr; + y = XschGraphicDy - Ycr - gs_y/2; + x = X1r + cs; + n = Obj->ARG1; + + /* Or shape alone */ + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, y, x + gs_x/2, y ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x , y + gs_y, + x + gs_x/2, y + gs_y ); + + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, y, gs_x, gs_y, 90 * 64, -180 * 64); + + Radius = (float)(gs_y) * 0.707106781185; + + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x - (Radius * 5 / 3), yc - Radius, + Radius * 2, Radius * 2, 45 * 64, -90 * 64); + + if ( Obj->ARG3 == 0 ) + { + /* Output line : centered vertically */ + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x + gs_x, yc, x + gs_x + cs, yc ); + } + else + { + /* Output circle */ + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x + gs_x, yc - cs/2, cs, cs, 0 * 64, 360 * 64); + } + + /* Input lines */ +# if 0 + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, x, y, x, y + gs_y); +# endif + + y1 = Obj->Y + ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + + /* Circle for inversion */ + for (i = 0; i < n; i++) + { + yc = (float)( y1 ) * XschUnitGridStep; + yc = ( yc / XSCH_UNIT ) - XschPixelGridY; + yc = XschGraphicDy - yc; + + if (( Obj->ARG2 & (1 << i)) == 0) + { + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x - cs, yc, x, yc ); + } + else + { + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x - cs, + yc - cs/2, + cs, cs, 0 * 64, 360 * 64); + } + + y1 += ( SCP_BOX_CON_STEP_Y * XSCH_UNIT ); + } +} + +/*------------------------------------------------------------\ +| | +| XschDrawXor | +| | +\------------------------------------------------------------*/ + +static void XschDrawXor( X1r, Y1r, X2r, Y2r, Ycr, Obj ) + + long X1r; + long Y1r; + long X2r; + long Y2r; + long Ycr; + xschobj_list *Obj; +{ +/* +** Fred Petrot (The King ) has initially written those lines ! +** Ludo Jacomme (The Slave) has modified them :-) +*/ + long gs_y; + long gs_x; + long cs; + long Radius; + int i; + int n; + long x, y; + long yc; + long y1; + long DeltaX; + long DeltaY; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + +# if 0 + XDrawRectangle( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + X1r, XschGraphicDy - Y2r, + DeltaX, DeltaY ); +# endif + + gs_y = ( 7 * DeltaY ) / 8; + gs_x = ( 6 * DeltaX ) / 8; + cs = DeltaX / 8; + + yc = XschGraphicDy - Ycr; + y = XschGraphicDy - Ycr - gs_y/2; + x = X1r + cs; + n = Obj->ARG1; + + /* Xor shape alone */ + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x + gs_x/4, y, x + gs_x/2, y ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x + gs_x/4, y + gs_y, + x + gs_x/2, y + gs_y ); + + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, y, gs_x, gs_y, 90 * 64, -180 * 64); + + Radius = (float)(gs_y) * 0.707106781185; /* sqrt(2) */ + + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x - (Radius * 5 / 3), yc - Radius, + Radius * 2, Radius * 2, 45 * 64, -90 * 64); + + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x - (Radius * 4 / 3), yc - Radius, + Radius * 2, Radius * 2, 45 * 64, -90 * 64); + + if ( Obj->ARG3 == 0 ) + { + /* Output line : centered vertically */ + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x + gs_x, yc, x + gs_x + cs, yc ); + } + else + { + /* Output circle */ + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x + gs_x, yc - cs/2, cs, cs, 0 * 64, 360 * 64); + } + + /* Input lines */ +# if 0 + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, x, y, x, y + gs_y); +# endif + + y1 = Obj->Y + ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + + /* Circle for inversion */ + for (i = 0; i < n; i++) + { + yc = (float)( y1 ) * XschUnitGridStep; + yc = ( yc / XSCH_UNIT ) - XschPixelGridY; + yc = XschGraphicDy - yc; + + if (( Obj->ARG2 & (1 << i)) == 0) + { + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x - cs, yc, x, yc ); + } + else + { + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x - cs, + yc - cs/2, + cs, cs, 0 * 64, 360 * 64); + } + + y1 += ( SCP_BOX_CON_STEP_Y * XSCH_UNIT ); + } +} + +/*------------------------------------------------------------\ +| | +| XschDrawAndOr | +| | +\------------------------------------------------------------*/ + +static void XschDrawAndOr( X1r, Y1r, X2r, Y2r, Ycr, Obj ) + + long X1r; + long Y1r; + long X2r; + long Y2r; + long Ycr; + xschobj_list *Obj; +{ + long gs_y; + long gs_x; + long cs; + int i; + int n; + int na; + long gos_y; + long gos_x; + long gas_y; + long gas_x; + long Radius; + + long x, y; + long yc; + long y1; + long DeltaX; + long DeltaY; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + +# if 0 +XDrawRectangle( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + X1r, XschGraphicDy - Y2r, + DeltaX, DeltaY ); +# endif + + n = Obj->ARG1; + + gs_y = ( 7 * DeltaY ) / 8; + gs_x = ( 6 * DeltaX ) / 8; + cs = DeltaX / 8; + + yc = XschGraphicDy - Ycr; + y = XschGraphicDy - Ycr - gs_y/2; + x = X1r + cs; + + if ( Obj->ARG3 == 0 ) + { + /* Output line : centered vertically */ + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x + gs_x, yc, x + gs_x + cs, yc ); + } + else + { + /* Output circle */ + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x + gs_x, yc - cs/2, cs, cs, 0 * 64, 360 * 64); + } + +/* +** Input connectors +*/ + y1 = Obj->Y + ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + + /* Circle for inversion */ + for (i = 0; i < n; i++) + { + yc = (float)( y1 ) * XschUnitGridStep; + yc = ( yc / XSCH_UNIT ) - XschPixelGridY; + yc = XschGraphicDy - yc; + + if (( Obj->ARG2 & (1 << i)) == 0) + { + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x - cs, yc, x, yc ); + } + else + { + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x - cs, + yc - cs/2, + cs, cs, 0 * 64, 360 * 64); + } + + y1 += ( SCP_BOX_CON_STEP_Y * XSCH_UNIT ); + } +/* +** Draw Input And gates +*/ + na = n / 2; + + if ( n & 1 ) gas_y = 7 * DeltaY / ( 8 * ( na + 1 ) ); + else gas_y = 7 * DeltaY / ( 8 * na ); + + gas_x = gs_x / 3; + + y1 = Obj->Y + Obj->DY - ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + y1 -= SCP_BOX_CON_STEP_Y * XSCH_UNIT / 2; + + for ( i = 0; i < na; i++ ) + { + yc = (float)( y1 ) * XschUnitGridStep; + yc = ( yc / XSCH_UNIT ) - XschPixelGridY; + yc = XschGraphicDy - yc; + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, x, yc - gas_y /2, x, yc + gas_y/2); + + /* And Shape */ + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, yc - gas_y/2, x + gas_x/2, yc - gas_y/2 ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x , yc + gas_y/2, + x + gas_x/2, yc + gas_y/2 ); + + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, yc - gas_y/2, gas_x, gas_y -1, 90 * 64, -180 * 64); + + y1 -= 2 * ( SCP_BOX_CON_STEP_Y * XSCH_UNIT ); + } + + if ( n & 1 ) + { + y1 = y1 + ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + + yc = (float)( y1 ) * XschUnitGridStep; + yc = ( yc / XSCH_UNIT ) - XschPixelGridY; + yc = XschGraphicDy - yc; + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x , yc, x + gas_x, yc ); + + + } +/* +** Draw Output Or gate +*/ + /* Or shape alone */ + gos_y = 2 * DeltaY / 3; + gos_x = ( 2 * gs_x ) / 3; + yc = XschGraphicDy - Ycr; + y = yc + gos_y /2; + x = x + gas_x; + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, y, x + gos_x/2, y ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x , y - gos_y, + x + gos_x/2, y - gos_y ); + + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, y - gos_y, gos_x, gos_y, 90 * 64, -180 * 64); + + Radius = (float)(gos_y) * 0.707106781185; + + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x - (Radius * 5 / 3), yc - Radius, + Radius * 2, Radius * 2, 45 * 64, -90 * 64); +} + +/*------------------------------------------------------------\ +| | +| XschDrawMux | +| | +\------------------------------------------------------------*/ + +static void XschDrawMux( X1r, Y1r, X2r, Y2r, Ycr, Obj ) + + long X1r; + long Y1r; + long X2r; + long Y2r; + long Ycr; + xschobj_list *Obj; +{ + long gs_y; + long gs_x; + long ms_x; + long ms_y; + long cs; + int i; + int ni; + int ns; + + long x, y; + long yc; + long y1; + long y2; + long y3; + long x3; + long DeltaX; + long DeltaY; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + + ns = Obj->ARG1; + ni = Obj->ARG2; + +# if 0 +XDrawRectangle( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + X1r, XschGraphicDy - Y2r, + DeltaX, DeltaY ); +# endif + + gs_y = ( 7 * DeltaY ) / 8; + gs_x = ( 6 * DeltaX ) / 8; + cs = DeltaX / 8; + + yc = XschGraphicDy - Ycr; + x = X1r + cs; + +/* +** Draw Mux Rectangle +*/ + ms_x = gs_x / 2; + + y1 = Obj->Y + (2 * SCP_BOX_CON_BASE_Y + (ni - 1) * SCP_BOX_CON_STEP_Y) * XSCH_UNIT; + + y2 = (float)( y1 ) * XschUnitGridStep; + y2 = ( y2 / XSCH_UNIT ) - XschPixelGridY; + + ms_y = y2 - Y1r; + + y2 = XschGraphicDy - y2; + + XDrawRectangle( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, y2, ms_x, ms_y ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, y2, x + ms_x, y2 + ms_y / 2 ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x + ms_x, y2 + ms_y/2, x, y2 + ms_y ); + + if ( Obj->ARG4 == 0 ) + { + /* Output line : centered vertically */ + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x + ms_x, y2 + ms_y/2, x + ms_x + cs, y2 + ms_y/2 ); + } + else + { + /* Output circle */ + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x + ms_x, y2 + ms_y/2 - cs/2, cs, cs, 0 * 64, 360 * 64); + } + + y3 = y2 + ms_y/2; + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x + ms_x + cs, y3, x + gs_x + cs, y3 ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x + gs_x + cs, y3, x + gs_x + cs, yc ); +/* +** Input connectors +*/ + y1 = Obj->Y + ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + + /* Circle for inversion */ + for (i = 0; i < ni; i++) + { + y3 = (float)( y1 ) * XschUnitGridStep; + y3 = ( y3 / XSCH_UNIT ) - XschPixelGridY; + y3 = XschGraphicDy - y3; + + if (( Obj->ARG3 & (1 << i)) == 0) + { + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x - cs, y3, x, y3 ); + } + else + { + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x - cs, + y3 - cs/2, + cs, cs, 0 * 64, 360 * 64); + } + + y1 += ( SCP_BOX_CON_STEP_Y * XSCH_UNIT ); + } + + x3 = x; +/* +** Select connectors +*/ + for (i = 0; i < ns; i++) + { + y3 = (float)( y1 ) * XschUnitGridStep; + y3 = ( y3 / XSCH_UNIT ) - XschPixelGridY; + y3 = XschGraphicDy - y3; + + x3 += ms_x / ( ns + 1 ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x - cs, y3, x3, y3 ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x3, y3, x3, y2 ); + + y1 += ( SCP_BOX_CON_STEP_Y * XSCH_UNIT ); + } + +# if 0 +/* +** Draw Input And gates +*/ + na = n / 2; + + if ( n & 1 ) gas_y = 7 * DeltaY / ( 8 * ( na + 1 ) ); + else gas_y = 7 * DeltaY / ( 8 * na ); + + gas_x = gs_x / 3; + + y1 = Obj->Y + Obj->DY - ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + y1 -= SCP_BOX_CON_STEP_Y * XSCH_UNIT / 2; + + for ( i = 0; i < na; i++ ) + { + yc = (float)( y1 ) * XschUnitGridStep; + yc = ( yc / XSCH_UNIT ) - XschPixelGridY; + yc = XschGraphicDy - yc; + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, x, yc - gas_y /2, x, yc + gas_y/2); + + /* And Shape */ + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, yc - gas_y/2, x + gas_x/2, yc - gas_y/2 ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x , yc + gas_y/2, + x + gas_x/2, yc + gas_y/2 ); + + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, yc - gas_y/2, gas_x, gas_y -1, 90 * 64, -180 * 64); + + y1 -= 2 * ( SCP_BOX_CON_STEP_Y * XSCH_UNIT ); + } + + if ( n & 1 ) + { + y1 = y1 + ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + + yc = (float)( y1 ) * XschUnitGridStep; + yc = ( yc / XSCH_UNIT ) - XschPixelGridY; + yc = XschGraphicDy - yc; + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x , yc, x + gas_x, yc ); + + + } +/* +** Draw Output Or gate +*/ + /* Or shape alone */ + gos_y = 2 * DeltaY / 3; + gos_x = ( 2 * gs_x ) / 3; + yc = XschGraphicDy - Ycr; + y = yc + gos_y /2; + x = x + gas_x; + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, y, x + gos_x/2, y ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x , y - gos_y, + x + gos_x/2, y - gos_y ); + + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, y - gos_y, gos_x, gos_y, 90 * 64, -180 * 64); + + Radius = (float)(gos_y) * 0.707106781185; + + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x - (Radius * 5 / 3), yc - Radius, + Radius * 2, Radius * 2, 45 * 64, -90 * 64); +# endif +} + +/*------------------------------------------------------------\ +| | +| XschDrawOrAnd | +| | +\------------------------------------------------------------*/ + +static void XschDrawOrAnd( X1r, Y1r, X2r, Y2r, Ycr, Obj ) + + long X1r; + long Y1r; + long X2r; + long Y2r; + long Ycr; + xschobj_list *Obj; +{ + long gs_y; + long gs_x; + long cs; + int i; + int n; + int no; + long gos_y; + long gos_x; + long gas_y; + long gas_x; + long Radius; + + long x, y; + long yc; + long y1; + long DeltaX; + long DeltaY; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + +# if 0 +XDrawRectangle( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + X1r, XschGraphicDy - Y2r, + DeltaX, DeltaY ); +# endif + + n = Obj->ARG1; + + gs_y = ( 7 * DeltaY ) / 8; + gs_x = ( 6 * DeltaX ) / 8; + cs = DeltaX / 8; + + yc = XschGraphicDy - Ycr; + y = XschGraphicDy - Ycr - gs_y/2; + x = X1r + cs; + + if ( Obj->ARG3 == 0 ) + { + /* Output line : centered vertically */ + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x + gs_x, yc, x + gs_x + cs, yc ); + } + else + { + /* Output circle */ + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x + gs_x, yc - cs/2, cs, cs, 0 * 64, 360 * 64); + } + +/* +** Input connectors +*/ + y1 = Obj->Y + ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + + /* Circle for inversion */ + for (i = 0; i < n; i++) + { + yc = (float)( y1 ) * XschUnitGridStep; + yc = ( yc / XSCH_UNIT ) - XschPixelGridY; + yc = XschGraphicDy - yc; + + if (( Obj->ARG2 & (1 << i)) == 0) + { + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x - cs, yc, x, yc ); + } + else + { + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x - cs, + yc - cs/2, + cs, cs, 0 * 64, 360 * 64); + } + + y1 += ( SCP_BOX_CON_STEP_Y * XSCH_UNIT ); + } +/* +** Draw Input Or gates +*/ + no = n / 2; + + if ( n & 1 ) gos_y = 7 * DeltaY / ( 8 * ( no + 1 ) ); + else gos_y = 7 * DeltaY / ( 8 * no ); + + gos_x = gs_x / 3; + + y1 = Obj->Y + Obj->DY - ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + y1 -= SCP_BOX_CON_STEP_Y * XSCH_UNIT / 2; + + for ( i = 0; i < no; i++ ) + { + yc = (float)( y1 ) * XschUnitGridStep; + yc = ( yc / XSCH_UNIT ) - XschPixelGridY; + yc = XschGraphicDy - yc; + + /* Or shape alone */ + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x , yc + gos_y/2, + x + gos_x/2, yc + gos_y/2 ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x , yc - gos_y/2, + x + gos_x/2, yc - gos_y/2 ); + + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, yc - gos_y/2, gos_x, gos_y-1, 90 * 64, -180 * 64); + + Radius = (float)(gos_y) * 0.707106781185; + + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x - (Radius * 5 / 3), yc - Radius, + Radius * 2, Radius * 2, 45 * 64, -90 * 64); + + + y1 -= 2 * ( SCP_BOX_CON_STEP_Y * XSCH_UNIT ); + } + + if ( n & 1 ) + { + y1 = y1 + ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ); + + yc = (float)( y1 ) * XschUnitGridStep; + yc = ( yc / XSCH_UNIT ) - XschPixelGridY; + yc = XschGraphicDy - yc; + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x , yc, x + gos_x, yc ); + + } + + /* Draw output And Gate */ + gas_y = 2 * DeltaY / 3; + gas_x = ( 2 * gs_x ) / 3; + yc = XschGraphicDy - Ycr; + y = yc + gas_y /2; + x = x + gos_x; + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, x, yc - gas_y /2, x, yc + gas_y/2); + + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, yc - gas_y/2, x + gas_x/2, yc - gas_y/2 ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x , yc + gas_y/2, + x + gas_x/2, yc + gas_y/2 ); + + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + x, yc - gas_y/2, gas_x, gas_y -1, 90 * 64, -180 * 64); +} + +/*------------------------------------------------------------\ +| | +| XschDisplayOneObject | +| | +\------------------------------------------------------------*/ + +void XschDisplayOneObject( Obj ) + + xschobj_list *Obj; +{ + XPoint Points[ 7 ]; + int Index; + long X1r; + long X2r; + long Y1r; + long Y2r; + long Ycr; + long DeltaX; + long DeltaY; + short ObjType; + + if ( IsXschLineLeft( Obj ) ) + { + X1r = Obj->X + Obj->DX; + X2r = Obj->X; + } + else + { + X1r = Obj->X; + X2r = Obj->X + Obj->DX; + } + + if ( IsXschLineDown( Obj ) ) + { + Y1r = Obj->Y + Obj->DY; + Y2r = Obj->Y; + } + else + { + Y1r = Obj->Y; + Y2r = Obj->Y + Obj->DY; + } + + Ycr = (float)( ( Y2r + Y1r) >> 1 ) * XschUnitGridStep; + X1r = (float)( X1r ) * XschUnitGridStep; + Y1r = (float)( Y1r ) * XschUnitGridStep; + X2r = (float)( X2r ) * XschUnitGridStep; + Y2r = (float)( Y2r ) * XschUnitGridStep; + + Ycr = ( Ycr / XSCH_UNIT ) - XschPixelGridY; + X1r = ( X1r / XSCH_UNIT ) - XschPixelGridX; + X2r = ( X2r / XSCH_UNIT ) - XschPixelGridX; + Y1r = ( Y1r / XSCH_UNIT ) - XschPixelGridY; + Y2r = ( Y2r / XSCH_UNIT ) - XschPixelGridY; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + + ObjType = GetXschObjectType( Obj ); + + if ( ( ObjType >= XSCH_OBJECT_BUFFER ) && + ( ObjType <= XSCH_OBJECT_MUX ) ) + { + if ( ( DeltaX < 5 ) || + ( DeltaY < 5 ) ) ObjType = XSCH_OBJECT_RECTANGLE; + } + + switch ( ObjType ) + { + case XSCH_OBJECT_LINE : + + if ( Y1r == Y2r ) + { + if ( X1r < 0 ) X1r = 0; + if ( X2r < 0 ) X2r = 0; + if ( X1r > (long)XschGraphicDx ) X1r = (long)XschGraphicDx; + if ( X2r > (long)XschGraphicDx ) X2r = (long)XschGraphicDx; + } + else + if ( X1r == X2r ) + { + if ( Y1r < 0 ) Y1r = 0; + if ( Y2r < 0 ) Y2r = 0; + if ( Y1r > (long)XschGraphicDy ) Y1r = (long)XschGraphicDy; + if ( Y2r > (long)XschGraphicDy ) Y2r = (long)XschGraphicDy; + } + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + X1r, XschGraphicDy - Y1r, + X2r, XschGraphicDy - Y2r ); + break; + + case XSCH_OBJECT_ARROW : + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + X1r, XschGraphicDy - Y1r, + X2r, XschGraphicDy - Y2r ); + + if ( XschComputeArrow( X1r, Y1r, X2r, Y2r, Points ) ) + { + Points[ 0 ].y = XschGraphicDy - Points[ 0 ].y; + Points[ 1 ].y = XschGraphicDy - Points[ 1 ].y; + Points[ 2 ].y = XschGraphicDy - Points[ 2 ].y; + + XFillPolygon( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, Points, 3, + Convex, + CoordModeOrigin ); + } + + break; + + case XSCH_OBJECT_PENTAGON : + + if ( XschComputePentagon( X1r, Y1r, X2r, Y2r, Points ) ) + { + for ( Index = 0; Index < 7; Index++ ) + { + Points[ Index ].y = XschGraphicDy - Points[ Index ].y; + } + + XDrawLines( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, Points, 7, + CoordModeOrigin ); + } + + break; + + case XSCH_OBJECT_CIRCLE : + + XDrawArc( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + X1r, XschGraphicDy - Y2r, + DeltaX, DeltaY, 0, 23040 ); + break; + + case XSCH_OBJECT_RECTANGLE : + + XDrawRectangle( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + X1r, XschGraphicDy - Y2r, + DeltaX, DeltaY ); + + break; + + case XSCH_OBJECT_TRIANGLE : + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + X1r, XschGraphicDy - Y1r, + X2r, ( XschGraphicDy - Y1r - ( DeltaY >> 1 ) ) ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + X1r, XschGraphicDy - Y1r, + X1r, XschGraphicDy - Y2r ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + X1r, XschGraphicDy - Y2r, + X2r, ( XschGraphicDy - Y1r - ( DeltaY >> 1 ) ) ); + + break; + + case XSCH_OBJECT_CROSS_BOX : + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + X1r, XschGraphicDy - Y1r, + X2r, XschGraphicDy - Y2r ); + + XDrawLine( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + X1r, XschGraphicDy - Y2r, + X2r, XschGraphicDy - Y1r ); + + XDrawRectangle( XschGraphicDisplay, + XschGraphicPixmap, + XschDrawGC, + X1r, XschGraphicDy - Y2r, + DeltaX, DeltaY ); + break; + + case XSCH_OBJECT_BUFFER : + + XschDrawBuffer( X1r, Y1r, X2r, Y2r, Ycr, Obj ); + + break; + + case XSCH_OBJECT_AND : + + XschDrawAnd( X1r, Y1r, X2r, Y2r, Ycr, Obj ); + + + break; + + case XSCH_OBJECT_OR : + + XschDrawOr( X1r, Y1r, X2r, Y2r, Ycr, Obj ); + + break; + + case XSCH_OBJECT_XOR : + + XschDrawXor( X1r, Y1r, X2r, Y2r, Ycr, Obj ); + + break; + + case XSCH_OBJECT_TRISTATE : + + XschDrawTristate( X1r, Y1r, X2r, Y2r, Ycr, Obj ); + + break; + + case XSCH_OBJECT_REGISTER : + + XschDrawRegister( X1r, Y1r, X2r, Y2r, Ycr, Obj ); + + break; + + case XSCH_OBJECT_TRANSISTOR : + + XschDrawTransistor( X1r, Y1r, X2r, Y2r, Ycr, Obj ); + + break; + + case XSCH_OBJECT_CONSTANT : + + XschDrawConstant( X1r, Y1r, X2r, Y2r, Ycr, Obj ); + + break; + + case XSCH_OBJECT_ANDOR : + + XschDrawAndOr( X1r, Y1r, X2r, Y2r, Ycr, Obj ); + + break; + + case XSCH_OBJECT_ORAND : + + XschDrawOrAnd( X1r, Y1r, X2r, Y2r, Ycr, Obj ); + + break; + + case XSCH_OBJECT_MUX : + + XschDrawMux( X1r, Y1r, X2r, Y2r, Ycr, Obj ); + + break; + } +} + +/*------------------------------------------------------------\ +| | +| XschDisplayOneString | +| | +\------------------------------------------------------------*/ + +void XschDisplayOneString( Obj ) + + xschobj_list *Obj; +{ + long X1r; + long X2r; + long Y1r; + long Y2r; + long DeltaX; + long DeltaY; + long WidthText; + long HeightText; + int Length; + + if ( IsXschLineLeft( Obj ) ) + { + X1r = Obj->X + Obj->DX; + X2r = Obj->X; + } + else + { + X1r = Obj->X; + X2r = Obj->X + Obj->DX; + } + + if ( IsXschLineDown( Obj ) ) + { + Y1r = Obj->Y + Obj->DY; + Y2r = Obj->Y; + } + else + { + Y1r = Obj->Y; + Y2r = Obj->Y + Obj->DY; + } + + X1r = (float)( X1r ) * XschUnitGridStep; + Y1r = (float)( Y1r ) * XschUnitGridStep; + X2r = (float)( X2r ) * XschUnitGridStep; + Y2r = (float)( Y2r ) * XschUnitGridStep; + + X1r = ( X1r / XSCH_UNIT ) - XschPixelGridX; + X2r = ( X2r / XSCH_UNIT ) - XschPixelGridX; + Y1r = ( Y1r / XSCH_UNIT ) - XschPixelGridY; + Y2r = ( Y2r / XSCH_UNIT ) - XschPixelGridY; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + + Length = strlen( Obj->NAME ); + WidthText = XTextWidth( XschTextFont, Obj->NAME, Length ); + HeightText = XschTextFont->ascent; + + if ( ( IsXschSchNet( Obj ) ) && + ( DeltaX < WidthText ) ) return; + + if ( Obj->TYPE == XSCH_OBJECT_TEXT_RIGHT ) + { + XDrawString( XschGraphicDisplay, + XschGraphicPixmap, + XschTextGC, + X1r, + XschGraphicDy - (( Y1r + Y2r - HeightText ) >> 1), + Obj->NAME, Length ); + } + else + if ( Obj->TYPE == XSCH_OBJECT_TEXT_LEFT ) + { + XDrawString( XschGraphicDisplay, + XschGraphicPixmap, + XschTextGC, + X2r - WidthText, + XschGraphicDy - (( Y1r + Y2r - HeightText ) >> 1), + Obj->NAME, Length ); + } + else + { + XDrawString( XschGraphicDisplay, + XschGraphicPixmap, + XschTextGC, + ( X2r + X1r - WidthText ) >> 1, + XschGraphicDy - (( Y1r + Y2r - HeightText ) >> 1), + Obj->NAME, Length ); + } +} + +/*------------------------------------------------------------\ +| | +| XschDisplayFigure | +| | +\------------------------------------------------------------*/ + +void XschDisplayFigure( GraphicX1, GraphicY1, GraphicX2, GraphicY2 ) + + long GraphicX1; + long GraphicY1; + long GraphicX2; + long GraphicY2; +{ + xschview_list *View; + xschobj_list *Obj; + long X1; + long Y1; + long X2; + long Y2; + int Layer; + char DisplayText; + + autbegin(); + + DisplayText = 1; + + XschGraphicX1 = GraphicX1; + XschGraphicX2 = GraphicX2; + XschGraphicY1 = GraphicY1; + XschGraphicY2 = GraphicY2; + + if ( XschUnitGridStep > 10.0 ) + { + XschTextGC = XschLargeTextGC; + XschTextFont = XschLargeTextFont; + } + else + if ( XschUnitGridStep > 6.0 ) + { + XschTextGC = XschMediumTextGC; + XschTextFont = XschMediumTextFont; + } + else + if ( ( XschUnitGridStep > 3.0 ) || + ( XSCH_FORCE_DISPLAY ) ) + { + XschTextGC = XschSmallTextGC; + XschTextFont = XschSmallTextFont; + } + else + { + DisplayText = 0; + } + + XschClearGraphicWindow( GraphicX1, + XschGraphicDy - GraphicY2, + GraphicX2 - GraphicX1, + GraphicY2 - GraphicY1 ); + + if ( XschFigure == (xschfig_list *)NULL ) return; + + X1 = GraphicX1 + XschPixelGridX; + X2 = GraphicX2 + XschPixelGridX; + Y1 = GraphicY1 + XschPixelGridY; + Y2 = GraphicY2 + XschPixelGridY; + + X1 = ( X1 / XschUnitGridStep ); + Y1 = ( Y1 / XschUnitGridStep ); + X2 = ( X2 / XschUnitGridStep ); + Y2 = ( Y2 / XschUnitGridStep ); + + if ( X2 >= 0 ) { X2 = X2 + 1; } + if ( Y2 >= 0 ) { Y2 = Y2 + 1; } + if ( X1 <= 0 ) { X1 = X1 - 1; } + if ( Y1 <= 0 ) { Y1 = Y1 - 1; } + + X1 = X1 * XSCH_UNIT; + X2 = X2 * XSCH_UNIT; + Y1 = Y1 * XSCH_UNIT; + Y2 = Y2 * XSCH_UNIT; + + for ( Layer = 0; Layer < XSCH_MAX_LAYER; Layer++ ) + { + if ( XSCH_ACTIVE_LAYER_TABLE[ Layer ] == 0 ) continue; + + XschDrawGC = XschLayerDrawGC[ Layer ]; + + for ( Obj = XschFigure->OBJECT[ Layer ]; + Obj != (xschobj_list *)NULL; + Obj = Obj->NEXT ) + { + if ( XSCH_ACTIVE_LAYER_TABLE[ Obj->LAYER ] == 0 ) continue; + + if ( ( Obj->X <= X2 ) && + ( Obj->Y <= Y2 ) && + ( Obj->X + Obj->DX >= X1 ) && + ( Obj->Y + Obj->DY >= Y1 ) ) + { + if ( ( IsXschAccept( Obj ) ) || + ( IsXschConnect( Obj ) ) ) + { + XschAddViewLater( Obj ); + } + else + { + XschDisplayOneObject( Obj ); + + if ( Obj->NAME != (char *)0 ) + { + if ( DisplayText ) + { + if ( ( ( IsXschSchCon( Obj ) ) && + ( ( ( IsXschSchConExt( Obj ) ) && + ( XSCH_ACTIVE_NAME_TABLE[ XSCH_CONNECTOR_NAME ] ) ) || + ( ( ! IsXschSchConExt( Obj ) ) && + ( XSCH_ACTIVE_NAME_TABLE[ XSCH_INS_CON_NAME ] ) ) ) ) || + ( ( IsXschSchBox( Obj ) && + XSCH_ACTIVE_NAME_TABLE[ XSCH_INSTANCE_NAME ] ) ) || + ( ( IsXschSchNet( Obj ) && + XSCH_ACTIVE_NAME_TABLE[ XSCH_NET_NAME ] ) ) ) + { + XschDisplayOneString( Obj ); + } + } + } + } + } + } + } + + for ( View = XschHeadView; + View != (xschview_list *)NULL; + View = View->NEXT ) + { + Obj = View->OBJECT; + + if ( IsXschAccept( Obj ) ) + { + XschDrawGC = XschAcceptDrawGC; + } + else + { + XschDrawGC = XschConnectDrawGC; + } + + XschDisplayOneObject( Obj ); + + if ( Obj->NAME != (char *)0 ) + { + if ( DisplayText ) + { + XschDisplayOneString( Obj ); + } + } + } + + XschDelView(); + XschFlushEventDisplay(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschDisplayObject | +| | +\------------------------------------------------------------*/ + +void XschDisplayObject( Obj ) + + xschobj_list *Obj; +{ + xschobj_list *ScanObj; + long Xmin; + long Ymin; + long Xmax; + long Ymax; + + autbegin(); + + Xmin = Obj->X; + Ymin = Obj->Y; + Xmax = Xmin + Obj->DX; + Ymax = Ymin + Obj->DY; + + ScanObj = Obj->LINK; + + while ( ScanObj != Obj ) + { + if ( Xmin > ScanObj->X ) + { + Xmin = ScanObj->X; + } + + if ( Xmax < ( ScanObj->X + ScanObj->DX ) ) + { + Xmax = ScanObj->X + ScanObj->DX; + } + + if ( Ymin > ScanObj->Y ) + { + Ymin = ScanObj->Y; + } + + if ( Ymax < ( ScanObj->Y + ScanObj->DY ) ) + { + Ymax = ScanObj->Y + ScanObj->DY; + } + + ScanObj = ScanObj->LINK; + } + + Xmin = (float)( Xmin - XSCH_UNIT ) * XschUnitGridStep; + Ymin = (float)( Ymin - XSCH_UNIT ) * XschUnitGridStep; + Xmax = (float)( Xmax + XSCH_UNIT ) * XschUnitGridStep; + Ymax = (float)( Ymax + XSCH_UNIT ) * XschUnitGridStep; + + Xmin = ( Xmin / XSCH_UNIT ) - XschPixelGridX - 1; + Xmax = ( Xmax / XSCH_UNIT ) - XschPixelGridX + 1; + Ymin = ( Ymin / XSCH_UNIT ) - XschPixelGridY - 1; + Ymax = ( Ymax / XSCH_UNIT ) - XschPixelGridY + 1; + + if ( Xmin < 0 ) Xmin = 0; + if ( Ymin < 0 ) Ymin = 0; + + if ( Xmax > XschGraphicDx ) Xmax = XschGraphicDx; + if ( Ymax > XschGraphicDy ) Ymax = XschGraphicDy; + + if ( ( Xmax > 0 ) && + ( Ymax > 0 ) && + ( Xmin < XschGraphicDx ) && + ( Ymin < XschGraphicDy ) ) + { + XschDisplayFigure( Xmin, Ymin , Xmax, Ymax ); + + XschRefreshGraphicWindow( Xmin, XschGraphicDy - Ymax, + Xmax - Xmin, Ymax - Ymin ); + } + + autend(); +} diff --git a/alliance/src/xsch/src/XMX_view.h b/alliance/src/xsch/src/XMX_view.h new file mode 100644 index 00000000..e397c162 --- /dev/null +++ b/alliance/src/xsch/src/XMX_view.h @@ -0,0 +1,78 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : View.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_VIEW +# define XSCH_VIEW + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct xschview_list + { + struct xschview_list *NEXT; + xschobj_list *OBJECT; + + } xschview_list; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xsch/src/XSB.h b/alliance/src/xsch/src/XSB.h new file mode 100644 index 00000000..d2492584 --- /dev/null +++ b/alliance/src/xsch/src/XSB.h @@ -0,0 +1,207 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : XSB.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_XSB +# define XSCH_XSB + +/*------------------------------------------------------\ +| | +| Others | +| | +\------------------------------------------------------*/ + +# define XSCH_TRUE 1 +# define XSCH_FALSE 0 + +# define XSCH_ERROR 1 +# define XSCH_OK 0 + +# define XSCH_NORTH 0 +# define XSCH_SOUTH 1 +# define XSCH_EAST 2 +# define XSCH_WEST 3 + +# define XSCH_NORTH_MASK 1 +# define XSCH_SOUTH_MASK 2 +# define XSCH_WEST_MASK 4 +# define XSCH_EAST_MASK 8 + +# define XSCH_DEFAULT_FIGURE_NAME "NONAME" + +/*------------------------------------------------------\ +| | +| Layer | +| | +\------------------------------------------------------*/ + +# define XSCH_MAX_LAYER 38 + +# define XSCH_SCHBOX_LAYER 0 +# define XSCH_SCHCONIN_LAYER 1 +# define XSCH_SCHCONOUT_LAYER 2 +# define XSCH_SCHNET_LAYER 3 +# define XSCH_CONSTRUCTION_LAYER 4 +# define XSCH_FIRST_USER_LAYER 5 + +/*------------------------------------------------------\ +| | +| Active Name | +| | +\------------------------------------------------------*/ + +# define XSCH_CONNECTOR_NAME 0 +# define XSCH_INSTANCE_NAME 1 +# define XSCH_INS_CON_NAME 2 +# define XSCH_NET_NAME 3 +# define XSCH_MAX_ACTIVE_NAME 4 + +/*------------------------------------------------------------\ +| | +| Edit Mode | +| | +\------------------------------------------------------------*/ + +# define XSCH_EDIT_MEASURE (char)0x00 +# define XSCH_EDIT_IDENTIFY (char)0x01 +# define XSCH_EDIT_CONNECTED (char)0x02 +# define XSCH_TOOLS_HIERARCHY_DOWN (char)0x03 + +# define XSCH_ZOOM_CENTER (char)0x80 +# define XSCH_ZOOM_IN (char)0x81 +# define XSCH_ZOOM_PAN (char)0x82 + +# define XSCH_ZOOM_MARK (char)0x80 + +/*------------------------------------------------------------\ +| | +| Input Mode | +| | +\------------------------------------------------------------*/ + +# define XSCH_INPUT_POINT 0 +# define XSCH_INPUT_ORTHO 1 +# define XSCH_INPUT_LINE 2 +# define XSCH_INPUT_LSTRING 3 +# define XSCH_INPUT_BOX 4 +# define XSCH_INPUT_SORTHO 5 +# define XSCH_INPUT_HALF_BOX 6 + +/*------------------------------------------------------------\ +| | +| Icon Cell | +| | +\------------------------------------------------------------*/ + +# define XSCH_ICON_CELL_BUFFER 0 +# define XSCH_ICON_CELL_AND 1 +# define XSCH_ICON_CELL_OR 2 +# define XSCH_ICON_CELL_XOR 3 +# define XSCH_ICON_CELL_TRISTATE 4 +# define XSCH_ICON_CELL_REGISTER 5 +# define XSCH_ICON_CELL_CONSTANT 6 +# define XSCH_ICON_CELL_ANDOR 7 +# define XSCH_ICON_CELL_ORAND 8 +# define XSCH_ICON_CELL_MUX 9 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct xschicon + { + char *NAME; + chain_list *CON_IN; + chain_list *CON_OUT; + unsigned char TYPE; + short ARGS[ 6 ]; + + } xschicon; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char XSCH_ACTIVE_LAYER_TABLE[ XSCH_MAX_LAYER ]; + extern char XSCH_ACTIVE_NAME_TABLE[ XSCH_MAX_ACTIVE_NAME ]; + + extern char *XSCH_CURSOR_COLOR_NAME; + extern char *XSCH_BACKGROUND_COLOR_NAME; + extern char *XSCH_FOREGROUND_COLOR_NAME; + extern char *XSCH_ACCEPT_COLOR_NAME; + extern char *XSCH_CONNECT_COLOR_NAME; + + extern long XSCH_CURSOR_SIZE; + extern float XSCH_LOWER_GRID_STEP; + extern long XSCH_UNIT; + extern char *XSCH_LAYER_NAME_TABLE[ XSCH_MAX_LAYER ][ 3 ]; + extern long XSCH_LAYER_XFIG_COLOR[ XSCH_MAX_LAYER ]; + extern char *XSCH_PARAM_NAME; + + extern char *XSCH_XMS_FILE_NAME; + extern char *XschFirstFileName; + extern char *XSCH_IN_SCHEM; + + extern char XSCH_VECTORIZED_MODE; + extern char XSCH_FORCE_DISPLAY; + extern char XSCH_XOR_CURSOR; + extern char XSCH_SWITCH_COLOR_MAP; + + extern authtable *XSCH_HASH_ICON; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern char *XschPostTreatString(); + extern void XschLoadParameters(); + extern void Xschgetenv(); + +# endif diff --git a/alliance/src/xsch/src/XSB_error.c b/alliance/src/xsch/src/XSB_error.c new file mode 100644 index 00000000..e3d1269a --- /dev/null +++ b/alliance/src/xsch/src/XSB_error.c @@ -0,0 +1,188 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Xsb Errors | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XSB.h" +# include "XSB_error.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +void XsbPrintError( File, Line, ErrorType, Message, Data ) + + char *File; + int Line; + char ErrorType; + char *Message; + long Data; +{ + char *Name; + + fflush(stdout); + + Name = mbkstrdup( File ); + Name[ strlen( File ) - 1 ] = '\0'; + + fprintf( stderr, "%s%d ", Name, Line ); + + switch ( ErrorType ) + { + case DEFINE_MISSING : + + fprintf( stderr, "Some defines missing\n"); + break; + + case TABLE_MISSING : + + fprintf( stderr, "Some tables missing\n"); + break; + + case LINE_EXPECTED : + + fprintf( stderr, "%s expected line %lu\n", + Message, Data ); + break; + + case UNKNOWN_DEFINE : + + fprintf( stderr, "Unknown define %s line %lu\n", + Message, Data ); + break; + + case NOT_DEFINED : + + fprintf( stderr, "%s not defined line %lu\n", + Message, Data ); + break; + + case TOO_SMAL : + + fprintf( stderr, "%s too smal line %lu\n", + Message, Data ); + break; + + case MISSING_VALUE : + + fprintf( stderr, "Missing value at line %lu\n", + Data ); + break; + + case MISSING_NAME : + + fprintf( stderr, "Missing name of %s line %lu\n", + Message, Data ); + break; + + case UNEXPECTED_LINE : + + fprintf( stderr, "%s unexpected line %lu\n", + Message, Data ); + break; + + case UNEXPECTED_EOF : + + fprintf( stderr, "Unexpected end of file, missing definitions\n"); + break; + + case TOO_MANY_WORDS : + + fprintf( stderr, "Too many words %s unexpected line %lu\n", + Message, Data ); + break; + + case MISSING_TABLE : + + fprintf( stderr, "Missing value in %s table line %lu\n", + Message, Data ); + break; + + case OPEN_FILE : + + fprintf( stderr, "Parameters file %s can't be opened\n", + Message ); + break; + + case UNKNOWN_TABLE : + + fprintf( stderr, "Unknown table %s line %lu\n", + Message , Data ); + break; + + case SYNTAX_ERROR : + + fprintf( stderr, "Syntax Error %s at line %lu\n", + Message , Data ); + break; + + case ILLEGAL_FLOAT : + + fprintf( stderr, "Illegal floating point number %s line %lu\n", + Message , Data ); + break; + } + + autexit( 1 ); +} diff --git a/alliance/src/xsch/src/XSB_error.h b/alliance/src/xsch/src/XSB_error.h new file mode 100644 index 00000000..7bf35c59 --- /dev/null +++ b/alliance/src/xsch/src/XSB_error.h @@ -0,0 +1,90 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Xsb Errors | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSB_ERROR +# define XSB_ERROR + +/*------------------------------------------------------------\ +| | +| Rpr Error Constants | +| | +\------------------------------------------------------------*/ + +# define DEFINE_MISSING 0 +# define TABLE_MISSING 1 +# define LINE_EXPECTED 2 +# define UNKNOWN_DEFINE 3 +# define NOT_DEFINED 4 +# define TOO_SMAL 5 +# define MISSING_VALUE 6 +# define MISSING_NAME 7 +# define UNEXPECTED_LINE 8 +# define UNEXPECTED_EOF 9 +# define TOO_MANY_WORDS 10 +# define MISSING_TABLE 11 +# define OPEN_FILE 12 +# define UNKNOWN_TABLE 13 +# define SYNTAX_ERROR 14 +# define ILLEGAL_FLOAT 15 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XsbPrintError(); + +# endif diff --git a/alliance/src/xsch/src/XSB_parse.c b/alliance/src/xsch/src/XSB_parse.c new file mode 100644 index 00000000..55f6bad9 --- /dev/null +++ b/alliance/src/xsch/src/XSB_parse.c @@ -0,0 +1,960 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : XsbParse.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XSB.h" +# include "XSB_error.h" +# include "XSB_parse.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XsbError( X, Y, Z ) XsbPrintError( __FILE__, __LINE__, X, Y, Z ) + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Global Variables | +| | +\------------------------------------------------------------*/ + + char *XSCH_PARAM_NAME = (char *)NULL; + char *XSCH_LAYER_NAME_TABLE[ XSCH_MAX_LAYER ][ 3 ]; + long XSCH_LAYER_XFIG_COLOR[ XSCH_MAX_LAYER ]; + + authtable *XSCH_HASH_ICON = (authtable *)0; + +/*------------------------------------------------------------\ +| | +| Private Variables | +| | +\------------------------------------------------------------*/ + + static char *XschDefaultTechnoName = XSCH_DEFAULT_PARAM_NAME; + +/*------------------------------------------------------------\ +| | +| Table variables | +| | +\------------------------------------------------------------*/ + + char *XSCH_CURSOR_COLOR_NAME; + char *XSCH_BACKGROUND_COLOR_NAME; + char *XSCH_FOREGROUND_COLOR_NAME; + char *XSCH_ACCEPT_COLOR_NAME; + char *XSCH_CONNECT_COLOR_NAME; + + long XSCH_CURSOR_SIZE; + float XSCH_LOWER_GRID_STEP; + long XSCH_UNIT; + + char *XSCH_NOT_DEFINE = ""; + +/*------------------------------------------------------------\ +| | +| Keywords variables | +| | +\------------------------------------------------------------*/ + + static char KeywordDefined = 0; + + static char *DefineKeyword; + static char *TableKeyword; + static char *EndTableKeyword; + static char *EndRecordKeyword; + static char *LowerGridStepKeyword; + static char *CursorColorNameKeyword; + static char *BackgroundColorNameKeyword; + static char *ForegroundColorNameKeyword; + static char *AcceptColorNameKeyword; + static char *ConnectColorNameKeyword; + static char *CursorSizeKeyword; + static char *UnitKeyword; + static char *LayerNameKeyword; + static char *IconCellBufferKeyword; + static char *IconCellAndKeyword; + static char *IconCellOrKeyword; + static char *IconCellXorKeyword; + static char *IconCellTristateKeyword; + static char *IconCellRegisterKeyword; + static char *IconCellConstantKeyword; + static char *IconCellAndOrKeyword; + static char *IconCellOrAndKeyword; + static char *IconCellMuxKeyword; + + static xsb_keyword KeywordDefine[ XSB_MAX_KEYWORD ] = + + { + { "None", 0 } + }; + +/*------------------------------------------------------------\ +| | +| File variables | +| | +\------------------------------------------------------------*/ + + static FILE *XsbFile; + static char XsbBuffer[ XSB_MAX_BUFFER ]; + static long XsbCurrentLine; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Xsb File Get String | +| | +\------------------------------------------------------------*/ + +char *XsbFileGetString( String, Size ) + + char *String; + int Size; +{ + register char *RegisterString; + register Register; + + autbegin(); + + RegisterString = String; + + while (--Size > 0 && (Register = getc( XsbFile )) != EOF ) + { + if ((*RegisterString++ = Register) == '\\') + { + if ((Register = getc( XsbFile )) == '\n') + { + XsbCurrentLine++; + + *(RegisterString - 1) = ' '; + } + else + { + ungetc( Register, XsbFile ); + } + } + else + { + if ( Register == '\n') break; + } + } + + *RegisterString = '\0'; + + autend(); + return ( ( Register == EOF ) && + ( RegisterString == String ) ) ? (char *)NULL : String; +} + +/*------------------------------------------------------------\ +| | +| Xsb File Get Line | +| | +\------------------------------------------------------------*/ + +int XsbGetLine( Buffer ) + + char *Buffer; +{ + char *Check; + char *String; + char OneComment; + + do + { + OneComment = 0; + + Check = XsbFileGetString( Buffer, XSB_MAX_BUFFER ); + + if ( Check != (char *)NULL ) + { + XsbCurrentLine++; + } + else + { + return( 0 ); + } + + if ( ( String = strchr( Buffer, XSB_COMMENT_CHAR )) != (char *)0 ) + { + if ( String == Buffer ) + { + OneComment = 1; + } + /* + else + { + *(String - 1) = '\0'; + } + */ + } + + while (*Buffer != '\0' && strchr( XSB_SEPARATORS_STRING, *Buffer)) + { + Buffer = Buffer + 1;; + } + + if (*Buffer == '\0') OneComment = 1; + + } + while ( OneComment == 1); + + return( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Xsb Check Keyword | +| | +\------------------------------------------------------------*/ + +char XsbCheckKeyword( Word ) + + char *Word; +{ + if ( ( Word == DefineKeyword ) || + ( Word == TableKeyword ) ) + { + return 1; + } + else + { + return 0; + } +} + +/*------------------------------------------------------------\ +| | +| Xsb Get First word | +| | +\------------------------------------------------------------*/ + +char *XsbGetFirstWord( Buffer, IsKeyword, Hash ) + + char *Buffer; + char IsKeyword; + char Hash; +{ + char *String; + char *Text; + int Index; + + autbegin(); + + if ( ( String = (char *)strtok( Buffer, XSB_SEPARATORS_STRING )) != (char *)0 ) + { + if ( Hash ) + { + String = namealloc( String ); + } + else + { + Text = autallocblock( strlen( String ) + 1 ); + strcpy( Text, String ); + String = Text; + + for ( Index = 0; Text[ Index ]; Index++ ) + { + if ( Text[ Index ] == '_' ) Text[ Index ] = ' '; + } + } + + if ( ( IsKeyword ) && XsbCheckKeyword( String ) ) + { + XsbError( UNEXPECTED_LINE, String, XsbCurrentLine ); + } + } + + autend(); + return( String ); +} + +/*------------------------------------------------------------\ +| | +| Xsb Get Next word | +| | +\------------------------------------------------------------*/ + +char *XsbGetNextWord( IsKeyword, Hash ) + + char IsKeyword; + char Hash; +{ + char *String; + char *Text; + int Index; + + autbegin(); + + if ( ( String = (char *)strtok( (char *)NULL, XSB_SEPARATORS_STRING )) != (char *)0 ) + { + if ( Hash ) + { + String = namealloc( String ); + } + else + { + Text = autallocblock( strlen( String ) + 1 ); + strcpy( Text, String ); + String = Text; + + for ( Index = 0; Text[ Index ]; Index++ ) + { + if ( Text[ Index ] == '_' ) Text[ Index ] = ' '; + } + } + + if ( ( IsKeyword ) && XsbCheckKeyword( String ) ) + { + XsbError( UNEXPECTED_LINE, String, XsbCurrentLine ); + } + } + + autend(); + return( String ); +} + +/*------------------------------------------------------------\ +| | +| Xsb Keyword Compare | +| | +\------------------------------------------------------------*/ + +int XsbKeywordCompare( FirstKey, SecondKey ) + + xsb_keyword *FirstKey; + xsb_keyword *SecondKey; +{ + return strcmp( FirstKey->NAME, SecondKey->NAME ); +} + +/*------------------------------------------------------------\ +| | +| Xsb Get String Value | +| | +\------------------------------------------------------------*/ + +long XsbGetStringValue( String ) + + char *String; +{ + long Value; + xsb_keyword *Keyword; + xsb_keyword Entry; + + autbegin(); + + if ( sscanf( String, "%ld", &Value) != 0 ) + { + autend(); + return ( Value ); + } + + Entry.NAME = String; + + Keyword = (xsb_keyword *)bsearch( (char *)(&Entry), + (char *)KeywordDefine, + XSB_MAX_KEYWORD, sizeof( xsb_keyword ), + XsbKeywordCompare ); + + if ( Keyword == (xsb_keyword *)NULL ) + { + XsbError( UNEXPECTED_LINE, String, XsbCurrentLine ); + } + + autend(); + return( Keyword->VALUE ); +} + +/*------------------------------------------------------------\ +| | +| Xsb Get String Float | +| | +\------------------------------------------------------------*/ + +float XsbGetStringFloat( String ) + + char *String; +{ + float Value; + + autbegin(); + + if ( ! sscanf( String, "%g", &Value) ) + { + XsbError( ILLEGAL_FLOAT, String, XsbCurrentLine ); + } + + autend(); + return ( Value ); +} + +/*------------------------------------------------------------\ +| | +| Xsb Get Number | +| | +\------------------------------------------------------------*/ + +long XsbGetNumber( String ) + + char *String; +{ + long Value; + + autbegin(); + + if ( ! sscanf( String, "%ld", &Value )) + { + XsbError( UNEXPECTED_LINE, "number", XsbCurrentLine ); + } + + autend(); + return Value; +} + +/*------------------------------------------------------------\ +| | +| Xsb Get Name List | +| | +\------------------------------------------------------------*/ + +chain_list *XsbGetNameList( String ) + + char *String; +{ + chain_list *HeadList; + char *Scan; + + HeadList = (chain_list *)0; + + while ( ( Scan = strchr( String, ',' ) ) != (char *)0 ) + { + *Scan = '\0'; + HeadList = addchain( HeadList, namealloc( String ) ); + String = Scan + 1; + } + + HeadList = addchain( HeadList, namealloc( String ) ); + + return( HeadList ); +} + +/*------------------------------------------------------------\ +| | +| Xsb Read Icon Cell | +| | +\------------------------------------------------------------*/ + +void XsbReadIconCell( Type, FlagIn, FlagOut ) + + unsigned char Type; + unsigned char FlagIn; + unsigned char FlagOut; +{ + int EndTable; + char *FirstWord; + char *NextWord; + xschicon *XschIcon; + int NumberArgs; + + autbegin(); + + EndTable = 0; + + while ( EndTable != 1 ) + { + if ( ! XsbGetLine( XsbBuffer ) ) + { + XsbError( UNEXPECTED_EOF, (char *)NULL, XsbCurrentLine ); + } + + FirstWord = XsbGetFirstWord( XsbBuffer, 0, 1 ); + + if ( FirstWord == EndTableKeyword ) + { + EndTable = 1; + } + else + { + XschIcon = (xschicon *)autallocheap( sizeof( xschicon ) ); + XschIcon->NAME = FirstWord; + XschIcon->TYPE = Type; + + addauthelem( XSCH_HASH_ICON, FirstWord, (long)XschIcon ); + + if ( FlagIn ) + { + NextWord = XsbGetNextWord( 0, 0 ); + + if ( NextWord == EndRecordKeyword ) + { + XsbError( MISSING_VALUE, (char *)NULL, XsbCurrentLine ); + } + + XschIcon->CON_IN = XsbGetNameList( NextWord ); + } + + if ( FlagOut ) + { + NextWord = XsbGetNextWord( 0, 0 ); + + if ( NextWord == EndRecordKeyword ) + { + XsbError( MISSING_VALUE, (char *)NULL, XsbCurrentLine ); + } + + XschIcon->CON_OUT = XsbGetNameList( NextWord ); + } + + NumberArgs = 0; + + while ( ( NumberArgs < 6 ) && + ( ( NextWord = XsbGetNextWord( 0, 1 ) ) != EndRecordKeyword ) ) + { + XschIcon->ARGS[ NumberArgs ] = XsbGetStringValue( NextWord ); + NumberArgs++; + } +# ifdef DEBUG + { + chain_list *ScanChain; + + fprintf( stdout, "--> XschIcon\n" ); + fprintf( stdout, "NAME : %s\n", XschIcon->NAME ); + fprintf( stdout, "CON_IN : " ); + + for ( ScanChain = XschIcon->CON_IN; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + fprintf( stdout, "%s", (char *)ScanChain->DATA ); + + if ( ScanChain->NEXT != (chain_list *)0 ) + { + fprintf( stdout, "," ); + } + } + + fprintf( stdout, "\n" ); + fprintf( stdout, "CON_OUT: " ); + + for ( ScanChain = XschIcon->CON_OUT; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + fprintf( stdout, "%s", (char *)ScanChain->DATA ); + + if ( ScanChain->NEXT != (chain_list *)0 ) + { + fprintf( stdout, "," ); + } + } + + fprintf( stdout, "\n" ); + fprintf( stdout, "ARGS : " ); + + for ( NumberArgs = 0; NumberArgs < 6; NumberArgs++ ) + { + fprintf( stdout, "%d ", XschIcon->ARGS[ NumberArgs ] ); + } + + fprintf( stdout, "\n" ); + fprintf( stdout, "<-- XschIcon\n" ); + } +# endif + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Xsb Read Layer Name | +| | +\------------------------------------------------------------*/ + +void XsbReadLayerName() + +{ + int Layer; + int LayerCount; + int EndTable; + int Field; + char *FirstWord; + + autbegin(); + + EndTable = 0; + LayerCount = 0; + + while ( ( EndTable != 1 ) && + ( LayerCount <= XSCH_MAX_LAYER ) ) + { + if ( ! XsbGetLine( XsbBuffer ) ) + { + XsbError( UNEXPECTED_EOF, (char *)NULL, XsbCurrentLine ); + } + + FirstWord = XsbGetFirstWord( XsbBuffer, 1, 1 ); + + if ( FirstWord == EndTableKeyword ) + { + EndTable = 1; + } + else + if ( LayerCount < XSCH_MAX_LAYER ) + { + Layer = XsbGetStringValue( FirstWord ); + + for ( Field = 0; Field < 4; Field++ ) + { + FirstWord = XsbGetNextWord( 1, 0 ); + + if ( FirstWord == EndRecordKeyword ) + { + XsbError( MISSING_VALUE, (char *)NULL, XsbCurrentLine ); + } + else + if ( Field != 3 ) + { + XSCH_LAYER_NAME_TABLE [ Layer ][ Field ] = FirstWord; + } + else + { + sscanf( FirstWord, "%lx", &XSCH_LAYER_XFIG_COLOR[ Layer ] ); + } + } + + FirstWord = XsbGetNextWord( 0, 1 ); + + if ( FirstWord != EndRecordKeyword ) + { + XsbError( TOO_MANY_WORDS, FirstWord, XsbCurrentLine ); + } + } + + LayerCount = LayerCount + 1; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Xsb Read Parameters | +| | +\------------------------------------------------------------*/ + +void XsbReadParam() + +{ + char *FirstWord; + char *SecondWord; + short Continue; + long Mask; + + autbegin(); + + Mask = 0; + + while ( XsbGetLine( XsbBuffer ) ) + { + FirstWord = XsbGetFirstWord( XsbBuffer, 0, 1); + + if ( FirstWord == DefineKeyword ) + { + FirstWord = XsbGetNextWord( 1, 1 ); + + if (! FirstWord ) + { + XsbError( MISSING_NAME, DefineKeyword, XsbCurrentLine ); + } + + SecondWord = XsbGetNextWord( 1, 0 ); + + if (! SecondWord ) + { + XsbError( MISSING_VALUE, SecondWord, XsbCurrentLine ); + } + + if ( FirstWord == LowerGridStepKeyword ) + { + XSCH_LOWER_GRID_STEP = XsbGetStringFloat( SecondWord ); + + Mask |= XSB_LOWER_GRID_STEP_MASK; + } + else + if ( FirstWord == CursorColorNameKeyword ) + { + XSCH_CURSOR_COLOR_NAME = SecondWord; + + Mask |= XSB_CURSOR_COLOR_NAME_MASK; + } + else + if ( FirstWord == BackgroundColorNameKeyword ) + { + XSCH_BACKGROUND_COLOR_NAME = SecondWord; + + Mask |= XSB_BACKGROUND_COLOR_NAME_MASK; + } + else + if ( FirstWord == ForegroundColorNameKeyword ) + { + XSCH_FOREGROUND_COLOR_NAME = SecondWord; + + Mask |= XSB_FOREGROUND_COLOR_NAME_MASK; + } + else + if ( FirstWord == AcceptColorNameKeyword ) + { + XSCH_ACCEPT_COLOR_NAME = SecondWord; + + Mask |= XSB_ACCEPT_COLOR_NAME_MASK; + } + else + if ( FirstWord == ConnectColorNameKeyword ) + { + XSCH_CONNECT_COLOR_NAME = SecondWord; + + Mask |= XSB_CONNECT_COLOR_NAME_MASK; + } + else + if ( FirstWord == CursorSizeKeyword ) + { + XSCH_CURSOR_SIZE = XsbGetStringValue( SecondWord ); + + Mask |= XSB_CURSOR_SIZE_MASK; + } + else + if ( FirstWord == UnitKeyword ) + { + XSCH_UNIT = XsbGetStringValue( SecondWord ); + + Mask |= XSB_UNIT_MASK; + } + else + { + XsbError( UNKNOWN_DEFINE, FirstWord, XsbCurrentLine ); + } + } + else + if ( FirstWord == TableKeyword ) + { + if (!( FirstWord = XsbGetNextWord(1, 1))) + { + XsbError( MISSING_NAME, TableKeyword, XsbCurrentLine ); + } + + if ( FirstWord == LayerNameKeyword ) + { + XsbReadLayerName(); + + Mask |= XSB_LAYER_NAME_MASK; + } + else + if ( FirstWord == IconCellBufferKeyword ) + { + XsbReadIconCell( XSCH_ICON_CELL_BUFFER, 1, 1 ); + } + else + if ( FirstWord == IconCellAndKeyword ) + { + XsbReadIconCell( XSCH_ICON_CELL_AND, 1, 1 ); + } + else + if ( FirstWord == IconCellOrKeyword ) + { + XsbReadIconCell( XSCH_ICON_CELL_OR, 1, 1 ); + } + else + if ( FirstWord == IconCellXorKeyword ) + { + XsbReadIconCell( XSCH_ICON_CELL_XOR, 1, 1 ); + } + else + if ( FirstWord == IconCellTristateKeyword ) + { + XsbReadIconCell( XSCH_ICON_CELL_TRISTATE, 1, 1 ); + } + else + if ( FirstWord == IconCellRegisterKeyword ) + { + XsbReadIconCell( XSCH_ICON_CELL_REGISTER, 1, 1 ); + } + else + if ( FirstWord == IconCellConstantKeyword ) + { + XsbReadIconCell( XSCH_ICON_CELL_CONSTANT, 0, 1 ); + } + else + if ( FirstWord == IconCellAndOrKeyword ) + { + XsbReadIconCell( XSCH_ICON_CELL_ANDOR, 1, 1 ); + } + else + if ( FirstWord == IconCellOrAndKeyword ) + { + XsbReadIconCell( XSCH_ICON_CELL_ORAND, 1, 1 ); + } + else + if ( FirstWord == IconCellMuxKeyword ) + { + XsbReadIconCell( XSCH_ICON_CELL_MUX, 1, 1 ); + } + else + { + XsbError( UNKNOWN_TABLE, FirstWord, XsbCurrentLine ); + } + } + else + { + XsbError( SYNTAX_ERROR, FirstWord, XsbCurrentLine ); + } + } + + if ( Mask != XSB_ALL_DEFINED_MASK ) + { + XsbError( UNEXPECTED_EOF, (char *)NULL, XsbCurrentLine ); + } + + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Xsb Load Parameters | +| | +\------------------------------------------------------------*/ + +void XschLoadParameters() + +{ + short Layer; + + autbegin(); + + XSCH_PARAM_NAME = mbkgetenv( "XSCH_PARAM_NAME" ); + + if ( XSCH_PARAM_NAME == (char *)NULL ) + { + XSCH_PARAM_NAME = XschDefaultTechnoName; + } + + if ( ! KeywordDefined ) + { + DefineKeyword = namealloc( DEFINE_KEYWORD ); + TableKeyword = namealloc( TABLE_KEYWORD ); + EndTableKeyword = namealloc( END_TABLE_KEYWORD ); + EndRecordKeyword = namealloc( END_RECORD_KEYWORD ); + LowerGridStepKeyword = namealloc( LOWER_GRID_STEP_KEYWORD ); + CursorColorNameKeyword = namealloc( CURSOR_COLOR_NAME_KEYWORD ); + BackgroundColorNameKeyword = namealloc( BACKGROUND_COLOR_NAME_KEYWORD ); + ForegroundColorNameKeyword = namealloc( FOREGROUND_COLOR_NAME_KEYWORD ); + AcceptColorNameKeyword = namealloc( ACCEPT_COLOR_NAME_KEYWORD ); + ConnectColorNameKeyword = namealloc( CONNECT_COLOR_NAME_KEYWORD ); + CursorSizeKeyword = namealloc( CURSOR_SIZE_KEYWORD ); + UnitKeyword = namealloc( UNIT_KEYWORD ); + LayerNameKeyword = namealloc( LAYER_NAME_KEYWORD ); + IconCellBufferKeyword = namealloc( ICON_CELL_BUFFER_KEYWORD ); + IconCellAndKeyword = namealloc( ICON_CELL_AND_KEYWORD ); + IconCellOrKeyword = namealloc( ICON_CELL_OR_KEYWORD ); + IconCellXorKeyword = namealloc( ICON_CELL_XOR_KEYWORD ); + IconCellTristateKeyword = namealloc( ICON_CELL_TRISTATE_KEYWORD ); + IconCellRegisterKeyword = namealloc( ICON_CELL_REGISTER_KEYWORD ); + IconCellConstantKeyword = namealloc( ICON_CELL_CONSTANT_KEYWORD ); + IconCellOrAndKeyword = namealloc( ICON_CELL_ORAND_KEYWORD ); + IconCellAndOrKeyword = namealloc( ICON_CELL_ANDOR_KEYWORD ); + IconCellMuxKeyword = namealloc( ICON_CELL_MUX_KEYWORD ); + + KeywordDefined = 1; + } + + XSCH_LOWER_GRID_STEP = 0.0; + + XSCH_CURSOR_COLOR_NAME = (char *)NULL; + XSCH_BACKGROUND_COLOR_NAME = (char *)NULL; + XSCH_FOREGROUND_COLOR_NAME = (char *)NULL; + XSCH_ACCEPT_COLOR_NAME = (char *)NULL; + XSCH_CONNECT_COLOR_NAME = (char *)NULL; + + XSCH_CURSOR_SIZE = 5; + XSCH_UNIT = 4; + + for ( Layer = 0; Layer < XSCH_MAX_LAYER; Layer++ ) + { + XSCH_LAYER_NAME_TABLE[ Layer ][0] = XSCH_NOT_DEFINE; + XSCH_LAYER_NAME_TABLE[ Layer ][1] = (char *)NULL; + XSCH_LAYER_NAME_TABLE[ Layer ][2] = (char *)NULL; + XSCH_LAYER_XFIG_COLOR[ Layer ] = 0; + } + + XSCH_HASH_ICON = createauthtable( 100 ); + + if ( !( XsbFile = fopen( XSCH_PARAM_NAME, "r"))) + { + XsbError( OPEN_FILE, XSCH_PARAM_NAME, 0); + } + + XsbReadParam(); + + fclose( XsbFile ); + + autend(); +} diff --git a/alliance/src/xsch/src/XSB_parse.h b/alliance/src/xsch/src/XSB_parse.h new file mode 100644 index 00000000..a8e3727c --- /dev/null +++ b/alliance/src/xsch/src/XSB_parse.h @@ -0,0 +1,122 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSB | +| | +| File : Xsbparse.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSB_PARSE +# define XSB_PARSE + +# define XSB_MAX_BUFFER 255 +# define XSB_MAX_KEYWORD 1 + +# define XSB_SEPARATORS_STRING " \t\n" +# define XSB_COMMENT_CHAR '#' + +/*------------------------------------------------------------\ +| | +| Keyword Constants | +| | +\------------------------------------------------------------*/ + +# define DEFINE_KEYWORD "DEFINE" +# define TABLE_KEYWORD "TABLE" +# define END_TABLE_KEYWORD "END" +# define END_RECORD_KEYWORD NULL + +# define LOWER_GRID_STEP_KEYWORD "XSCH_LOWER_GRID_STEP" +# define CURSOR_COLOR_NAME_KEYWORD "XSCH_CURSOR_COLOR_NAME" +# define BACKGROUND_COLOR_NAME_KEYWORD "XSCH_BACKGROUND_COLOR_NAME" +# define FOREGROUND_COLOR_NAME_KEYWORD "XSCH_FOREGROUND_COLOR_NAME" +# define ACCEPT_COLOR_NAME_KEYWORD "XSCH_ACCEPT_COLOR_NAME" +# define CONNECT_COLOR_NAME_KEYWORD "XSCH_CONNECT_COLOR_NAME" +# define CURSOR_SIZE_KEYWORD "XSCH_CURSOR_SIZE" +# define UNIT_KEYWORD "XSCH_UNIT" +# define LAYER_NAME_KEYWORD "XSCH_LAYER_NAME" +# define ICON_CELL_BUFFER_KEYWORD "XSCH_ICON_CELL_BUFFER" +# define ICON_CELL_AND_KEYWORD "XSCH_ICON_CELL_AND" +# define ICON_CELL_OR_KEYWORD "XSCH_ICON_CELL_OR" +# define ICON_CELL_XOR_KEYWORD "XSCH_ICON_CELL_XOR" +# define ICON_CELL_TRISTATE_KEYWORD "XSCH_ICON_CELL_TRISTATE" +# define ICON_CELL_REGISTER_KEYWORD "XSCH_ICON_CELL_REGISTER" +# define ICON_CELL_CONSTANT_KEYWORD "XSCH_ICON_CELL_CONSTANT" +# define ICON_CELL_ANDOR_KEYWORD "XSCH_ICON_CELL_ANDOR" +# define ICON_CELL_ORAND_KEYWORD "XSCH_ICON_CELL_ORAND" +# define ICON_CELL_MUX_KEYWORD "XSCH_ICON_CELL_MUX" + +# define XSB_LOWER_GRID_STEP_MASK 0x00001 +# define XSB_CURSOR_COLOR_NAME_MASK 0x00002 +# define XSB_BACKGROUND_COLOR_NAME_MASK 0x00004 +# define XSB_FOREGROUND_COLOR_NAME_MASK 0x00008 +# define XSB_ACCEPT_COLOR_NAME_MASK 0x00010 +# define XSB_CONNECT_COLOR_NAME_MASK 0x00020 +# define XSB_CURSOR_SIZE_MASK 0x00040 +# define XSB_UNIT_MASK 0x00080 +# define XSB_LAYER_NAME_MASK 0x00100 + +# define XSB_ALL_DEFINED_MASK 0x001FF + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct xsb_keyword + { + char *NAME; + char VALUE; + + } xsb_keyword; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xsch/src/XSB_share.c b/alliance/src/xsch/src/XSB_share.c new file mode 100644 index 00000000..f4109a83 --- /dev/null +++ b/alliance/src/xsch/src/XSB_share.c @@ -0,0 +1,156 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Share.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "scl.h" +# include "XSB.h" +# include "XSB_share.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + char XSCH_ACTIVE_NAME_TABLE [ XSCH_MAX_ACTIVE_NAME ] = + { + 1, 1, 1, 1 + }; + + char XSCH_ACTIVE_LAYER_TABLE [ XSCH_MAX_LAYER ] = + { + 1, 1, 1, 1, 1 + }; + + char *XschFirstFileName = (char *)NULL; + char *XSCH_XMS_FILE_NAME = (char *)NULL; + char *XSCH_IN_SCHEM = (char *)NULL; + + char XSCH_FORCE_DISPLAY = XSCH_FALSE; + char XSCH_XOR_CURSOR = XSCH_FALSE; + char XSCH_SWITCH_COLOR_MAP = XSCH_FALSE; + + char XSCH_VECTORIZED_MODE = XSCH_FALSE; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschPostTreatString | +| | +\------------------------------------------------------------*/ + +char *XschPostTreatString( Text ) + + char *Text; +{ + char OnlySpace; + int Counter; + + autbegin(); + + if ( Text != (char *)NULL ) + { + OnlySpace = 1; + + for ( Counter = 0; Text[ Counter ]; Counter++ ) + { + if ( Text[ Counter ] != ' ' ) OnlySpace = 0; + } + + if ( OnlySpace ) Text = (char *)NULL; + } + + autend(); + return( Text ); +} + +/*------------------------------------------------------------\ +| | +| Xschgetenv | +| | +\------------------------------------------------------------*/ + +void Xschgetenv() +{ + char *Env; + + Env = mbkgetenv( "HOME" ); + + if ( Env == (char *)NULL ) + { + XSCH_XMS_FILE_NAME = XMS_FILE_NAME; + } + else + { + XSCH_XMS_FILE_NAME = + + (char *)autallocblock( strlen( Env ) + strlen( XMS_FILE_NAME ) + 2 ); + + strcpy( XSCH_XMS_FILE_NAME, Env ); + strcat( XSCH_XMS_FILE_NAME, "/" ); + strcat( XSCH_XMS_FILE_NAME, XMS_FILE_NAME ); + } + + XSCH_IN_SCHEM = SCH_IN; +} diff --git a/alliance/src/xsch/src/XSB_share.h b/alliance/src/xsch/src/XSB_share.h new file mode 100644 index 00000000..4f63bcbf --- /dev/null +++ b/alliance/src/xsch/src/XSB_share.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Share.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSB_SHARE +# define XSB_SHARE + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xsch/src/XSC.h b/alliance/src/xsch/src/XSC.h new file mode 100644 index 00000000..b37b7853 --- /dev/null +++ b/alliance/src/xsch/src/XSC.h @@ -0,0 +1,331 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : XFS.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_XFS +# define XSCH_XFS + +# include "scl.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XSCH_OBJECT_CIRCLE 0x00000 +# define XSCH_OBJECT_LINE 0x00001 +# define XSCH_OBJECT_RECTANGLE 0x00002 +# define XSCH_OBJECT_ARROW 0x00003 +# define XSCH_OBJECT_PENTAGON 0x00004 +# define XSCH_OBJECT_TEXT_CENTER 0x00005 +# define XSCH_OBJECT_TEXT_LEFT 0x00006 +# define XSCH_OBJECT_TEXT_RIGHT 0x00007 +# define XSCH_OBJECT_TRIANGLE 0x00008 +# define XSCH_OBJECT_CROSS_BOX 0x00009 +# define XSCH_OBJECT_BUFFER 0x0000A +# define XSCH_OBJECT_AND 0x0000B +# define XSCH_OBJECT_OR 0x0000C +# define XSCH_OBJECT_XOR 0x0000D +# define XSCH_OBJECT_TRISTATE 0x0000E +# define XSCH_OBJECT_REGISTER 0x0000F +# define XSCH_OBJECT_TRANSISTOR 0x00010 +# define XSCH_OBJECT_CONSTANT 0x00011 +# define XSCH_OBJECT_ANDOR 0x00012 +# define XSCH_OBJECT_ORAND 0x00013 +# define XSCH_OBJECT_MUX 0x00014 + +# define XSCH_OBJECT_TYPE 0x000FF + +# define XSCH_OBJECT_SCHCON 0x00100 +# define XSCH_OBJECT_SCHNET 0x00200 +# define XSCH_OBJECT_SCHBOX 0x00400 +# define XSCH_OBJECT_SCHCON_EXT 0x00800 + +# define XSCH_OBJECT_LINE_DOWN 0x01000 +# define XSCH_OBJECT_LINE_LEFT 0x02000 + +# define XSCH_OBJECT_SELECT 0x04000 +# define XSCH_OBJECT_ACCEPT 0x08000 +# define XSCH_OBJECT_CONNECT 0x10000 + +/*------------------------------------------------------------\ +| | +| Macros | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Object | +| | +\------------------------------------------------------------*/ + +# define GetXschObjectType( X ) ( ( X )->TYPE & XSCH_OBJECT_TYPE ) + +# define IsXschLineDown( X ) ( ( X )->TYPE & XSCH_OBJECT_LINE_DOWN ) +# define IsXschLineLeft( X ) ( ( X )->TYPE & XSCH_OBJECT_LINE_LEFT ) +# define IsXschSchCon( X ) ( ( X )->TYPE & XSCH_OBJECT_SCHCON ) +# define IsXschSchConExt( X ) ( ( X )->TYPE & XSCH_OBJECT_SCHCON_EXT ) +# define IsXschSchNet( X ) ( ( X )->TYPE & XSCH_OBJECT_SCHNET ) +# define IsXschSchBox( X ) ( ( X )->TYPE & XSCH_OBJECT_SCHBOX ) + +# define SetXschLineDown( X ) ( ( X )->TYPE |= XSCH_OBJECT_LINE_DOWN ) +# define SetXschLineLeft( X ) ( ( X )->TYPE |= XSCH_OBJECT_LINE_LEFT ) +# define SetXschSchCon( X ) ( ( X )->TYPE |= XSCH_OBJECT_SCHCON ) +# define SetXschSchConExt( X ) ( ( X )->TYPE |= XSCH_OBJECT_SCHCON_EXT ) +# define SetXschSchNet( X ) ( ( X )->TYPE |= XSCH_OBJECT_SCHNET ) +# define SetXschSchBox( X ) ( ( X )->TYPE |= XSCH_OBJECT_SCHBOX ) + +# define ClearXschLineDown( X ) ( ( X )->TYPE &= ~XSCH_OBJECT_LINE_DOWN ) +# define ClearXschLineLeft( X ) ( ( X )->TYPE &= ~XSCH_OBJECT_LINE_LEFT ) +# define ClearXschSchCon( X ) ( ( X )->TYPE &= ~XSCH_OBJECT_SCHCON ) +# define ClearXschSchConExt( X ) ( ( X )->TYPE &= ~XSCH_OBJECT_SCHCON_EXT ) +# define ClearXschSchNet( X ) ( ( X )->TYPE &= ~XSCH_OBJECT_SCHNET ) +# define ClearXschSchBox( X ) ( ( X )->TYPE &= ~XSCH_OBJECT_SCHBOX ) + +/*------------------------------------------------------------\ +| | +| Select | +| | +\------------------------------------------------------------*/ + +# define IsXschSelect( X ) ( ( X )->TYPE & XSCH_OBJECT_SELECT ) +# define SetXschSelect( X ) ( ( X )->TYPE |= XSCH_OBJECT_SELECT ) +# define ClearXschSelect( X ) ( ( X )->TYPE &= ~XSCH_OBJECT_SELECT ) + +/*------------------------------------------------------------\ +| | +| Accept | +| | +\------------------------------------------------------------*/ + +# define IsXschAccept( X ) ( ( X )->TYPE & XSCH_OBJECT_ACCEPT ) +# define SetXschAccept( X ) ( ( X )->TYPE |= XSCH_OBJECT_ACCEPT ) +# define ClearXschAccept( X ) ( ( X )->TYPE &= ~XSCH_OBJECT_ACCEPT ) + +/*------------------------------------------------------------\ +| | +| Connect | +| | +\------------------------------------------------------------*/ + +# define IsXschConnect( X ) ( ( X )->TYPE & XSCH_OBJECT_CONNECT ) +# define SetXschConnect( X ) ( ( X )->TYPE |= XSCH_OBJECT_CONNECT ) +# define ClearXschConnect( X ) ( ( X )->TYPE &= ~XSCH_OBJECT_CONNECT ) + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Object | +| | +\------------------------------------------------------------*/ + + typedef struct xschobj_list + { + struct xschobj_list *NEXT; + struct xschobj_list *LINK; + char *NAME; + short LAYER; + long TYPE; + long X; + long Y; + long DX; + long DY; + short ARG1; + short ARG2; + short ARG3; + short ARG4; + short ARG5; + short ARG6; + void *USER; + + } xschobj_list; + + typedef struct xschfig_list + { + struct xschfig_list *NEXT; + char *NAME; + xschobj_list *OBJECT [ XSCH_MAX_LAYER ]; + void *USER; + + } xschfig_list; + +/*------------------------------------------------------------\ +| | +| Select | +| | +\------------------------------------------------------------*/ + + typedef struct xschselect_list + { + struct xschselect_list *NEXT; + xschobj_list *OBJECT; + + } xschselect_list; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern long XschBoundXmin; + extern long XschBoundYmin; + extern long XschBoundXmax; + extern long XschBoundYmax; + extern char XschRecomputeBound; + + extern xschfig_list *XschFigure; + extern schfig_list *XschFigureSch; + + extern xschselect_list *XschHeadSelect; + extern xschselect_list *XschHeadConnect; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Add Functions | +| | +\------------------------------------------------------------*/ + + extern xschfig_list *XschAddFigure(); + extern xschobj_list *XschAddCircle(); + extern xschobj_list *XschAddLine(); + extern xschobj_list *XschAddRectangle(); + extern xschobj_list *XschAddTriangle(); + extern xschobj_list *XschAddPentagon(); + extern xschobj_list *XschAddText(); + extern xschobj_list *XschAddTextWidth(); + extern xschobj_list *XschAddCrossBox(); + + extern xschobj_list *XschAddBuffer(); + extern xschobj_list *XschAddAnd(); + extern xschobj_list *XschAddOr(); + extern xschobj_list *XschAddXor(); + extern xschobj_list *XschAddTristate(); + extern xschobj_list *XschAddRegister(); + extern xschobj_list *XschAddTransistor(); + extern xschobj_list *XschAddConstant(); + extern xschobj_list *XschAddAndOr(); + extern xschobj_list *XschAddOrAnd(); + extern xschobj_list *XschAddMux(); + +/*------------------------------------------------------------\ +| | +| Del Functions | +| | +\------------------------------------------------------------*/ + + extern void XschDelFigure(); + +/*------------------------------------------------------------\ +| | +| Flag Set & Clear Functions | +| | +\------------------------------------------------------------*/ + + extern void XschSelectObject(); + extern void XschUnselectObject(); + extern void XschAcceptObject(); + extern void XschRejectObject(); + extern void XschConnectObject(); + extern void XschDisconnectObject(); + +/*------------------------------------------------------------\ +| | +| Select Functions | +| | +\------------------------------------------------------------*/ + + extern void XschAddSelect(); + extern void XschDelSelect(); + extern void XschPurgeSelect(); + extern void XschFreeSelect(); + +/*------------------------------------------------------------\ +| | +| Connect Functions | +| | +\------------------------------------------------------------*/ + + extern void XschAddConnect(); + extern void XschDelConnect(); + +/*------------------------------------------------------------\ +| | +| Bound Compute | +| | +\------------------------------------------------------------*/ + + extern char XschComputeBound(); + +/*------------------------------------------------------------\ +| | +| Load Functions | +| | +\------------------------------------------------------------*/ + + extern void XschLoadFigure(); + +/*------------------------------------------------------------\ +| | +| Error Message Functions | +| | +\------------------------------------------------------------*/ + + extern char *XschGetErrorMessage(); + extern void XschExitErrorMessage(); + extern void XschInitializeErrorMessage(); + +/*------------------------------------------------------------\ +| | +| Informations Functions | +| | +\------------------------------------------------------------*/ + + extern char *XschGetInformations(); + +# endif diff --git a/alliance/src/xsch/src/XSC_bound.c b/alliance/src/xsch/src/XSC_bound.c new file mode 100644 index 00000000..e8c08497 --- /dev/null +++ b/alliance/src/xsch/src/XSC_bound.c @@ -0,0 +1,147 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Bound.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XSB.h" +# include "XSC.h" +# include "XSC_bound.h" + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + long XschBoundXmin = 0; + long XschBoundYmin = 0; + long XschBoundXmax = 0; + long XschBoundYmax = 0; + + char XschRecomputeBound = XSCH_TRUE; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschComputeBound | +| | +\------------------------------------------------------------*/ + +char XschComputeBound() + +{ + xschobj_list *Obj; + short Layer; + short FirstBound; + + if ( XschFigure == (xschfig_list *)NULL ) + { + return( XSCH_FALSE ); + } + + if ( XschRecomputeBound == XSCH_FALSE ) + { + return( XSCH_TRUE ); + } + + autbegin(); + + FirstBound = 1; + + for ( Layer = 0; Layer < XSCH_MAX_LAYER; Layer++ ) + { + for ( Obj = XschFigure->OBJECT[ Layer ]; + Obj != (xschobj_list *)NULL; + Obj = Obj->NEXT ) + { + if ( FirstBound ) + { + XschBoundXmin = Obj->X; + XschBoundYmin = Obj->Y; + XschBoundXmax = Obj->X + Obj->DX; + XschBoundYmax = Obj->Y + Obj->DY; + FirstBound = 0; + } + else + { + if ( Obj->X < XschBoundXmin ) + { + XschBoundXmin = Obj->X; + } + + if ( Obj->Y < XschBoundYmin ) + { + XschBoundYmin = Obj->Y; + } + + if ( ( Obj->X + Obj->DX ) > XschBoundXmax ) + { + XschBoundXmax = Obj->X + Obj->DX; + } + + if ( ( Obj->Y + Obj->DY ) > XschBoundYmax ) + { + XschBoundYmax = Obj->Y + Obj->DY; + } + } + } + } + + XschBoundXmin = XschBoundXmin - ( XSCH_UNIT << 1 ); + XschBoundYmin = XschBoundYmin - ( XSCH_UNIT << 1 ); + XschBoundXmax = XschBoundXmax + ( XSCH_UNIT << 1 ); + XschBoundYmax = XschBoundYmax + ( XSCH_UNIT << 1 ); + + XschRecomputeBound = XSCH_FALSE; + + autend(); + return( XSCH_TRUE ); +} diff --git a/alliance/src/xsch/src/XSC_bound.h b/alliance/src/xsch/src/XSC_bound.h new file mode 100644 index 00000000..532d3321 --- /dev/null +++ b/alliance/src/xsch/src/XSC_bound.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Bound.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSC_BOUND +# define XSC_BOUND + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XSCH_DEFAULT_BOUND_XMIN 0 +# define XSCH_DEFAULT_BOUND_YMIN 0 +# define XSCH_DEFAULT_BOUND_XMAX 100 +# define XSCH_DEFAULT_BOUND_YMAX 100 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xsch/src/XSC_error.c b/alliance/src/xsch/src/XSC_error.c new file mode 100644 index 00000000..70168e65 --- /dev/null +++ b/alliance/src/xsch/src/XSC_error.c @@ -0,0 +1,333 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Error.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XSB.h" +# include "XSC.h" +# include "XSC_error.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static FILE *XschStreamErr; + static FILE *XschStreamOut; + static FILE *XschStreamAll; + + static char XschErrFileName[ 40 ]; + static char XschOutFileName[ 40 ]; + static char XschAllFileName[ 40 ]; + + static char XschNormalMode = 1; + +/*------------------------------------------------------------\ +| | +| Xsch Error Message | +| | +\------------------------------------------------------------*/ + + static char *XschErrorBuffer = (char *)NULL; + +/*------------------------------------------------------------\ +| | +| Xsch Informations | +| | +\------------------------------------------------------------*/ + + static char XschInformationsBuffer[ XSCH_INFORMATIONS_BUFFER_SIZE ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Xsch Error Message Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschExitErrorMessage | +| | +\------------------------------------------------------------*/ + +void XschExitErrorMessage( Error ) + + int Error; +{ + autbegin(); + + if ( XschStreamErr != (FILE *)0 ) + { + fclose( XschStreamErr ); + unlink( XschErrFileName ); + } + + if ( XschStreamAll != (FILE *)0 ) + { + fclose( XschStreamAll ); + unlink( XschAllFileName ); + } + + if ( ( XschNormalMode ) && + ( XschStreamOut != (FILE *)0 ) ) + { + fclose( XschStreamOut ); + unlink( XschOutFileName ); + } + + autexit( Error ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschInitializeErrorMessage | +| | +\------------------------------------------------------------*/ + +void XschInitializeErrorMessage( Debug ) + + char Debug; +{ + autbegin(); + + XschNormalMode = ! Debug; + + if ( XschNormalMode ) + { + sprintf( XschOutFileName, "/tmp/%s_out_%d", XSCH_TOOL_NAME, getpid() ); + } + + sprintf( XschErrFileName, "/tmp/%s_err_%d", XSCH_TOOL_NAME, getpid() ); + sprintf( XschAllFileName, "/tmp/%s_all_%d", XSCH_TOOL_NAME, getpid() ); + + XschStreamErr = freopen( XschErrFileName, "w+", stderr); + XschStreamAll = fopen ( XschAllFileName, "w+" ); + + if ( XschNormalMode ) + { + XschStreamOut = freopen( XschOutFileName, "w+", stdout); + } + else + { + XschStreamOut = XschStreamErr; + } + + if ( ( XschStreamAll == (FILE *)NULL ) || + ( XschStreamOut == (FILE *)NULL ) || + ( XschStreamErr == (FILE *)NULL ) ) + { + fprintf( stdout, "Grm: Unable to open trace window !\n"); + autexit( 1 ); + } + + if ( XschNormalMode ) + { + unlink( XschOutFileName ); + } + + unlink( XschErrFileName ); + + signal( SIGINT, XschExitErrorMessage ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschFlushErrorMessage | +| | +\------------------------------------------------------------*/ + +void XschFlushErrorMessage() +{ + int Data; + + autbegin(); + + fflush( XschStreamErr ); + fseek( XschStreamErr, 0L, 0 ); + + while( ( Data = fgetc( XschStreamErr ) ) != EOF ) + { + fputc( Data, XschStreamAll ); + } + + fclose( XschStreamErr ); + + XschStreamErr = freopen( XschErrFileName, "w+", stderr ); + + if ( XschNormalMode ) + { + fflush( XschStreamOut ); + fseek( XschStreamOut, 0L, 0 ); + + while( ( Data = fgetc( XschStreamOut ) ) != EOF ) + { + fputc( Data, XschStreamAll ); + } + + fclose( XschStreamOut ); + + XschStreamOut = freopen( XschOutFileName, "w+", stdout ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschGetErrorMessage | +| | +\------------------------------------------------------------*/ + +char *XschGetErrorMessage() + +{ + char *Message; + long Length; + long Index; + int Data; + + autbegin(); + + XschFlushErrorMessage(); + + fflush( XschStreamAll ); + + Length = ftell( XschStreamAll ); + + if ( XschErrorBuffer != (char *)NULL ) + { + autfreeblock( XschErrorBuffer ); + } + + XschErrorBuffer = autallocblock( Length + 1 ); + Index = 0; + + while ( ( ( Data = fgetc( XschStreamAll ) ) != EOF ) && + ( Index < Length ) ) + { + XschErrorBuffer[ Index++ ] = (char)Data; + } + + rewind( XschStreamAll ); + + XschErrorBuffer[ Index ] = '\0'; + + if ( Index == 0 ) + { + Message = (char *)NULL; + } + else + { + Message = XschErrorBuffer; + } + + autend(); + return( Message ); +} + +/*------------------------------------------------------------\ +| | +| XschGetInformations | +| | +\------------------------------------------------------------*/ + +char *XschGetInformations() + +{ + char *Scan; + + autbegin(); + + XschComputeBound(); + + Scan = XschInformationsBuffer; + + if ( XschFigureSch != (schfig_list *)NULL ) + { + sprintf( Scan, " FIGURE : %s\n\n", + XschFigureSch->NAME ); + } + else + { + sprintf( Scan, " FIGURE : No current figure !\n\n" ); + } + + Scan = Scan + strlen( Scan ); + + sprintf( Scan, + " BOUNDING BOX : \n\n XMIN : %ld\n YMIN : %ld\n XMAX : %ld\n YMAX : %ld\n\n", + XschBoundXmin / XSCH_UNIT, XschBoundYmin / XSCH_UNIT, + XschBoundXmax / XSCH_UNIT, XschBoundYmax / XSCH_UNIT ); + + Scan = Scan + strlen( Scan ); + + sprintf( Scan, " XSCH PARAM : %s\n\n", XSCH_PARAM_NAME ); + + autend(); + return( XschInformationsBuffer ); +} diff --git a/alliance/src/xsch/src/XSC_error.h b/alliance/src/xsch/src/XSC_error.h new file mode 100644 index 00000000..c2ddd9ac --- /dev/null +++ b/alliance/src/xsch/src/XSC_error.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Error.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSC_ERROR +# define XSC_ERROR + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XSCH_INFORMATIONS_BUFFER_SIZE 1024 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschFlushErrorMessage(); + extern void XschExitErrorMessage(); + +# endif diff --git a/alliance/src/xsch/src/XSC_object.c b/alliance/src/xsch/src/XSC_object.c new file mode 100644 index 00000000..a35ffc15 --- /dev/null +++ b/alliance/src/xsch/src/XSC_object.c @@ -0,0 +1,999 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Object.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "scl.h" +# include "XSB.h" +# include "XSC.h" +# include "XSC_place.h" +# include "XSC_object.h" +# include "XSC_schem.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + xschfig_list *XschFigure = (xschfig_list *)NULL; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Alloc Functions | +| | +\------------------------------------------------------------*/ + +xschfig_list *XschAllocFigure() +{ + return( (xschfig_list *)autallocblock( sizeof( xschfig_list ) ) ); +} + +xschobj_list *XschAllocObject() +{ + return( (xschobj_list *)autallocheap( sizeof( xschobj_list ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Free Functions | +| | +\------------------------------------------------------------*/ + +void XschFreeFigure( Figure ) + + xschfig_list *Figure; +{ + autfreeblock( Figure ); +} + +void XschFreeObject( Object ) + + xschobj_list *Object; +{ + autfreeheap( Object, sizeof( xschobj_list ) ); +} + +/*------------------------------------------------------------\ +| | +| Add Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschAddCircle | +| | +\------------------------------------------------------------*/ + +xschobj_list *XschAddCircle( X, Y, R, Layer ) + + long X; + long Y; + long R; + short Layer; +{ + xschobj_list *Object; + + autbegin(); + + Object = XschAllocObject(); + Object->TYPE = XSCH_OBJECT_CIRCLE; + Object->LAYER = Layer; + Object->NEXT = XschFigure->OBJECT[ Layer ]; + Object->X = X - R; + Object->Y = Y - R; + Object->DX = ( R << 1 ); + Object->DY = ( R << 1 ); + + XschFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XschAddLine | +| | +\------------------------------------------------------------*/ + +xschobj_list *XschAddLine( X1, Y1, X2, Y2, LayerFrom, LayerTo ) + + long X1; + long Y1; + long X2; + long Y2; + short LayerFrom; + short LayerTo; +{ + xschobj_list *Object; + + autbegin(); + + Object = XschAllocObject(); + Object->LAYER = LayerFrom; + Object->TYPE = XSCH_OBJECT_LINE; + Object->NEXT = XschFigure->OBJECT[ LayerTo ]; + + if ( X1 > X2 ) + { + SetXschLineLeft( Object ); + + Object->X = X2; + Object->DX = X1 - X2; + } + else + { + Object->X = X1; + Object->DX = X2 - X1; + } + + if ( Y1 > Y2 ) + { + SetXschLineDown( Object ); + + Object->Y = Y2; + Object->DY = Y1 - Y2; + } + else + { + Object->Y = Y1; + Object->DY = Y2 - Y1; + } + + XschFigure->OBJECT[ LayerTo ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XschAddArrow | +| | +\------------------------------------------------------------*/ + +xschobj_list *XschAddArrow( X1, Y1, X2, Y2, LayerFrom, LayerTo ) + + long X1; + long Y1; + long X2; + long Y2; + short LayerFrom; + short LayerTo; +{ + xschobj_list *Object; + + autbegin(); + + Object = XschAllocObject(); + Object->LAYER = LayerFrom; + Object->TYPE = XSCH_OBJECT_ARROW; + Object->NEXT = XschFigure->OBJECT[ LayerTo ]; + + if ( X1 > X2 ) + { + SetXschLineLeft( Object ); + + Object->X = X2; + Object->DX = X1 - X2; + } + else + { + Object->X = X1; + Object->DX = X2 - X1; + } + + if ( Y1 > Y2 ) + { + SetXschLineDown( Object ); + + Object->Y = Y2; + Object->DY = Y1 - Y2; + } + else + { + Object->Y = Y1; + Object->DY = Y2 - Y1; + } + + XschFigure->OBJECT[ LayerTo ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XschAddTriangle | +| | +\------------------------------------------------------------*/ + +xschobj_list *XschAddTriangle( X, Y, DX, DY, Layer ) + + long X; + long Y; + long DX; + long DY; + short Layer; +{ + xschobj_list *Object; + + autbegin(); + + Object = XschAllocObject(); + Object->TYPE = XSCH_OBJECT_TRIANGLE; + Object->LAYER = Layer; + Object->NEXT = XschFigure->OBJECT[ Layer ]; + Object->X = X; + Object->Y = Y; + Object->DX = DX; + Object->DY = DY; + + XschFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XschAddTristate | +| | +\------------------------------------------------------------*/ + +xschobj_list *XschAddTristate( X, Y, DX, DY, NotIn, NotOut, Layer ) + + long X; + long Y; + long DX; + long DY; + short NotIn; + short NotOut; + short Layer; +{ + xschobj_list *Object; + + autbegin(); + + Object = XschAllocObject(); + Object->TYPE = XSCH_OBJECT_TRISTATE; + Object->LAYER = Layer; + Object->NEXT = XschFigure->OBJECT[ Layer ]; + Object->X = X; + Object->Y = Y; + Object->DX = DX; + Object->DY = DY; + Object->ARG1 = NotIn; + Object->ARG2 = NotOut; + + XschFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XschAddConstant | +| | +\------------------------------------------------------------*/ + +xschobj_list *XschAddConstant( X, Y, DX, DY, NumberOut, Value, Layer ) + + long X; + long Y; + long DX; + long DY; + short NumberOut; + short Value; + short Layer; +{ + xschobj_list *Object; + + autbegin(); + + Object = XschAllocObject(); + Object->TYPE = XSCH_OBJECT_CONSTANT; + Object->LAYER = Layer; + Object->NEXT = XschFigure->OBJECT[ Layer ]; + Object->X = X; + Object->Y = Y; + Object->DX = DX; + Object->DY = DY; + Object->ARG1 = NumberOut; + Object->ARG2 = Value; + + XschFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XschAddTransistor | +| | +\------------------------------------------------------------*/ + +xschobj_list *XschAddTransistor( X, Y, DX, DY, NTrans, Layer ) + + long X; + long Y; + long DX; + long DY; + short NTrans; + short Layer; +{ + xschobj_list *Object; + + autbegin(); + + Object = XschAllocObject(); + Object->TYPE = XSCH_OBJECT_TRANSISTOR; + Object->LAYER = Layer; + Object->NEXT = XschFigure->OBJECT[ Layer ]; + Object->X = X; + Object->Y = Y; + Object->DX = DX; + Object->DY = DY; + Object->ARG1 = NTrans; + + XschFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XschAddBuffer | +| | +\------------------------------------------------------------*/ + +xschobj_list *XschAddBuffer( X, Y, DX, DY, NotIn, NotOut, Layer ) + + long X; + long Y; + long DX; + long DY; + short NotIn; + short NotOut; + short Layer; +{ + xschobj_list *Object; + + autbegin(); + + Object = XschAllocObject(); + Object->TYPE = XSCH_OBJECT_BUFFER; + Object->LAYER = Layer; + Object->NEXT = XschFigure->OBJECT[ Layer ]; + Object->X = X; + Object->Y = Y; + Object->DX = DX; + Object->DY = DY; + Object->ARG1 = NotIn; + Object->ARG2 = NotOut; + + XschFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XschAddOrAnd | +| | +\------------------------------------------------------------*/ + +xschobj_list *XschAddOrAnd( X, Y, DX, DY, NumberIn, NotIn, NotOut, Layer ) + + long X; + long Y; + long DX; + long DY; + short NumberIn; + short NotIn; + short NotOut; + short Layer; +{ + xschobj_list *Object; + + autbegin(); + + Object = XschAllocObject(); + Object->TYPE = XSCH_OBJECT_ORAND; + Object->LAYER = Layer; + Object->NEXT = XschFigure->OBJECT[ Layer ]; + Object->X = X; + Object->Y = Y; + Object->DX = DX; + Object->DY = DY; + Object->ARG1 = NumberIn; + Object->ARG2 = NotIn; + Object->ARG3 = NotOut; + + XschFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XschAddAndOr | +| | +\------------------------------------------------------------*/ + +xschobj_list *XschAddAndOr( X, Y, DX, DY, NumberIn, NotIn, NotOut, Layer ) + + long X; + long Y; + long DX; + long DY; + short NumberIn; + short NotIn; + short NotOut; + short Layer; +{ + xschobj_list *Object; + + autbegin(); + + Object = XschAllocObject(); + Object->TYPE = XSCH_OBJECT_ANDOR; + Object->LAYER = Layer; + Object->NEXT = XschFigure->OBJECT[ Layer ]; + Object->X = X; + Object->Y = Y; + Object->DX = DX; + Object->DY = DY; + Object->ARG1 = NumberIn; + Object->ARG2 = NotIn; + Object->ARG3 = NotOut; + + XschFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XschAddMux | +| | +\------------------------------------------------------------*/ + +xschobj_list *XschAddMux( X, Y, DX, DY, NumberIn, NumberSel, NotIn, NotOut, Layer ) + + long X; + long Y; + long DX; + long DY; + short NumberIn; + short NumberSel; + short NotIn; + short NotOut; + short Layer; +{ + xschobj_list *Object; + + autbegin(); + + Object = XschAllocObject(); + Object->TYPE = XSCH_OBJECT_MUX; + Object->LAYER = Layer; + Object->NEXT = XschFigure->OBJECT[ Layer ]; + Object->X = X; + Object->Y = Y; + Object->DX = DX; + Object->DY = DY; + Object->ARG1 = NumberIn; + Object->ARG2 = NumberSel; + Object->ARG3 = NotIn; + Object->ARG4 = NotOut; + + XschFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XschAddOr | +| | +\------------------------------------------------------------*/ + +xschobj_list *XschAddOr( X, Y, DX, DY, NumberIn, NotIn, NotOut, Layer ) + + long X; + long Y; + long DX; + long DY; + short NumberIn; + short NotIn; + short NotOut; + short Layer; +{ + xschobj_list *Object; + + autbegin(); + + Object = XschAllocObject(); + Object->TYPE = XSCH_OBJECT_OR; + Object->LAYER = Layer; + Object->NEXT = XschFigure->OBJECT[ Layer ]; + Object->X = X; + Object->Y = Y; + Object->DX = DX; + Object->DY = DY; + Object->ARG1 = NumberIn; + Object->ARG2 = NotIn; + Object->ARG3 = NotOut; + + XschFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XschAddAnd | +| | +\------------------------------------------------------------*/ + +xschobj_list *XschAddAnd( X, Y, DX, DY, NumberIn, NotIn, NotOut, Layer ) + + long X; + long Y; + long DX; + long DY; + short NumberIn; + short NotIn; + short NotOut; + short Layer; +{ + xschobj_list *Object; + + autbegin(); + + Object = XschAllocObject(); + Object->TYPE = XSCH_OBJECT_AND; + Object->LAYER = Layer; + Object->NEXT = XschFigure->OBJECT[ Layer ]; + Object->X = X; + Object->Y = Y; + Object->DX = DX; + Object->DY = DY; + Object->ARG1 = NumberIn; + Object->ARG2 = NotIn; + Object->ARG3 = NotOut; + + XschFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XschAddXor | +| | +\------------------------------------------------------------*/ + +xschobj_list *XschAddXor( X, Y, DX, DY, NumberIn, NotIn, NotOut, Layer ) + + long X; + long Y; + long DX; + long DY; + short NumberIn; + short NotIn; + short NotOut; + short Layer; +{ + xschobj_list *Object; + + autbegin(); + + Object = XschAllocObject(); + Object->TYPE = XSCH_OBJECT_XOR; + Object->LAYER = Layer; + Object->NEXT = XschFigure->OBJECT[ Layer ]; + Object->X = X; + Object->Y = Y; + Object->DX = DX; + Object->DY = DY; + Object->ARG1 = NumberIn; + Object->ARG2 = NotIn; + Object->ARG3 = NotOut; + + XschFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XschAddRegister | +| | +\------------------------------------------------------------*/ + +xschobj_list *XschAddRegister( X, Y, DX, DY, NumberIn, NotIn, ClockIn, NotOut, Edge, Layer ) + + long X; + long Y; + long DX; + long DY; + short NumberIn; + short NotIn; + short ClockIn; + short NotOut; + short Edge; + short Layer; +{ + xschobj_list *Object; + + autbegin(); + + Object = XschAllocObject(); + Object->TYPE = XSCH_OBJECT_REGISTER; + Object->LAYER = Layer; + Object->NEXT = XschFigure->OBJECT[ Layer ]; + Object->X = X; + Object->Y = Y; + Object->DX = DX; + Object->DY = DY; + Object->ARG1 = NumberIn; + Object->ARG2 = NotIn; + Object->ARG3 = ClockIn; + Object->ARG4 = NotOut; + Object->ARG5 = Edge; + + XschFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XschAddRectangle | +| | +\------------------------------------------------------------*/ + +xschobj_list *XschAddRectangle( X, Y, DX, DY, Layer ) + + long X; + long Y; + long DX; + long DY; + short Layer; +{ + xschobj_list *Object; + + autbegin(); + + Object = XschAllocObject(); + Object->TYPE = XSCH_OBJECT_RECTANGLE; + Object->LAYER = Layer; + Object->NEXT = XschFigure->OBJECT[ Layer ]; + Object->X = X; + Object->Y = Y; + Object->DX = DX; + Object->DY = DY; + + XschFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XschAddCrossBox | +| | +\------------------------------------------------------------*/ + +xschobj_list *XschAddCrossBox( X, Y, DX, DY, Layer ) + + long X; + long Y; + long DX; + long DY; + short Layer; +{ + xschobj_list *Object; + + autbegin(); + + Object = XschAllocObject(); + Object->TYPE = XSCH_OBJECT_CROSS_BOX; + Object->LAYER = Layer; + Object->NEXT = XschFigure->OBJECT[ Layer ]; + Object->X = X; + Object->Y = Y; + Object->DX = DX; + Object->DY = DY; + + XschFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XschAddTextWidth | +| | +\------------------------------------------------------------*/ + +xschobj_list *XschAddTextWidth( X, Y, Width, Type, Name, Layer ) + + long X; + long Y; + long Width; + long Type; + char *Name; + short Layer; +{ + xschobj_list *Object; + + autbegin(); + + Object = XschAllocObject(); + Object->LAYER = Layer; + Object->TYPE = Type; + Object->NEXT = XschFigure->OBJECT[ Layer ]; + Object->NAME = namealloc( Name ); + Object->X = X; + Object->Y = Y; + Object->DX = Width; + + XschFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XschAddText | +| | +\------------------------------------------------------------*/ + +xschobj_list *XschAddText( X, Y, Type, Name, Layer ) + + long X; + long Y; + long Type; + char *Name; + short Layer; +{ + xschobj_list *Object; + long Width; + + autbegin(); + + Width = strlen( Name ) * XSCH_UNIT * 2 / 3; + + if ( Type == XSCH_OBJECT_TEXT_CENTER ) + { + X = X - ( Width >> 1 ); + } + + if ( Type == XSCH_OBJECT_TEXT_LEFT ) + { + X = X - Width; + } + + Object = XschAllocObject(); + Object->LAYER = Layer; + Object->TYPE = Type; + Object->NEXT = XschFigure->OBJECT[ Layer ]; + Object->NAME = namealloc( Name ); + Object->X = X; + Object->Y = Y; + Object->DX = Width; + + + XschFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XschAddPentagon | +| | +\------------------------------------------------------------*/ + +xschobj_list *XschAddPentagon( X, Y, DX, DY, Layer ) + + long X; + long Y; + long DX; + long DY; + short Layer; +{ + xschobj_list *Object; + + autbegin(); + + Object = XschAllocObject(); + Object->TYPE = XSCH_OBJECT_PENTAGON; + Object->LAYER = Layer; + Object->NEXT = XschFigure->OBJECT[ Layer ]; + Object->X = X; + Object->Y = Y; + Object->DX = DX; + Object->DY = DY; + + XschFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XschAddFigure | +| | +\------------------------------------------------------------*/ + +xschfig_list *XschAddFigure() +{ + autbegin(); + + XschFigure = XschAllocFigure(); + XschFigure->NAME = XschFigureSch->NAME; + + XschPlaceFigure( XschFigureSch ); + + autend(); + return( XschFigure ); +} + +/*------------------------------------------------------------\ +| | +| Load Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschLoadFigure | +| | +\------------------------------------------------------------*/ + +void XschLoadFigure( FileName ) + + char *FileName; +{ + autbegin(); + + XschFigureSch = (schfig_list *)Xschgetschfig( FileName ); + + if ( XschFigureSch != (schfig_list *)NULL ) + { + XschAddFigure(); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Del Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschDelFigure | +| | +\------------------------------------------------------------*/ + +void XschDelFigure() +{ + xschobj_list *ScanObject; + xschobj_list *DelObject; + short Layer; + + if ( XschFigure == (xschfig_list *)NULL ) return; + + autbegin(); + + for ( Layer = 0; Layer < XSCH_MAX_LAYER; Layer++ ) + { + ScanObject = XschFigure->OBJECT[ Layer ]; + + while ( ScanObject != (xschobj_list *)NULL ) + { + DelObject = ScanObject; + ScanObject = ScanObject->NEXT; + + XschFreeObject( DelObject ); + } + } + + XschFreeFigure( XschFigure ); + + delschfig( XschFigureSch ); + + while ( HEAD_LOFIG != (lofig_list *)0 ) + { + dellofig( HEAD_LOFIG->NAME ); + } + + XschFigure = (xschfig_list *)NULL; + XschFigureSch = (schfig_list *)NULL; + + autend(); +} diff --git a/alliance/src/xsch/src/XSC_object.h b/alliance/src/xsch/src/XSC_object.h new file mode 100644 index 00000000..04210857 --- /dev/null +++ b/alliance/src/xsch/src/XSC_object.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Object.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSC_OBJECT_H +# define XSC_OBJECT_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xsch/src/XSC_place.c b/alliance/src/xsch/src/XSC_place.c new file mode 100644 index 00000000..6bfc7aac --- /dev/null +++ b/alliance/src/xsch/src/XSC_place.c @@ -0,0 +1,1152 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : XSC_place.c | +| | +| Authors : Jacomme Ludovic | +| Miramond Benoit | +| Picault Stephane | +| | +| Date : 10.03.98 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "scl.h" +# include "XSB.h" +# include "XSC.h" + +# include "XSC_place.h" +# include "XSC_schem.h" + +# define IsSchWireHorizontal( Z ) ( ( Z )->DY == ( Z )->Y ) +# define IsSchWireVertical( Z ) ( ( Z )->DX == ( Z )->X ) + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static authtable *XschHashBoxInfo = (authtable *)0; + static authtable *XschHashNetInfo = (authtable *)0; + static authtable *XschHashConInfo = (authtable *)0; + static authtable *XschHashPathInfo = (authtable *)0; + + static ptype_list *XschLayerInfoList = (ptype_list *)0; + static xschpath_list *XschLayerPathList = (xschpath_list *)0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Xsch Add Layer Path | +| | +\------------------------------------------------------------*/ + +static xschpath_list *XschAddLayerPath( HeadList, From, To, Layer, String ) + + xschpath_list *HeadList; + char *From; + char *To; + long Layer; + char *String; +{ + xschpath_list *NewPath; + + NewPath = (xschpath_list *)autallocheap( sizeof( xschpath_list ) ); + NewPath->NEXT = HeadList; + NewPath->FROM = From; + NewPath->TO = To; + NewPath->LAYER = Layer; + NewPath->COMMENT = String; + + return( NewPath ); +} + +/*------------------------------------------------------------\ +| | +| Xsch Free Layer Path | +| | +\------------------------------------------------------------*/ + +static void XschFreeLayerPath( HeadList ) + + xschpath_list *HeadList; +{ + xschpath_list *ScanPath; + xschpath_list *DelPath; + + ScanPath = HeadList; + + while ( ScanPath != (xschpath_list *)0 ) + { + DelPath = ScanPath; + ScanPath = ScanPath->NEXT; + + autfreeheap( DelPath, sizeof( xschpath_list ) ); + } +} + +/*------------------------------------------------------------\ +| | +| Xsch Parse Layer Info | +| | +\------------------------------------------------------------*/ + +static void XschParseLayerInfo( SchFig ) + + schfig_list *SchFig; +{ + FILE *File; + long Layer; + char *String; + char *From; + char *To; + char *Name; + char *ScanString; + char *ScanLayer; + char *ScanName; + char *ScanFrom; + char *ScanTo; + char Buffer[ 512 ]; + + File = mbkfopen( SchFig->NAME, "xsc", "r" ); + + if ( File == (FILE *)0 ) return; + + while ( fgets( Buffer, 512, File ) != (char *)0 ) + { + if ( ( Buffer[ 0 ] == 'B' ) || + ( Buffer[ 0 ] == 'N' ) || + ( Buffer[ 0 ] == 'C' ) ) + { + ScanName = strchr( Buffer, ':' ); + if ( ScanName == (char *)0 ) continue; + + ScanLayer = strchr( ScanName + 1, ':' ); + if ( ScanLayer == (char *)0 ) continue; + + ScanString = strchr( ScanLayer + 1, ':' ); + if ( ScanString == (char *)0 ) continue; + + *ScanName = '\0'; + *ScanLayer = '\0'; + *ScanString = '\0'; + + Layer = atol( ScanLayer + 1 ); + + Name = namealloc( ScanName + 1 ); + + ScanName = strchr( ScanString + 1, '\n' ); + if ( ScanName != (char *)0 ) *ScanName = '\0'; + + String = autnamealloc( ScanString + 1 ); + + if ( ( Layer < 0 ) || + ( Layer > 32 ) ) + { + Layer = -1; + } + + XschLayerInfoList = addptype( XschLayerInfoList, Layer, String ); + + if ( Buffer[ 0 ] == 'B' ) + { + addauthelem( XschHashBoxInfo, Name, (long)XschLayerInfoList ); + } + else + if ( Buffer[ 0 ] == 'N' ) + { + addauthelem( XschHashNetInfo, Name, (long)XschLayerInfoList ); + } + else + { + addauthelem( XschHashConInfo, Name, (long)XschLayerInfoList ); + } + } + else + if ( Buffer[ 0 ] == 'P' ) + { + ScanFrom = strchr( Buffer, ':' ); + if ( ScanFrom == (char *)0 ) continue; + + ScanName = strchr( ScanFrom + 1, ':' ); + if ( ScanName == (char *)0 ) continue; + + ScanTo = strchr( ScanName + 1, ':' ); + if ( ScanTo == (char *)0 ) continue; + + ScanLayer = strchr( ScanTo + 1, ':' ); + if ( ScanLayer == (char *)0 ) continue; + + ScanString = strchr( ScanLayer + 1, ':' ); + if ( ScanString == (char *)0 ) continue; + + *ScanFrom = '\0'; + *ScanName = '\0'; + *ScanTo = '\0'; + *ScanLayer = '\0'; + *ScanString = '\0'; + + Layer = atol( ScanLayer + 1 ); + + From = namealloc( ScanFrom + 1 ); + Name = namealloc( ScanName + 1 ); + To = namealloc( ScanTo + 1 ); + + ScanName = strchr( ScanString + 1, '\n' ); + if ( ScanName != (char *)0 ) *ScanName = '\0'; + + String = autnamealloc( ScanString + 1 ); + + if ( ( Layer < 0 ) || + ( Layer > 32 ) ) + { + Layer = -1; + } + + XschLayerPathList = XschAddLayerPath( XschLayerPathList, From, To, Layer, String ); + + addauthelem( XschHashPathInfo, Name, (long)XschLayerPathList ); + } + } + + fclose( File ); +} + +/*------------------------------------------------------------\ +| | +| Place Con | +| | +\------------------------------------------------------------*/ + +void XschPlaceConnector( HeadList, X, Y, LayerCon ) + + schcon_list *HeadList; + long X; + long Y; + unsigned char LayerCon; +{ + authelem *Element; + schcon_list *SchCon; + xschobj_list *Object1; + xschobj_list *Object2; + ptype_list *InfoPType; + long X_trace; + long X_con; + long Y_trace; + long Y_con; + int ObjectType; + long DeltaX; + long DeltaY; + unsigned char Layer; + + for ( SchCon = HeadList; + SchCon != (schcon_list *)0; + SchCon = SchCon->NEXT ) + { + Layer = LayerCon; + + Element = searchauthelem( XschHashConInfo, SchCon->NAME ); + + if ( Element != (authelem *)0 ) + { + InfoPType = (ptype_list *)Element->VALUE; + SchCon->USER = (void *)InfoPType->DATA; + + if ( InfoPType->TYPE != -1 ) Layer = InfoPType->TYPE + XSCH_FIRST_USER_LAYER; + } + else + { + SchCon->USER = (void *)0; + } + + X_con = ( SchCon->X_REL * XSCH_UNIT ); + Y_con = ( SchCon->Y_REL * XSCH_UNIT ) - XSCH_UNIT; + + if ( IsSchConIn( SchCon ) ) + { + ObjectType = XSCH_OBJECT_TEXT_LEFT; + DeltaX = - XSCH_UNIT; + } + else + { + ObjectType = XSCH_OBJECT_TEXT_RIGHT; + DeltaX = XSCH_UNIT; + } + + X_trace = X_con + X; + Y_trace = Y_con + Y; + + if ( IsSchConExternal( SchCon ) ) + { + DeltaX *= 2; + DeltaY = 0; + + if ( IsSchConIn( SchCon ) ) + { + X_trace -= SCP_PRIMARY_CON_DX * XSCH_UNIT; + } + + Object1 = XschAddPentagon( X_trace, Y_trace, + SCP_PRIMARY_CON_DX * XSCH_UNIT, + SCP_PRIMARY_CON_DY * XSCH_UNIT, Layer ); + + if ( IsSchConOut( SchCon ) ) + { + X_trace += SCP_PRIMARY_CON_DX * XSCH_UNIT; + } + } + else + { + Object1 = (xschobj_list *)0; + DeltaY = - XSCH_UNIT; + } + + Object2 = XschAddText( X_trace + DeltaX, + Y_trace + DeltaY + ((SCP_PRIMARY_CON_DY * XSCH_UNIT) / 2 ), + ObjectType, SchCon->NAME, Layer ); + + if ( Object1 == (xschobj_list *)0 ) + { + Object1 = Object2; + } + + Object1->LINK = Object2; + Object2->LINK = Object1; + + Object1->USER = (void *)SchCon; + Object2->USER = (void *)SchCon; + + SetXschSchCon( Object1 ); + SetXschSchCon( Object2 ); + + if ( IsSchConExternal( SchCon ) ) + { + SetXschSchConExt( Object1 ); + SetXschSchConExt( Object2 ); + } + } +} + +/*------------------------------------------------------------\ +| | +| XschPlaceCutWire | +| | +\------------------------------------------------------------*/ + +static schwir_list *XschPlaceCutWire( HeadWire ) + + schwir_list *HeadWire; +{ + schwir_list *SchWire1; + schwir_list *SchWire2; + schwir_list *SchWire3; + + for ( SchWire1 = HeadWire; + SchWire1 != (schwir_list *)0; + SchWire1 = SchWire1->NEXT ) + { + for ( SchWire2 = HeadWire; + SchWire2 != (schwir_list *)0; + SchWire2 = SchWire2->NEXT ) + { + if ( ( IsSchWireHorizontal( SchWire1 ) ) && + ( IsSchWireVertical( SchWire2 ) ) ) + { + if ( ( SchWire1->Y <= SchWire2->Y ) || + ( ( SchWire1->Y >= ( SchWire2->DY ) ) ) ) continue; + + if ( ( SchWire2->X >= SchWire1->X ) && + ( SchWire2->X <= SchWire1->DX ) ) + { + /* Split SchWire2 */ + + SchWire3 = allocschwir(); + SchWire3->NET = SchWire2->NET; + SchWire3->FLAGS = SchWire2->FLAGS; + SchWire3->USER = SchWire2->USER; + SchWire3->X = SchWire2->X; + SchWire3->DX = SchWire2->DX; + + SchWire3->Y = SchWire1->Y; + SchWire3->DY = SchWire2->DY; + + SchWire2->DY = SchWire1->Y; + + SchWire3->NEXT = SchWire2->NEXT; + SchWire2->NEXT = SchWire3; + } + } + else + if ( ( IsSchWireVertical( SchWire1 ) ) && + ( IsSchWireHorizontal( SchWire2 ) ) ) + { + if ( ( SchWire1->X <= SchWire2->X ) || + ( ( SchWire1->X >= ( SchWire2->DX ) ) ) ) continue; + + if ( ( SchWire2->Y >= SchWire1->Y ) && + ( SchWire2->Y <= SchWire1->DY ) ) + { + /* Split SchWire2 */ + + SchWire3 = allocschwir(); + SchWire3->NET = SchWire2->NET; + SchWire3->FLAGS = SchWire2->FLAGS; + SchWire3->USER = SchWire2->USER; + SchWire3->Y = SchWire2->Y; + SchWire3->DY = SchWire2->DY; + + SchWire3->X = SchWire1->X; + SchWire3->DX = SchWire2->DX; + + SchWire2->DX = SchWire1->X; + + SchWire3->NEXT = SchWire2->NEXT; + SchWire2->NEXT = SchWire3; + } + } + } + } + + return( HeadWire ); +} + +/*------------------------------------------------------------\ +| | +| XschPlaceScanWirePath | +| | +\------------------------------------------------------------*/ + +static int XschPlaceScanWirePath( SchNet, X, Y, SchLastWire ) + + schnet_list *SchNet; + long X; + long Y; + schwir_list *SchLastWire; +{ + schwir_list *SchWire; + int Found; + + for ( SchWire = SchNet->WIRE; + SchWire != (schwir_list *)0; + SchWire = SchWire->NEXT ) + { + if ( IsXschWireTag( SchWire ) ) continue; + + if ( ( SchWire->X == X ) && + ( SchWire->Y == Y ) ) + { + SetXschWireTag( SchWire ); + + if ( SchWire == SchLastWire ) + { + Found = 1; + } + else + { + Found = XschPlaceScanWirePath( SchNet, SchWire->DX, SchWire->DY, SchLastWire ); + } + + if ( Found ) + { + SetXschWirePath( SchWire ); + + return( 1 ); + } + } + else + if ( ( SchWire->DX == X ) && + ( SchWire->DY == Y ) ) + { + SetXschWireTag( SchWire ); + + if ( SchWire == SchLastWire ) + { + Found = 1; + } + else + { + Found = XschPlaceScanWirePath( SchNet, SchWire->X, SchWire->Y, SchLastWire ); + } + + if ( Found ) + { + SetXschWirePath( SchWire ); + + return( 1 ); + } + } + } + + return( 0 ); +} + +/*------------------------------------------------------------\ +| | +| XschPlaceTreatPath | +| | +\------------------------------------------------------------*/ + +static void XschPlaceTreatPath( SchFig, SchNet, PathInfo ) + + schfig_list *SchFig; + schnet_list *SchNet; + xschpath_list *PathInfo; +{ + schbox_list *SchBox; + schcon_list *SchCon; + schwir_list *SchWire; + schwir_list *SchLastWire; + schwir_list *SchFirstWire; +/* +** Cut wire +*/ + SchNet->WIRE = XschPlaceCutWire( SchNet->WIRE ); +/* +** Find the first wire ! +*/ + SchFirstWire = (schwir_list *)0; + + for ( SchBox = SchFig->BOX; + SchBox != (schbox_list *)0; + SchBox = SchBox->NEXT ) + { + if ( SchBox->NAME == PathInfo->FROM ) + { + for ( SchWire = SchNet->WIRE; + SchWire != (schwir_list *)0; + SchWire = SchWire->NEXT ) + { + if ( ( SchWire->X == ( SchBox->X + SchBox->DX ) ) && + ( SchWire->Y >= SchBox->Y ) && + ( SchWire->DY <= ( SchBox->Y + SchBox->DY ) ) ) + { + SchFirstWire = SchWire; break; + } + } + } + + if ( SchFirstWire != (schwir_list *)0 ) break; + } + + if ( SchFirstWire == (schwir_list *)0 ) + { + for ( SchCon = SchFig->CON_IN; + SchCon != (schcon_list *)0; + SchCon = SchCon->NEXT ) + { + if ( PathInfo->FROM == SchCon->NAME ) + { + for ( SchWire = SchNet->WIRE; + SchWire != (schwir_list *)0; + SchWire = SchWire->NEXT ) + { + if ( ( SchWire->X == ( SchCon->X_REL + SchFig->X ) ) && + ( SchWire->Y == ( SchCon->Y_REL + SchFig->Y ) ) ) + { + SchFirstWire = SchWire; break; + } + } + } + + if ( SchFirstWire != (schwir_list *)0 ) break; + } + } + + if ( SchFirstWire == (schwir_list *)0 ) return; + SetXschWirePath( SchFirstWire ); +/* +** Find the last wire ! +*/ + SchLastWire = (schwir_list *)0; + + for ( SchBox = SchFig->BOX; + SchBox != (schbox_list *)0; + SchBox = SchBox->NEXT ) + { + if ( SchBox->NAME == PathInfo->TO ) + { + for ( SchWire = SchNet->WIRE; + SchWire != (schwir_list *)0; + SchWire = SchWire->NEXT ) + { + if ( ( SchWire->DX == SchBox->X ) && + ( SchWire->Y >= SchBox->Y ) && + ( SchWire->DY <= ( SchBox->Y + SchBox->DY ) ) ) + { + SchLastWire = SchWire; break; + } + } + } + + if ( SchLastWire != (schwir_list *)0 ) break; + } + + if ( SchLastWire == (schwir_list *)0 ) + { + for ( SchCon = SchFig->CON_OUT; + SchCon != (schcon_list *)0; + SchCon = SchCon->NEXT ) + { + if ( PathInfo->TO == SchCon->NAME ) + { + for ( SchWire = SchNet->WIRE; + SchWire != (schwir_list *)0; + SchWire = SchWire->NEXT ) + { + if ( ( SchWire->DX == ( SchCon->X_REL + SchFig->X ) ) && + ( SchWire->DY == ( SchCon->Y_REL + SchFig->Y ) ) ) + { + SchLastWire = SchWire; break; + } + } + } + + if ( SchLastWire != (schwir_list *)0 ) break; + } + } + + if ( SchLastWire == (schwir_list *)0 ) return; + SetXschWirePath( SchLastWire ); + + if ( SchLastWire == SchFirstWire ) return; + + XschPlaceScanWirePath( SchNet, SchFirstWire->DX, SchFirstWire->DY, SchLastWire ); + + for ( SchWire = SchNet->WIRE; + SchWire != (schwir_list *)0; + SchWire = SchWire->NEXT ) + { + ClearXschWireTag( SchWire ); + } +} + +/*------------------------------------------------------------\ +| | +| XschPlace | +| | +\------------------------------------------------------------*/ + +void XschPlaceFigure( SchFig ) + + schfig_list *SchFig; +{ + schbox_list *SchBox; + schnet_list *SchNet; + schwir_list *SchWir; + schwir_list *ScanWir; + xschobj_list *Object; + xschobj_list *FirstObj; + xschobj_list *PrevObj; + ptype_list *InfoPType; + xschpath_list *PathInfo; + authelem *Element; + xschicon *XschIcon; + loins_list *LoIns; + lotrs_list *LoTrs; + losig_list *LoSig; + char *ModelName; + char *WireName; + char *Comment; + long X_trace; + long X_fig; + long X_box; + long X_wir; + long Dx; + long DX_wir; + long MaxY_wire; + long MinY_wire; + long Y_trace; + long Y_fig; + long Y_box; + long Y_wir; + long Dy; + long DY_wir; + unsigned char Layer; + unsigned char WireLayer; + unsigned char PathMode; + long cptmax_wire; + long cptmin_wire; + + cptmax_wire = 0; + cptmin_wire = 0; + + X_fig = 0; + Y_fig = 0; + + XschLayerInfoList = (ptype_list *)0; + + if ( XschHashBoxInfo == (authtable *)0 ) + { + XschHashBoxInfo = createauthtable( 100 ); + XschHashNetInfo = createauthtable( 100 ); + XschHashConInfo = createauthtable( 100 ); + XschHashPathInfo = createauthtable( 100 ); + } + + XschParseLayerInfo( SchFig ); + + XschPlaceConnector( SchFig->CON_IN , X_fig, Y_fig, XSCH_SCHCONIN_LAYER ); + XschPlaceConnector( SchFig->CON_OUT, X_fig, Y_fig, XSCH_SCHCONOUT_LAYER ); +/* +** Place all nets +*/ + for ( SchNet = SchFig->NET; + SchNet != (schnet_list *)0; + SchNet = SchNet->NEXT ) + { + WireName = (char *)0; + Comment = (char *)0; + PathMode = 0; + Layer = XSCH_SCHNET_LAYER; + + if ( SchNet->SOURCE_TYPE == SCH_SOURCE_LOSIG ) + { + LoSig = (losig_list *)SchNet->SOURCE; + + if ( LoSig->NAMECHAIN != (chain_list *)0 ) + { + WireName = (char *)LoSig->NAMECHAIN->DATA; + } + } + + if ( WireName != (char *)0 ) + { + Element = searchauthelem( XschHashNetInfo, WireName ); + + if ( Element != (authelem *)0 ) + { + InfoPType = (ptype_list *)Element->VALUE; + Comment = (char *)InfoPType->DATA; + + if ( InfoPType->TYPE != -1 ) Layer = InfoPType->TYPE + XSCH_FIRST_USER_LAYER; + } + + Element = searchauthelem( XschHashPathInfo, WireName ); + + if ( Element != (authelem *)0 ) + { + PathInfo = (xschpath_list *)Element->VALUE; + PathMode = 1; + + Comment = PathInfo->COMMENT; + } + } + + SchNet->USER = (void *)Comment; + + FirstObj = NULL; + PrevObj = NULL; + +# if 0 + fprintf( stdout, "--> NET !\n" ); +# endif + + for ( SchWir = SchNet->WIRE; + SchWir != (schwir_list *)0; + SchWir = SchWir->NEXT ) + { +# if 0 + fprintf( stdout, "Wire (%ld %ld) (%ld %ld)\n", + SchWir->X, SchWir->Y, SchWir->DX, SchWir->DY ); +# endif + X_wir = SchWir->X * XSCH_UNIT; + Y_wir = SchWir->Y * XSCH_UNIT; + DX_wir = SchWir->DX * XSCH_UNIT; + DY_wir = SchWir->DY * XSCH_UNIT; + + X_trace = X_fig + X_wir; + Y_trace = Y_fig + Y_wir; + + if ( IsSchWireVertical(SchWir) ) + { + cptmax_wire=0; + cptmin_wire=0; + + if (SchWir->Y < SchWir->DY) + { + MaxY_wire = SchWir->DY; + MinY_wire = SchWir->Y; + } + else + { + MaxY_wire = SchWir->Y; + MinY_wire = SchWir->DY; + } + + for ( ScanWir = SchNet->WIRE; + ScanWir != (schwir_list *)0; + ScanWir = ScanWir->NEXT) + { + if ( IsSchWireHorizontal(ScanWir) ) + { + if ( ( ScanWir->DX == SchWir->X ) || + ( ScanWir->X == SchWir->X ) ) + { + if ( ( MinY_wire < ScanWir->Y ) && + ( ScanWir->Y < MaxY_wire ) ) + { + Object = XschAddCrossBox( X_trace - ( XSCH_UNIT / 2 ), + Y_fig + (ScanWir->DY * XSCH_UNIT ) - (XSCH_UNIT / 2), + XSCH_UNIT, XSCH_UNIT, Layer ); + SetXschSchNet( Object ); + + if ( PrevObj != NULL ) PrevObj->LINK = Object; + if ( FirstObj == NULL ) FirstObj = Object; + + Object->USER = (void *)SchNet; + PrevObj = Object; + } + + if ( MaxY_wire != MinY_wire ) + { + if ( MaxY_wire == ScanWir->Y ) cptmax_wire++; + if ( MinY_wire == ScanWir->Y ) cptmin_wire++; + } + } + } + } + + if ( cptmax_wire >= 2 ) + { + Object = XschAddCrossBox( X_trace - ( XSCH_UNIT / 2 ), + Y_fig + ( MaxY_wire * XSCH_UNIT ) - (XSCH_UNIT / 2), + XSCH_UNIT, XSCH_UNIT, Layer ); + SetXschSchNet( Object ); + + Object->USER = (void *)SchNet; + if ( PrevObj != NULL ) PrevObj->LINK = Object; + PrevObj = Object; + } + + if (cptmin_wire >= 2) + { + Object = XschAddCrossBox( X_trace - ( XSCH_UNIT / 2 ), + Y_fig + ( MinY_wire * XSCH_UNIT ) - (XSCH_UNIT / 2), + XSCH_UNIT, XSCH_UNIT, Layer ); + SetXschSchNet( Object ); + + if ( PrevObj != NULL ) PrevObj->LINK = Object; + if ( FirstObj == NULL ) FirstObj = Object; + + Object->USER = (void *)SchNet; + PrevObj = Object; + } + } + else + if ( WireName != (char *)0 ) + { + Object = XschAddTextWidth( X_trace, + /* + ((DX_wir - X_wir ) >> 1), */ + Y_trace + XSCH_UNIT, DX_wir - X_wir, + XSCH_OBJECT_TEXT_CENTER, + WireName, Layer ); + + /* + Object->DX = DX_wir - X_wir; + */ + + SetXschSchNet( Object ); + + if ( PrevObj != NULL ) PrevObj->LINK = Object; + if ( FirstObj == NULL ) FirstObj = Object; + + Object->USER = (void *)SchNet; + PrevObj = Object; + } + } +/* +** Special treatment for highlighted path ! +*/ + if ( PathMode ) + { + XschPlaceTreatPath( SchFig, SchNet, PathInfo ); + } + + for ( SchWir = SchNet->WIRE; + SchWir != (schwir_list *)0; + SchWir = SchWir->NEXT ) + { + WireLayer = Layer; + + if ( ( PathMode ) && + ( IsXschWirePath( SchWir ) ) && + ( PathInfo->LAYER != -1 ) ) + { + WireLayer = PathInfo->LAYER + XSCH_FIRST_USER_LAYER; + } + + X_wir = SchWir->X * XSCH_UNIT; + Y_wir = SchWir->Y * XSCH_UNIT; + DX_wir = SchWir->DX * XSCH_UNIT; + DY_wir = SchWir->DY * XSCH_UNIT; + + X_trace = X_fig + X_wir; + Y_trace = Y_fig + Y_wir; + + Object = XschAddLine( X_trace, Y_trace, DX_wir+X_fig, DY_wir+Y_fig , + WireLayer, WireLayer ); + SetXschSchNet( Object ); + + if ( FirstObj == NULL ) FirstObj = Object; + + Object->USER = (void *)SchNet; + Object->LINK = Object; + + if ( PrevObj != NULL ) PrevObj->LINK = Object; + + PrevObj = Object; + } + + if ( PrevObj != NULL ) PrevObj->LINK = FirstObj; + } + +/* +** Place all boxes +*/ + for ( SchBox = SchFig->BOX; + SchBox != (schbox_list *)0; + SchBox = SchBox->NEXT ) + { + if ( ( IsSchBoxTransparence( SchBox ) ) || + ( IsSchBoxCluster( SchBox ) ) || + ( IsSchBoxClusterNet( SchBox ) ) ) + { + Layer = XSCH_CONSTRUCTION_LAYER; + } + else + { + Layer = XSCH_SCHBOX_LAYER; + } + + Element = searchauthelem( XschHashBoxInfo, SchBox->NAME ); + + if ( Element != (authelem *)0 ) + { + InfoPType = (ptype_list *)Element->VALUE; + SchBox->USER = (char *)InfoPType->DATA; + + if ( InfoPType->TYPE != -1 ) Layer = InfoPType->TYPE + XSCH_FIRST_USER_LAYER; + } + else + { + SchBox->USER = (void *)0; + } + + X_box = SchBox->X * XSCH_UNIT; + Y_box = SchBox->Y * XSCH_UNIT; + Dx = SchBox->DX * XSCH_UNIT; + Dy = SchBox->DY * XSCH_UNIT; + + X_trace = X_box + X_fig; + Y_trace = Y_box + Y_fig; + + Object = (xschobj_list *)0; + ModelName = (char *)0; + + if ( SchBox->SOURCE_TYPE == SCH_SOURCE_LOINS ) + { + LoIns = (loins_list *)SchBox->SOURCE; + ModelName = LoIns->FIGNAME; + + Element = searchauthelem( XSCH_HASH_ICON, ModelName ); + + if ( Element != (authelem *)0 ) + { + XschIcon = (xschicon *)Element->VALUE; + + if ( XschIcon->TYPE == XSCH_ICON_CELL_BUFFER ) + { + Object = XschAddBuffer( X_trace, Y_trace, Dx, Dy, + XschIcon->ARGS[ 0 ], XschIcon->ARGS[ 1 ], Layer ); + } + else + if ( XschIcon->TYPE == XSCH_ICON_CELL_AND ) + { + Object = XschAddAnd( X_trace, Y_trace, Dx, Dy, + XschIcon->ARGS[ 0 ], + XschIcon->ARGS[ 1 ], + XschIcon->ARGS[ 2 ], Layer ); + } + else + if ( XschIcon->TYPE == XSCH_ICON_CELL_OR ) + { + Object = XschAddOr( X_trace, Y_trace, Dx, Dy, + XschIcon->ARGS[ 0 ], + XschIcon->ARGS[ 1 ], + XschIcon->ARGS[ 2 ], Layer ); + } + else + if ( XschIcon->TYPE == XSCH_ICON_CELL_XOR ) + { + Object = XschAddXor( X_trace, Y_trace, Dx, Dy, + XschIcon->ARGS[ 0 ], + XschIcon->ARGS[ 1 ], + XschIcon->ARGS[ 2 ], Layer ); + } + else + if ( XschIcon->TYPE == XSCH_ICON_CELL_TRISTATE ) + { + Object = XschAddTristate( X_trace, Y_trace, Dx, Dy, + XschIcon->ARGS[ 0 ], + XschIcon->ARGS[ 1 ], Layer ); + } + else + if ( XschIcon->TYPE == XSCH_ICON_CELL_REGISTER ) + { + Object = XschAddRegister( X_trace, Y_trace, Dx, Dy, + XschIcon->ARGS[ 0 ], + XschIcon->ARGS[ 1 ], + XschIcon->ARGS[ 2 ], + XschIcon->ARGS[ 3 ], + XschIcon->ARGS[ 4 ], Layer ); + } + else + if ( XschIcon->TYPE == XSCH_ICON_CELL_CONSTANT ) + { + Object = XschAddConstant( X_trace, Y_trace, Dx, Dy, + XschIcon->ARGS[ 0 ], + XschIcon->ARGS[ 1 ], Layer ); + } + else + if ( XschIcon->TYPE == XSCH_ICON_CELL_ANDOR ) + { + Object = XschAddAndOr( X_trace, Y_trace, Dx, Dy, + XschIcon->ARGS[ 0 ], + XschIcon->ARGS[ 1 ], + XschIcon->ARGS[ 2 ], Layer ); + } + else + if ( XschIcon->TYPE == XSCH_ICON_CELL_ORAND ) + { + Object = XschAddOrAnd( X_trace, Y_trace, Dx, Dy, + XschIcon->ARGS[ 0 ], + XschIcon->ARGS[ 1 ], + XschIcon->ARGS[ 2 ], Layer ); + } + else + if ( XschIcon->TYPE == XSCH_ICON_CELL_MUX ) + { + Object = XschAddMux( X_trace, Y_trace, Dx, Dy, + XschIcon->ARGS[ 0 ], + XschIcon->ARGS[ 1 ], + XschIcon->ARGS[ 2 ], + XschIcon->ARGS[ 3 ], Layer ); + } + + ModelName = (char *)0; + } + } + else + if ( SchBox->SOURCE_TYPE == SCH_SOURCE_LOTRS ) + { + LoTrs = (lotrs_list *)SchBox->SOURCE; + + + Object = XschAddTransistor( X_trace, Y_trace, Dx, Dy, + ( LoTrs->TYPE == TRANSN ) ? 1 : 0, Layer ); + ModelName = (char *)0; + } + + if ( Object == (xschobj_list *)0 ) + { + Object = XschAddRectangle( X_trace, Y_trace, Dx, Dy, Layer ); + } + + Object->LINK = XschAddText( X_trace + ( Dx >> 1 ), + Y_trace + ( Dy >> 1 ), XSCH_OBJECT_TEXT_CENTER, + SchBox->NAME, Layer ); + + SetXschSchBox( Object ); + SetXschSchBox( Object->LINK ); + + Object->USER = (void *)SchBox; + Object->LINK->USER = (void *)SchBox; + + if ( ModelName == (char *)0 ) + { + Object->LINK->LINK = Object; + } + else + { + Object->LINK->LINK = XschAddText( X_trace + ( Dx >> 1 ), + Y_trace + ( SCP_BOX_CON_BASE_Y * XSCH_UNIT ), + XSCH_OBJECT_TEXT_CENTER, + ModelName, Layer ); + + SetXschSchBox( Object->LINK->LINK ); + + Object->LINK->LINK->USER = (void *)SchBox; + Object->LINK->LINK->LINK = Object; + } + + XschPlaceConnector( SchBox->CON_IN , X_trace, Y_trace, Layer ); + XschPlaceConnector( SchBox->CON_OUT, X_trace, Y_trace, Layer ); + } + + resetauthtable( XschHashBoxInfo ); + resetauthtable( XschHashNetInfo ); + resetauthtable( XschHashConInfo ); + resetauthtable( XschHashPathInfo ); + + freeptype( XschLayerInfoList ); + XschLayerInfoList = (ptype_list *)0; + + XschFreeLayerPath( XschLayerPathList ); + XschLayerPathList = (xschpath_list *)0; +} diff --git a/alliance/src/xsch/src/XSC_place.h b/alliance/src/xsch/src/XSC_place.h new file mode 100644 index 00000000..d7d94229 --- /dev/null +++ b/alliance/src/xsch/src/XSC_place.h @@ -0,0 +1,111 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Trace.h | +| | +| Authors : Miramond Benoit | +| Picault Stephane | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSC_PLACE_H +# define XSC_PLACE_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XSCH_GRID_X 4 +# define XSCH_CELL_ROOT_LOINS 0 +# define XSCH_CELL_ROOT_LOCON 1 + +/*------------------------------------------------------------\ +| | +| Mask | +| | +\------------------------------------------------------------*/ + +# define XSCH_WIRE_TAG_MASK 0x01 +# define XSCH_WIRE_PATH_MASK 0x02 + +# define IsXschWireTag( X ) ( ( X )->FLAGS & XSCH_WIRE_TAG_MASK ) +# define SetXschWireTag( X ) ( ( X )->FLAGS |= XSCH_WIRE_TAG_MASK ) +# define ClearXschWireTag( X ) ( ( X )->FLAGS &= ~XSCH_WIRE_TAG_MASK ) + +# define IsXschWirePath( X ) ( ( X )->FLAGS & XSCH_WIRE_PATH_MASK ) +# define SetXschWirePath( X ) ( ( X )->FLAGS |= XSCH_WIRE_PATH_MASK ) +# define ClearXschWirePath( X ) ( ( X )->FLAGS &= ~XSCH_WIRE_PATH_MASK ) + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct xschpath_list + { + struct xschpath_list *NEXT; + char *FROM; + char *TO; + char *COMMENT; + long LAYER; + + } xschpath_list; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschPlaceFigure(); + +# endif diff --git a/alliance/src/xsch/src/XSC_schem.c b/alliance/src/xsch/src/XSC_schem.c new file mode 100644 index 00000000..a8a65ff3 --- /dev/null +++ b/alliance/src/xsch/src/XSC_schem.c @@ -0,0 +1,366 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Sch.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "abe.h" +# include "abv.h" +# include "mlo.h" +# include "XSB.h" +# include "XSC.h" +# include "scl.h" + +# include "XSC_schem.h" +# include "XSC_error.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + schfig_list *XschFigureSch = (schfig_list *)NULL; + +/*------------------------------------------------------------\ +| | +| For Set Long Jump | +| | +\------------------------------------------------------------*/ + + static jmp_buf XschJumpBuffer; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Xsch Exit Handler Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschExitHandler | +| | +\------------------------------------------------------------*/ + +void XschExitHandler() +{ + XschFlushErrorMessage(); + + longjmp( XschJumpBuffer, 1); +} + +/*------------------------------------------------------------\ +| | +| XschActiveExitHandler | +| | +\------------------------------------------------------------*/ + +void XschActiveExitHandler() +{ + MBK_EXIT_FUNCTION = XschExitHandler; +} + +/*------------------------------------------------------------\ +| | +| XschResetExitHandler | +| | +\------------------------------------------------------------*/ + +void XschResetExitHandler() +{ + MBK_EXIT_FUNCTION = NULL; +} + +/*------------------------------------------------------------\ +| | +| Order Functions | +| | +\------------------------------------------------------------*/ + +static void XschOrderLoconFigure( Figure ) + + lofig_list *Figure; +{ + xschicon *XschIcon; + authelem *Element; + loins_list *LoIns; + locon_list **PrevLoCon; + locon_list *HeadLoCon; + locon_list **QueueLoCon; + locon_list *ScanLoCon; + chain_list *ScanChain; + + for ( LoIns = Figure->LOINS; + LoIns != (loins_list *)0; + LoIns = LoIns->NEXT ) + { + Element = searchauthelem( XSCH_HASH_ICON, LoIns->FIGNAME ); + + if ( Element != (authelem *)0 ) + { + XschIcon = (xschicon *)Element->VALUE; + + HeadLoCon = (locon_list *)0; + QueueLoCon = &HeadLoCon; + + for ( ScanChain = XschIcon->CON_IN; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + PrevLoCon = &LoIns->LOCON; + ScanLoCon = LoIns->LOCON; + + while ( ScanLoCon != (locon_list *)0 ) + { + if ( ScanLoCon->NAME == (char *)ScanChain->DATA ) + { + ScanLoCon->DIRECTION = IN; + + *PrevLoCon = ScanLoCon->NEXT; + ScanLoCon->NEXT = (locon_list *)0; + *QueueLoCon = ScanLoCon; + QueueLoCon = &ScanLoCon->NEXT; + + break; + } + + PrevLoCon = &ScanLoCon->NEXT; + ScanLoCon = ScanLoCon->NEXT; + } + } + + for ( ScanChain = XschIcon->CON_OUT; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + PrevLoCon = &LoIns->LOCON; + ScanLoCon = LoIns->LOCON; + + while ( ScanLoCon != (locon_list *)0 ) + { + if ( ScanLoCon->NAME == (char *)ScanChain->DATA ) + { + ScanLoCon->DIRECTION = OUT; + + *PrevLoCon = ScanLoCon->NEXT; + ScanLoCon->NEXT = (locon_list *)0; + *QueueLoCon = ScanLoCon; + QueueLoCon = &ScanLoCon->NEXT; + + break; + } + + PrevLoCon = &ScanLoCon->NEXT; + ScanLoCon = ScanLoCon->NEXT; + } + } + + *QueueLoCon = LoIns->LOCON; + LoIns->LOCON = HeadLoCon; + } + } +} + +/*------------------------------------------------------------\ +| | +| Get Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Xschgetlofig | +| | +\------------------------------------------------------------*/ + +lofig_list *Xschgetlofig( FileName, Mode ) + + char *FileName; + unsigned char Mode; +{ + lofig_list *Figure; + + autbegin(); + + Figure = (lofig_list *)NULL; + + XschActiveExitHandler(); + + if ( setjmp( XschJumpBuffer ) == 0 ) + { + Figure = getlofig( FileName, Mode ); + + XschResetExitHandler(); + + XschOrderLoconFigure( Figure ); + + autend(); + return( Figure ); + } + + XschResetExitHandler(); + + dellofig( FileName ); + + autend(); + return( (lofig_list *)0 ); +} + +/*------------------------------------------------------------\ +| | +| Xschvhdlloadbefig | +| | +\------------------------------------------------------------*/ + +befig_list *Xschvhdlloadbefig( FileName, Mode ) + + char *FileName; + unsigned char Mode; +{ + befig_list *Figure; + + autbegin(); + + Figure = (befig_list *)NULL; + + XschActiveExitHandler(); + + if ( setjmp( XschJumpBuffer ) == 0 ) + { + Figure = vhdlloadbefig( (befig_list *)0, FileName, Mode ); + + XschResetExitHandler(); + + autend(); + return( Figure ); + } + + XschResetExitHandler(); + + beh_frebefig( Figure ); + + autend(); + return( (befig_list *)0 ); +} + +/*------------------------------------------------------------\ +| | +| Xschgetschfig | +| | +\------------------------------------------------------------*/ + +schfig_list *Xschgetschfig( FileName ) + + char *FileName; +{ + lofig_list *FigureLo; + befig_list *FigureBeh; + schfig_list *FigureSch; + FILE *File; + int ParseVbe; + + autbegin(); + + FigureSch = (schfig_list *)0; + ParseVbe = 0; + + if ( strcmp( XSCH_IN_SCHEM, "vbe" ) ) + { + File = mbkfopen( FileName, IN_LO, "r" ); + + if ( File != (FILE *)0 ) + { + fclose( File ); + + FigureLo = Xschgetlofig( FileName, 'A' ); + + if ( FigureLo != (lofig_list *)0 ) + { + FigureSch = lofig2schfig( FigureLo, XSCH_VECTORIZED_MODE ); + placerouteschfig( FigureSch ); + } + } + else + { + ParseVbe = 1; + } + } + else + { + ParseVbe = 1; + } + + if ( ParseVbe ) + { + FigureBeh = Xschvhdlloadbefig( FileName, 2 ); + + if ( FigureBeh != (befig_list *)0 ) + { + FigureSch = befig2schfig( FigureBeh ); + placerouteschfig( FigureSch ); + } + } + + autend(); + return( FigureSch ); +} diff --git a/alliance/src/xsch/src/XSC_schem.h b/alliance/src/xsch/src/XSC_schem.h new file mode 100644 index 00000000..207d3e97 --- /dev/null +++ b/alliance/src/xsch/src/XSC_schem.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Fsm.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSC_SCH_H +# define XSC_SCH_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern schfig_list *Xschgetschfig(); + +# endif diff --git a/alliance/src/xsch/src/XSC_select.c b/alliance/src/xsch/src/XSC_select.c new file mode 100644 index 00000000..1e7796c8 --- /dev/null +++ b/alliance/src/xsch/src/XSC_select.c @@ -0,0 +1,423 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Select.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XSB.h" +# include "XSC.h" +# include "XSC_select.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + xschselect_list *XschHeadSelect = (xschselect_list *)NULL; + xschselect_list *XschHeadConnect = (xschselect_list *)NULL; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Alloc Functions | +| | +\------------------------------------------------------------*/ + +xschselect_list *XschAllocSelect() +{ + return( (xschselect_list *)autallocheap( sizeof( xschselect_list ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Free Functions | +| | +\------------------------------------------------------------*/ + +void XschFreeSelect( Select ) + + xschselect_list *Select; +{ + autfreeheap( Select, sizeof( xschselect_list ) ); +} + +/*------------------------------------------------------------\ +| | +| Select Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschSelectObject | +| | +\------------------------------------------------------------*/ + +void XschSelectObject( Object ) + + xschobj_list *Object; +{ + xschobj_list *Scan; + + autbegin(); + + Scan = Object; + + do + { + SetXschSelect( Scan ); + + Scan = Scan->LINK; + } + while ( Scan != Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschUnselectObject | +| | +\------------------------------------------------------------*/ + +void XschUnselectObject( Object ) + + xschobj_list *Object; +{ + xschobj_list *Scan; + + autbegin(); + + Scan = Object; + + do + { + ClearXschSelect( Scan ); + + Scan = Scan->LINK; + } + while ( Scan != Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschAcceptObject | +| | +\------------------------------------------------------------*/ + +void XschAcceptObject( Object ) + + xschobj_list *Object; +{ + xschobj_list *Scan; + + autbegin(); + + Scan = Object; + + do + { + SetXschAccept( Scan ); + + Scan = Scan->LINK; + } + while ( Scan != Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschRejectObject | +| | +\------------------------------------------------------------*/ + +void XschRejectObject( Object ) + + xschobj_list *Object; +{ + xschobj_list *Scan; + + autbegin(); + + Scan = Object; + + do + { + ClearXschAccept( Scan ); + + Scan = Scan->LINK; + } + while ( Scan != Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschConnectObject | +| | +\------------------------------------------------------------*/ + +void XschConnectObject( Object ) + + xschobj_list *Object; +{ + xschobj_list *Scan; + + autbegin(); + + Scan = Object; + + do + { + SetXschConnect( Scan ); + + Scan = Scan->LINK; + } + while ( Scan != Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschDisconnectObject | +| | +\------------------------------------------------------------*/ + +void XschDisconnectObject( Object ) + + xschobj_list *Object; +{ + xschobj_list *Scan; + + autbegin(); + + Scan = Object; + + do + { + ClearXschConnect( Scan ); + + Scan = Scan->LINK; + } + while ( Scan != Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Add Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschAddSelect | +| | +\------------------------------------------------------------*/ + +void XschAddSelect( Object ) + + xschobj_list *Object; +{ + xschselect_list *Select; + + autbegin(); + + Select = XschAllocSelect(); + Select->NEXT = XschHeadSelect; + Select->OBJECT = Object; + XschHeadSelect = Select; + + XschSelectObject( Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschAddConnect | +| | +\------------------------------------------------------------*/ + +void XschAddConnect( Object ) + + xschobj_list *Object; +{ + xschselect_list *Connect; + + autbegin(); + + Connect = XschAllocSelect(); + Connect->NEXT = XschHeadConnect; + Connect->OBJECT = Object; + XschHeadConnect = Connect; + + XschConnectObject( Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Del Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschDelSelect | +| | +\------------------------------------------------------------*/ + +void XschDelSelect() +{ + xschselect_list *Select; + xschselect_list *DelSelect; + + autbegin(); + + Select = XschHeadSelect; + XschHeadSelect = (xschselect_list *)NULL; + + while ( Select != (xschselect_list *)NULL ) + { + XschRejectObject( Select->OBJECT ); + + DelSelect = Select; + Select = Select->NEXT; + + XschFreeSelect( DelSelect ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschPurgeSelect | +| | +\------------------------------------------------------------*/ + +void XschPurgeSelect() +{ + xschselect_list *DelSelect; + xschselect_list *Select; + xschselect_list **Previous; + + autbegin(); + + Previous = &XschHeadSelect; + Select = XschHeadSelect; + + while( Select != (xschselect_list *)NULL ) + { + if ( ! IsXschAccept( Select->OBJECT ) ) + { + DelSelect = Select; + Select = Select->NEXT; + *Previous = Select; + + XschFreeSelect( DelSelect ); + } + else + { + Previous = &Select->NEXT; + Select = Select->NEXT; + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschDelConnect | +| | +\------------------------------------------------------------*/ + +void XschDelConnect() +{ + xschselect_list *Connect; + xschselect_list *DelConnect; + + autbegin(); + + Connect = XschHeadConnect; + XschHeadConnect = (xschselect_list *)NULL; + + while ( Connect != (xschselect_list *)NULL ) + { + XschDisconnectObject( Connect->OBJECT ); + + DelConnect = Connect; + Connect = Connect->NEXT; + + XschFreeSelect( DelConnect ); + } + + autend(); +} diff --git a/alliance/src/xsch/src/XSC_select.h b/alliance/src/xsch/src/XSC_select.h new file mode 100644 index 00000000..23cf3917 --- /dev/null +++ b/alliance/src/xsch/src/XSC_select.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Select.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSC_SELECT_H +# define XSC_SELECT_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xsch/src/XTB.h b/alliance/src/xsch/src/XTB.h new file mode 100644 index 00000000..520c9426 --- /dev/null +++ b/alliance/src/xsch/src/XTB.h @@ -0,0 +1,216 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : XTB.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_XTB +# define XSCH_XTB + +/*------------------------------------------------------------\ +| | +| MouseCursors | +| | +\------------------------------------------------------------*/ + +# define XSCH_NORMAL_CURSOR 0 +# define XSCH_WATCH_CURSOR 1 +# define XSCH_PIRATE_CURSOR 2 +# define XSCH_CROSS_CURSOR 3 +# define XSCH_NO_CURSOR 4 + +# define XSCH_MAX_CURSOR 5 + +/*------------------------------------------------------------\ +| | +| DialogBoxType | +| | +\------------------------------------------------------------*/ + +# define XSCH_DIALOG_MESSAGE 0 +# define XSCH_DIALOG_ERROR 1 +# define XSCH_DIALOG_INFO 2 +# define XSCH_DIALOG_QUESTION 3 +# define XSCH_DIALOG_WARNING 4 +# define XSCH_DIALOG_WORKING 5 +# define XSCH_DIALOG_FILE 6 +# define XSCH_DIALOG_PROMPT 7 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschDialogBox | +| | +\------------------------------------------------------------*/ + + typedef struct XschDialogItem + + { + char *LABEL; + char TYPE; + Widget WIDGET; + void (*CALLBACK_OK)(); + XtPointer CALLDATA_OK; + void (*CALLBACK_CANCEL)(); + XtPointer CALLDATA_CANCEL; + + } XschDialogItem; + + +/*------------------------------------------------------------\ +| | +| XschMenuItem | +| | +\------------------------------------------------------------*/ + + typedef struct XschMenuItem + + { + char *LABEL; + char MNEMONIC; + char *SHORT_KEY; + char *SHORT_KEY_TEXT; + WidgetClass *CLASS; + Boolean SEPARATOR; + Boolean TITLE; + Boolean HELP; + void (*CALLBACK)(); + XtPointer CALLDATA; + Widget BUTTON; + Widget MENU; + struct XschMenuItem *NEXT; + + } XschMenuItem; + +/*------------------------------------------------------------\ +| | +| XschPanelButtonItem | +| | +\------------------------------------------------------------*/ + + typedef struct XschPanelButtonItem + + { + char **LABEL; + char *TEXT; + char *BITMAP; + int WIDTH; + int HEIGHT; + char **FOREGROUND; + char **BACKGROUND; + unsigned char X; + unsigned char Y; + unsigned char DX; + unsigned char DY; + void (*CALLBACK)(); + XtPointer CALLDATA; + Widget BUTTON; + + } XschPanelButtonItem; + +/*------------------------------------------------------------\ +| | +| XschPanelItem | +| | +\------------------------------------------------------------*/ + + typedef struct XschPanelItem + + { + char *TITLE; + char COMPUTE; + char MANAGED; + int X; + int Y; + int WIDTH; + int HEIGHT; + unsigned char COLUMN; + unsigned char ROW; + Widget PANEL; + Widget PANEL_FORM; + Widget FRAME; + Widget FORM; + XschPanelButtonItem *LIST; + + } XschPanelItem; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char *XschPanelButtonDisable; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XschDestroyDialogCallback(); + extern void XschExitDialogCallback(); + + extern void XschSetMouseCursor(); + extern Pixmap XschCreatePixmap(); + extern void XschSetIcon(); + extern void XschBuildMenus(); + extern void XschBuildPanel(); + extern void XschEnterPanel(); + extern void XschExitPanel(); + extern void XschBuildDialog(); + extern void XschEnterDialog(); + extern void XschReEnterDialog(); + extern void XschExitDialog(); + extern void XschWarningMessage(); + extern void XschErrorMessage(); + extern void XschLimitedLoop(); + +# endif diff --git a/alliance/src/xsch/src/XTB_cursor.c b/alliance/src/xsch/src/XTB_cursor.c new file mode 100644 index 00000000..720a9b4f --- /dev/null +++ b/alliance/src/xsch/src/XTB_cursor.c @@ -0,0 +1,176 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : cursor.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XTB.h" +# include "XSB.h" +# include "XTB_cursor.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static XschMouseCursor XschMouseCursorArray [ XSCH_MAX_CURSOR ] = + + { + { XC_left_ptr , True }, + { XC_watch , True }, + { XC_pirate , True }, + { XC_cross_reverse , True }, + { 0 , True } + }; + + static char XschCursorMaskOr [ 8 ] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + static char XschCursorMaskAnd [ 8 ] = + + { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschSetMouseCursor | +| | +\------------------------------------------------------------*/ + +void XschSetMouseCursor( MainWidget, CursorType ) + + Widget MainWidget; + int CursorType; +{ + Display *DisplayId; + Window MainWindow; + XColor White; + XColor Black; + XColor ForgetIt; + Colormap ColorMap; + Pixmap MaskOr; + Pixmap MaskAnd; + Cursor Type; + Cursor NewCursor; + + autbegin(); + + DisplayId = XtDisplay( MainWidget ); + MainWindow = XtWindow( MainWidget ); + + Type = XschMouseCursorArray[ CursorType ].CURSOR; + + if ( XschMouseCursorArray[ CursorType ].MAKE == True ) + { + if ( Type != 0 ) + { + NewCursor = XCreateFontCursor( DisplayId, Type ); + } + else + { + ColorMap = DefaultColormapOfScreen ( XtScreen( MainWidget ) ); + + XAllocNamedColor( DisplayId, ColorMap, "black", &Black, &ForgetIt ); + XAllocNamedColor( DisplayId, ColorMap, "white", &White, &ForgetIt ); + + MaskOr = + + XCreatePixmapFromBitmapData( DisplayId, + MainWindow, + XschCursorMaskOr, + 8, 8, + Black.pixel, + White.pixel, 1 ); + + MaskAnd = + + XCreatePixmapFromBitmapData( DisplayId, + MainWindow, + XschCursorMaskAnd, + 8, 8, + Black.pixel, + White.pixel, 1 ); + + NewCursor = XCreatePixmapCursor( DisplayId, + MaskAnd, MaskOr, + &Black, &White, 0, 0 ); + } + + XschMouseCursorArray[ CursorType ].CURSOR = NewCursor; + XschMouseCursorArray[ CursorType ].MAKE = False; + + Type = NewCursor; + } + + XDefineCursor( DisplayId, MainWindow, Type ); + + XmUpdateDisplay( MainWidget ); + + autend(); +} diff --git a/alliance/src/xsch/src/XTB_cursor.h b/alliance/src/xsch/src/XTB_cursor.h new file mode 100644 index 00000000..2de5c301 --- /dev/null +++ b/alliance/src/xsch/src/XTB_cursor.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : cursor.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_XTB_CURSOR +# define XSCH_XTB_CURSOR + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct XschMouseCursor + { + Cursor CURSOR; + Boolean MAKE; + + } XschMouseCursor; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xsch/src/XTB_dialog.c b/alliance/src/xsch/src/XTB_dialog.c new file mode 100644 index 00000000..6dfe2d1d --- /dev/null +++ b/alliance/src/xsch/src/XTB_dialog.c @@ -0,0 +1,466 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XTB.h" +# include "XSB.h" + +# include "XTB_dialog.h" +# include "XSC_error.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static XschLockLoop = 0; + + static XschDialogItem XschWarningDialog = + + { + "Warning", + XSCH_DIALOG_WARNING, + (Widget)NULL, + (void *)NULL, + (XtPointer)NULL, + (void *)NULL, + (XtPointer)NULL + }; + + static XschDialogItem XschErrorDialog = + + { + "Error", + XSCH_DIALOG_ERROR, + (Widget)NULL, + (void *)NULL, + (XtPointer)NULL, + (void *)NULL, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschDestroyDialogCallback | +| | +\------------------------------------------------------------*/ + +void XschDestroyDialogCallback( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + XschLockLoop = 0; + XschExitErrorMessage( 1 ); +} + +/*------------------------------------------------------------\ +| | +| XschExitDialogCallback | +| | +\------------------------------------------------------------*/ + +void XschExitDialogCallback() + +{ + autbegin(); + + XschExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschBuildDialog | +| | +\------------------------------------------------------------*/ + +void XschBuildDialog( Father, Dialog ) + + Widget Father; + XschDialogItem *Dialog; +{ + Arg Args[3]; + XmString Label; + + autbegin(); + + Label = XmStringCreateLtoR( Dialog->LABEL, + XmSTRING_DEFAULT_CHARSET ); + + if ( Dialog->TYPE < XSCH_DIALOG_FILE ) + { + XtSetArg( Args[0], XmNmessageString , Label); + } + else + { + XtSetArg( Args[0], XmNselectionLabelString, Label); + } + + XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING ); + XtSetArg( Args[2], XmNtitle, " " ); + + switch ( Dialog->TYPE ) + { + case XSCH_DIALOG_MESSAGE : + + Dialog->WIDGET = + + XmCreateMessageDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case XSCH_DIALOG_ERROR : + + Dialog->WIDGET = + + XmCreateErrorDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case XSCH_DIALOG_INFO : + + Dialog->WIDGET = + + XmCreateInformationDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case XSCH_DIALOG_QUESTION : + + Dialog->WIDGET = + + XmCreateQuestionDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case XSCH_DIALOG_WARNING : + + Dialog->WIDGET = + + XmCreateWarningDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case XSCH_DIALOG_WORKING : + + Dialog->WIDGET = + + XmCreateWorkingDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case XSCH_DIALOG_FILE : + + Dialog->WIDGET = + + XmCreateFileSelectionDialog( Father, Dialog->LABEL, Args, 3); + + XtUnmanageChild( XmFileSelectionBoxGetChild( Dialog->WIDGET, + XmDIALOG_FILTER_LABEL ) ); + + XtUnmanageChild( XmFileSelectionBoxGetChild( Dialog->WIDGET, + XmDIALOG_FILTER_TEXT ) ); + + break; + + case XSCH_DIALOG_PROMPT : + + Dialog->WIDGET = + + XmCreatePromptDialog( Father, Dialog->LABEL, Args, 3); + + XtUnmanageChild( XmSelectionBoxGetChild( Dialog->WIDGET, + XmDIALOG_HELP_BUTTON ) ); + } + + XmStringFree( Label ); + + XtAddCallback (Dialog->WIDGET, XmNdestroyCallback, + XschDestroyDialogCallback, NULL ); + + if ( Dialog->TYPE < XSCH_DIALOG_FILE ) + { + XtUnmanageChild( XmMessageBoxGetChild( Dialog->WIDGET, + XmDIALOG_HELP_BUTTON ) ); + } + + if ( ( Dialog->CALLBACK_OK == NULL ) && + ( Dialog->CALLBACK_CANCEL == NULL ) ) + { + XtAddCallback( Dialog->WIDGET, XmNokCallback, + XschExitDialogCallback, NULL ); + } + else + { + if ( Dialog->CALLBACK_OK == NULL ) + { + XtUnmanageChild( XmMessageBoxGetChild( Dialog->WIDGET, + XmDIALOG_OK_BUTTON ) ); + } + else + { + XtAddCallback( Dialog->WIDGET, XmNokCallback, + Dialog->CALLBACK_OK, + Dialog->CALLDATA_OK ); + } + } + + if ( Dialog->CALLBACK_CANCEL == NULL ) + { + XtUnmanageChild( XmMessageBoxGetChild( Dialog->WIDGET, + XmDIALOG_CANCEL_BUTTON ) ); + } + else + { + XtAddCallback( Dialog->WIDGET, XmNcancelCallback, + Dialog->CALLBACK_CANCEL, + Dialog->CALLDATA_CANCEL ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschLimitedLoop | +| | +\------------------------------------------------------------*/ + +void XschLimitedLoop( MyWidget ) + + Widget MyWidget; +{ + Widget DialogShell, WShell; + XEvent Event; + XAnyEvent *AnyEvent; + XtAppContext Context; + + autbegin(); + + Context = XtWidgetToApplicationContext( MyWidget ); + + XschLockLoop = 1; + + for ( WShell = MyWidget; + ! XtIsShell( WShell ); + WShell = XtParent( WShell ) ); + + while( XschLockLoop == 1 ) + { + XtAppNextEvent( Context, &Event ); + + AnyEvent = (XAnyEvent *)( &Event ); + + for ( DialogShell = XtWindowToWidget( AnyEvent->display, AnyEvent->window ); + ((DialogShell != NULL ) && (!XtIsShell( DialogShell ))); + DialogShell = XtParent(DialogShell)); + + switch ( AnyEvent->type ) + { + case ButtonPress : + case ButtonRelease : + + if ( WShell == DialogShell ) + { + XtDispatchEvent( &Event ); + } + + break; + + case KeyPress : + case KeyRelease : + + if ( WShell != DialogShell ) + { + AnyEvent->window = XtWindow( WShell ); + } + + default : + + XtDispatchEvent( &Event ); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschEnterDialog | +| | +\------------------------------------------------------------*/ + +void XschEnterDialog( Dialog ) + + XschDialogItem *Dialog; +{ + autbegin(); + + XtManageChild ( Dialog->WIDGET ); + + XschLimitedLoop( Dialog->WIDGET ); + + XtUnmanageChild( Dialog->WIDGET ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschReEnterDialog | +| | +\------------------------------------------------------------*/ + +void XschReEnterDialog() +{ + XschLockLoop = 1; +} + +/*------------------------------------------------------------\ +| | +| XschExitDialog | +| | +\------------------------------------------------------------*/ + +void XschExitDialog() + +{ + XschLockLoop = 0; +} + +/*------------------------------------------------------------\ +| | +| XschWarningMessage | +| | +\------------------------------------------------------------*/ + +void XschWarningMessage( Father, Subject ) + + Widget Father; + char *Subject; +{ + XmString Label; + + autbegin(); + + if ( XschWarningDialog.WIDGET == (Widget)NULL ) + { + XschBuildDialog( Father, &XschWarningDialog ); + } + + Label = XmStringCreateLtoR( Subject, + XmSTRING_DEFAULT_CHARSET ); + + XtVaSetValues( XschWarningDialog.WIDGET, + XmNmessageString, + Label, NULL ); + + XmStringFree( Label ); + + XschEnterDialog( &XschWarningDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschErrorMessage | +| | +\------------------------------------------------------------*/ + +void XschErrorMessage( Father, Subject ) + + Widget Father; + char *Subject; +{ + XmString Label; + + autbegin(); + + if ( XschErrorDialog.WIDGET == (Widget)NULL ) + { + XschBuildDialog( Father, &XschErrorDialog ); + } + + Label = XmStringCreateLtoR( Subject, + XmSTRING_DEFAULT_CHARSET ); + + XtVaSetValues( XschErrorDialog.WIDGET, + XmNmessageString, + Label, NULL ); + + XmStringFree( Label ); + + XschEnterDialog( &XschErrorDialog ); + + autend(); +} diff --git a/alliance/src/xsch/src/XTB_dialog.h b/alliance/src/xsch/src/XTB_dialog.h new file mode 100644 index 00000000..74a4b79e --- /dev/null +++ b/alliance/src/xsch/src/XTB_dialog.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_XTB_DIALOG +# define XSCH_XTB_DIALOG + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xsch/src/XTB_icon.c b/alliance/src/xsch/src/XTB_icon.c new file mode 100644 index 00000000..4cce44f3 --- /dev/null +++ b/alliance/src/xsch/src/XTB_icon.c @@ -0,0 +1,105 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : icon.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XTB.h" +# include "XSB.h" +# include "XTB_icon.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschSetIcon | +| | +\------------------------------------------------------------*/ + +void XschSetIcon( ShellWidget, IconBits, IconWidth, IconHeight ) + + Widget ShellWidget; + char *IconBits; + int IconWidth; + int IconHeight; +{ + Pixmap IconPixmap; + + autbegin(); + + IconPixmap = XCreatePixmapFromBitmapData( XtDisplay( ShellWidget ), + RootWindowOfScreen( XtScreen( ShellWidget ) ), + IconBits, IconWidth, IconHeight, + WhitePixelOfScreen( XtScreen( ShellWidget ) ), + BlackPixelOfScreen( XtScreen( ShellWidget ) ), + DefaultDepthOfScreen( XtScreen( ShellWidget ) ) ); + XtVaSetValues( ShellWidget, + XmNiconPixmap, IconPixmap, + XmNiconic, False, + NULL ); + + autend(); +} + diff --git a/alliance/src/xsch/src/XTB_icon.h b/alliance/src/xsch/src/XTB_icon.h new file mode 100644 index 00000000..e36b5e4a --- /dev/null +++ b/alliance/src/xsch/src/XTB_icon.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : icon.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_XTB_ICON +# define XSCH_XTB_ICON + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xsch/src/XTB_menu.c b/alliance/src/xsch/src/XTB_menu.c new file mode 100644 index 00000000..815c7d4b --- /dev/null +++ b/alliance/src/xsch/src/XTB_menu.c @@ -0,0 +1,196 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XTB.h" +# include "XSB.h" +# include "XTB_menu.h" + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static char MenuBuffer [ MENU_BUFFER_SIZE ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschBuildMenus | +| | +\------------------------------------------------------------*/ + +void XschBuildMenus( Father, Menu ) + + Widget Father; + XschMenuItem *Menu; +{ + + Widget Button; + Widget SubMenu; + XmString Text; + Arg Args[ 2 ]; + int Counter; + + autbegin(); + + for ( Counter = 0; + Menu[ Counter ].LABEL != NULL; + Counter++ ) + { + if ( Menu[ Counter ].SEPARATOR == True ) + { + XtCreateManagedWidget( "Separator", + xmSeparatorWidgetClass, Father, + NULL , + 0 ); + } + + Button = XtVaCreateManagedWidget( Menu[ Counter ].LABEL, + *Menu[ Counter ].CLASS, Father, + XmNmnemonic, + Menu[ Counter ].MNEMONIC, + NULL ); + Menu[ Counter ].BUTTON = Button; + + if ( Menu[ Counter ].SHORT_KEY != NULL ) + { + XtVaSetValues( Button, + XmNaccelerator, + Menu[ Counter ].SHORT_KEY, + NULL ); + } + + if ( Menu[ Counter ].SHORT_KEY != NULL ) + { + Text = XmStringCreateSimple( Menu[ Counter ].SHORT_KEY_TEXT ); + + XtVaSetValues( Button, + XmNacceleratorText, + Text, + NULL ); + + XmStringFree( Text ); + } + + if ( Menu[ Counter ].CALLBACK != NULL ) + { + XtAddCallback( Button, + XmNactivateCallback, + Menu[ Counter ].CALLBACK, + Menu[ Counter ].CALLDATA ); + } + + if ( Menu[ Counter ].HELP == True ) + { + XtSetArg( Args[ 0 ], XmNmenuHelpWidget, Button ); + + XtSetValues( Father, Args, 1 ); + } + + if ( Menu[ Counter ].NEXT != NULL) + { + strcpy( MenuBuffer, Menu[ Counter ].LABEL ); + strcat( MenuBuffer, " Menu" ); + + SubMenu = XmCreatePulldownMenu( Father, + MenuBuffer, + Args, 0 ); + + Menu[ Counter ].MENU = SubMenu; + + if ( Menu[ Counter ].TITLE == True ) + { + Text = XmStringCreateLtoR( MenuBuffer, XmSTRING_DEFAULT_CHARSET ); + + XtVaCreateManagedWidget( "MenuTitle", + xmLabelWidgetClass, + SubMenu, + XmNlabelString, Text, + NULL ); + + XmStringFree( Text ); + + XtCreateManagedWidget( "Separator", + xmSeparatorWidgetClass, + SubMenu, + NULL, + 0 ); + } + + XtSetArg( Args[ 0 ], XmNsubMenuId, SubMenu ); + XtSetValues( Button, Args, 1 ); + + XschBuildMenus( SubMenu, Menu[ Counter ].NEXT ); + } + else Menu[ Counter ].MENU = (Widget)NULL; + } + + autend(); +} + diff --git a/alliance/src/xsch/src/XTB_menu.h b/alliance/src/xsch/src/XTB_menu.h new file mode 100644 index 00000000..eec99e45 --- /dev/null +++ b/alliance/src/xsch/src/XTB_menu.h @@ -0,0 +1,67 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_XTB_MENU +# define XSCH_XTB_MENU + +# define MENU_BUFFER_SIZE 80 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xsch/src/XTB_panel.c b/alliance/src/xsch/src/XTB_panel.c new file mode 100644 index 00000000..2337ceac --- /dev/null +++ b/alliance/src/xsch/src/XTB_panel.c @@ -0,0 +1,378 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XTB.h" +# include "XSB.h" +# include "XTB_panel.h" +# include "XTB_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static char *XschPanelButtonDisable = "xxxx"; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschBuildPanel | +| | +\------------------------------------------------------------*/ + +void XschBuildPanel( Father, Panel ) + + Widget Father; + XschPanelItem *Panel; +{ + Arg Args[13]; + XschPanelButtonItem *Button; + char *Label; + int Counter; + int Fraction; + int X1; + int Y1; + int X2; + int Y2; + Pixmap ButtonPixmap; + + autbegin(); + + Fraction = Panel->ROW * Panel->COLUMN; + + XtSetArg( Args[0], XmNshadowType, XmSHADOW_ETCHED_IN ); + XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING ); + XtSetArg( Args[2], XmNtitle , Panel->TITLE ); + + Panel->PANEL = XmCreateFormDialog( Father, Panel->TITLE, Args, 3); + + XtAddCallback( Panel->PANEL, XmNdestroyCallback, + XschDestroyDialogCallback, NULL ); + + Panel->PANEL_FORM = XtVaCreateManagedWidget( "", + xmFormWidgetClass, + Panel->PANEL, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , 100, + NULL + ); + + Panel->FRAME = XtVaCreateManagedWidget( "", + xmFrameWidgetClass, + Panel->PANEL_FORM, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + NULL + ); + + Panel->FORM = XtVaCreateManagedWidget( "", + xmFormWidgetClass, + Panel->FRAME, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , Fraction, + NULL + ); + Button = Panel->LIST; + + for ( Counter = 0; + Button[ Counter ].LABEL != NULL; + Counter++ ) + { + X1 = Button[ Counter ].X * Panel->ROW; + Y1 = Button[ Counter ].Y * Panel->COLUMN; + X2 = X1 + Button[ Counter ].DX * Panel->ROW; + Y2 = Y1 + Button[ Counter ].DY * Panel->COLUMN; + + if ( *Button[ Counter ].LABEL[0] != '\0' ) + { + Label = *Button[ Counter ].LABEL; + } + else + { + Label = XschPanelButtonDisable; + } + + if ( ( Button[ Counter ].TEXT != (char *)NULL ) && + ( Button[ Counter ].BITMAP != (char *)NULL ) ) + { + XtSetArg( Args[0] , XmNtopAttachment , XmATTACH_POSITION ); + XtSetArg( Args[1] , XmNtopPosition , Y1 ); + XtSetArg( Args[2] , XmNbottomAttachment , XmATTACH_POSITION ); + XtSetArg( Args[3] , XmNbottomPosition , Y2 ); + XtSetArg( Args[4] , XmNrightAttachment , XmATTACH_POSITION ); + XtSetArg( Args[5] , XmNrightPosition , X2 ); + XtSetArg( Args[6] , XmNleftAttachment , XmATTACH_POSITION ); + XtSetArg( Args[7] , XmNleftPosition , X1 ); + XtSetArg( Args[8] , XmNscrollBarDisplayPolicy, XmSTATIC ); + XtSetArg( Args[9] , XmNscrollHorizontal , True ); + XtSetArg( Args[10] , XmNscrollVertical , True ); + XtSetArg( Args[11] , XmNlistSizePolicy , XmCONSTANT ); + XtSetArg( Args[12] , XmNselectionPolicy , XmMULTIPLE_SELECT ); + + Button[ Counter ].BUTTON = + + XmCreateScrolledList( Panel->FORM, Button[ Counter ].TEXT, Args, 13 ); + + XtManageChild ( Button[ Counter ].BUTTON ); + } + else + if ( Button[ Counter ].TEXT != (char *)NULL ) + { + XtSetArg( Args[0] , XmNrows , 10 ); + XtSetArg( Args[1] , XmNeditable , False ); + XtSetArg( Args[2] , XmNeditMode , XmMULTI_LINE_EDIT ); + XtSetArg( Args[3] , XmNcursorPositionVisible, False ); + XtSetArg( Args[4] , XmNtopAttachment , XmATTACH_POSITION ); + XtSetArg( Args[5] , XmNtopPosition , Y1 ); + XtSetArg( Args[6] , XmNleftAttachment , XmATTACH_POSITION ); + XtSetArg( Args[7] , XmNleftPosition , X1 ); + XtSetArg( Args[8] , XmNbottomAttachment , XmATTACH_POSITION ); + XtSetArg( Args[9] , XmNbottomPosition , Y2 ); + XtSetArg( Args[10], XmNrightAttachment , XmATTACH_POSITION ); + XtSetArg( Args[11], XmNrightPosition , X2 ); + + Button[ Counter ].BUTTON = + + XmCreateScrolledText( Panel->FORM, Button[ Counter ].TEXT, Args, 12); + + XtManageChild ( Button[ Counter ].BUTTON ); + } + else + if ( Button[ Counter ].BITMAP != (char *)NULL ) + { + ButtonPixmap = XschCreatePixmap( Father, + Button[ Counter ].BITMAP, + Button[ Counter ].WIDTH, + Button[ Counter ].HEIGHT ); + Button[ Counter ].BUTTON = + + XtVaCreateManagedWidget( Label, + xmPushButtonWidgetClass, + Panel->FORM, + XmNlabelType , XmPIXMAP, + XmNlabelPixmap , ButtonPixmap, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , X1, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , X2, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , Y1, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , Y2, + NULL + ); + } + else + { + Button[ Counter ].BUTTON = + + XtVaCreateManagedWidget( Label, + xmPushButtonWidgetClass, + Panel->FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , X1, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , X2, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , Y1, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , Y2, + NULL + ); + } + + + if ( Label != XschPanelButtonDisable ) + { + if ( Button[ Counter ].FOREGROUND != NULL ) + { + XtVaSetValues ( Button[ Counter ].BUTTON , + XtVaTypedArg , XmNforeground, + XmRString , + *Button[ Counter ].FOREGROUND , + strlen ( *Button[ Counter ].FOREGROUND ) + 1, + NULL + ); + } + + if ( Button[ Counter ].BACKGROUND != NULL ) + { + XtVaSetValues ( Button[ Counter ].BUTTON , + XtVaTypedArg , XmNbackground, + XmRString , + *Button[ Counter ].BACKGROUND , + strlen ( *Button[ Counter ].BACKGROUND ) + 1, + NULL + ); + } + + if ( Button[ Counter ].CALLBACK != NULL ) + { + if ( ( Button[ Counter ].TEXT != (char *)NULL ) && + ( Button[ Counter ].BITMAP != (char *)NULL ) ) + { + XtAddCallback( Button[ Counter ].BUTTON, + XmNdefaultActionCallback, + Button[ Counter ].CALLBACK, + (XtPointer)NULL ); + + XtAddCallback( Button[ Counter ].BUTTON, + XmNmultipleSelectionCallback, + Button[ Counter ].CALLBACK, + Button[ Counter ].CALLDATA ); + + } + else + { + XtAddCallback( Button[ Counter ].BUTTON, + XmNactivateCallback, + Button[ Counter ].CALLBACK, + Button[ Counter ].CALLDATA ); + } + } + } + else + { + Button[ Counter ].BUTTON = NULL; + } + } + + XtVaSetValues( Panel->PANEL , + XmNresizable , False, + XmNx , Panel->X, + XmNy , Panel->Y, + XmNheight , Panel->HEIGHT, + XmNwidth , Panel->WIDTH, + NULL ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschEnterPanel | +| | +\------------------------------------------------------------*/ + +void XschEnterPanel( Panel ) + + XschPanelItem *Panel; +{ + autbegin(); + + XtManageChild( Panel->PANEL ); + + if ( Panel->COMPUTE == 1 ) + { + XtVaSetValues( Panel->PANEL , + XmNresizable , False, + XmNx , Panel->X, + XmNy , Panel->Y, + XmNheight , Panel->HEIGHT, + XmNwidth , Panel->WIDTH, + NULL ); + + Panel->COMPUTE = 0; + } + + Panel->MANAGED = 1; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XschExitPanel | +| | +\------------------------------------------------------------*/ + +void XschExitPanel( Panel ) + + XschPanelItem *Panel; +{ + autbegin(); + + XtUnmanageChild( Panel->PANEL ); + + Panel->MANAGED = 0; + + autend(); +} diff --git a/alliance/src/xsch/src/XTB_panel.h b/alliance/src/xsch/src/XTB_panel.h new file mode 100644 index 00000000..65f37c8d --- /dev/null +++ b/alliance/src/xsch/src/XTB_panel.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_XTB_PANEL +# define XSCH_XTB_PANEL + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xsch/src/XTB_pixmap.c b/alliance/src/xsch/src/XTB_pixmap.c new file mode 100644 index 00000000..e2f1d3d9 --- /dev/null +++ b/alliance/src/xsch/src/XTB_pixmap.c @@ -0,0 +1,106 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : Pixmap.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +# include +# include +# include "mut.h" +# include "aut.h" +# include "mlo.h" +# include "XTB.h" +# include "XSB.h" + +# include "XTB_pixmap.h" + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschCreatePixmap | +| | +\------------------------------------------------------------*/ + +Pixmap XschCreatePixmap( MainWidget, IconBits, IconWidth, IconHeight ) + + Widget MainWidget; + char *IconBits; + int IconWidth; + int IconHeight; +{ + Pixel Foreground; + Pixel Background; + Pixmap IconPixmap; + + autbegin(); + + XtVaGetValues( MainWidget, XmNforeground, &Foreground, + XmNbackground, &Background, NULL ); + + IconPixmap = XCreatePixmapFromBitmapData( XtDisplay( MainWidget ), + RootWindowOfScreen( XtScreen( MainWidget ) ), + IconBits, IconWidth, IconHeight, + Foreground, Background, + DefaultDepthOfScreen( XtScreen( MainWidget ) ) ); + + autend(); + return( IconPixmap ); +} + diff --git a/alliance/src/xsch/src/XTB_pixmap.h b/alliance/src/xsch/src/XTB_pixmap.h new file mode 100644 index 00000000..ee36f4fd --- /dev/null +++ b/alliance/src/xsch/src/XTB_pixmap.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : pixmap.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_XTB_PIXMAP +# define XSCH_XTB_PIXMAP + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xsch/src/bitmap.c b/alliance/src/xsch/src/bitmap.c new file mode 100644 index 00000000..b7a0adff --- /dev/null +++ b/alliance/src/xsch/src/bitmap.c @@ -0,0 +1,33 @@ +#define toto_width 50 +#define toto_height 50 +static unsigned char toto_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x07, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x7f, + 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0xc0, 0x03, + 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, + 0x40, 0xfc, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x84, 0x00, 0x00, 0x00, + 0x40, 0x00, 0xc0, 0x83, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x80, 0x00, + 0x00, 0x00, 0x40, 0x00, 0x40, 0x80, 0xf8, 0xff, 0x00, 0x40, 0x00, 0x40, + 0x80, 0xc8, 0x80, 0x00, 0x7f, 0x00, 0x40, 0x80, 0x08, 0x83, 0x00, 0x40, + 0x00, 0x20, 0x80, 0x0f, 0x8c, 0x00, 0x40, 0x00, 0x18, 0x00, 0x08, 0xb0, + 0x00, 0xc0, 0xff, 0x07, 0x00, 0x08, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x80, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xc0, 0x00, 0xc0, 0xff, 0x07, + 0x00, 0x08, 0xb0, 0x00, 0x40, 0x00, 0x18, 0x80, 0x0f, 0x8c, 0x00, 0x7f, + 0x00, 0x20, 0x80, 0x08, 0x83, 0x00, 0x40, 0x00, 0x40, 0x80, 0xc8, 0x80, + 0x00, 0x40, 0x00, 0x40, 0x80, 0xf8, 0xff, 0x00, 0x40, 0x00, 0xc0, 0x83, + 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x84, 0x00, 0x00, 0x00, 0x40, 0x00, + 0x40, 0xfc, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x04, 0x00, 0x00, 0x00, + 0x40, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, + 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, + 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x00, 0xc0, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00}; diff --git a/alliance/src/xsch/src/icone.c b/alliance/src/xsch/src/icone.c new file mode 100644 index 00000000..d1f97ccb --- /dev/null +++ b/alliance/src/xsch/src/icone.c @@ -0,0 +1,808 @@ +/*------------------------------------------------------------\ +| | +| Tool : 3DD | +| | +| File : d3d_graphic.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 14.10.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include +# include +# include + +# include "d3d_graphic.h" + + Display *D3dDisplay; + Window D3dWindow; + int D3dScreen; + XSizeHints D3dHint; + + GC D3dGC[ D3D_MAX_GC ]; + int D3dColors[ D3D_MAX_COLOR ]; + + Colormap D3dColorMap; + Font D3dFont; + + XEvent D3dEvent; + int D3dWindowDx; + int D3dWindowDy; + + static char *D3dColorName[ D3D_MAX_COLOR ] = + { + "Black", + "White", + "Red" + }; + +#define GSIZE 10 +#define CSIZE 2 + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +void XschAnd(x0, y0, scale, n, cflag) +{ +int gs = GSIZE * scale; +int cs = CSIZE * scale; /* Size of the circle when an io is complemented */ +int i; +int x = x0, y = y0 - gs/2; + + /* And shape alone */ + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x, y, x + gs/2, y); + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x, y + gs, x + gs/2, y + gs); + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x, y, gs, gs, 90 * 64, -180 * 64); + + if ((cflag & 1) == 0) + /* Output line : centered vertically */ + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs, y + gs/2, x + gs + cs, y + gs/2); + else + /* Output circle (for a NAND) */ + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs, y + gs/2 - cs/2, cs, cs, 0 * 64, 360 * 64); + + /* Input lines */ + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x, y + gs/2 - gs/4 * n, x, y + gs/2 + gs/4 * n); + /* Circle for inversion */ + for (i = 0; i < n; i++) { + if ((cflag & (1 << i + 1)) == 0) + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x - cs, + y + gs/4 - (n - 2) * gs/4 + i * gs/2, + x, + y + gs/4 - (n - 2) * gs/4 + i * gs/2); + else + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x - cs, + y + gs/4 - (n - 2) * gs/4 + i * gs/2 - cs/2, + cs, cs, 0 * 64, 360 * 64); + } +} + +void XschOr(x0, y0, scale, n, cflag) +{ +int gs = GSIZE * scale; +int cs = CSIZE * scale; /* Size of the circle when an io is complemented */ +int i; +int x, y, x1, y1; + + /* Or shape alone */ + x = x0; + y = y0 - gs/2; + x1 = x0 - 2*gs + (int)((double)gs * (1.0 - sqrt(3)/2)); + y1 = y0 - gs; + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x1, y1, 2*gs, 2*gs, -30 * 64, 60 * 64); + + x1 = x0 - gs + (int)((double)gs * (1.0 - sqrt(3)/2)); + y1 = y0 - 3*gs/2; + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x1, y1, 2*gs, 2*gs, -90 * 64, 60 * 64); + x1 = x0; + y1 = y0 - gs/2; + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x1, y1, x1 + (int)((double)gs * (1.0 - sqrt(3)/2)), y1); + + x1 = x0 - gs + (int)((double)gs * (1.0 - sqrt(3)/2)); + y1 = y0 - gs/2; + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x1, y1, 2*gs, 2*gs, 90 * 64, -60 * 64); + x1 = x0; + y1 = y0 + gs/2; + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x1, y1, x1 + (int)((double)gs * (1.0 - sqrt(3)/2)), y1); + + if ((cflag & 1) == 0) + /* Output line : centered vertically */ + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs, y + gs/2, x + gs + cs, y + gs/2); + else + /* Output circle */ + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs, y + gs/2 - cs/2, cs, cs, 0 * 64, 360 * 64); + + /* Input lines */ + /* Vertical bars */ + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x, y + gs/2 - gs/4 * n, + x, y); + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x, y + gs, + x, y + gs/2 + gs/4 * n); + /* Circle for complementation */ + for (i = 0; i < n; i++) { + if ((cflag & (1 << i + 1)) == 0) + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x - cs, + y + gs/4 - (n - 2) * gs/4 + i * gs/2, + x, + y + gs/4 - (n - 2) * gs/4 + i * gs/2); + else + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x - cs, + y + gs/4 - (n - 2) * gs/4 + i * gs/2 - cs/2, + cs, cs, 0 * 64, 360 * 64); + } +} + +void XschXor(x0, y0, scale, n, cflag) +{ +int gs = GSIZE * scale; +int cs = CSIZE * scale; /* Size of the circle when an io is complemented */ +int i; +int x, y, x1, y1; + + /* Or shape alone */ + x = x0; + y = y0 - gs/2; + + x1 = x0 - 2*gs + (int)((double)gs * (1.0 - sqrt(3)/2)); + y1 = y0 - gs; + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x1, y1, 2*gs, 2*gs, -30 * 64, 60 * 64); + + x1 = x0 - 2*gs + 2 * (int)((double)gs * (1.0 - sqrt(3)/2)); + y1 = y0 - gs; + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x1, y1, 2*gs, 2*gs, -30 * 64, 60 * 64); + + x1 = x0 - gs + (int)((double)gs * (1.0 - sqrt(3)/2)); + y1 = y0 - 3*gs/2; + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x1, y1, 2*gs, 2*gs, -90 * 64, 60 * 64); + + x1 = x0 - gs + (int)((double)gs * (1.0 - sqrt(3)/2)); + y1 = y0 - gs/2; + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x1, y1, 2*gs, 2*gs, 90 * 64, -60 * 64); + + if ((cflag & 1) == 0) + /* Output line : centered vertically */ + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs, y + gs/2, x + gs + cs, y + gs/2); + else + /* Output circle */ + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs, y + gs/2 - cs/2, cs, cs, 0 * 64, 360 * 64); + + /* Input lines */ + /* Vertical bars */ + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x, y + gs/2 - gs/4 * n, + x, y); + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x, y + gs, + x, y + gs/2 + gs/4 * n); + /* Circle for complementation */ + for (i = 0; i < n; i++) { + if ((cflag & (1 << i + 1)) == 0) + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x - cs, + y + gs/4 - (n - 2) * gs/4 + i * gs/2, + x, + y + gs/4 - (n - 2) * gs/4 + i * gs/2); + else + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x - cs, + y + gs/4 - (n - 2) * gs/4 + i * gs/2 - cs/2, + cs, cs, 0 * 64, 360 * 64); + } +} + +void XschBuf(x0, y0, scale, cflag) +{ +int gs = GSIZE * scale; +int is = (2 * GSIZE * scale) / 3; +int cs = CSIZE * scale; /* Size of the circle when an io is complemented */ +int i; +int x, y, x1, y1; + + x = x0; + y = y0 - gs/2; + + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x, y0 - is/2, + x, y0 + is/2); + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x, y0 - is/2, + x + is, y0); + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x, y0 + is/2, + x + is, y0); + if ((cflag & 1) == 0) + /* input line : centered vertically */ + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x - cs, y + gs/2, x, y + gs/2); + else + /* Input circle */ + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x - cs, y + gs/2, cs, cs, 0 * 64, 360 * 64); + if ((cflag & 2) == 0) + /* Output line : centered vertically */ + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + is, y + gs/2, x + is + cs, y + gs/2); + else + /* Output circle */ + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + is, y + gs/2 - cs/2, cs, cs, 0 * 64, 360 * 64); +} + +void XschMux(x0, y0, scale, ns, sflag, ni, iflag) +{ +int gs = GSIZE * scale; +int cs = CSIZE * scale; /* Size of the circle when an io is complemented */ +int i; +int x = x0, y = y0 - gs/2; + + /* Circle for inversion */ + for (i = 0; i < ns; i++) { + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs - gs/ns/2 - i * gs/ns, + y - cs - gs/4 * ni - gs/2 * (ns - i - 2), + x + gs - gs/ns/2 - i * gs/ns, + y - cs + gs/2 - gs/4 * ni); + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x - cs, + y - cs - gs/4 * ni - gs/2 * (ns - i - 2), + x + gs - gs/ns/2 - i * gs/ns, + y - cs - gs/4 * ni - gs/2 * (ns - i - 2)); + if ((sflag & (1 << i)) == 0) + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs - gs/ns/2 - i * gs/ns, + y - cs + gs/2 - gs/4 * ni, + x + gs - gs/ns/2 - i * gs/ns, + y + gs/2 - gs/4 * ni); + else + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x - cs/2 + gs - gs/ns/2 - i * gs/ns, + y - cs + gs/2 - gs/4 * ni, + cs, cs, 0 * 64, 360 * 64); + } + + if ((iflag & 1) == 0) + /* Output line : centered vertically */ + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs, y + gs/2, x + gs + cs, y + gs/2); + else + /* Output circle (for a NAND) */ + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs, y + gs/2 - cs/2, cs, cs, 0 * 64, 360 * 64); + + /* Shape */ + XDrawRectangle(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x, y + gs/2 - gs/4 * ni, gs, gs + (ni - 2) * gs/2); + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x, y + gs/2 - gs/4 * ni, x + gs, y + gs/2); + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x, y + gs/2 + gs/4 * ni, x + gs, y + gs/2); + /* Circle for inversion */ + for (i = 0; i < ni; i++) { + if ((iflag & (1 << i + 1)) == 0) + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x - cs, + y + gs/4 - (ni - 2) * gs/4 + i * gs/2, + x, + y + gs/4 - (ni - 2) * gs/4 + i * gs/2); + else + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x - cs, + y + gs/4 - (ni - 2) * gs/4 + i * gs/2 - cs/2, + cs, cs, 0 * 64, 360 * 64); + } +} + +/* pflag: presence: d q ck we set reset + iflag: inversion +*/ +void XschReg(x0, y0, scale, pflag, iflag) +{ +int gs = GSIZE * scale; +int cs = CSIZE * scale; /* Size of the circle when an io is complemented */ +int i, j; +int x = x0, y = y0 - gs/2; +int ns; + + if ((iflag & 1) == 0) + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x - cs, y + gs/2, x, y + gs/2); + else + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x - cs, y + gs/2 - cs/2, cs, cs, 0 * 64, 360 * 64); + + if ((iflag & (1 << 1)) == 0) + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs, y + gs/2, x + gs + cs, y + gs/2); + else + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs, y + gs/2 - cs/2, cs, cs, 0 * 64, 360 * 64); + + if ((iflag & (1 << 3)) == 0) + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs/2, + y + gs, + x + gs/2, + y + gs + cs); + else + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs/2 - cs/2, + y + gs, + cs, cs, 0 * 64, 360 * 64); + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs/2, + y + gs + cs, + x - cs/2, + y + gs + cs); + + /* Input lines and shape */ + XDrawRectangle(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x, y, gs, gs); + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs/4, y + gs, x + gs/2, y + 3*gs/4); + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs/2, y + 3*gs/4, x + 3*gs/4, y + gs); + + ns = ((pflag & (1 << 3)) != 0) + + ((pflag & (1 << 4)) != 0) + + ((pflag & (1 << 5)) != 0); + for (j = 0, i = 0; i < ns; i++) { + if ((pflag & (1 << 3 + i)) == 0) + j++; + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs - gs/ns/2 - i * gs/ns, + y - cs - gs/2 * (ns - i - 2) - gs/2, + x + gs - gs/ns/2 - i * gs/ns, + y - cs + gs/2 - gs/2); + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x - cs, + y - cs - gs/2 * (ns - i - 2) - gs/2, + x + gs - gs/ns/2 - i * gs/ns, + y - cs - gs/2 * (ns - i - 2) - gs/2); + if ((iflag & (1 << i + 3 + j)) == 0) + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs - gs/ns/2 - i * gs/ns, + y - cs + gs/2 - gs/2, + x + gs - gs/ns/2 - i * gs/ns, + y + gs/2 - gs/2); + else + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x - cs/2 + gs - gs/ns/2 - i * gs/ns, + y - cs + gs/2 - gs/2, + cs, cs, 0 * 64, 360 * 64); + } +} + +void XschMuxReg(x0, y0, scale, ns, sflag, ni, iflag, pflag, nflag) +{ +int gs = GSIZE * scale; +int cs = CSIZE * scale; /* Size of the circle when an io is complemented */ +int i, j, n; +int x = x0, y = y0 - gs/2; + + /* Multiplexer part */ + for (i = 0; i < ns; i++) { + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs - gs/ns/2 - i * gs/ns, + y - cs - gs/4 * ni - gs/2 * (ns - i - 2), + x + gs - gs/ns/2 - i * gs/ns, + y - cs + gs/2 - gs/4 * ni); + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x - cs, + y - cs - gs/4 * ni - gs/2 * (ns - i - 2), + x + gs - gs/ns/2 - i * gs/ns, + y - cs - gs/4 * ni - gs/2 * (ns - i - 2)); + if ((sflag & (1 << i)) == 0) + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs - gs/ns/2 - i * gs/ns, + y - cs + gs/2 - gs/4 * ni, + x + gs - gs/ns/2 - i * gs/ns, + y + gs/2 - gs/4 * ni); + else + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x - cs/2 + gs - gs/ns/2 - i * gs/ns, + y - cs + gs/2 - gs/4 * ni, + cs, cs, 0 * 64, 360 * 64); + } + + if ((iflag & 1) == 0) + /* Output line : centered vertically */ + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs, y + gs/2, x + gs + cs, y + gs/2); + else + /* Output circle (for a NAND) */ + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs, y + gs/2 - cs/2, cs, cs, 0 * 64, 360 * 64); + + /* Shape */ + XDrawRectangle(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x, y + gs/2 - gs/4 * ni, gs, gs + (ni - 2) * gs/2); + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x, y + gs/2 - gs/4 * ni, x + gs, y + gs/2); + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x, y + gs/2 + gs/4 * ni, x + gs, y + gs/2); + /* Circle for inversion */ + for (i = 0; i < ni; i++) { + if ((iflag & (1 << i + 1)) == 0) + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x - cs, + y + gs/4 - (ni - 2) * gs/4 + i * gs/2, + x, + y + gs/4 - (ni - 2) * gs/4 + i * gs/2); + else + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x - cs, + y + gs/4 - (ni - 2) * gs/4 + i * gs/2 - cs/2, + cs, cs, 0 * 64, 360 * 64); + } + + /* Register part */ + x += gs + 2*cs; + if ((nflag & 1) == 0) + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x - cs, y + gs/2, x, y + gs/2); + else + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x - cs, y + gs/2 - cs/2, cs, cs, 0 * 64, 360 * 64); + + if ((nflag & (1 << 1)) == 0) + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs, y + gs/2, x + gs + cs, y + gs/2); + else + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs, y + gs/2 - cs/2, cs, cs, 0 * 64, 360 * 64); + + if ((nflag & (1 << 3)) == 0) + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs/2, + y + gs/2, + x + gs/2, + y + 3*gs/4 - gs/4 * ni + gs + (ni - 2) * gs/2); + else { + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs/2 - cs/2, + y + gs, + cs, cs, 0 * 64, 360 * 64); + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs/2, + y + gs + cs, + x + gs/2, + y + 3*gs/4 - gs/4 * ni + gs + (ni - 2) * gs/2); + } + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs/2, + y + 3*gs/4 - gs/4 * ni + gs + (ni - 2) * gs/2, + x - 2*cs - gs - cs, /* - gs -cs is the mux contribution */ + y + 3*gs/4 - gs/4 * ni + gs + (ni - 2) * gs/2); + + /* Input lines and shape */ + XDrawRectangle(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x, y, gs, gs); + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs/4, y + gs, x + gs/2, y + 3*gs/4); + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs/2, y + 3*gs/4, x + 3*gs/4, y + gs); + + n = ((pflag & (1 << 3)) != 0) + + ((pflag & (1 << 4)) != 0) + + ((pflag & (1 << 5)) != 0); + for (j = 0, i = 0; i < n; i++) { + if ((pflag & (1 << 3 + i)) == 0) + j++; + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs - gs/n/2 - i * gs/n, + y - cs - gs/2 * (n - i - 2) - gs/2 - (ni * gs)/4 - (ns - 1) * gs/2, + x + gs - gs/n/2 - i * gs/n, + y - cs); + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs - gs/n/2 - i * gs/n, + y - cs - gs/2 * (n - i - 2) - gs/2 - (ni * gs)/4 - (ns - 1) * gs/2, + x - 2*cs - gs - cs, + y - cs - gs/2 * (n - i - 2) - gs/2 - (ni * gs)/4 - (ns - 1) * gs/2); + if ((nflag & (1 << i + 3 + j)) == 0) + XDrawLine(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x + gs - gs/n/2 - i * gs/n, + y - cs + gs/2 - gs/2, + x + gs - gs/n/2 - i * gs/n, + y); + else + XDrawArc(D3dDisplay, D3dWindow, D3dGC[ D3D_COLOR_WHITE ], + x - cs/2 + gs - gs/n/2 - i * gs/n, + y - cs + gs/2 - gs/2, + cs, cs, 0 * 64, 360 * 64); + } +} + +void D3dDisplayAllObject() +{ +#if 0 + XschAnd(100, 75, 8, 2, (1 | (1<<1))); + + XschOr(200, 200, 8, 3, (1<<2)); + + XschXor(300, 400, 8, 8, 1); + + + XschAnd(100, 325, 8, 2, (1 | (1<<1))); + XschReg(250, 325, 8, 0x3F, 0x3F); +#endif + XschMuxReg(250, 325, 5, 5, 0, 5, 0, 0x3F, 0xFF); +#if 0 + XschMux(300, 300, 8, 3, 7, 8, 0xAAA); + XschReg(500, 325, 10, 5); +#endif +} +/*------------------------------------------------------------\ +| | +| D3dGraphicClear | +| | +\------------------------------------------------------------*/ + +void D3dGraphicClear() +{ + XClearWindow( D3dDisplay, D3dWindow ); +} + +/*------------------------------------------------------------\ +| | +| D3dGraphicResize | +| | +\------------------------------------------------------------*/ + +void D3dGraphicResize() +{ + Window MyWindow; + int ForgetMe; + + XGetGeometry( D3dDisplay , D3dWindow, &MyWindow, + &ForgetMe , &ForgetMe, + &D3dWindowDx, &D3dWindowDy, + &ForgetMe , &ForgetMe ); +} + +/*------------------------------------------------------------\ +| | +| D3dGraphicLoadFonts | +| | +\------------------------------------------------------------*/ + +static void D3dGraphicLoadFonts() +{ +static char fn[] = "-adobe-courier-bold-r-normal--18-180-75-75-m-110-iso8859-1"; + + if ( ( D3dFont = XLoadFont( D3dDisplay, fn ) ) == 0 ) + { + fprintf( stderr, "Font %s not available !\n", fn); + + exit( 2 ); + } +} + +/*------------------------------------------------------------\ +| | +| D3dGraphicLoadColors | +| | +\------------------------------------------------------------*/ + +static void D3dGraphicLoadColors() +{ + XColor Define; + XColor ForgetIt; + int Counter; + + for ( Counter = 0; Counter < D3D_MAX_COLOR; Counter++ ) + { + if ( ! XAllocNamedColor( D3dDisplay, D3dColorMap, + D3dColorName[ Counter ], &Define, &ForgetIt ) ) + { + fprintf( stderr, "Color '%s' not available !\n", D3dColorName[ Counter ] ); + + exit( 1 ); + } + + D3dColors[ Counter ] = Define.pixel; + } +} + +/*------------------------------------------------------------\ +| | +| D3dGraphicSetGC | +| | +\------------------------------------------------------------*/ + +static void D3dGraphicSetGC() +{ + XGCValues ValueGC; + int Counter; + + for ( Counter = 0; Counter < D3D_MAX_COLOR; Counter++ ) + { + ValueGC.fill_style = FillSolid; + ValueGC.line_width = 2; + ValueGC.foreground = D3dColors[ Counter ]; + ValueGC.background = D3dColors[ D3D_COLOR_BLACK ]; + ValueGC.plane_mask = AllPlanes; + ValueGC.font = D3dFont; + + D3dGC[ Counter ] = XCreateGC( D3dDisplay, D3dWindow, + ( GCForeground | GCBackground | + GCFillStyle | GCPlaneMask | + GCFont | GCLineWidth), + &ValueGC ); + } +} + +/*------------------------------------------------------------\ +| | +| D3dGraphicOpen | +| | +\------------------------------------------------------------*/ + +void D3dGraphicOpen( Argc, Argv ) + + int Argc; + char **Argv; +{ + D3dDisplay = XOpenDisplay( (char *)0 ); + D3dScreen = DefaultScreen( D3dDisplay ); + D3dColorMap = DefaultColormap( D3dDisplay, D3dScreen ); + + D3dHint.x = 4; + D3dHint.y = 4; + D3dHint.width = DisplayWidth( D3dDisplay, D3dScreen ) - 20; + D3dHint.height = DisplayHeight( D3dDisplay, D3dScreen ) - 240; + D3dHint.flags = PPosition | PSize | PMinSize; + + D3dHint.min_width = 400; + D3dHint.min_height = 224; + + D3dWindowDx = D3dHint.width; + D3dWindowDy = D3dHint.height; + + D3dGraphicLoadColors(); + D3dGraphicLoadFonts(); + + D3dWindow = XCreateSimpleWindow( D3dDisplay, + DefaultRootWindow( D3dDisplay ), + D3dHint.x , D3dHint.y, + D3dHint.width, D3dHint.height, 5, + D3dColors[ D3D_COLOR_WHITE ], + D3dColors[ D3D_COLOR_BLACK ] ); + + XSetStandardProperties( D3dDisplay, D3dWindow, "D3D", "D3D", + None, Argv, Argc, &D3dHint); + D3dGraphicSetGC(); + + XSelectInput( D3dDisplay, D3dWindow, + ( ButtonPressMask | KeyPressMask | + EnterWindowMask | + ExposureMask | ButtonReleaseMask | + PointerMotionMask | Button1MotionMask ) ); + + XMapRaised( D3dDisplay, D3dWindow ); +} + +/*------------------------------------------------------------\ +| | +| D3dGraphicTreatEvent | +| | +\------------------------------------------------------------*/ + +static int D3dGraphicTreatEvent() +{ + KeySym ValueKey; + char CodeKey; + int Stop; + + Stop = 0; + + switch ( D3dEvent.type ) + { + case Expose : + D3dDisplayAllObject(); + break; + + case KeyPress : + + XLookupString( &D3dEvent.xkey, &CodeKey, 1, &ValueKey, 0 ); + + switch ( ValueKey ) + { + case XK_q : Stop = 1; + + break; + } + + D3dGraphicClear(); + D3dDisplayAllObject(); + + break; + + case EnterNotify : + + XSetInputFocus( D3dDisplay, D3dWindow, RevertToNone, CurrentTime ); + + break; + + case ButtonPress : + + XSetInputFocus( D3dDisplay, D3dWindow, RevertToNone, CurrentTime ); + + break; + +/*\ + case MotionNotify : + + fprintf( stdout, "MotionNotify\n" ); + + break; +\*/ + } + + return( ! Stop ); +} + +/*------------------------------------------------------------\ +| | +| D3dGraphicLoop | +| | +\------------------------------------------------------------*/ + +void D3dGraphicLoop() +{ + do + { + XNextEvent( D3dDisplay, &D3dEvent ); + } + while ( D3dGraphicTreatEvent() ); +} + +/*------------------------------------------------------------\ +| | +| D3dGraphicClose | +| | +\------------------------------------------------------------*/ + +void D3dGraphicClose() +{ + XDestroyWindow( D3dDisplay, D3dWindow ); + XCloseDisplay( D3dDisplay ); +} diff --git a/alliance/src/xsch/src/xsch.c b/alliance/src/xsch/src/xsch.c new file mode 100644 index 00000000..5df02bbc --- /dev/null +++ b/alliance/src/xsch/src/xsch.c @@ -0,0 +1,193 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : xsch.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "abe.h" +# include "mlo.h" +# include "scl.h" +# include "XSB.h" +# include "XSC.h" +# include "XMX.h" + +# include "xsch.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| present | +| | +\------------------------------------------------------------*/ + +void XschPresent() +{ + alliancebanner_with_contrib( "Xsch", XSCH_VERSION, + "Graphical Schematic Viewer", "2000", + ALLIANCE_VERSION, "Ludovic Jacomme", + "B.Miramond, F.Petrot, S.Picault" ); +} + +/*------------------------------------------------------------\ +| | +| main | +| | +\------------------------------------------------------------*/ + +int main( argc, argv ) + + int argc; + char *argv[]; +{ + int Debug = 0; + + int Index; + + XschPresent(); + + mbkenv(); + autenv(); + ablenv(); + bddenv(); + schenv(); + + for ( Index = 1; + Index < argc; + Index++ ) + { + if ( ! strcmp( argv[ Index ], "-l" ) ) + { + if ( ( Index + 1 ) < argc ) + { + Index = Index + 1; + XschFirstFileName = argv[ Index ]; + } + } + else + if ( ! strcmp( argv[ Index ], "-debug" ) ) + { + Debug = 1; + } + else + if ( ! strcmp( argv[ Index ], "-xor" ) ) + { + XSCH_XOR_CURSOR = XSCH_TRUE; + } + else + if ( ! strcmp( argv[ Index ], "-force" ) ) + { + XSCH_FORCE_DISPLAY = XSCH_TRUE; + } + else + if ( ! strcmp( argv[ Index ], "-install" ) ) + { + XSCH_SWITCH_COLOR_MAP = XSCH_TRUE; + } + else + if ( ! strcmp( argv[ Index ], "-v" ) ) + { + XSCH_VECTORIZED_MODE = XSCH_TRUE; + } + else + if ( ! strcmp( argv[ Index ], "-I" ) ) + { + if ( ( Index + 1 ) < argc ) + { + Index = Index + 1; + SCH_IN = namealloc( argv[ Index ] ); + + if ( strlen( SCH_IN ) <= 3 ) + { + strcpy( IN_LO, SCH_IN ); + } + } + } + else + if ( ! strcmp( argv[ Index ], "-slide" ) ) + { + for ( Index++; Index < argc; Index++ ) + { + XschFileAddSlide( argv[ Index ] ); + } + } + } + + if ( Debug ) autdebug(); + + autbegin(); + + Xschgetenv(); + XschLoadParameters(); + + XschInitializeRessources( &argc, argv ); + XschInitializeErrorMessage( Debug ); + + XtAppMainLoop( XschApplication ); + + autend(); + + return( 0 ); +} diff --git a/alliance/src/xsch/src/xsch.h b/alliance/src/xsch/src/xsch.h new file mode 100644 index 00000000..7843df82 --- /dev/null +++ b/alliance/src/xsch/src/xsch.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSCH | +| | +| File : xsch.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 01.06.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XSCH_XSCH +# define XSCH_XSCH + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XschInitializeRessources | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xvpn/Makefile.am b/alliance/src/xvpn/Makefile.am new file mode 100644 index 00000000..af437a64 --- /dev/null +++ b/alliance/src/xvpn/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src diff --git a/alliance/src/xvpn/configure.in b/alliance/src/xvpn/configure.in new file mode 100644 index 00000000..998b39d6 --- /dev/null +++ b/alliance/src/xvpn/configure.in @@ -0,0 +1,35 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(src/xvpn.c) + +XVPN_MAJOR_VERSION=1 +XVPN_MINOR_VERSION=5 +XVPN_VERSION=$XVPN_MAJOR_VERSION.$XVPN_MINOR_VERSION + +AC_SUBST(XVPN_MAJOR_VERSION) +AC_SUBST(XVPN_MINOR_VERSION) +AC_SUBST(XVPN_VERSION) + +# For automake. +VERSION=$XVPN_VERSION +PACKAGE=xvpn + +dnl Initialize automake stuff +AM_INIT_AUTOMAKE($PACKAGE, $VERSION) + +dnl Checks for programs. +AC_PROG_CC +AM_PROG_LEX +AC_PROG_YACC +AC_PROG_RANLIB +AC_PROG_MAKE_SET +AC_FIND_MOTIF + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST + +AM_ALLIANCE + +AC_OUTPUT([ +Makefile +src/Makefile +]) diff --git a/alliance/src/xvpn/etc/xvpn.par b/alliance/src/xvpn/etc/xvpn.par new file mode 100644 index 00000000..31b8403a --- /dev/null +++ b/alliance/src/xvpn/etc/xvpn.par @@ -0,0 +1,63 @@ +# /*------------------------------------------------------------\ +# | | +# | Title : Parameters File for Xvpn | +# | | +# | Date : 01.01.95 | +# | | +# \------------------------------------------------------------*/ +# /*------------------------------------------------------------\ +# | | +# | Unit | +# | | +# \------------------------------------------------------------*/ + +DEFINE XVPN_UNIT 32 + +# /*------------------------------------------------------------\ +# | | +# | Lower Grid Step in pixel by unit | +# | | +# \------------------------------------------------------------*/ + +DEFINE XVPN_LOWER_GRID_STEP 50 + +# /*------------------------------------------------------------\ +# | | +# | Xvpn Cursor Color Name | +# | | +# \------------------------------------------------------------*/ + +DEFINE XVPN_CURSOR_COLOR_NAME Black +DEFINE XVPN_BACKGROUND_COLOR_NAME Black +DEFINE XVPN_FOREGROUND_COLOR_NAME White +DEFINE XVPN_ACCEPT_COLOR_NAME magenta +DEFINE XVPN_CONNECT_COLOR_NAME pink + +# /*------------------------------------------------------------\ +# | | +# | Xvpn Cursor Size in pixel | +# | | +# \------------------------------------------------------------*/ + +DEFINE XVPN_CURSOR_SIZE 10 + +# /*------------------------------------------------------------\ +# | | +# | Xvpn Layer Color | +# | | +# \------------------------------------------------------------*/ + +TABLE XVPN_LAYER_NAME + + 0 Process Cyan Black + 1 Function sky_blue Black + 2 Wait pink Black + 3 Assign lawn_green Black + 4 Guard red Black + 5 Asg-Guard yellow Black + 6 Token magenta Black + 7 Unused_7 gray Black + 8 Unused_8 gray Black + 9 Unused_9 gray Black + +END diff --git a/alliance/src/xvpn/motif.m4 b/alliance/src/xvpn/motif.m4 new file mode 100644 index 00000000..098892a0 --- /dev/null +++ b/alliance/src/xvpn/motif.m4 @@ -0,0 +1,196 @@ +dnl +dnl +dnl AC_FIND_MOTIF : find OSF/Motif or LessTif, and provide variables +dnl to easily use them in a Makefile. +dnl +dnl Adapted from a macro by Andreas Zeller. +dnl +dnl The variables provided are : +dnl LINK_MOTIF (e.g. -L/usr/lesstif/lib -lXm) +dnl INCLUDE_MOTIF (e.g. -I/usr/lesstif/lib) +dnl MOTIF_LIBRARIES (e.g. /usr/lesstif/lib) +dnl MOTIF_INCLUDES (e.g. /usr/lesstif/include) +dnl +dnl The LINK_MOTIF and INCLUDE_MOTIF variables should be fit to put on +dnl your application's link line in your Makefile. +dnl +dnl Oleo CVS $Id: motif.m4,v 1.1 2002/03/29 17:41:15 ludo Exp $ +dnl +AC_DEFUN(AC_FIND_MOTIF, +[ + +AC_REQUIRE([AC_PATH_XTRA]) + +MOTIF_INCLUDES= +MOTIF_LIBRARIES= + +dnl AC_ARG_WITH(motif, +dnl [ --without-motif do not use Motif widgets]) +dnl Treat --without-motif like +dnl --without-motif-includes --without-motif-libraries. +dnl if test "$with_motif" = "no" +dnl then +dnl MOTIF_INCLUDES=none +dnl MOTIF_LIBRARIES=none +dnl fi + +AC_ARG_WITH(motif-includes, +[ --with-motif-includes=DIR Motif include files are in DIR], +MOTIF_INCLUDES="$withval") + +AC_ARG_WITH(motif-libraries, +[ --with-motif-libraries=DIR Motif libraries are in DIR], +MOTIF_LIBRARIES="$withval") + +AC_MSG_CHECKING(for Motif) + +# +# +# Search the include files. +# +if test "$MOTIF_INCLUDES" = ""; then +AC_CACHE_VAL(ac_cv_motif_includes, +[ +ac_motif_save_LIBS="$LIBS" +ac_motif_save_CFLAGS="$CFLAGS" +ac_motif_save_CPPFLAGS="$CPPFLAGS" +ac_motif_save_LDFLAGS="$LDFLAGS" +# +LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS" +CFLAGS="$X_CFLAGS $CFLAGS" +CPPFLAGS="$X_CFLAGS $CPPFLAGS" +LDFLAGS="$X_LIBS $LDFLAGS" +# +ac_cv_motif_includes="none" +AC_TRY_COMPILE([#include ],[int a;], +[ +# Xm/Xm.h is in the standard search path. +ac_cv_motif_includes= +], +[ +# Xm/Xm.h is not in the standard search path. +# Locate it and put its directory in `MOTIF_INCLUDES' +# +# /usr/include/Motif* are used on HP-UX (Motif). +# /usr/include/X11* are used on HP-UX (X and Athena). +# /usr/dt is used on Solaris (Motif). +# /usr/openwin is used on Solaris (X and Athena). +# Other directories are just guesses. +for dir in "$x_includes" "${prefix}/include" /usr/include /usr/local/include \ + /usr/include/Motif2.0 /usr/include/Motif1.2 /usr/include/Motif1.1 \ + /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 \ + /usr/dt/include /usr/openwin/include \ + /usr/dt/*/include /opt/*/include /usr/include/Motif* \ + "${prefix}"/*/include /usr/*/include /usr/local/*/include \ + "${prefix}"/include/* /usr/include/* /usr/local/include/*; do +if test -f "$dir/Xm/Xm.h"; then +ac_cv_motif_includes="$dir" +break +fi +done +]) +# +LIBS="$ac_motif_save_LIBS" +CFLAGS="$ac_motif_save_CFLAGS" +CPPFLAGS="$ac_motif_save_CPPFLAGS" +LDFLAGS="$ac_motif_save_LDFLAGS" +]) +MOTIF_INCLUDES="$ac_cv_motif_includes" +fi +# +# +# Now for the libraries. +# +if test "$MOTIF_LIBRARIES" = ""; then +AC_CACHE_VAL(ac_cv_motif_libraries, +[ +ac_motif_save_LIBS="$LIBS" +ac_motif_save_CFLAGS="$CFLAGS" +ac_motif_save_CPPFLAGS="$CPPFLAGS" +ac_motif_save_LDFLAGS="$LDFLAGS" +# +LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS" +CFLAGS="$X_CFLAGS $CFLAGS" +CPPFLAGS="$X_CFLAGS $CPPFLAGS" +LDFLAGS="$X_LIBS $LDFLAGS" +# +ac_cv_motif_libraries="none" +AC_TRY_LINK([#include ],[XtToolkitInitialize();], +[ +# libXm.a is in the standard search path. +ac_cv_motif_libraries= +], +[ +# libXm.a is not in the standard search path. +# Locate it and put its directory in `MOTIF_LIBRARIES' +# +# /usr/lib/Motif* are used on HP-UX (Motif). +# /usr/lib/X11* are used on HP-UX (X and Athena). +# /usr/dt is used on Solaris (Motif). +# /usr/lesstif is used on Linux (Lesstif). +# /usr/openwin is used on Solaris (X and Athena). +# Other directories are just guesses. +for dir in "$x_libraries" "${prefix}/lib" /usr/lib /usr/local/lib \ + /usr/lib/Motif2.0 /usr/lib/Motif1.2 /usr/lib/Motif1.1 \ + /usr/lib/X11R6 /usr/lib/X11R5 /usr/lib/X11R4 /usr/lib/X11 \ + /usr/dt/lib /usr/openwin/lib \ + /usr/dt/*/lib /opt/*/lib /usr/lib/Motif* \ + /usr/lesstif*/lib /usr/lib/Lesstif* \ + "${prefix}"/*/lib /usr/*/lib /usr/local/*/lib \ + "${prefix}"/lib/* /usr/lib/* /usr/local/lib/*; do +if test -d "$dir" && test "`ls $dir/libXm.* 2> /dev/null`" != ""; then +ac_cv_motif_libraries="$dir" +break +fi +done +]) +# +LIBS="$ac_motif_save_LIBS" +CFLAGS="$ac_motif_save_CFLAGS" +CPPFLAGS="$ac_motif_save_CPPFLAGS" +LDFLAGS="$ac_motif_save_LDFLAGS" +]) +# +MOTIF_LIBRARIES="$ac_cv_motif_libraries" +fi +# +# Provide an easier way to link +# +if test "$MOTIF_INCLUDES" = "none" -o "$MOTIF_LIBRARIES" = "none"; then + with_motif="no" +else + with_motif="yes" +fi + +if test "$with_motif" != "no"; then + if test "$MOTIF_LIBRARIES" = ""; then + LINK_MOTIF="-lXm" + MOTIF_LIBS="-lXm" + else + LINK_MOTIF="-L$MOTIF_LIBRARIES -lXm" + MOTIF_LIBS="-L$MOTIF_LIBRARIES -lXm" + fi + if test "$MOTIF_INCLUDES" != ""; then + INCLUDE_MOTIF="-I$MOTIF_INCLUDES" + MOTIF_CFLAGS="-I$MOTIF_INCLUDES" + fi + AC_DEFINE(HAVE_MOTIF) +else + with_motif="no" +fi +# +AC_SUBST(LINK_MOTIF) +AC_SUBST(INCLUDE_MOTIF) +# +# +# +motif_libraries_result="$MOTIF_LIBRARIES" +motif_includes_result="$MOTIF_INCLUDES" +test "$motif_libraries_result" = "" && motif_libraries_result="in default path" +test "$motif_includes_result" = "" && motif_includes_result="in default path" +test "$motif_libraries_result" = "none" && motif_libraries_result="(none)" +test "$motif_includes_result" = "none" && motif_includes_result="(none)" +AC_MSG_RESULT( + [libraries $motif_libraries_result, headers $motif_includes_result]) +])dnl + diff --git a/alliance/src/xvpn/src/LIP6bw.h b/alliance/src/xvpn/src/LIP6bw.h new file mode 100644 index 00000000..cfecd995 --- /dev/null +++ b/alliance/src/xvpn/src/LIP6bw.h @@ -0,0 +1,293 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +#define LIP6bw_width 164 +#define LIP6bw_height 150 +static char LIP6bw_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x70, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, + 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x70, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0xfc, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x01, + 0xe0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x7f, 0x00, 0xc0, 0xff, 0x7f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x3f, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xe0, + 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xe0, 0x01, 0xff, 0xff, + 0x01, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x01, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, + 0x01, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, + 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x03, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0xf0, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, + 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0xf9, 0xff, 0xff, + 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0x20, 0xc0, 0xff, 0xff, 0x07, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0x00, 0x80, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0x00, + 0x00, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, + 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x03, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0xe0, 0x00, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xe0, + 0x01, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, + 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x03, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, + 0x01, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, + 0x01, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x1f, 0xf0, 0x01, 0xff, 0xff, 0x01, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0x1f, 0xe0, 0x01, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x3f, 0xc0, + 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0x3f, 0x00, 0x80, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0x7f, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x03, + 0xf0, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x1f, 0xff, 0xff, 0x1f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0xc0, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, + 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; diff --git a/alliance/src/xvpn/src/Makefile.am b/alliance/src/xvpn/src/Makefile.am new file mode 100644 index 00000000..d5dc1f3d --- /dev/null +++ b/alliance/src/xvpn/src/Makefile.am @@ -0,0 +1,33 @@ +## Process this file with automake to produce Makefile.in + +bin_PROGRAMS = xvpn +CFLAGS = @CFLAGS@ @X_CFLAGS@ -DXVPN_VERSION=\"@XVPN_VERSION@\" \ + -DXVPN_TOOL_NAME=\"xvpn\" \ + -DXVPN_DEFAULT_PARAM_NAME=\"${ALLIANCE_TOP}/etc/xvpn.par\" \ + -DXMS_FILE_NAME=\".xvpn.cfg\" + +xvpn_LDADD = @LIBS@ @X_LIBS@ @LINK_MOTIF@ \ + -lVtl -lVvh -lVpd -lVpn -lVbl -lVbh -lVex -lAbl -lAut -lMut -lm + +INCLUDES = @INCLUDES@ @INCLUDE_MOTIF@ + +xvpn_SOURCES = \ +LIP6bw.h XME_dialog.c XME_dialog.h XME_edit.c XME_edit.h XME.h XME_menu.c \ +XME_menu.h XME_message.c XME_message.h XME_panel.c XME_panel.h XME_search.c \ +XME_search.h XME_select.c XME_select.h XMF_dialog.c XMF_dialog.h XMF_file.c \ +XMF_file.h XMF.h XMF_menu.c XMF_menu.h XMF_panel.c XMF_panel.h XMH.h XMH_help.c \ +XMH_help.h XMH_menu.c XMH_menu.h XMH_panel.c XMH_panel.h XMS_dialog.c \ +XMS_dialog.h XMS.h XMS_menu.c XMS_menu.h XMS_panel.c XMS_panel.h XMS_setup.c \ +XMS_setup.h XMT_dialog.c XMT_dialog.h XMT.h XMT_menu.c XMT_menu.h XMT_message.c \ +XMT_message.h XMT_panel.c XMT_panel.h XMT_tools.c XMT_tools.h XMV_dialog.c \ +XMV_dialog.h XMV.h XMV_map.c XMV_map.h XMV_menu.c XMV_menu.h XMV_message.c \ +XMV_message.h XMV_panel.c XMV_panel.h XMV_view.c XMV_view.h XMX_color.c \ +XMX_color.h XMX_cursor.c XMX_cursor.h XMX_dialog.c XMX_dialog.h XMX_event.c \ +XMX_event.h XMX_graphic.c XMX_graphic.h XMX_grid.c XMX_grid.h XMX.h XMX_icon.c \ +XMX_icon.h XMX_menu.c XMX_menu.h XMX_message.c XMX_message.h XMX_motif.c \ +XMX_motif.h XMX_panel.c XMX_panel.h XMX_view.c XMX_view.h XSB_error.c \ +XSB_error.h XSB.h XSB_parse.c XSB_parse.h XSB_share.c XSB_share.h XTB_cursor.c \ +XTB_cursor.h XTB_dialog.c XTB_dialog.h XTB.h XTB_icon.c XTB_icon.h XTB_menu.c \ +XTB_menu.h XTB_panel.c XTB_panel.h XTB_pixmap.c XTB_pixmap.h XVP_bound.c \ +XVP_bound.h XVP_error.c XVP_error.h XVP.h xvpn.c xvpn.h XVP_object.c \ +XVP_object.h XVP_select.c XVP_select.h diff --git a/alliance/src/xvpn/src/XME.h b/alliance/src/xvpn/src/XME.h new file mode 100644 index 00000000..114954bd --- /dev/null +++ b/alliance/src/xvpn/src/XME.h @@ -0,0 +1,88 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : XME.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_XME +# define XVPN_XME + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XvpnMenuItem XvpnEditMenu[]; + + extern XvpnPanelItem XvpnEditSearchViewPanel; + extern XvpnPanelItem XvpnEditSelectPanel; + extern XvpnPanelItem XvpnEditIdentifyPanel; + extern XvpnPanelItem XvpnEditDescriptionPanel; + + extern int XvpnEditSearchViewDefaultValues[ 5 ]; + extern int XvpnEditIdentifyDefaultValues[ 5 ]; + extern int XvpnEditDescriptionDefaultValues[ 5 ]; + extern int XvpnEditSelectDefaultValues[ 5 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnBuildEditDialog(); + + extern void XvpnEditSearch(); + extern void XvpnEditIdentify(); + extern void XvpnEditConnected(); + extern void XvpnEditUnselectAll(); + + extern void XvpnDisplayEditIdentify(); + extern void XvpnDisplayEditDescription(); + +# endif diff --git a/alliance/src/xvpn/src/XME_dialog.c b/alliance/src/xvpn/src/XME_dialog.c new file mode 100644 index 00000000..3aced73b --- /dev/null +++ b/alliance/src/xvpn/src/XME_dialog.c @@ -0,0 +1,183 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XMX.h" +# include "XTB.h" +# include "XME.h" + +# include "XME_dialog.h" +# include "XME_edit.h" +# include "XME_search.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Search Dialog | +| | +\------------------------------------------------------------*/ + + XvpnDialogItem XvpnSearchObjectDialog = + + { + "Object name", + XVPN_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackSearchObjectOk, + (XtPointer)NULL, + (void *)CallbackSearchObjectCancel, + (XtPointer)NULL + }; + + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnBuildEditDialog | +| | +\------------------------------------------------------------*/ + +void XvpnBuildEditDialog() + +{ + autbegin(); + + XvpnBuildDialog( XvpnMainWindow, &XvpnSearchObjectDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Search Callback | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback For Object | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackSearchObjectOk | +| | +\------------------------------------------------------------*/ + +void CallbackSearchObjectOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *NameSet; + + autbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &NameSet ); + + XtUnmanageChild( XvpnSearchObjectDialog.WIDGET ); + + XvpnExitDialog(); + + NameSet = XvpnPostTreatString( NameSet ); + + if ( NameSet != (char *)NULL ) + { + NameSet = namealloc( NameSet ); + + XvpnEditSearchObject( NameSet ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSearchObjectCancel | +| | +\------------------------------------------------------------*/ + +void CallbackSearchObjectCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + autbegin(); + + XtUnmanageChild( XvpnSearchObjectDialog.WIDGET ); + + XvpnExitDialog(); + + autend(); +} diff --git a/alliance/src/xvpn/src/XME_dialog.h b/alliance/src/xvpn/src/XME_dialog.h new file mode 100644 index 00000000..f1b5352d --- /dev/null +++ b/alliance/src/xvpn/src/XME_dialog.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_EDIT_DIALOG +# define XVPN_EDIT_DIALOG + + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XvpnDialogItem XvpnSearchObjectDialog; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackSearchObjectOk(); + extern void CallbackSearchObjectCancel(); + +# endif diff --git a/alliance/src/xvpn/src/XME_edit.c b/alliance/src/xvpn/src/XME_edit.c new file mode 100644 index 00000000..d1376d1c --- /dev/null +++ b/alliance/src/xvpn/src/XME_edit.c @@ -0,0 +1,629 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Edit.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XVP.h" +# include "XMV.h" +# include "XME.h" + +# include "XME_edit.h" +# include "XME_panel.h" +# include "XME_select.h" +# include "XME_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Identify Buffer | +| | +\------------------------------------------------------------*/ + + static char XvpnIdentifyMessage[ XVPN_IDENTIFY_MESSAGE_SIZE ]; + static char XvpnIdentifyBuffer [ XVPN_IDENTIFY_BUFFER_SIZE ]; + static char XvpnIdentifyVex [ XVPN_IDENTIFY_VEX_SIZE ]; + static char XvpnIdentifyAct [ XVPN_IDENTIFY_ACT_SIZE ]; + static char XvpnIdentifySig [ XVPN_IDENTIFY_SIG_SIZE ]; + + static char *XvpnScanIdentify; + static long XvpnIdentifyLength; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnAddIdentify | +| | +\------------------------------------------------------------*/ + +short XvpnAddIdentify( Obj ) + + xvpnobj_list *Obj; +{ + vpnplace_list *Place; + vpntrans_list *Trans; + vpnarc *Tra; + vpnarc *Pla; + vpnact_list *Act; + vpnsym *Sig; + vpnproc_list *Proc; + vpnfunc_list *Func; + vpndecl_list *Decl; + vpnline_list *Line; + chain_list *ScanChain; + char *ScanString; + char *VexString; + char *FileName; + long Length; + + autbegin(); + + XvpnIdentifyBuffer[0] = '\0'; + + if ( IsXvpnPlace( Obj ) ) + { + Place = (vpnplace_list *)( Obj->USER ); + + ScanString = XvpnIdentifyBuffer; + strcpy( ScanString, "PLACE\n\n LINE :" ); + ScanString += 15; + + FileName = (char *)0; + + for ( Line = Place->LINE; + Line != (vpnline_list *)0; + Line = Line->NEXT ) + { + if ( FileName != Line->NAME ) + { + FileName = Line->NAME; + sprintf( ScanString, " %s [%ld]", Line->NAME, Line->LINE ); + } + else + { + sprintf( ScanString, " [%ld]", Line->LINE ); + } + + ScanString += strlen( ScanString ); + } + + sprintf( ScanString, + "\n NAME : %s\n FATHER : %s\n TYPE : %s\n TOKEN : %d\n NUMBER IN : %d\n NUMBER OUT : %d\n LINK : %s\n FLAGS : %ld\n\n", + Place->NAME, + VPN_FATHER_TYPE[ Place->FATHER ], + VPN_PLACE_TYPE[ Place->TYPE ], + Place->TOKEN, + Place->NUMBER_IN, + Place->NUMBER_OUT, + ( Place->LINK == (vpnplace_list *)0 ) ? "none" : Place->LINK->NAME, + Place->FLAGS ); + } + else + if ( IsXvpnTrans( Obj ) ) + { + Trans = (vpntrans_list *)( Obj->USER ); + + ScanString = XvpnIdentifyAct; + strcpy( ScanString, " " ); + ScanString += 2; + + for ( Act = Trans->ACT; + Act != (vpnact_list *)0; + Act = Act->NEXT ) + { + strcpy( ScanString, "LINE :" ); + ScanString += 6; + + for ( Line = Act->LINE; + Line != (vpnline_list *)0; + Line = Line->NEXT ) + { + sprintf( ScanString, " [%ld]", Line->LINE ); + ScanString += strlen( ScanString ); + } + +/*\ + strcpy( ScanString, "\n TYPE : " ); + ScanString += 10; + + VexString = VPN_ACT_TYPE[ Act->TYPE ]; + strcpy( ScanString, VexString ); + ScanString += strlen( VexString ); +\*/ + strcpy( ScanString, "\n > " ); + ScanString += 5; + + if ( Act->VEX_ATOM != (vexexpr *)0 ) + { + VexString = XvpnVex2String( Act->VEX_ATOM ); + strcpy( ScanString, VexString ); + ScanString += strlen( VexString ); + + if ( Act->TYPE == VPN_ACT_ASG_VARIABLE ) + { + strcpy( ScanString, " := " ); + } + else + if ( Act->TYPE == VPN_ACT_ASG_DEFINE ) + { + strcpy( ScanString, " #= " ); + } + else + { + strcpy( ScanString, " <= " ); + } + + ScanString += 4; + } + + if ( Act->VEX_EXPR != (vexexpr *)0 ) + { + VexString = XvpnVex2String( Act->VEX_EXPR ); + strcpy( ScanString, VexString ); + ScanString += strlen( VexString ); + } + + strcpy( ScanString, "\n " ); + ScanString += 3; + } + + ScanString = XvpnIdentifySig; + strcpy( ScanString, " " ); + ScanString += 2; + + for ( ScanChain = Trans->WAIT_SYM; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + Sig = (vpnsym *)( ScanChain->DATA ); + sprintf( ScanString, "%s %d", Sig->NAME, Sig->INDEX ); + ScanString += strlen( ScanString ); + + strcpy( ScanString, "\n " ); + ScanString += 3; + } + + if ( Trans->VEX_GUARD != (vexexpr *)0 ) + { + VexString = XvpnVex2String( Trans->VEX_GUARD ); + strcpy( XvpnIdentifyVex, VexString ); + } + else + { + XvpnIdentifyVex[ 0 ] = '\0'; + } + + sprintf( XvpnIdentifyBuffer, + "TRANSITION :\n\n NAME : %s\n FATHER : %s\n TYPE : %s\n NUMBER IN : %d\n NUMBER OUT : %d\n FLAGS : %ld\n GUARD : %s\n ACTION : \n%s\n SYMBOLS\n%s\n\n", + Trans->NAME, + VPN_FATHER_TYPE[ Trans->FATHER ], + VPN_TRANS_TYPE[ Trans->TYPE ], + Trans->NUMBER_IN, + Trans->NUMBER_OUT, + Trans->FLAGS, + XvpnIdentifyVex, + XvpnIdentifyAct, + XvpnIdentifySig ); + } + else + if ( IsXvpnArcPlace( Obj ) ) + { + Tra = (vpnarc *)( Obj->USER ); + Trans = (vpntrans_list *)( Tra->TARGET ); + Place = (vpnplace_list *)( Tra->SOURCE ); + + sprintf( XvpnIdentifyBuffer, + "ARC : \n\n FROM PLACE : %s\n TO TRANSITION : %s\n\n", + Place->NAME, Trans->NAME); + } + else + if ( IsXvpnArcTrans( Obj ) ) + { + Pla = (vpnarc *)( Obj->USER ); + Place = (vpnplace_list *)( Pla->TARGET ); + Trans = (vpntrans_list *)( Pla->SOURCE ); + + sprintf( XvpnIdentifyBuffer, + "ARC :\n\n FROM TRANSITION : %s\n TO PLACE : %s\n\n", + Trans->NAME, Place->NAME ); + } + else + if ( IsXvpnProc( Obj ) ) + { + Proc = (vpnproc_list *)( Obj->USER ); + ScanString = XvpnIdentifySig; + strcpy( ScanString, " " ); + ScanString += 2; + + for ( ScanChain = Proc->VAR_DECL; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + Decl = (vpndecl_list *)( ScanChain->DATA ); + + strcpy( ScanString, "> LINE :" ); + ScanString += 8; + + for ( Line = Decl->LINE; + Line != (vpnline_list *)0; + Line = Line->NEXT ) + { + sprintf( ScanString, " [%ld]", Line->LINE ); + ScanString += strlen( ScanString ); + } + + strcpy( ScanString, "\n " ); + ScanString += 3; + + VexString = XvpnVex2String( Decl->VEX_ATOM ); + strcpy( ScanString, VexString ); + ScanString += strlen( ScanString ); + + strcpy( ScanString, "\n " ); + ScanString += 3; + } + + ScanString = XvpnIdentifyVex; + strcpy( ScanString, " " ); + ScanString += 2; + + for ( ScanChain = Proc->DEF_DECL; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + Decl = (vpndecl_list *)( ScanChain->DATA ); + + strcpy( ScanString, "> LINE :" ); + ScanString += 8; + + for ( Line = Decl->LINE; + Line != (vpnline_list *)0; + Line = Line->NEXT ) + { + sprintf( ScanString, " [%ld]", Line->LINE ); + ScanString += strlen( ScanString ); + } + + strcpy( ScanString, "\n " ); + ScanString += 3; + + VexString = XvpnVex2String( Decl->VEX_ATOM ); + strcpy( ScanString, VexString ); + ScanString += strlen( ScanString ); + + strcpy( ScanString, "\n " ); + ScanString += 3; + } + + ScanString = XvpnIdentifyBuffer; + strcpy( ScanString, "PROCESS\n\n LINE :" ); + ScanString += 17; + + for ( Line = Proc->LINE; + Line != (vpnline_list *)0; + Line = Line->NEXT ) + { + sprintf( ScanString, " [%ld]", Line->LINE ); + ScanString += strlen( ScanString ); + } + + sprintf( ScanString, + "\n NAME : %s\n VARIABLE : \n%s\n DEFINE : \n%s\n\n", + Proc->NAME, XvpnIdentifySig, XvpnIdentifyVex ); + + ScanString += strlen( ScanString ); + sprintf( ScanString, "\n ELABO : %s\n FIRST : %s\n\n\n", + ( Proc->ELABO != (vpntrans_list *)0 ) ? Proc->ELABO->NAME : "None", + ( Proc->FIRST != (vpntrans_list *)0 ) ? Proc->FIRST->NAME : "None" ); + } + else + if ( IsXvpnFunc( Obj ) ) + { + Func = (vpnfunc_list *)( Obj->USER ); + + ScanString = XvpnIdentifySig; + strcpy( ScanString, " " ); + ScanString += 2; + + for ( ScanChain = Func->ARG_DECL; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + Decl = (vpndecl_list *)( ScanChain->DATA ); + + strcpy( ScanString, "> LINE :" ); + ScanString += 8; + + for ( Line = Decl->LINE; + Line != (vpnline_list *)0; + Line = Line->NEXT ) + { + sprintf( ScanString, " [%ld]", Line->LINE ); + ScanString += strlen( ScanString ); + } + + strcpy( ScanString, "\n " ); + ScanString += 3; + + VexString = XvpnVex2String( Decl->VEX_ATOM ); + strcpy( ScanString, VexString ); + ScanString += strlen( ScanString ); + + strcpy( ScanString, "\n " ); + ScanString += 3; + } + + ScanString = XvpnIdentifyAct; + strcpy( ScanString, " " ); + ScanString += 2; + + for ( ScanChain = Func->VAR_DECL; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + Decl = (vpndecl_list *)( ScanChain->DATA ); + + strcpy( ScanString, "> LINE :" ); + ScanString += 8; + + for ( Line = Decl->LINE; + Line != (vpnline_list *)0; + Line = Line->NEXT ) + { + sprintf( ScanString, " [%ld]", Line->LINE ); + ScanString += strlen( ScanString ); + } + + strcpy( ScanString, "\n " ); + ScanString += 3; + + VexString = XvpnVex2String( Decl->VEX_ATOM ); + strcpy( ScanString, VexString ); + ScanString += strlen( ScanString ); + + strcpy( ScanString, "\n " ); + ScanString += 3; + } + + ScanString = XvpnIdentifyVex; + strcpy( ScanString, " " ); + ScanString += 2; + + for ( ScanChain = Func->DEF_DECL; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + Decl = (vpndecl_list *)( ScanChain->DATA ); + + strcpy( ScanString, "> LINE :" ); + ScanString += 8; + + for ( Line = Decl->LINE; + Line != (vpnline_list *)0; + Line = Line->NEXT ) + { + sprintf( ScanString, " [%ld]", Line->LINE ); + ScanString += strlen( ScanString ); + } + + strcpy( ScanString, "\n " ); + ScanString += 3; + + VexString = XvpnVex2String( Decl->VEX_ATOM ); + strcpy( ScanString, VexString ); + ScanString += strlen( ScanString ); + + strcpy( ScanString, "\n " ); + ScanString += 3; + } + + ScanString = XvpnIdentifyBuffer; + strcpy( ScanString, "FUNCTION\n\n LINE :" ); + ScanString += 18; + + for ( Line = Func->LINE; + Line != (vpnline_list *)0; + Line = Line->NEXT ) + { + sprintf( ScanString, " [%ld]", Line->LINE ); + ScanString += strlen( ScanString ); + } + + sprintf( ScanString, + "\n NAME : %s\n ARGUMENT : \n%s\n VARIABLE : \n%s\n DEFINE : \n%s\n\n", + Func->NAME, XvpnIdentifySig, XvpnIdentifyAct, XvpnIdentifyVex ); + } + + Length = strlen( XvpnIdentifyBuffer ); + + if ( ( XvpnIdentifyLength + Length ) < ( XVPN_IDENTIFY_MESSAGE_SIZE - 1 ) ) + { + strcpy( XvpnScanIdentify, XvpnIdentifyBuffer ); + + XvpnScanIdentify += Length; + XvpnIdentifyLength += Length; + + autend(); + return( XVPN_TRUE ); + } + + strcpy( XvpnScanIdentify, "#" ); + + autend(); + return( XVPN_FALSE ); +} + +/*------------------------------------------------------------\ +| | +| XvpnEditIdentify | +| | +\------------------------------------------------------------*/ + +void XvpnEditIdentify( X1, Y1 ) + + long X1; + long Y1; +{ + xvpnselect_list *Select; + + strcpy( XvpnIdentifyMessage, "No element found !" ); + + XvpnScanIdentify = XvpnIdentifyMessage; + XvpnIdentifyLength = 0; + + XvpnEditSelectPoint( X1, Y1 ); + + for ( Select = XvpnHeadSelect; + Select != (xvpnselect_list *)0; + Select = Select->NEXT ) + { + if ( ! XvpnAddIdentify( Select->OBJECT ) ) break; + } + + XvpnDelSelect(); + + XvpnDisplayEditIdentify( XvpnIdentifyMessage ); + XvpnEnterPanel( &XvpnEditIdentifyPanel ); +} + +/*------------------------------------------------------------\ +| | +| XvpnEditConnected | +| | +\------------------------------------------------------------*/ + +void XvpnEditConnected( X1, Y1 ) + + long X1; + long Y1; +{ + xvpnselect_list *Select; + xvpnobj_list *Obj; + + if ( XvpnHeadConnect != (xvpnselect_list *)0 ) + { + XvpnDelConnect(); + XvpnZoomRefresh(); + } + + XvpnEditSelectPoint( X1, Y1 ); + + XvpnDisplaySelectList( (char *)0 ); + + for ( Select = XvpnHeadSelect; + Select != (xvpnselect_list *)0; + Select = Select->NEXT ) + { + XvpnAddSelectList( Select->OBJECT ); + } + + if ( XvpnHeadSelect == (xvpnselect_list *)0 ) + { + XvpnWarningMessage( XvpnMainWindow, "No element found !" ); + } + else + { + if ( XvpnHeadSelect->NEXT != (xvpnselect_list *)0 ) + { + XvpnEnterPanel( &XvpnEditSelectPanel ); + XvpnLimitedLoop( XvpnEditSelectPanel.PANEL ); + } + else + { + XvpnAcceptObject( XvpnHeadSelect->OBJECT ); + XvpnDisplayObject( XvpnHeadSelect->OBJECT ); + } + } + + XvpnPurgeSelect(); + + for ( Select = XvpnHeadSelect; + Select != (xvpnselect_list *)0; + Select = Select->NEXT ) + { + XvpnAddConnect( Select->OBJECT ); + } + + if ( XvpnHeadSelect != (xvpnselect_list *)0 ) + { + if ( XvpnHeadSelect->NEXT == (xvpnselect_list *)0 ) + { + Obj = XvpnHeadSelect->OBJECT; + XvpnDelSelect(); + XvpnDisplayObject( Obj ); + } + else + { + XvpnDelSelect(); + XvpnZoomRefresh(); + } + } +} diff --git a/alliance/src/xvpn/src/XME_edit.h b/alliance/src/xvpn/src/XME_edit.h new file mode 100644 index 00000000..618af0b5 --- /dev/null +++ b/alliance/src/xvpn/src/XME_edit.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Edit.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_EDIT +# define XVPN_EDIT + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XVPN_IDENTIFY_BUFFER_SIZE 32768 +# define XVPN_IDENTIFY_VEX_SIZE 16384 +# define XVPN_IDENTIFY_ACT_SIZE 16384 +# define XVPN_IDENTIFY_SIG_SIZE 16384 +# define XVPN_IDENTIFY_MESSAGE_SIZE 16384 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xvpn/src/XME_menu.c b/alliance/src/xvpn/src/XME_menu.c new file mode 100644 index 00000000..434d1fae --- /dev/null +++ b/alliance/src/xvpn/src/XME_menu.c @@ -0,0 +1,228 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XTB.h" +# include "XMV.h" +# include "XME.h" +# include "XMX.h" + +# include "XME_menu.h" +# include "XME_dialog.h" +# include "XME_edit.h" +# include "XME_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XvpnMenuItem XvpnEditMenu[] = + + { + { + "Identify", + 'I', + "CtrlI", + "Ctrl I", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditIdentify, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XvpnMenuItem *)NULL + } + , + { + "Connected", + 'C', + "CtrlC", + "Ctrl C", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditConnected, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XvpnMenuItem *)NULL + } + , + { + "Search ", + 'S', + "CtrlS", + "Ctrl S", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditSearch, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XvpnMenuItem *)NULL + } + , + { + "Description ", + 'D', + "CtrlD", + "Ctrl D", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackEditDescription, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XvpnMenuItem *)NULL + } + , + { NULL } + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackEditIdentify | +| | +\------------------------------------------------------------*/ + +void CallbackEditIdentify( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnChangeEditMode( XVPN_EDIT_IDENTIFY, + XvpnPromptEditIdentify ); + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditConnected | +| | +\------------------------------------------------------------*/ + +void CallbackEditConnected( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnChangeEditMode( XVPN_EDIT_CONNECTED, + XvpnPromptEditConnected ); + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditSearch | +| | +\------------------------------------------------------------*/ + +void CallbackEditSearch( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnEnterDialog( &XvpnSearchObjectDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditDescription | +| | +\------------------------------------------------------------*/ + +void CallbackEditDescription( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnEnterPanel( &XvpnEditDescriptionPanel ); + + autend(); +} diff --git a/alliance/src/xvpn/src/XME_menu.h b/alliance/src/xvpn/src/XME_menu.h new file mode 100644 index 00000000..065e8048 --- /dev/null +++ b/alliance/src/xvpn/src/XME_menu.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_MENU +# define XVPN_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackEditIdentify(); + extern void CallbackEditDescription(); + extern void CallbackEditConnected(); + extern void CallbackEditSearch(); + +# endif diff --git a/alliance/src/xvpn/src/XME_message.c b/alliance/src/xvpn/src/XME_message.c new file mode 100644 index 00000000..ced13ce0 --- /dev/null +++ b/alliance/src/xvpn/src/XME_message.c @@ -0,0 +1,113 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Message.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XMX.h" +# include "XTB.h" +# include "XME.h" +# include "XME_edit.h" +# include "XME_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnPromptEditIdentify | +| | +\------------------------------------------------------------*/ + +void XvpnPromptEditIdentify() + +{ + autbegin(); + + XvpnDisplayMessage( XVPN_MESSAGE_MODE , "Identify" ); + XvpnDisplayMessage( XVPN_MESSAGE_INFO , "Select object" ); + XvpnDisplayMessage( XVPN_MESSAGE_PROMPT, "Enter select point" ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnPromptEditConnected | +| | +\------------------------------------------------------------*/ + +void XvpnPromptEditConnected() + +{ + autbegin(); + + XvpnDisplayMessage( XVPN_MESSAGE_MODE , "Connected" ); + XvpnDisplayMessage( XVPN_MESSAGE_INFO , "Select object" ); + XvpnDisplayMessage( XVPN_MESSAGE_PROMPT, "Enter select point" ); + + autend(); +} diff --git a/alliance/src/xvpn/src/XME_message.h b/alliance/src/xvpn/src/XME_message.h new file mode 100644 index 00000000..cd3adfd3 --- /dev/null +++ b/alliance/src/xvpn/src/XME_message.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Message.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_MESSAGE +# define XVPN_MESSAGE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnPromptEditIdentify(); + extern void XvpnPromptEditConnected(); + +# endif diff --git a/alliance/src/xvpn/src/XME_panel.c b/alliance/src/xvpn/src/XME_panel.c new file mode 100644 index 00000000..77e868e4 --- /dev/null +++ b/alliance/src/xvpn/src/XME_panel.c @@ -0,0 +1,614 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XMX.h" +# include "XTB.h" +# include "XME.h" + +# include "XME_panel.h" +# include "XME_select.h" +# include "XME_message.h" +# include "XME_dialog.h" +# include "XME_edit.h" +# include "XME_search.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Search View Panel | +| | +\------------------------------------------------------------*/ + + static char *XvpnEditSearchViewButtonName[] = + + { + "Continue", + "Abort" + }; + + static XvpnPanelButtonItem XvpnEditSearchViewButton[] = + + { + { + &XvpnEditSearchViewButtonName[0], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackEditSearchViewContinue, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnEditSearchViewButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 1, + 1, 1, + CallbackEditSearchViewAbort, + (XtPointer)NULL, + (Widget)NULL + } + , + { NULL } + }; + + XvpnPanelItem XvpnEditSearchViewPanel = + + { + "View search", + 1, + 0, + XVPN_EDIT_VIEW_SEARCH_X, + XVPN_EDIT_VIEW_SEARCH_Y, + 100, + 50, + 1, + 2, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XvpnEditSearchViewButton + }; + + int XvpnEditSearchViewDefaultValues[ 5 ] = + + { + XVPN_EDIT_VIEW_SEARCH_X, + XVPN_EDIT_VIEW_SEARCH_Y, + 100, 50, 0 + }; + +/*------------------------------------------------------------\ +| | +| Panel Identify | +| | +\------------------------------------------------------------*/ + + static char *XvpnPanelIdentifyButtonName[] = + + { + "Text", + "Close" + }; + + XvpnPanelButtonItem XvpnEditIdentifyButton[] = + + { + { + &XvpnPanelIdentifyButtonName[0], + "Nothing", NULL, 0, 0, + NULL, + NULL, + 0, 0, + 8, 9, + NULL, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnPanelIdentifyButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 3, 9, + 2, 1, + CallbackEditCloseIdentify, + (XtPointer)NULL, + (Widget)NULL + } + , + { NULL } + }; + + XvpnPanelItem XvpnEditIdentifyPanel = + + { + "Identify", + 1, + 0, + XVPN_EDIT_IDENTIFY_X, + XVPN_EDIT_IDENTIFY_Y, + 490, + 250, + 8, + 10, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XvpnEditIdentifyButton + }; + + int XvpnEditIdentifyDefaultValues[ 5 ] = + + { + XVPN_EDIT_IDENTIFY_X, + XVPN_EDIT_IDENTIFY_Y, + 490, 250, 0 + }; + +/*------------------------------------------------------------\ +| | +| Select Panel | +| | +\------------------------------------------------------------*/ + + static char *XvpnEditSelectButtonName[] = + + { + "Select", + "Accept", + "Cancel" + }; + + XvpnPanelButtonItem XvpnEditSelectButton[] = + + { + { + &XvpnEditSelectButtonName[0], + "List", + "List", 0, 0, + NULL, + NULL, + 0, 0, + 8, 9, + CallbackEditSelectList, + (XtPointer)1, + (Widget)NULL + } + , + { + &XvpnEditSelectButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 1, 9, + 2, 1, + CallbackEditSelectAccept, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnEditSelectButtonName[2], + NULL, NULL, 0, 0, + NULL, + NULL, + 5, 9, + 2, 1, + CallbackEditSelectCancel, + (XtPointer)NULL, + (Widget)NULL + } + , + { NULL } + }; + + XvpnPanelItem XvpnEditSelectPanel = + + { + "Select", + 1, + 0, + XVPN_EDIT_SELECT_X, + XVPN_EDIT_SELECT_Y, + 360, + 250, + 8, + 10, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XvpnEditSelectButton + }; + + int XvpnEditSelectDefaultValues[ 5 ] = + + { + XVPN_EDIT_SELECT_X, + XVPN_EDIT_SELECT_Y, + 360, 250, 0 + }; + +/*------------------------------------------------------------\ +| | +| Panel Description | +| | +\------------------------------------------------------------*/ + + static char *XvpnPanelDescriptionButtonName[] = + + { + "Text", + "Close" + }; + + XvpnPanelButtonItem XvpnEditDescriptionButton[] = + + { + { + &XvpnPanelDescriptionButtonName[0], + "Nothing", NULL, 0, 0, + NULL, + NULL, + 0, 0, + 8, 9, + NULL, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnPanelDescriptionButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 3, 9, + 2, 1, + CallbackEditCloseDescription, + (XtPointer)NULL, + (Widget)NULL + } + , + { NULL } + }; + + XvpnPanelItem XvpnEditDescriptionPanel = + + { + "Description", + 1, + 0, + XVPN_EDIT_DESCRIPTION_X, + XVPN_EDIT_DESCRIPTION_Y, + 360, + 250, + 8, + 10, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XvpnEditDescriptionButton + }; + + int XvpnEditDescriptionDefaultValues[ 5 ] = + + { + XVPN_EDIT_DESCRIPTION_X, + XVPN_EDIT_DESCRIPTION_Y, + 360, 250, 0 + }; + +/*------------------------------------------------------------\ +| | +| Callback For View Search | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackEditSearchViewContinue | +| | +\------------------------------------------------------------*/ + +void CallbackEditSearchViewContinue( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditSearchViewAbort | +| | +\------------------------------------------------------------*/ + +void CallbackEditSearchViewAbort( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnSearchAbort = XVPN_TRUE; + + XvpnExitDialog(); + + autbegin(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Identify | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackEditCloseIdentify | +| | +\------------------------------------------------------------*/ + +void CallbackEditCloseIdentify( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnExitPanel( &XvpnEditIdentifyPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnDisplayEditIdentify | +| | +\------------------------------------------------------------*/ + +void XvpnDisplayEditIdentify( Message ) + + char *Message; +{ + autbegin(); + + XmTextSetString( XvpnEditIdentifyButton[0].BUTTON, Message ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Select | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackEditSelectList | +| | +\------------------------------------------------------------*/ + +void CallbackEditSelectList( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmListCallbackStruct *CallData; +{ + autbegin(); + + if ( ClientData == (caddr_t)NULL ) + { + CallbackEditSelectAccept( MyWidget, (caddr_t)NULL, (caddr_t)NULL ); + } + else + { + XvpnEditSelectObject( CallData->item_position - 1 ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditSelectAccept | +| | +\------------------------------------------------------------*/ + +void CallbackEditSelectAccept( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnExitPanel( &XvpnEditSelectPanel ); + + XvpnExitDialog(); + + XvpnEditSelectAccept(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEditSelectCancel | +| | +\------------------------------------------------------------*/ + +void CallbackEditSelectCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnExitPanel( &XvpnEditSelectPanel ); + + XvpnExitDialog(); + + XvpnEditSelectCancel(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnDisplaySelectList | +| | +\------------------------------------------------------------*/ + +void XvpnDisplaySelectList( Message ) + + char *Message; +{ + XmString Label; + + autbegin(); + + if ( Message == (char *)NULL ) + { + XmListDeleteAllItems( XvpnEditSelectButton[ 0 ].BUTTON ); + } + else + { + Label = XmStringCreateSimple( Message ); + XmListAddItem( XvpnEditSelectButton[ 0 ].BUTTON , Label , NULL ); + XmStringFree( Label ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Description | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackEditCloseDescription | +| | +\------------------------------------------------------------*/ + +void CallbackEditCloseDescription( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnExitPanel( &XvpnEditDescriptionPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnDisplayEditDescription | +| | +\------------------------------------------------------------*/ + +void XvpnDisplayEditDescription( Message ) + + char *Message; +{ + autbegin(); + + if ( Message != (char *)NULL ) + { + XmTextSetString( XvpnEditDescriptionButton[0].BUTTON, Message ); + } + else + { + XmTextSetString( XvpnEditDescriptionButton[0].BUTTON, "" ); + } + + autend(); +} diff --git a/alliance/src/xvpn/src/XME_panel.h b/alliance/src/xvpn/src/XME_panel.h new file mode 100644 index 00000000..be28a6e1 --- /dev/null +++ b/alliance/src/xvpn/src/XME_panel.h @@ -0,0 +1,94 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_EDIT_PANEL +# define XVPN_EDIT_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XVPN_EDIT_VIEW_SEARCH_X 790 +# define XVPN_EDIT_VIEW_SEARCH_Y 450 + +# define XVPN_EDIT_IDENTIFY_X 250 +# define XVPN_EDIT_IDENTIFY_Y 280 + +# define XVPN_EDIT_DESCRIPTION_X 330 +# define XVPN_EDIT_DESCRIPTION_Y 280 + +# define XVPN_EDIT_SELECT_X 330 +# define XVPN_EDIT_SELECT_Y 280 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackEditSearchViewContinue(); + extern void CallbackEditSearchViewAbort(); + + extern void CallbackEditCloseIdentify(); + extern void CallbackEditCloseDescription(); + + extern void CallbackEditSelectList(); + extern void CallbackEditSelectAccept(); + extern void CallbackEditSelectCancel(); + + extern void XvpnDisplaySelectList(); + +# endif diff --git a/alliance/src/xvpn/src/XME_search.c b/alliance/src/xvpn/src/XME_search.c new file mode 100644 index 00000000..7adc0697 --- /dev/null +++ b/alliance/src/xvpn/src/XME_search.c @@ -0,0 +1,230 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Search.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XVP.h" +# include "XME.h" +# include "XMV.h" + +# include "XME_search.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + char XvpnSearchAbort; + int XvpnSearchNumber; + char *XvpnSearchString; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnEditInitializeSearch | +| | +\------------------------------------------------------------*/ + +void XvpnEditInitializeSearch( Name ) + + char *Name; +{ + char *Star; + + autbegin(); + + Star = strrchr( Name, '*' ); + + if ( Star != (char *)NULL ) + { + XvpnSearchNumber = (int)(Star - Name); + } + else + { + XvpnSearchNumber = 0; + } + + XvpnSearchString = Name; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnEditSearchCompare | +| | +\------------------------------------------------------------*/ + +int XvpnEditSearchCompare( Name ) + + char *Name; +{ + if ( Name != (char *)NULL ) + { + if ( XvpnSearchNumber ) + { + return( ! strncmp( XvpnSearchString, Name, XvpnSearchNumber ) ); + } + else + { + return( Name == XvpnSearchString ); + } + } + + return( 0 ); +} + +/*------------------------------------------------------------\ +| | +| XvpnEditSearchObject | +| | +\------------------------------------------------------------*/ + +void XvpnEditSearchObject( ObjectName ) + + char *ObjectName; +{ + xvpnobj_list *Obj; + xvpnselect_list *Search; + short Layer; + long X1; + long Y1; + + autbegin(); + + if ( XvpnHeadConnect != (xvpnselect_list *)NULL ) + { + XvpnDelConnect(); + XvpnZoomRefresh(); + } + + XvpnEditInitializeSearch( ObjectName ); + + for ( Layer = 0; Layer < XVPN_MAX_LAYER; Layer++ ) + { + if ( XVPN_ACTIVE_LAYER_TABLE[ Layer ] == 0 ) continue; + + for ( Obj = XvpnFigure->TEXT[ Layer ]; + Obj != (xvpnobj_list *)NULL; + Obj = Obj->NEXT ) + { + if ( ! IsXvpnSelect( Obj ) ) + { + if ( XvpnEditSearchCompare( Obj->NAME ) ) + { + XvpnAddSelect( Obj ); + } + } + } + } + + for ( Search = XvpnHeadSelect; + Search != (xvpnselect_list *)NULL; + Search = Search->NEXT ) + { + XvpnUnselectObject( Search->OBJECT ); + } + + if ( XvpnHeadSelect == (xvpnselect_list *)NULL ) + { + XvpnWarningMessage( XvpnMainWindow, "No object found !" ); + } + else + { + XvpnSearchAbort = XVPN_FALSE; + + for ( Search = XvpnHeadSelect; + Search != (xvpnselect_list *)NULL; + Search = Search->NEXT ) + { + Obj = Search->OBJECT; + + XvpnAddConnect( Obj ); + + if ( XvpnSearchAbort ) continue; + + X1 = ( Obj->X + ( Obj->DX >> 1 ) ) / XVPN_UNIT; + Y1 = ( Obj->Y + ( Obj->DY >> 1 ) ) / XVPN_UNIT; + + XvpnZoomCenter( X1, Y1 ); + + if ( Search->NEXT != (xvpnselect_list *)NULL ) + { + XvpnEnterPanel( &XvpnEditSearchViewPanel ); + XvpnLimitedLoop( XvpnEditSearchViewPanel.PANEL ); + } + } + + XvpnDelSelect(); + + XvpnExitPanel( &XvpnEditSearchViewPanel ); + } + + autend(); +} diff --git a/alliance/src/xvpn/src/XME_search.h b/alliance/src/xvpn/src/XME_search.h new file mode 100644 index 00000000..069538d7 --- /dev/null +++ b/alliance/src/xvpn/src/XME_search.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Search.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_SEARCH +# define XVPN_SEARCH + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char XvpnSearchAbort; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnEditSearchObject(); + +# endif diff --git a/alliance/src/xvpn/src/XME_select.c b/alliance/src/xvpn/src/XME_select.c new file mode 100644 index 00000000..b70fd921 --- /dev/null +++ b/alliance/src/xvpn/src/XME_select.c @@ -0,0 +1,389 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Edit.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XVP.h" +# include "XME.h" +# include "XMV.h" + +# include "XME_select.h" +# include "XME_panel.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Select Buffer | +| | +\------------------------------------------------------------*/ + + static char XvpnSelectBuffer [ XVPN_SELECT_BUFFER_SIZE ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnAddSelectList | +| | +\------------------------------------------------------------*/ + +void XvpnAddSelectList( Obj ) + + xvpnobj_list *Obj; +{ + autbegin(); + + XvpnSelectBuffer[0] = '\0'; + +/*\ + if ( IsXvpnPlace( Obj ) ) + { + Place = (vpnplace_list *)( Obj->USER ); + + sprintf( XvpnSelectBuffer, " PLACE %s", Place->NAME ); + } + else + if ( IsXvpnTrans( Obj ) ) + { + Trans = (vpntrans_list *)( Obj->USER ); + + sprintf( XvpnSelectBuffer, " TRANSITION %s", Trans->NAME ); + } + else + if ( IsXvpnArcPlace( Obj ) ) + { + Tra = (vpnarc_list *)( Obj->USER ); + Trans = (vpntrans_list *)( Tra->TARGET ); + Place = (vpnplace_list *)( VPN_ARC_PLUS( Tra )->USER ); + + sprintf( XvpnSelectBuffer, " ARC FROM PLACE %s TO TRANSITION %s", + Place->NAME, Trans->NAME ); + } + else + if ( IsXvpnArcTrans( Obj ) ) + { + Pla = (vpnarc_list *)( Obj->USER ); + Place = (vpnplace_list *)( Pla->TARGET ); + Trans = (vpntrans_list *)( VPN_ARC_PLUS( Pla )->USER ); + + sprintf( XvpnSelectBuffer, " ARC FROM TRANSITION %s TO PLACE %s", + Trans->NAME, Place->NAME ); + } +\*/ + + XvpnDisplaySelectList( XvpnSelectBuffer ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnEditSelectObject | +| | +\------------------------------------------------------------*/ + +void XvpnEditSelectObject( Number ) + + int Number; +{ + xvpnselect_list *Select; + int Counter; + + autbegin(); + + Select = XvpnHeadSelect; + + for ( Counter = 0; Counter < Number; Counter++ ) + { + Select = Select->NEXT; + } + + if ( IsXvpnAccept( Select->OBJECT ) ) + { + XvpnRejectObject( Select->OBJECT ); + } + else + { + XvpnAcceptObject( Select->OBJECT ); + } + + XvpnDisplayObject( Select->OBJECT ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnEditSelectAccept | +| | +\------------------------------------------------------------*/ + +void XvpnEditSelectAccept() +{ + autbegin(); + + XvpnPurgeSelect(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnEditSelectCancel | +| | +\------------------------------------------------------------*/ + +void XvpnEditSelectCancel() +{ + autbegin(); + + XvpnEditUnselectAll(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Select Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnEditUnselectAll | +| | +\------------------------------------------------------------*/ + +void XvpnEditUnselectAll() +{ + xvpnobj_list *Obj; + + autbegin(); + + if ( XvpnHeadSelect != (xvpnselect_list *)NULL ) + { + if ( XvpnHeadSelect->NEXT == (xvpnselect_list *)NULL ) + { + Obj = XvpnHeadSelect->OBJECT; + XvpnDelSelect(); + XvpnDisplayObject( Obj ); + } + else + { + XvpnDelSelect(); + XvpnZoomRefresh(); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnEditObjectNearPoint | +| | +\------------------------------------------------------------*/ + +char XvpnEditObjectNearPoint( Obj, X1, Y1 ) + + xvpnobj_list *Obj; + long X1; + long Y1; +{ + short Type; + long X1r; + long Y1r; + long X2r; + long Y2r; + float VectorX; + float VectorY; + float LineX; + float LineY; + float Norm; + float Distance; + + Type = GetXvpnObjectType( Obj ); + + if ( ( Obj->X <= X1 ) && + ( Obj->Y <= Y1 ) && + ( Obj->X + Obj->DX >= X1 ) && + ( Obj->Y + Obj->DY >= Y1 ) ) + { + if ( ( Type == XVPN_OBJECT_LINE ) || + ( Type == XVPN_OBJECT_ARROW ) ) + { + if ( ( Obj->DX == 0 ) && + ( Obj->DY == 0 ) ) + { + if ( ( Obj->X == X1 ) && + ( Obj->Y == Y1 ) ) + { + return( XVPN_TRUE ); + } + } + else + { + if ( IsXvpnLineLeft( Obj ) ) + { + X1r = Obj->X + Obj->DX; + X2r = Obj->X; + } + else + { + X1r = Obj->X; + X2r = Obj->X + Obj->DX; + } + + if ( IsXvpnLineDown( Obj ) ) + { + Y1r = Obj->Y + Obj->DY; + Y2r = Obj->Y; + } + else + { + Y1r = Obj->Y; + Y2r = Obj->Y + Obj->DY; + } + + LineX = (float)( X2r - X1r ); + LineY = (float)( Y2r - Y1r ); + Norm = sqrt( ( LineX * LineX ) + ( LineY * LineY ) ); + LineX /= Norm; + LineY /= Norm; + + VectorX = (float)( X2r - X1 ); + VectorY = (float)( Y2r - Y1 ); + + Distance = fabs( ( VectorX * LineY ) - ( VectorY * LineX ) ); + + if ( Distance < (float) XVPN_UNIT ) + { + return( XVPN_TRUE ); + } + } + } + else + { + return( XVPN_TRUE ); + } + } + + return( XVPN_FALSE ); +} + +/*------------------------------------------------------------\ +| | +| XvpnEditSelectPoint | +| | +\------------------------------------------------------------*/ + +void XvpnEditSelectPoint( X1, Y1 ) + + long X1; + long Y1; +{ + xvpnobj_list *Obj; + xvpnselect_list *Select; + int Layer; + + if ( XvpnFigure == (xvpnfig_list *)0 ) return; + + X1 = X1 * XVPN_UNIT; + Y1 = Y1 * XVPN_UNIT; + + for ( Layer = 0; Layer < XVPN_MAX_LAYER; Layer++ ) + { + if ( XVPN_ACTIVE_LAYER_TABLE[ Layer ] == 0 ) continue; + + for ( Obj = XvpnFigure->OBJECT[ Layer ]; + Obj != (xvpnobj_list *)NULL; + Obj = Obj->NEXT ) + { + if ( XVPN_ACTIVE_LAYER_TABLE[ Obj->LAYER ] == 0 ) continue; + + if ( ! IsXvpnSelect( Obj ) ) + { + if ( XvpnEditObjectNearPoint( Obj, X1, Y1 ) ) + { + XvpnAddSelect( Obj ); + } + } + } + } + + for ( Select = XvpnHeadSelect; + Select != (xvpnselect_list *)NULL; + Select = Select->NEXT ) + { + XvpnUnselectObject( Select->OBJECT ); + } +} diff --git a/alliance/src/xvpn/src/XME_select.h b/alliance/src/xvpn/src/XME_select.h new file mode 100644 index 00000000..fd876f98 --- /dev/null +++ b/alliance/src/xvpn/src/XME_select.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Select.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_SELECT +# define XVPN_SELECT + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XVPN_SELECT_BUFFER_SIZE 256 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnEditSelectObject(); + extern void XvpnEditSelectPoint(); + extern void XvpnAddSelectList(); + extern void XvpnEditSelectAccept(); + extern void XvpnEditSelectCancel(); + +# endif diff --git a/alliance/src/xvpn/src/XMF.h b/alliance/src/xvpn/src/XMF.h new file mode 100644 index 00000000..b691d2d9 --- /dev/null +++ b/alliance/src/xvpn/src/XMF.h @@ -0,0 +1,80 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : XMF.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_XMF +# define XVPN_XMF + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XvpnMenuItem XvpnFileMenu []; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnBuildFileDialog(); + extern void XvpnFileOpen(); + + extern void XvpnFileAddSlide(); + extern void XvpnFileNextSlide(); + extern void XvpnFilePrevSlide(); + +# endif diff --git a/alliance/src/xvpn/src/XMF_dialog.c b/alliance/src/xvpn/src/XMF_dialog.c new file mode 100644 index 00000000..06eedd0f --- /dev/null +++ b/alliance/src/xvpn/src/XMF_dialog.c @@ -0,0 +1,234 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XMX.h" +# include "XTB.h" +# include "XMF.h" + +# include "XMF_dialog.h" +# include "XMF_file.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| File Dialog | +| | +\------------------------------------------------------------*/ + + XvpnDialogItem XvpnFileOpenDialog = + + { + "Open File", + XVPN_DIALOG_FILE, + (Widget)NULL, + (void *)CallbackFileOpenOk, + (XtPointer)NULL, + (void *)CallbackFileOpenCancel, + (XtPointer)NULL + }; + + XvpnDialogItem XvpnFileQuitDialog = + + { + "Do you really want to quit Xvpn ?", + XVPN_DIALOG_WARNING, + (Widget)NULL, + (void *)CallbackFileQuitOk, + (XtPointer)NULL, + (void *)CallbackFileQuitCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnBuildFileDialog | +| | +\------------------------------------------------------------*/ + +void XvpnBuildFileDialog() + +{ + autbegin(); + + XvpnBuildDialog( XvpnMainWindow, &XvpnFileOpenDialog ); + XvpnBuildDialog( XvpnMainWindow, &XvpnFileQuitDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileQuitOk | +| | +\------------------------------------------------------------*/ + +void CallbackFileQuitOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnExitDialog(); + + XtCloseDisplay( XtDisplay( XtParent( MyWidget ) ) ); + XvpnExitErrorMessage( 0 ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileQuitCancel | +| | +\------------------------------------------------------------*/ + +void CallbackFileQuitCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileOpenOk | +| | +\------------------------------------------------------------*/ + +void CallbackFileOpenOk( MyWidget, ClientData, FileStruct ) + + Widget MyWidget; + caddr_t ClientData; + XmFileSelectionBoxCallbackStruct *FileStruct; +{ + char *FileName; + + autbegin(); + + XtUnmanageChild( XvpnFileOpenDialog.WIDGET ); + + XvpnExitDialog(); + + if ( FileStruct->value != NULL ) + { + XmStringGetLtoR( FileStruct->value, + XmSTRING_DEFAULT_CHARSET, + &FileName + ); + + FileName = XvpnPostTreatString( FileName ); + + if ( FileName != (char *)NULL ) + { + XvpnFileOpen( FileName ); + + XvpnChangeEditMode( XVPN_EDIT_IDENTIFY, + XvpnPromptEditIdentify ); + } + else + { + XvpnErrorMessage( XvpnMainWindow, "Unable to load this file !" ); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileOpenCancel | +| | +\------------------------------------------------------------*/ + +void CallbackFileOpenCancel( MyWidget, ClientData, FileStruct ) + + Widget MyWidget; + caddr_t ClientData; + XmFileSelectionBoxCallbackStruct *FileStruct; +{ + autbegin(); + + XtUnmanageChild( XvpnFileOpenDialog.WIDGET ); + + XvpnExitDialog(); + + autend(); +} diff --git a/alliance/src/xvpn/src/XMF_dialog.h b/alliance/src/xvpn/src/XMF_dialog.h new file mode 100644 index 00000000..c4c0bfad --- /dev/null +++ b/alliance/src/xvpn/src/XMF_dialog.h @@ -0,0 +1,81 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_FILE_DIALOG +# define XVPN_FILE_DIALOG + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XvpnDialogItem XvpnFileOpenDialog; + extern XvpnDialogItem XvpnFileQuitDialog; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackFileQuitOk(); + extern void CallbackFileQuitCancel(); + extern void CallbackFileOpenOk(); + extern void CallbackFileOpenCancel(); + + extern void XvpnExitErrorMessage(); + +# endif diff --git a/alliance/src/xvpn/src/XMF_file.c b/alliance/src/xvpn/src/XMF_file.c new file mode 100644 index 00000000..84535428 --- /dev/null +++ b/alliance/src/xvpn/src/XMF_file.c @@ -0,0 +1,341 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : File.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" +# include "vtl.h" +# include "XSB.h" +# include "XVP.h" +# include "XMX.h" +# include "XTB.h" +# include "XMF.h" +# include "XME.h" +# include "XMT.h" +# include "XMV.h" + +# include "XMF_file.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static xvpnslide_list *XVPN_HEAD_SLIDE = (xvpnslide_list *)0; + static xvpnslide_list *XVPN_LAST_SLIDE = (xvpnslide_list *)0; + static xvpnslide_list *XVPN_CURRENT_SLIDE = (xvpnslide_list *)0; + + char XvpnFileFilter[ 10 ] = "*."; + char XvpnFileExtention[ 10 ] = "."; + + char XvpnFileBuffer[ 128 ]; + char XvpnDirectoryBuffer[ 512 ]; + + char *XVPN_WORK_LIB = (char *)NULL; + + char XvpnFileDescription[ 128 ]; + char *XvpnDescriptionBuffer = (char *)NULL; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnLoadDescription | +| | +\------------------------------------------------------------*/ + +void XvpnLoadDescription( FigureName ) + + char *FigureName; +{ + FILE *FileDesc; + long Length; + long Index; + long Line; + int Data; + + if ( XvpnDescriptionBuffer != (char *)NULL ) + { + autfreeblock( XvpnDescriptionBuffer ); + XvpnDescriptionBuffer = (char *)NULL; + } + + FileDesc = mbkfopen( FigureName, "vhdl", "r" ); + + if ( FileDesc != (FILE *)NULL ) + { + Line = 1; + Length = 1; + + while ( ( Data = fgetc( FileDesc ) ) != EOF ) + { + Length++; + if ( (char)Data == '\n' ) Line++; + } + + Length += ( Line * 7 ); + + XvpnDescriptionBuffer = (char *)autallocblock( Length ); + + fseek( FileDesc, 0L, 0 ); + + strcpy( XvpnDescriptionBuffer, "1 " ); + Index = 7; + Line = 1; + + while ( ( ( Data = fgetc( FileDesc ) ) != EOF ) && + ( Index < Length ) ) + { + XvpnDescriptionBuffer[ Index++ ] = (char)Data; + + if ( (char)Data == '\n' ) + { + Line++; + sprintf( &XvpnDescriptionBuffer[ Index ], "%-6ld ", Line ); + Index += 7; + } + } + + XvpnDescriptionBuffer[ Index ] = '\0'; + + fclose( FileDesc ); + } +} + +/*------------------------------------------------------------\ +| | +| XvpnFileOpen | +| | +\------------------------------------------------------------*/ + +void XvpnFileOpen( FileName ) + + char *FileName; +{ + int Index; + char *SWAP_WORK_LIB = WORK_LIB; + + autbegin(); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_WATCH_CURSOR ); + XvpnUndisplayCursor(); + + XvpnDelConnect(); + XvpnDelFigure(); + + XvpnRecomputeBound = XVPN_TRUE; + + if ( XVPN_WORK_LIB == (char *)NULL ) + { + XVPN_WORK_LIB = WORK_LIB; + } + + if ( XvpnFileFilter[2] == '\0' ) + { + strcat( XvpnFileFilter, VPN_IN ); + strcat( XvpnFileExtention, VPN_IN ); + } + + for ( Index = strlen( FileName ); Index >= 0; Index-- ) + { + if ( FileName[ Index ] == '/' ) break; + } + + if ( Index >= 0 ) + { + strcpy( XvpnDirectoryBuffer, FileName ); + strcpy( XvpnFileBuffer, FileName + Index + 1); + + XvpnDirectoryBuffer[ Index + 1 ] = '\0'; + + WORK_LIB = XvpnDirectoryBuffer; + } + else + { + strcpy( XvpnFileBuffer, FileName ); + + WORK_LIB = XVPN_WORK_LIB; + } + + Index = strlen( XvpnFileBuffer ) - strlen( XvpnFileExtention ); + + if ( Index >= 0 ) + { + if ( ! strcmp( XvpnFileBuffer + Index, XvpnFileExtention ) ) + { + XvpnFileBuffer[ Index ] = '\0'; + } + } + + XvpnLoadFigure( XvpnFileBuffer ); + + if ( XvpnFigure != (xvpnfig_list *)NULL ) + { + XvpnChangeTopLevelTitle( XvpnFileBuffer ); + + XvpnLoadDescription( XvpnFileBuffer ); + + XvpnDisplayEditDescription( XvpnDescriptionBuffer ); + } + else + { + XvpnChangeTopLevelTitle( (char *)NULL ); + + XvpnDisplayEditDescription( (char *)NULL ); + } + + XvpnDisplayToolsMessage(); + + XvpnInitializeZoom(); + XvpnDisplayFigure( 0, 0, XvpnGraphicDx, XvpnGraphicDy ); + + XvpnRefreshGraphicWindow( 0, 0, + XvpnGraphicDx, XvpnGraphicDy ); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_NORMAL_CURSOR ); + XvpnDisplayCursor(); + + WORK_LIB = SWAP_WORK_LIB; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnFileAddSlide | +| | +\------------------------------------------------------------*/ + +void XvpnFileAddSlide( FileName ) + + char *FileName; +{ + xvpnslide_list *Slide; + + Slide = (xvpnslide_list *)autallocheap( sizeof( xvpnslide_list ) ); + + if ( XVPN_HEAD_SLIDE == (xvpnslide_list *)0 ) + { + XVPN_HEAD_SLIDE = Slide; + XVPN_LAST_SLIDE = Slide; + } + else + { + XVPN_LAST_SLIDE->NEXT = Slide; + Slide->PREV = XVPN_LAST_SLIDE; + + XVPN_LAST_SLIDE = Slide; + } + + Slide->NAME = mbkstrdup( FileName ); +} + +/*------------------------------------------------------------\ +| | +| XvpnFileNextSlide | +| | +\------------------------------------------------------------*/ + +void XvpnFileNextSlide() +{ + if ( XVPN_HEAD_SLIDE == (xvpnslide_list *)0 ) return; + + if ( ( XVPN_CURRENT_SLIDE == (xvpnslide_list *)0 ) || + ( XVPN_CURRENT_SLIDE->NEXT == (xvpnslide_list *)0 ) ) + { + XVPN_CURRENT_SLIDE = XVPN_HEAD_SLIDE; + } + else + { + XVPN_CURRENT_SLIDE = XVPN_CURRENT_SLIDE->NEXT; + } + + XvpnFileOpen( XVPN_CURRENT_SLIDE->NAME ); +} + +/*------------------------------------------------------------\ +| | +| XvpnFilePrevSlide | +| | +\------------------------------------------------------------*/ + +void XvpnFilePrevSlide() +{ + if ( XVPN_HEAD_SLIDE == (xvpnslide_list *)0 ) return; + + if ( ( XVPN_CURRENT_SLIDE == (xvpnslide_list *)0 ) || + ( XVPN_CURRENT_SLIDE->PREV == (xvpnslide_list *)0 ) ) + { + XVPN_CURRENT_SLIDE = XVPN_LAST_SLIDE; + } + else + { + XVPN_CURRENT_SLIDE = XVPN_CURRENT_SLIDE->PREV; + } + + XvpnFileOpen( XVPN_CURRENT_SLIDE->NAME ); +} diff --git a/alliance/src/xvpn/src/XMF_file.h b/alliance/src/xvpn/src/XMF_file.h new file mode 100644 index 00000000..6e703e07 --- /dev/null +++ b/alliance/src/xvpn/src/XMF_file.h @@ -0,0 +1,83 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : File.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_FILE +# define XVPN_FILE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct xvpnslide_list + { + struct xvpnslide_list *NEXT; + struct xvpnslide_list *PREV; + char *NAME; + + } xvpnslide_list; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char XvpnFileFilter[ 10 ]; + extern char XvpnFileExtention[ 10 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xvpn/src/XMF_menu.c b/alliance/src/xvpn/src/XMF_menu.c new file mode 100644 index 00000000..9a45ec57 --- /dev/null +++ b/alliance/src/xvpn/src/XMF_menu.c @@ -0,0 +1,190 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" +# include "vtl.h" +# include "XSB.h" +# include "XVP.h" +# include "XMX.h" +# include "XTB.h" +# include "XMF.h" + +# include "XMF_menu.h" +# include "XMF_dialog.h" +# include "XMF_file.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static XvpnFirstFileOpen = 1; + +/*------------------------------------------------------------\ +| | +| Menu | +| | +\------------------------------------------------------------*/ + + XvpnMenuItem XvpnFileMenu[] = + + { + { + "Open", + 'O', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackFileOpen, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XvpnMenuItem *)NULL + } + , + { + "Quit ", + 'Q', + "CtrlQ", + "Ctrl Q", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackFileQuit, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XvpnMenuItem *)NULL + } + , + { NULL } + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackFileOpen | +| | +\------------------------------------------------------------*/ + +void CallbackFileOpen( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + XmString Filter; + + autbegin(); + + if ( XvpnFirstFileOpen ) + { + XvpnFirstFileOpen = 0; + + if ( XvpnFileFilter[2] == '\0' ) + { + strcat( XvpnFileFilter, VPN_IN ); + strcat( XvpnFileExtention, VPN_IN ); + } + + Filter = XmStringCreateSimple( XvpnFileFilter ); + + XtVaSetValues( XvpnFileOpenDialog.WIDGET, + XmNpattern, Filter, NULL); + + XmStringFree( Filter ); + } + + XvpnEnterDialog( &XvpnFileOpenDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackFileQuit | +| | +\------------------------------------------------------------*/ + +void CallbackFileQuit( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnEnterDialog( &XvpnFileQuitDialog ); + + autend(); +} diff --git a/alliance/src/xvpn/src/XMF_menu.h b/alliance/src/xvpn/src/XMF_menu.h new file mode 100644 index 00000000..9614685c --- /dev/null +++ b/alliance/src/xvpn/src/XMF_menu.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_FILE_MENU +# define XVPN_FILE_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackFileOpen(); + extern void CallbackFileQuit(); + +# endif diff --git a/alliance/src/xvpn/src/XMF_panel.c b/alliance/src/xvpn/src/XMF_panel.c new file mode 100644 index 00000000..20a1e881 --- /dev/null +++ b/alliance/src/xvpn/src/XMF_panel.c @@ -0,0 +1,88 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XMX.h" +# include "XTB.h" +# include "XMF.h" + +# include "XMF_panel.h" +# include "XMF_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ diff --git a/alliance/src/xvpn/src/XMF_panel.h b/alliance/src/xvpn/src/XMF_panel.h new file mode 100644 index 00000000..53647218 --- /dev/null +++ b/alliance/src/xvpn/src/XMF_panel.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_FILE_PANEL +# define XVPN_FILE_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xvpn/src/XMH.h b/alliance/src/xvpn/src/XMH.h new file mode 100644 index 00000000..07a189b5 --- /dev/null +++ b/alliance/src/xvpn/src/XMH.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : XMH101.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_XMH +# define XVPN_XMH + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XvpnMenuItem XvpnHelpMenu[]; + extern XvpnPanelItem XvpnHelpPresentPanel; + + extern int XvpnHelpPresentDefaultValues[5]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnBuildPresentPanel(); + extern void XvpnEnterPresentPanel(); + +# endif diff --git a/alliance/src/xvpn/src/XMH_help.c b/alliance/src/xvpn/src/XMH_help.c new file mode 100644 index 00000000..0a1c7511 --- /dev/null +++ b/alliance/src/xvpn/src/XMH_help.c @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Help.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XTB.h" +# include "XSB.h" +# include "XMH.h" +# include "XMX.h" + +# include "XMH_help.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ diff --git a/alliance/src/xvpn/src/XMH_help.h b/alliance/src/xvpn/src/XMH_help.h new file mode 100644 index 00000000..5c936622 --- /dev/null +++ b/alliance/src/xvpn/src/XMH_help.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Help.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_HELP +# define XVPN_HELP + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xvpn/src/XMH_menu.c b/alliance/src/xvpn/src/XMH_menu.c new file mode 100644 index 00000000..bd57f672 --- /dev/null +++ b/alliance/src/xvpn/src/XMH_menu.c @@ -0,0 +1,124 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XTB.h" +# include "XSB.h" +# include "XMH.h" +# include "XMX.h" + +# include "XMH_menu.h" +# include "XMH_panel.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Help Menu | +| | +\------------------------------------------------------------*/ + + XvpnMenuItem XvpnHelpMenu[] = + + { + { + "About Xvpn", + 'G', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackHelpAbout, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XvpnMenuItem *)NULL + } + , + { NULL } + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackHelpAbout | +| | +\------------------------------------------------------------*/ + +void CallbackHelpAbout( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnEnterPresentPanel(); + + autend(); +} diff --git a/alliance/src/xvpn/src/XMH_menu.h b/alliance/src/xvpn/src/XMH_menu.h new file mode 100644 index 00000000..66891620 --- /dev/null +++ b/alliance/src/xvpn/src/XMH_menu.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_HELP_MENU +# define XVPN_HELP_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackHelpAbout(); + +# endif diff --git a/alliance/src/xvpn/src/XMH_panel.c b/alliance/src/xvpn/src/XMH_panel.c new file mode 100644 index 00000000..9d79e4d5 --- /dev/null +++ b/alliance/src/xvpn/src/XMH_panel.c @@ -0,0 +1,320 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XMH.h" + +# include "XMH_panel.h" +# include "LIP6bw.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XvpnPanelItem XvpnHelpPresentPanel = + + { + "Xvpn present", + 1, + 0, + XVPN_HELP_PRESENT_X, + XVPN_HELP_PRESENT_Y, + 700, + 360, + 0, + 0, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (XvpnPanelButtonItem *)NULL + }; + + int XvpnHelpPresentDefaultValues[ 5 ] = + + { + XVPN_HELP_PRESENT_X, + XVPN_HELP_PRESENT_Y, + 700, 360, 0 + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnBuildPresentPanel | +| | +\------------------------------------------------------------*/ + +void XvpnBuildPresentPanel() + +{ + Widget PanelLabel; + Widget PanelButton; + Pixmap PanelPixmap; + XmString PanelString; + XmString PanelString1; + XmString PanelString2; + XmFontList PanelFontList; + XFontStruct *PanelFont; + Display *PanelDisplay; + char Buffer[ 64 ]; + Arg Args[3]; + + autbegin(); + + PanelDisplay = XtDisplay( XvpnMainWindow ); + PanelFont = XLoadQueryFont( PanelDisplay, "-*-helvetica-bold-o-*--24-*" ); + PanelFontList = XmFontListCreate( PanelFont, "Panel_charset1" ); + PanelFont = XLoadQueryFont( PanelDisplay, "-*-helvetica-bold-r-*--18-*" ); + PanelFontList = XmFontListAdd( PanelFontList, PanelFont, "Panel_charset2" ); + PanelFont = XLoadQueryFont( PanelDisplay, "-*-helvetica-bold-r-*--12-*" ); + PanelFontList = XmFontListAdd( PanelFontList, PanelFont, "Panel_charset4" ); + + XtSetArg( Args[0], XmNshadowType , XmSHADOW_ETCHED_IN ); + XtSetArg( Args[1], XmNdeleteResponse, XmDESTROY ); + XtSetArg( Args[2], XmNtitle , "Xvpn present" ); + + XvpnHelpPresentPanel.PANEL = + + XmCreateFormDialog( XvpnMainWindow, XvpnHelpPresentPanel.TITLE, Args, 3); + + XtAddCallback( XvpnHelpPresentPanel.PANEL, XmNdestroyCallback, + XvpnDestroyDialogCallback, NULL ); + + XvpnHelpPresentPanel.PANEL_FORM = + + XtVaCreateManagedWidget( "", + xmFormWidgetClass, + XvpnHelpPresentPanel.PANEL, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + NULL + ); + + XvpnHelpPresentPanel.FRAME = + + XtVaCreateManagedWidget( "", + xmFrameWidgetClass, + XvpnHelpPresentPanel.PANEL_FORM, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 05, + XmNbottomAttachment, XmATTACH_POSITION, + XmNbottomPosition , 95, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 05, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 95, + NULL + ); + + XvpnHelpPresentPanel.FORM = + + XtVaCreateManagedWidget( "", + xmFormWidgetClass, + XvpnHelpPresentPanel.FRAME, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 05, + XmNbottomAttachment, XmATTACH_POSITION, + XmNbottomPosition , 95, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 05, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 95, + NULL + ); + + PanelPixmap = XvpnCreatePixmap( XvpnMainWindow, + LIP6bw_bits, + LIP6bw_width, + LIP6bw_height); + + PanelLabel = XtVaCreateManagedWidget( "", + xmLabelGadgetClass, + XvpnHelpPresentPanel.FORM, + XmNlabelType , XmPIXMAP, + XmNlabelPixmap , PanelPixmap, + NULL + ); + + sprintf( Buffer, "ALLIANCE CAD SYSTEM %s\n", ALLIANCE_VERSION ); + + PanelString = XmStringCreateLtoR( Buffer, "Panel_charset2" ); + + PanelLabel = XtVaCreateManagedWidget( "", + xmLabelWidgetClass, + XvpnHelpPresentPanel.FORM, + XmNfontList , PanelFontList, + XmNlabelString , PanelString, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 15, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 75, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 25, + NULL + ); + XmStringFree( PanelString ); + + PanelString1 = XmStringCreateLtoR( "Xvpn" , "Panel_charset1" ); + PanelString2 = XmStringCreateLtoR( "\n( Touch Me )", "Panel_charset4" ); + PanelString = XmStringConcat( PanelString1, PanelString2 ); + + PanelButton = XtVaCreateManagedWidget( "", + xmPushButtonWidgetClass, + XvpnHelpPresentPanel.FORM, + XmNfontList , PanelFontList, + XmNlabelString , PanelString, + XmNshadowThickness , 3, + XmNtopAttachment , XmATTACH_WIDGET, + XmNtopWidget , PanelLabel, + XmNtopOffset , 5, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 60, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 40, + NULL + ); + XmStringFree( PanelString ); + XmStringFree( PanelString1 ); + XmStringFree( PanelString2 ); + + XtAddCallback( PanelButton, + XmNactivateCallback, + XvpnExitDialogCallback, NULL ); + + sprintf( Buffer, "\nGraphic Petri Nets Viewer\nVersion %s", XVPN_VERSION ); + + PanelString = XmStringCreateLtoR( Buffer, "Panel_charset2" ); + + PanelLabel = XtVaCreateManagedWidget( "", + xmLabelWidgetClass, + XvpnHelpPresentPanel.FORM, + XmNfontList , PanelFontList, + XmNlabelString , PanelString, + XmNtopAttachment , XmATTACH_WIDGET, + XmNtopWidget , PanelButton, + XmNtopOffset , 5, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 75, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 25, + NULL + ); + XmStringFree( PanelString ); + + PanelString = XmStringCreateLtoR( "copyright \251 1996-2000 ASIM, \ +CAO-VLSI Team\nWritten by Ludovic Jacomme\nE-mail support: alliance-support@asim.lip6.fr", "Panel_charset4" ); + + PanelLabel = XtVaCreateManagedWidget( "", + xmLabelWidgetClass, + XvpnHelpPresentPanel.FORM, + XmNfontList , PanelFontList, + XmNlabelString , PanelString, + XmNtopAttachment , XmATTACH_WIDGET, + XmNtopWidget , PanelLabel, + XmNtopOffset , 5, + XmNrightAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + NULL + ); + XmStringFree( PanelString ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnEnterPresentPanel | +| | +\------------------------------------------------------------*/ + +void XvpnEnterPresentPanel() + +{ + autbegin(); + + XvpnEnterPanel( &XvpnHelpPresentPanel ); + + XvpnLimitedLoop( XvpnHelpPresentPanel.PANEL ); + + XvpnExitPanel( &XvpnHelpPresentPanel ); + + autend(); +} diff --git a/alliance/src/xvpn/src/XMH_panel.h b/alliance/src/xvpn/src/XMH_panel.h new file mode 100644 index 00000000..37ff0757 --- /dev/null +++ b/alliance/src/xvpn/src/XMH_panel.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_HELP_PANEL +# define XVPN_HELP_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XVPN_PRESENT_PIXMAP_WIDTH 164 +# define XVPN_PRESENT_PIXMAP_HEIGHT 150 + +# define XVPN_HELP_PRESENT_X 180 +# define XVPN_HELP_PRESENT_Y 200 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xvpn/src/XMS.h b/alliance/src/xvpn/src/XMS.h new file mode 100644 index 00000000..d78d9144 --- /dev/null +++ b/alliance/src/xvpn/src/XMS.h @@ -0,0 +1,79 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : XMS.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_XMS +# define XVPN_XMS + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XvpnMenuItem XvpnSetupMenu[]; + extern XvpnPanelItem XvpnSetupInformationsPanel; + + extern int XvpnSetupInformationsDefaultValues[ 5 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackSetupLoadConfig(); + extern void CallbackSetupSaveConfig(); + extern void CallbackSetupDefaultConfig(); + extern void CallbackSetupInformations(); + + extern void XvpnLoadConfig(); + extern void XvpnLoadTopLevelConfig(); + +# endif diff --git a/alliance/src/xvpn/src/XMS_dialog.c b/alliance/src/xvpn/src/XMS_dialog.c new file mode 100644 index 00000000..393ebdaa --- /dev/null +++ b/alliance/src/xvpn/src/XMS_dialog.c @@ -0,0 +1,80 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XMX.h" +# include "XTB.h" +# include "XMS.h" + +# include "XMS_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ diff --git a/alliance/src/xvpn/src/XMS_dialog.h b/alliance/src/xvpn/src/XMS_dialog.h new file mode 100644 index 00000000..2206cf5c --- /dev/null +++ b/alliance/src/xvpn/src/XMS_dialog.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_SETUP_DIALOG +# define XVPN_SETUP_DIALOG + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xvpn/src/XMS_menu.c b/alliance/src/xvpn/src/XMS_menu.c new file mode 100644 index 00000000..cbfdbe25 --- /dev/null +++ b/alliance/src/xvpn/src/XMS_menu.c @@ -0,0 +1,231 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XTB.h" +# include "XMS.h" + +# include "XMS_menu.h" +# include "XMS_panel.h" +# include "XMS_setup.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XvpnMenuItem XvpnSetupMenu[] = + + { + { + "Default Config", + 'D', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackSetupDefaultConfig, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XvpnMenuItem *)NULL + } + , + { + "Load Config", + 'L', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackSetupLoadConfig, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XvpnMenuItem *)NULL + } + , + { + "Save Config", + 'S', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackSetupSaveConfig, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XvpnMenuItem *)NULL + } + , + { + "Informations", + 'I', + NULL, + NULL, + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackSetupInformations, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XvpnMenuItem *)NULL + } + , + { NULL } + }; + + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackSetupLoadConfig | +| | +\------------------------------------------------------------*/ + +void CallbackSetupLoadConfig( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnLoadConfig( XVPN_TRUE ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSetupSaveConfig | +| | +\------------------------------------------------------------*/ + +void CallbackSetupSaveConfig( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnSaveConfig(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSetupDefaultConfig | +| | +\------------------------------------------------------------*/ + +void CallbackSetupDefaultConfig( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnDefaultConfig(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSetupInformations | +| | +\------------------------------------------------------------*/ + +void CallbackSetupInformations( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnDisplayInformations(); + + autend(); +} + diff --git a/alliance/src/xvpn/src/XMS_menu.h b/alliance/src/xvpn/src/XMS_menu.h new file mode 100644 index 00000000..402ad3c6 --- /dev/null +++ b/alliance/src/xvpn/src/XMS_menu.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_SETUP_MENU +# define XVPN_SETUP_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xvpn/src/XMS_panel.c b/alliance/src/xvpn/src/XMS_panel.c new file mode 100644 index 00000000..59705a2d --- /dev/null +++ b/alliance/src/xvpn/src/XMS_panel.c @@ -0,0 +1,183 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" +# include "XSB.h" +# include "XVP.h" +# include "XTB.h" +# include "XMS.h" + +# include "XMS_panel.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Panel | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Panel Informations | +| | +\------------------------------------------------------------*/ + + static char *XvpnPanelInformationsButtonName[] = + + { + "Text", + "Close" + }; + + XvpnPanelButtonItem XvpnSetupInformationsButton[] = + + { + { + &XvpnPanelInformationsButtonName[0], + "Nothing", NULL, 0, 0, + NULL, + NULL, + 0, 0, + 8, 9, + NULL, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnPanelInformationsButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 3, 9, + 2, 1, + XvpnExitDialogCallback, + (XtPointer)NULL, + (Widget)NULL + } + , + { NULL } + }; + + XvpnPanelItem XvpnSetupInformationsPanel = + + { + "Informations", + 1, + 0, + XVPN_SETUP_INFORMATIONS_X, + XVPN_SETUP_INFORMATIONS_Y, + 360, + 250, + 8, + 10, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XvpnSetupInformationsButton + }; + + int XvpnSetupInformationsDefaultValues[ 5 ] = + + { + XVPN_SETUP_INFORMATIONS_X, + XVPN_SETUP_INFORMATIONS_Y, + 360, 250, 0 + }; + +/*------------------------------------------------------------\ +| | +| Callback For Informations | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnDisplayInformations | +| | +\------------------------------------------------------------*/ + +void XvpnDisplayInformations() + +{ + char *Message; + + autbegin(); + + Message = XvpnGetInformations(); + + XmTextSetString( XvpnSetupInformationsButton[0].BUTTON, Message ); + + XvpnEnterPanel( &XvpnSetupInformationsPanel ); + + XvpnLimitedLoop( XvpnSetupInformationsPanel.PANEL ); + + XvpnExitPanel( &XvpnSetupInformationsPanel ); + + autend(); +} diff --git a/alliance/src/xvpn/src/XMS_panel.h b/alliance/src/xvpn/src/XMS_panel.h new file mode 100644 index 00000000..61010f23 --- /dev/null +++ b/alliance/src/xvpn/src/XMS_panel.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_SETUP_PANEL +# define XVPN_SETUP_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XVPN_SETUP_INFORMATIONS_X 330 +# define XVPN_SETUP_INFORMATIONS_Y 280 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnDisplayInformations(); + +# endif diff --git a/alliance/src/xvpn/src/XMS_setup.c b/alliance/src/xvpn/src/XMS_setup.c new file mode 100644 index 00000000..9450ad29 --- /dev/null +++ b/alliance/src/xvpn/src/XMS_setup.c @@ -0,0 +1,521 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Setup.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XMF.h" +# include "XME.h" +# include "XMV.h" +# include "XMT.h" +# include "XMS.h" +# include "XMH.h" + +# include "XMS_setup.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static FILE *FileConfig; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Set Panel New Values | +| | +\------------------------------------------------------------*/ + +void XvpnSetPanelValues( Panel, Values ) + + XvpnPanelItem *Panel; + int *Values; +{ + autbegin(); + + Panel->COMPUTE = 1; + Panel->X = Values[0]; + Panel->Y = Values[1]; + Panel->WIDTH = Values[2]; + Panel->HEIGHT = Values[3]; + Panel->MANAGED = Values[4]; + + XtVaSetValues( Panel->PANEL, + XmNx , Values[0], + XmNy , Values[1], + XmNwidth , Values[2], + XmNheight , Values[3], + NULL ); + + if ( Panel->MANAGED ) + { + XvpnEnterPanel( Panel ); + } + else + { + XtUnmanageChild( Panel->PANEL ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Write TopLevel Values | +| | +\------------------------------------------------------------*/ + +void XvpnWriteTopLevelValues() + +{ + Dimension Values[5]; + + autbegin(); + + XtVaGetValues( XvpnTopLevel, + XmNx , &Values[0], + XmNy , &Values[1], + XmNwidth , &Values[2], + XmNheight , &Values[3], + NULL ); + + Values[0] = Values[0] - XVPN_TOPLEVEL_TRANSLATE_X; + Values[1] = Values[1] - XVPN_TOPLEVEL_TRANSLATE_Y; + Values[4] = 1; + + fprintf( FileConfig, "VERSION: %s\n", XVPN_VERSION ); + fprintf( FileConfig, "X: %d, Y: %d, WIDTH: %d, HEIGHT: %d, MANAGED: %d\n", + Values[0], Values[1], Values[2], Values[3], Values[4] ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Write Panel Values | +| | +\------------------------------------------------------------*/ + +void XvpnWritePanelValues( Panel ) + + XvpnPanelItem *Panel; +{ + Dimension Values[5]; + + autbegin(); + + if ( Panel->COMPUTE == 0 ) + { + XtVaGetValues( Panel->PANEL, + XmNx , &Values[0], + XmNy , &Values[1], + XmNwidth , &Values[2], + XmNheight , &Values[3], + NULL ); + + Values[0] = Values[0] - XVPN_PANEL_TRANSLATE_X; + Values[1] = Values[1] - XVPN_PANEL_TRANSLATE_Y; + } + else + { + Values[0] = Panel->X; + Values[1] = Panel->Y; + Values[2] = Panel->WIDTH; + Values[3] = Panel->HEIGHT; + } + + Values[4] = Panel->MANAGED; + + fprintf( FileConfig, "X: %d, Y: %d, WIDTH: %d, HEIGHT: %d, MANAGED: %d\n", + Values[0], Values[1], Values[2], Values[3], Values[4] ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Read Panel Values | +| | +\------------------------------------------------------------*/ + +void XvpnReadPanelValues( Panel ) + + XvpnPanelItem *Panel; +{ + int Values[5]; + + autbegin(); + + fscanf( FileConfig, "X: %d, Y: %d, WIDTH: %d, HEIGHT: %d, MANAGED: %d\n", + &Values[0], &Values[1], &Values[2], &Values[3], &Values[4] ); + + XvpnSetPanelValues( Panel, Values ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Read Panel Values | +| | +\------------------------------------------------------------*/ + +short XvpnReadTopLevelValues() + +{ + int Values[5]; + char Version[64]; + + autbegin(); + + fscanf( FileConfig, "VERSION: %s\n", Version ); + + if ( strcmp( Version, XVPN_VERSION ) ) + { + autend(); + return( 0 ); + } + + fscanf( FileConfig, "X: %d, Y: %d, WIDTH: %d, HEIGHT: %d, MANAGED: %d\n", + &Values[0], &Values[1], &Values[2], &Values[3], &Values[4] ); + + XtVaSetValues( XvpnTopLevel, + XmNx , Values[0], + XmNy , Values[1], + XmNwidth , Values[2], + XmNheight , Values[3], + NULL ); + autend(); + return( 1 ); +} + +/*------------------------------------------------------------\ +| | +| ReadActiveLayers | +| | +\------------------------------------------------------------*/ + +void XvpnReadActiveLayers() + +{ + short Layer; + int Value; + + autbegin(); + + for ( Layer = 0; Layer < XVPN_MAX_LAYER; Layer++ ) + { + fscanf( FileConfig, "ACTIVE: %d\n", &Value ); + + XVPN_ACTIVE_LAYER_TABLE[ Layer ] = Value; + } + + for ( Layer = 0; Layer < XVPN_MAX_ACTIVE_NAME; Layer++ ) + { + fscanf( FileConfig, "ACTIVE: %d\n", &Value ); + + XVPN_ACTIVE_NAME_TABLE[ Layer ] = Value; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| WriteActiveLayers | +| | +\------------------------------------------------------------*/ + +void XvpnWriteActiveLayers() + +{ + short Layer; + + autbegin(); + + for ( Layer = 0; Layer < XVPN_MAX_LAYER; Layer++ ) + { + fprintf( FileConfig, "ACTIVE: %d\n", + XVPN_ACTIVE_LAYER_TABLE[ Layer ] ); + } + + for ( Layer = 0; Layer < XVPN_MAX_ACTIVE_NAME; Layer++ ) + { + fprintf( FileConfig, "ACTIVE: %d\n", + XVPN_ACTIVE_NAME_TABLE[ Layer ] ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnDefaultTopLevelValues | +| | +\------------------------------------------------------------*/ + +void XvpnDefaultTopLevelValues() + +{ + autbegin(); + + XtVaSetValues( XvpnTopLevel, + XmNheight , XVPN_TOPLEVEL_HEIGHT, + XmNwidth , XVPN_TOPLEVEL_WIDTH, + XmNx , XVPN_TOPLEVEL_X, + XmNy , XVPN_TOPLEVEL_Y, + NULL + ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnDefaultConfig | +| | +\------------------------------------------------------------*/ + +void XvpnDefaultConfig() + +{ + short Layer; + + autbegin(); + + XvpnDefaultTopLevelValues(); + + XvpnSetPanelValues( &XvpnViewArrowsPanel, + XvpnViewArrowsDefaultValues ); + XvpnSetPanelValues( &XvpnViewZoomPanel, + XvpnViewZoomDefaultValues ); + XvpnSetPanelValues( &XvpnViewGridPanel, + XvpnViewGridDefaultValues ); + XvpnSetPanelValues( &XvpnViewLayerPanel, + XvpnViewLayerDefaultValues ); + XvpnSetPanelValues( &XvpnViewMapPanel, + XvpnViewMapDefaultValues ); + XvpnSetPanelValues( &XvpnEditSearchViewPanel, + XvpnEditSearchViewDefaultValues ); + XvpnSetPanelValues( &XvpnEditSelectPanel, + XvpnEditSelectDefaultValues ); + XvpnSetPanelValues( &XvpnEditIdentifyPanel, + XvpnEditIdentifyDefaultValues ); + XvpnSetPanelValues( &XvpnEditDescriptionPanel, + XvpnEditDescriptionDefaultValues ); + XvpnSetPanelValues( &XvpnToolsMessagePanel, + XvpnToolsMessageDefaultValues ); + XvpnSetPanelValues( &XvpnSetupInformationsPanel, + XvpnSetupInformationsDefaultValues ); + XvpnSetPanelValues( &XvpnHelpPresentPanel, + XvpnHelpPresentDefaultValues ); + + for ( Layer = 0; Layer < XVPN_MAX_LAYER; Layer++ ) + { + XVPN_ACTIVE_LAYER_TABLE[ Layer ] = 1; + } + + for ( Layer = 0; Layer < XVPN_MAX_ACTIVE_NAME; Layer++ ) + { + XVPN_ACTIVE_NAME_TABLE[ Layer ] = 1; + } + + XvpnInitializeLayer(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnLoadTopLevelConfig | +| | +\------------------------------------------------------------*/ + +void XvpnLoadTopLevelConfig() + +{ + autbegin(); + + FileConfig = fopen( XVPN_XMS_FILE_NAME, "r" ); + + if ( FileConfig == (FILE *)NULL ) + { + XvpnDefaultTopLevelValues(); + } + else + { + if ( ! XvpnReadTopLevelValues() ) + { + XvpnDefaultTopLevelValues(); + } + + fclose( FileConfig ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnLoadConfig | +| | +\------------------------------------------------------------*/ + +void XvpnLoadConfig( Message ) + + short Message; +{ + autbegin(); + + FileConfig = fopen( XVPN_XMS_FILE_NAME, "r" ); + + if ( FileConfig == (FILE *)NULL ) + { + if ( Message ) + { + XvpnErrorMessage( XvpnMainWindow, + "Unable to open config file !" ); + } + else + { + XvpnDefaultConfig(); + } + } + else + { + if ( XvpnReadTopLevelValues() ) + { + XvpnReadPanelValues( &XvpnViewArrowsPanel ); + XvpnReadPanelValues( &XvpnViewZoomPanel ); + XvpnReadPanelValues( &XvpnViewGridPanel ); + XvpnReadPanelValues( &XvpnViewLayerPanel ); + XvpnReadPanelValues( &XvpnViewMapPanel ); + XvpnReadPanelValues( &XvpnEditSearchViewPanel ); + XvpnReadPanelValues( &XvpnEditSelectPanel ); + XvpnReadPanelValues( &XvpnEditIdentifyPanel ); + XvpnReadPanelValues( &XvpnEditDescriptionPanel ); + XvpnReadPanelValues( &XvpnToolsMessagePanel ); + XvpnReadPanelValues( &XvpnSetupInformationsPanel ); + XvpnReadPanelValues( &XvpnHelpPresentPanel ); + + XvpnReadActiveLayers(); + XvpnInitializeLayer(); + } + else + if ( Message ) + { + XvpnErrorMessage( XvpnMainWindow, + "Bad version, unable to open config file !" ); + } + + fclose( FileConfig ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnSaveConfig | +| | +\------------------------------------------------------------*/ + +void XvpnSaveConfig() + +{ + autbegin(); + + FileConfig = fopen( XVPN_XMS_FILE_NAME, "w" ); + + if ( FileConfig == (FILE *)NULL ) + { + XvpnErrorMessage( XvpnMainWindow, + "Unable to open config file !" ); + } + else + { + XvpnWriteTopLevelValues(); + + XvpnWritePanelValues( &XvpnViewArrowsPanel ); + XvpnWritePanelValues( &XvpnViewZoomPanel ); + XvpnWritePanelValues( &XvpnViewGridPanel ); + XvpnWritePanelValues( &XvpnViewLayerPanel ); + XvpnWritePanelValues( &XvpnViewMapPanel ); + XvpnWritePanelValues( &XvpnEditSearchViewPanel ); + XvpnWritePanelValues( &XvpnEditSelectPanel ); + XvpnWritePanelValues( &XvpnEditIdentifyPanel ); + XvpnWritePanelValues( &XvpnEditDescriptionPanel ); + XvpnWritePanelValues( &XvpnToolsMessagePanel ); + XvpnWritePanelValues( &XvpnSetupInformationsPanel ); + XvpnWritePanelValues( &XvpnHelpPresentPanel ); + + XvpnWriteActiveLayers(); + + fclose( FileConfig ); + } + + autend(); +} diff --git a/alliance/src/xvpn/src/XMS_setup.h b/alliance/src/xvpn/src/XMS_setup.h new file mode 100644 index 00000000..7aaeb08b --- /dev/null +++ b/alliance/src/xvpn/src/XMS_setup.h @@ -0,0 +1,85 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Setup.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_SETUP +# define XVPN_SETUP + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XVPN_TOPLEVEL_TRANSLATE_X 8 +# define XVPN_TOPLEVEL_TRANSLATE_Y 25 +# define XVPN_PANEL_TRANSLATE_X 0 +# define XVPN_PANEL_TRANSLATE_Y 0 + +# define XVPN_TOPLEVEL_X 10 +# define XVPN_TOPLEVEL_Y 10 +# define XVPN_TOPLEVEL_WIDTH 1024 +# define XVPN_TOPLEVEL_HEIGHT 768 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnDefaultConfig(); + extern void XvpnSaveConfig(); + extern void XvpnLoadConfig(); + +# endif diff --git a/alliance/src/xvpn/src/XMT.h b/alliance/src/xvpn/src/XMT.h new file mode 100644 index 00000000..7707387b --- /dev/null +++ b/alliance/src/xvpn/src/XMT.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : XMT.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_XMT +# define XVPN_XMT + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XvpnMenuItem XvpnToolsMenu[]; + extern XvpnPanelItem XvpnToolsMessagePanel; + + extern int XvpnToolsMessageDefaultValues[ 5 ]; + + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnDisplayToolsMessage(); + +# endif diff --git a/alliance/src/xvpn/src/XMT_dialog.c b/alliance/src/xvpn/src/XMT_dialog.c new file mode 100644 index 00000000..2ae40c26 --- /dev/null +++ b/alliance/src/xvpn/src/XMT_dialog.c @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XMX.h" +# include "XTB.h" +# include "XMT.h" + +# include "XMT_dialog.h" +# include "XMT_tools.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ diff --git a/alliance/src/xvpn/src/XMT_dialog.h b/alliance/src/xvpn/src/XMT_dialog.h new file mode 100644 index 00000000..67897046 --- /dev/null +++ b/alliance/src/xvpn/src/XMT_dialog.h @@ -0,0 +1,71 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_TOOLS_DIALOG +# define XVPN_TOOLS_DIALOG + + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xvpn/src/XMT_menu.c b/alliance/src/xvpn/src/XMT_menu.c new file mode 100644 index 00000000..d6b9ec90 --- /dev/null +++ b/alliance/src/xvpn/src/XMT_menu.c @@ -0,0 +1,157 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XTB.h" +# include "XMV.h" +# include "XMT.h" +# include "XMX.h" + +# include "XMT_menu.h" +# include "XMT_tools.h" +# include "XMT_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XvpnMenuItem XvpnToolsMenu[] = + + { + { + "Message", + 'M', + "CtrlM", + "Ctrl M", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackToolsMessage, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XvpnMenuItem *)NULL + } + , + { + "Elaborate", + 'E', + "CtrlE", + "Ctrl E", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackToolsElaborate, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XvpnMenuItem *)NULL + } + , + { NULL } + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackToolsMessage | +| | +\------------------------------------------------------------*/ + +void CallbackToolsMessage( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnEnterPanel( &XvpnToolsMessagePanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackToolsElaborate | +| | +\------------------------------------------------------------*/ + +void CallbackToolsElaborate( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnToolsElaborate(); + + autend(); +} diff --git a/alliance/src/xvpn/src/XMT_menu.h b/alliance/src/xvpn/src/XMT_menu.h new file mode 100644 index 00000000..7d626d1b --- /dev/null +++ b/alliance/src/xvpn/src/XMT_menu.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_MENU +# define XVPN_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackToolsMessage(); + extern void CallbackToolsElaborate(); + +# endif diff --git a/alliance/src/xvpn/src/XMT_message.c b/alliance/src/xvpn/src/XMT_message.c new file mode 100644 index 00000000..a1c19fde --- /dev/null +++ b/alliance/src/xvpn/src/XMT_message.c @@ -0,0 +1,78 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Message.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XMX.h" +# include "XTB.h" +# include "XMT.h" +# include "XMT_tools.h" +# include "XMT_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ diff --git a/alliance/src/xvpn/src/XMT_message.h b/alliance/src/xvpn/src/XMT_message.h new file mode 100644 index 00000000..7d31c35d --- /dev/null +++ b/alliance/src/xvpn/src/XMT_message.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Message.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_MESSAGE +# define XVPN_MESSAGE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xvpn/src/XMT_panel.c b/alliance/src/xvpn/src/XMT_panel.c new file mode 100644 index 00000000..6d1efb01 --- /dev/null +++ b/alliance/src/xvpn/src/XMT_panel.c @@ -0,0 +1,203 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" +# include "XSB.h" +# include "XVP.h" +# include "XMX.h" +# include "XTB.h" +# include "XMT.h" + +# include "XMT_panel.h" +# include "XMT_message.h" +# include "XMT_dialog.h" +# include "XMT_tools.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Panel Message | +| | +\------------------------------------------------------------*/ + + static char *XvpnPanelMessageButtonName[] = + + { + "Text", + "Close" + }; + + XvpnPanelButtonItem XvpnToolsMessageButton[] = + + { + { + &XvpnPanelMessageButtonName[0], + "Nothing", NULL, 0, 0, + NULL, + NULL, + 0, 0, + 8, 9, + NULL, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnPanelMessageButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 3, 9, + 2, 1, + CallbackToolsCloseMessage, + (XtPointer)NULL, + (Widget)NULL + } + , + { NULL } + }; + + XvpnPanelItem XvpnToolsMessagePanel = + + { + "Message", + 1, + 0, + XVPN_TOOLS_MESSAGE_X, + XVPN_TOOLS_MESSAGE_Y, + 360, + 250, + 8, + 10, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XvpnToolsMessageButton + }; + + int XvpnToolsMessageDefaultValues[ 5 ] = + + { + XVPN_TOOLS_MESSAGE_X, + XVPN_TOOLS_MESSAGE_Y, + 360, 250, 0 + }; + +/*------------------------------------------------------------\ +| | +| Callback For Message | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackToolsCloseMessage | +| | +\------------------------------------------------------------*/ + +void CallbackToolsCloseMessage( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnExitPanel( &XvpnToolsMessagePanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnDisplayToolsMessage | +| | +\------------------------------------------------------------*/ + +void XvpnDisplayToolsMessage() +{ + char *Message; + + autbegin(); + + Message = XvpnGetErrorMessage(); + + if ( Message != (char *)NULL ) + { + XmTextSetString( XvpnToolsMessageButton[0].BUTTON, Message ); + + XvpnEnterPanel( &XvpnToolsMessagePanel ); + } + else + { + XmTextSetString( XvpnToolsMessageButton[0].BUTTON, "" ); + } + + autend(); +} diff --git a/alliance/src/xvpn/src/XMT_panel.h b/alliance/src/xvpn/src/XMT_panel.h new file mode 100644 index 00000000..ada54bdc --- /dev/null +++ b/alliance/src/xvpn/src/XMT_panel.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_TOOLS_PANEL +# define XVPN_TOOLS_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XVPN_TOOLS_MESSAGE_X 330 +# define XVPN_TOOLS_MESSAGE_Y 280 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void CallbackToolsCloseMessage(); + +# endif diff --git a/alliance/src/xvpn/src/XMT_tools.c b/alliance/src/xvpn/src/XMT_tools.c new file mode 100644 index 00000000..05e72053 --- /dev/null +++ b/alliance/src/xvpn/src/XMT_tools.c @@ -0,0 +1,104 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Tools.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XVP.h" +# include "XMV.h" +# include "XMT.h" + +# include "XMT_tools.h" +# include "XMT_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnToolsElaborate | +| | +\------------------------------------------------------------*/ + +void XvpnToolsElaborate() + +{ + autbegin(); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_WATCH_CURSOR ); + + XvpnElaborateFigure(); + + XvpnZoomRefresh(); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_NORMAL_CURSOR ); + + autend(); +} + diff --git a/alliance/src/xvpn/src/XMT_tools.h b/alliance/src/xvpn/src/XMT_tools.h new file mode 100644 index 00000000..a6fba1f0 --- /dev/null +++ b/alliance/src/xvpn/src/XMT_tools.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Tools.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_TOOLS +# define XVPN_TOOLS + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnToolsElaborate(); + + +# endif diff --git a/alliance/src/xvpn/src/XMV.h b/alliance/src/xvpn/src/XMV.h new file mode 100644 index 00000000..e0d3aa50 --- /dev/null +++ b/alliance/src/xvpn/src/XMV.h @@ -0,0 +1,132 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : XMV.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_XMV +# define XVPN_XMV + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern short XvpnFirstViewLayer; + +/*------------------------------------------------------------\ +| | +| Panel And Menu | +| | +\------------------------------------------------------------*/ + + extern XvpnMenuItem XvpnViewMenu[]; + extern XvpnPanelItem XvpnViewArrowsPanel; + extern XvpnPanelItem XvpnViewZoomPanel; + extern XvpnPanelItem XvpnViewGridPanel; + extern XvpnPanelItem XvpnViewLayerPanel; + extern XvpnPanelItem XvpnViewMapPanel; + + extern int XvpnPercentZoom; + extern int XvpnPercentMoveX; + extern int XvpnPercentMoveY; + + extern int XvpnViewArrowsDefaultValues[5]; + extern int XvpnViewZoomDefaultValues[5]; + extern int XvpnViewLayerDefaultValues[5]; + extern int XvpnViewGridDefaultValues[5]; + extern int XvpnViewMapDefaultValues[5]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Values | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Zoom | +| | +\------------------------------------------------------------*/ + + extern void XvpnComputeAndDisplayMap(); + extern void XvpnInitializeZoom(); + extern void XvpnBuildViewDialog(); + extern void XvpnBuildPanelMap(); + extern void XvpnInitializeMapEvent(); + + extern void XvpnZoomCenter(); + extern void XvpnZoomFit(); + extern void XvpnZoomIn(); + extern void XvpnZoomPan(); + extern void XvpnZoomUp(); + extern void XvpnZoomDown(); + extern void XvpnZoomLeft(); + extern void XvpnZoomRight(); + extern void XvpnZoomMore(); + extern void XvpnZoomLess(); + extern void XvpnZoomFit(); + extern void XvpnZoomRefresh(); + extern void XvpnZoomUndo(); + + extern void XvpnPromptZoomIn(); + extern void XvpnPromptZoomPan(); + extern void XvpnPromptZoomCenter(); + + extern void XvpnInitializeLayer(); + +# endif diff --git a/alliance/src/xvpn/src/XMV_dialog.c b/alliance/src/xvpn/src/XMV_dialog.c new file mode 100644 index 00000000..55d8ba8e --- /dev/null +++ b/alliance/src/xvpn/src/XMV_dialog.c @@ -0,0 +1,539 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XMV.h" + +# include "XMV_dialog.h" +# include "XMV_view.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Dialog Box | +| | +\------------------------------------------------------------*/ + + XvpnDialogItem XvpnViewZoomSetDialog = + + { + "Zoom set", + XVPN_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackViewZoomSetOk, + (XtPointer)NULL, + (void *)CallbackViewZoomSetCancel, + (XtPointer)NULL + }; + + XvpnDialogItem XvpnViewZoomGotoDialog = + + { + "Goto X,Y", + XVPN_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackViewZoomGotoOk, + (XtPointer)NULL, + (void *)CallbackViewZoomGotoCancel, + (XtPointer)NULL + }; + + XvpnDialogItem XvpnViewMoveSetDialog = + + { + "Move set dx,dy", + XVPN_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackViewMoveSetOk, + (XtPointer)NULL, + (void *)CallbackViewMoveSetCancel, + (XtPointer)NULL + }; + + XvpnDialogItem XvpnViewGridXDialog = + + { + "Grid X", + XVPN_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackViewGridXOk, + (XtPointer)NULL, + (void *)CallbackViewGridXCancel, + (XtPointer)NULL + }; + + XvpnDialogItem XvpnViewGridYDialog = + + { + "Grid Y", + XVPN_DIALOG_PROMPT, + (Widget)NULL, + (void *)CallbackViewGridYOk, + (XtPointer)NULL, + (void *)CallbackViewGridYCancel, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Build Dialog Box | +| | +\------------------------------------------------------------*/ + +void XvpnBuildViewDialog() + +{ + autbegin(); + + XvpnBuildDialog( XvpnMainWindow, &XvpnViewZoomSetDialog ); + XvpnBuildDialog( XvpnMainWindow, &XvpnViewZoomGotoDialog ); + XvpnBuildDialog( XvpnMainWindow, &XvpnViewMoveSetDialog ); + XvpnBuildDialog( XvpnMainWindow, &XvpnViewGridXDialog ); + XvpnBuildDialog( XvpnMainWindow, &XvpnViewGridYDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Dialog | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackViewZoomSetOk | +| | +\------------------------------------------------------------*/ + +void CallbackViewZoomSetOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *ZoomSet; + int ZoomPercent; + + autbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &ZoomSet ); + + XtUnmanageChild( XvpnViewZoomSetDialog.WIDGET ); + + XvpnExitDialog(); + + if ( ZoomSet != (char *)NULL ) + { + ZoomPercent = atoi( ZoomSet ); + + if ( ( ZoomPercent < XVPN_PERCENT_ZOOM_MIN ) || + ( ZoomPercent > XVPN_PERCENT_ZOOM_MAX ) ) + { + XvpnErrorMessage( XvpnMainWindow, "The value must be between 5% and 95% !" ); + } + else + { + XvpnPercentZoom = ZoomPercent; + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewZoomSetCancel | +| | +\------------------------------------------------------------*/ + +void CallbackViewZoomSetCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + autbegin(); + + XtUnmanageChild( XvpnViewZoomSetDialog.WIDGET ); + + XvpnExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewZoomGotoOk | +| | +\------------------------------------------------------------*/ + +void CallbackViewZoomGotoOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *ZoomGoto; + int Index; + long GotoX; + long GotoY; + + autbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &ZoomGoto ); + + XtUnmanageChild( XvpnViewZoomGotoDialog.WIDGET ); + + XvpnExitDialog(); + + if ( ZoomGoto != (char *)NULL ) + { + for ( Index = 0; ZoomGoto[ Index ]; Index++ ) + { + if ( ZoomGoto[ Index ] == ',' ) + { + ZoomGoto[ Index ] = '\0'; + + if ( Index == 0 ) + { + GotoX = XvpnUnitGridX + ( XvpnUnitGridDx >> 1 ); + } + else + { + GotoX = atoi( ZoomGoto ); + } + + if ( ZoomGoto[ Index + 1 ] == '\0' ) + { + GotoY = XvpnUnitGridY + ( XvpnUnitGridDy >> 1 ); + } + else + { + GotoY = atoi( ZoomGoto + Index + 1 ); + } + + ZoomGoto = (char *)NULL; + + XvpnZoomCenter( GotoX, GotoY ); + + break; + } + } + + if ( ZoomGoto != (char *)NULL ) + { + XvpnErrorMessage( XvpnMainWindow, "A coordinate must be specified !" ); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewZoomGotoCancel | +| | +\------------------------------------------------------------*/ + +void CallbackViewZoomGotoCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + autbegin(); + + XtUnmanageChild( XvpnViewZoomGotoDialog.WIDGET ); + + XvpnExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewMoveSetOk | +| | +\------------------------------------------------------------*/ + +void CallbackViewMoveSetOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *MoveSet; + int MovePercentX; + int MovePercentY; + int Index; + + autbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &MoveSet ); + + XtUnmanageChild( XvpnViewMoveSetDialog.WIDGET ); + + XvpnExitDialog(); + + if ( MoveSet != (char *)NULL ) + { + for ( Index = 0; MoveSet[ Index ]; Index++ ) + { + if ( MoveSet[ Index ] == ',' ) + { + MoveSet[ Index ] = '\0'; + + MovePercentX = atoi( MoveSet ); + MovePercentY = atoi( MoveSet + Index + 1 ); + MoveSet = (char *)NULL; + + break; + } + } + + if ( MoveSet != (char *)NULL ) + { + MovePercentY = MovePercentX = atoi( MoveSet ); + } + + if ( ( MovePercentX < XVPN_PERCENT_MOVE_MIN ) || + ( MovePercentX > XVPN_PERCENT_MOVE_MAX ) || + ( MovePercentY < XVPN_PERCENT_MOVE_MIN ) || + ( MovePercentY > XVPN_PERCENT_MOVE_MAX ) ) + { + XvpnErrorMessage( XvpnMainWindow, "The values must be between 5% and 95% !" ); + } + else + { + XvpnPercentMoveX = MovePercentX; + XvpnPercentMoveY = MovePercentY; + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewMoveSetCancel | +| | +\------------------------------------------------------------*/ + +void CallbackViewMoveSetCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + autbegin(); + + XtUnmanageChild( XvpnViewMoveSetDialog.WIDGET ); + + XvpnExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewGridXOk | +| | +\------------------------------------------------------------*/ + +void CallbackViewGridXOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *GridSet; + int GridPercent; + + autbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &GridSet ); + + XtUnmanageChild( XvpnViewGridXDialog.WIDGET ); + + XvpnExitDialog(); + + if ( GridSet != (char *)NULL ) + { + GridPercent = atoi( GridSet ); + + if ( GridPercent < 2 ) + { + XvpnErrorMessage( XvpnMainWindow, "The value must be greater than one !" ); + } + else + { + XvpnUnitUserGridDx = GridPercent; + XvpnZoomRefresh(); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewGridXCancel | +| | +\------------------------------------------------------------*/ + +void CallbackViewGridXCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + autbegin(); + + XtUnmanageChild( XvpnViewGridXDialog.WIDGET ); + + XvpnExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewGridYOk | +| | +\------------------------------------------------------------*/ + +void CallbackViewGridYOk( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + char *GridSet; + int GridPercent; + + autbegin(); + + XmStringGetLtoR( CallData->value, + XmSTRING_DEFAULT_CHARSET, + &GridSet ); + + XtUnmanageChild( XvpnViewGridYDialog.WIDGET ); + + XvpnExitDialog(); + + if ( GridSet != (char *)NULL ) + { + GridPercent = atoi( GridSet ); + + if ( GridPercent < 2 ) + { + XvpnErrorMessage( XvpnMainWindow, "The value must be greater than one !" ); + } + else + { + XvpnUnitUserGridDy = GridPercent; + XvpnZoomRefresh(); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewGridYCancel | +| | +\------------------------------------------------------------*/ + +void CallbackViewGridYCancel( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + XmSelectionBoxCallbackStruct *CallData; +{ + autbegin(); + + XtUnmanageChild( XvpnViewGridYDialog.WIDGET ); + + XvpnExitDialog(); + + autend(); +} diff --git a/alliance/src/xvpn/src/XMV_dialog.h b/alliance/src/xvpn/src/XMV_dialog.h new file mode 100644 index 00000000..6b9212e3 --- /dev/null +++ b/alliance/src/xvpn/src/XMV_dialog.h @@ -0,0 +1,93 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_VIEW_DIALOG +# define XVPN_VIEW_DIALOG + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XvpnDialogItem XvpnViewZoomSetDialog; + extern XvpnDialogItem XvpnViewZoomGotoDialog; + extern XvpnDialogItem XvpnViewMoveSetDialog; + extern XvpnDialogItem XvpnViewGridXDialog; + extern XvpnDialogItem XvpnViewGridYDialog; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback View Dialog | +| | +\------------------------------------------------------------*/ + + extern void CallbackViewZoomGotoOk(); + extern void CallbackViewZoomGotoCancel(); + extern void CallbackViewZoomSetOk(); + extern void CallbackViewZoomSetCancel(); + extern void CallbackViewMoveSetOk(); + extern void CallbackViewMoveSetCancel(); + extern void CallbackViewGridXOk(); + extern void CallbackViewGridXCancel(); + extern void CallbackViewGridYOk(); + extern void CallbackViewGridYCancel(); + +# endif diff --git a/alliance/src/xvpn/src/XMV_map.c b/alliance/src/xvpn/src/XMV_map.c new file mode 100644 index 00000000..be25e9ad --- /dev/null +++ b/alliance/src/xvpn/src/XMV_map.c @@ -0,0 +1,756 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Map.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" +# include "XSB.h" +# include "XVP.h" +# include "XTB.h" +# include "XMX.h" +# include "XMV.h" + +# include "XMV_map.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XvpnPanelItem XvpnViewMapPanel = + + { + "Map", + 1, + 0, + XVPN_VIEW_MAP_X, + XVPN_VIEW_MAP_Y, + 190, + 200, + 0, + 0, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (XvpnPanelButtonItem *)NULL + }; + + int XvpnViewMapDefaultValues[ 5 ] = + + { + XVPN_VIEW_MAP_X, + XVPN_VIEW_MAP_Y, + 190, 200, 0 + }; + +/*------------------------------------------------------------\ +| | +| Graphic Map Window | +| | +\------------------------------------------------------------*/ + + Widget XvpnMapWindow; + Widget XvpnMapButtonCompute; + Widget XvpnMapButtonClose; + + Dimension XvpnMapDx = 0; + Dimension XvpnMapDy = 0; + + static char XvpnFirstEnterMap = XVPN_TRUE; + static char XvpnFirstExpose = XVPN_TRUE; + +/*------------------------------------------------------------\ +| | +| Unit Map | +| | +\------------------------------------------------------------*/ + + float XvpnUnitMapStep; + + long XvpnUnitMapX; + long XvpnUnitMapY; + long XvpnUnitMapDx; + long XvpnUnitMapDy; + + long XvpnBoundMapX; + long XvpnBoundMapY; + long XvpnBoundMapDx; + long XvpnBoundMapDy; + + long XvpnPixelMapX; + long XvpnPixelMapY; + +/*------------------------------------------------------------\ +| | +| Expose | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Translation | +| | +\------------------------------------------------------------*/ + + static String XvpnMapEventTranslation = + + ": CallbackMapEvent( 0 )\n\ + : CallbackMapEvent( 1 )\n\ + : CallbackMapEvent( 2 )"; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Event Callback | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackCloseMap | +| | +\------------------------------------------------------------*/ + +void CallbackCloseMap( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnExitPanel( &XvpnViewMapPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackMapCompute | +| | +\------------------------------------------------------------*/ + +void CallbackMapCompute( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnComputeAndDisplayMap(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackMapEvent | +| | +\------------------------------------------------------------*/ + +void CallbackMapEvent ( MyWidget, Event, Args, Argc ) + + Widget MyWidget; + XButtonEvent *Event; + String *Args; + int *Argc; +{ + Display *EventDisplay; + char MouseEvent; + long X; + long Y; + + autbegin(); + + EventDisplay = Event->display; + MouseEvent = Args[ 0 ][ 0 ] - '0'; + + X = Event->x; + Y = XvpnMapDy - Event->y; + + X = X + XvpnPixelMapX; + Y = Y + XvpnPixelMapY; + + if ( X < 0 ) + { + X = ((float)(X) / XvpnUnitMapStep) - 0.5 ; + } + else + { + X = ((float)(X) / XvpnUnitMapStep) + 0.5 ; + } + + if ( Y < 0 ) + { + Y = ((float)(Y) / XvpnUnitMapStep) - 0.5 ; + } + else + { + Y = ((float)(Y) / XvpnUnitMapStep) + 0.5 ; + } + + switch ( MouseEvent ) + { + case XVPN_B1UP : + case XVPN_B2UP : + case XVPN_B3UP : + + XvpnZoomCenter( X, Y ); + + break; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackMapResize | +| | +\------------------------------------------------------------*/ + +void CallbackMapResize( MyWidget, ClientData, CallData ) + + Widget MyWidget; + XtPointer ClientData; + XmDrawingAreaCallbackStruct *CallData; +{ + if ( ! XvpnFirstExpose ) + { + autbegin(); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_WATCH_CURSOR ); + XvpnResizeMapWindow(); + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_NORMAL_CURSOR ); + + autend(); + } +} + +/*------------------------------------------------------------\ +| | +| CallbackMapExpose | +| | +\------------------------------------------------------------*/ + +void CallbackMapExpose( MyWidget, ClientData, CallData ) + + Widget MyWidget; + XtPointer ClientData; + XmDrawingAreaCallbackStruct *CallData; +{ + XExposeEvent *ExposeEvent; + + autbegin(); + + ExposeEvent = (XExposeEvent *)CallData->event; + + if ( XvpnFirstExpose ) + { + XvpnFirstExpose = XVPN_FALSE; + + XvpnInitializeMapWindow(); + } + + XvpnRefreshMapWindow(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Initialize Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnsnitializeMapWindow | +| | +\------------------------------------------------------------*/ + +void XvpnInitializeMapWindow() + +{ + autbegin(); + + XtVaGetValues( XvpnMapWindow, + XmNwidth , &XvpnMapDx, + XmNheight, &XvpnMapDy, + NULL + ); + + XvpnInitializeUnitMap(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Graphic Window Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnRefreshMapWindow | +| | +\------------------------------------------------------------*/ + +void XvpnRefreshMapWindow() +{ + autbegin(); + + XvpnClearMapWindow(); + XvpnDisplayUnitMap(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnClearMapWindow | +| | +\------------------------------------------------------------*/ + +void XvpnClearMapWindow() + +{ + XFillRectangle( XtDisplay( XvpnMapWindow ), + XtWindow( XvpnMapWindow ), + XvpnBackgroundGC, + 0, 0, XvpnMapDx, XvpnMapDy ); +} + +/*------------------------------------------------------------\ +| | +| XvpnResizeMapWindow | +| | +\------------------------------------------------------------*/ + +void XvpnResizeMapWindow() + +{ + autbegin(); + + XtVaGetValues( XvpnMapWindow, + XmNwidth, &XvpnMapDx, + XmNheight, &XvpnMapDy, + NULL + ); + + XvpnComputeAndDisplayMap(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnInitializeMapEvent | +| | +\------------------------------------------------------------*/ + +void XvpnInitializeMapEvent() + +{ + XtActionsRec NewActions; + + autbegin(); + + XtVaSetValues( XvpnMapWindow, + XmNtranslations, + XtParseTranslationTable( XvpnMapEventTranslation ), + NULL + ); + + NewActions.string = "CallbackMapEvent"; + NewActions.proc = CallbackMapEvent; + + XtAppAddActions( XvpnApplication, &NewActions, 1 ); + + XtAddCallback( XvpnMapWindow, + XmNresizeCallback, + CallbackMapResize, NULL ); + + XtAddCallback( XvpnMapWindow, + XmNexposeCallback, + CallbackMapExpose, NULL ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Unit Map Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnInitializeUnitMap | +| | +\------------------------------------------------------------*/ + +void XvpnInitializeUnitMap() + +{ + autbegin(); + + if ( ! XvpnComputeBound() ) + { + XvpnBoundMapX = XVPN_DEFAULT_MAP_X; + XvpnBoundMapY = XVPN_DEFAULT_MAP_Y; + XvpnBoundMapDx = XVPN_DEFAULT_MAP_DX; + XvpnBoundMapDy = XVPN_DEFAULT_MAP_DY; + } + else + { + XvpnBoundMapX = XvpnBoundXmin / XVPN_UNIT; + XvpnBoundMapY = XvpnBoundYmin / XVPN_UNIT; + XvpnBoundMapDx = XvpnBoundXmax / XVPN_UNIT; + XvpnBoundMapDy = XvpnBoundYmax / XVPN_UNIT; + XvpnBoundMapDx = XvpnBoundMapDx - XvpnBoundMapX; + XvpnBoundMapDy = XvpnBoundMapDy - XvpnBoundMapY; + } + + XvpnUnitMapX = XvpnBoundMapX - 2; + XvpnUnitMapY = XvpnBoundMapY - 2; + XvpnUnitMapDx = XvpnBoundMapDx + 4; + XvpnUnitMapDy = XvpnBoundMapDy + 4; + + XvpnComputeUnitMap(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnComputeUnitMap | +| | +\------------------------------------------------------------*/ + +void XvpnComputeUnitMap() + +{ + long Delta; + float StepX; + float StepY; + + autbegin(); + + StepX = (float)(XvpnMapDx) / (float)(XvpnUnitMapDx); + StepY = (float)(XvpnMapDy) / (float)(XvpnUnitMapDy); + + if ( StepX < StepY ) + { + XvpnUnitMapStep = StepX; + Delta = XvpnUnitMapDy; + XvpnUnitMapDy = 1 + ( XvpnMapDy / StepX ); + Delta = ( XvpnUnitMapDy - Delta ) >> 1; + XvpnUnitMapY = XvpnUnitMapY - Delta; + } + else + { + XvpnUnitMapStep = StepY; + Delta = XvpnUnitMapDx; + XvpnUnitMapDx = 1 + ( XvpnMapDx / StepY ); + Delta = ( XvpnUnitMapDx - Delta ) >> 1; + XvpnUnitMapX = XvpnUnitMapX - Delta; + } + + XvpnPixelMapX = (float)(XvpnUnitMapX) * XvpnUnitMapStep; + XvpnPixelMapY = (float)(XvpnUnitMapY) * XvpnUnitMapStep; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnDisplayUnitMap | +| | +\------------------------------------------------------------*/ + +void XvpnDisplayUnitMap() +{ + long X1; + long Y1; + long X2; + long Y2; + + autbegin(); + + X1 = (float)( XvpnBoundMapX ) * XvpnUnitMapStep; + Y1 = (float)( XvpnBoundMapY ) * XvpnUnitMapStep; + X2 = (float)( XvpnBoundMapX + XvpnBoundMapDx ) * XvpnUnitMapStep; + Y2 = (float)( XvpnBoundMapY + XvpnBoundMapDy ) * XvpnUnitMapStep; + + X1 = X1 - XvpnPixelMapX; + X2 = X2 - XvpnPixelMapX; + Y1 = Y1 - XvpnPixelMapY; + Y2 = Y2 - XvpnPixelMapY; + + XDrawRectangle( XtDisplay( XvpnMapWindow ), + XtWindow( XvpnMapWindow ), + XvpnLargeTextGC, + X1, XvpnMapDy - Y2, + X2 - X1, Y2 - Y1 ); + + X1 = XvpnUnitGridX + ( XvpnUnitGridDx >> 1 ); + Y1 = XvpnUnitGridY + ( XvpnUnitGridDy >> 1 ); + X1 = (float)( X1 ) * XvpnUnitMapStep; + Y1 = (float)( Y1 ) * XvpnUnitMapStep; + + X1 = X1 - XvpnPixelMapX; + Y1 = Y1 - XvpnPixelMapY; + Y1 = XvpnMapDy - Y1; + + if ( ( X1 > 0 ) && + ( Y1 > 0 ) && + ( X1 < XvpnMapDx ) && + ( Y1 < XvpnMapDy ) ) + { + XDrawLine( XtDisplay( XvpnMapWindow ), + XtWindow( XvpnMapWindow ), + XvpnLargeTextGC, + X1 - 2, Y1, + X1 + 2, Y1 ); + + XDrawLine( XtDisplay( XvpnMapWindow ), + XtWindow( XvpnMapWindow ), + XvpnLargeTextGC, + X1, Y1 - 2, + X1, Y1 + 2 ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnBuildPanelMap | +| | +\------------------------------------------------------------*/ + +void XvpnBuildPanelMap() +{ + Arg Args[3]; + + autbegin(); + + XtSetArg( Args[0], XmNshadowType , XmSHADOW_ETCHED_IN ); + XtSetArg( Args[1], XmNdeleteResponse, XmDESTROY ); + XtSetArg( Args[2], XmNtitle , XvpnViewMapPanel.TITLE ); + + XvpnViewMapPanel.PANEL = + + XmCreateFormDialog( XvpnMainWindow, "XvpnViewMapPanel", Args, 3); + + XtAddCallback( XvpnViewMapPanel.PANEL, XmNdestroyCallback, + XvpnDestroyDialogCallback, NULL ); + + XvpnViewMapPanel.PANEL_FORM = + + XtVaCreateManagedWidget( "XvpnViewMapPanelForm", + xmFormWidgetClass, + XvpnViewMapPanel.PANEL, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , 100, + NULL + ); + + XvpnViewMapPanel.FRAME = + + XtVaCreateManagedWidget( "XvpnViewMapFrame", + xmFrameWidgetClass, + XvpnViewMapPanel.PANEL_FORM, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + NULL + ); + + XvpnViewMapPanel.FORM = + + XtVaCreateManagedWidget( "XvpnViewMapForm", + xmFormWidgetClass, + XvpnViewMapPanel.FRAME, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , 100, + NULL + ); + + XvpnMapButtonCompute = + + XtVaCreateManagedWidget( "Compute", + xmPushButtonWidgetClass, + XvpnViewMapPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 1, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 44, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 89, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 99, + NULL + ); + XvpnMapButtonClose = + + XtVaCreateManagedWidget( "Close", + xmPushButtonWidgetClass, + XvpnViewMapPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 45, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 99, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 89, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 99, + NULL + ); + + XvpnMapWindow = + + XtVaCreateManagedWidget( "XvpnMapWindow", + xmDrawingAreaWidgetClass, + XvpnViewMapPanel.FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 1, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 99, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 1, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 88, + XmNbackground , 1, + XmNforeground , 0, + NULL + ); + + XtAddCallback( XvpnMapButtonCompute, + XmNactivateCallback, + CallbackMapCompute, NULL ); + + XtAddCallback( XvpnMapButtonClose, + XmNactivateCallback, + CallbackCloseMap, NULL ); + + XtVaSetValues( XvpnViewMapPanel.PANEL, + XmNheight, XvpnViewMapPanel.HEIGHT, + XmNwidth , XvpnViewMapPanel.WIDTH, + XmNx , XvpnViewMapPanel.X, + XmNy , XvpnViewMapPanel.Y, + NULL ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnEnterMapPanel | +| | +\------------------------------------------------------------*/ + +void XvpnEnterMapPanel() + +{ + autbegin(); + + XvpnFirstEnterMap = XVPN_FALSE; + + XvpnEnterPanel( &XvpnViewMapPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnComputeAndDisplayMap | +| | +\------------------------------------------------------------*/ + +void XvpnComputeAndDisplayMap() + +{ + + if ( ! XvpnFirstEnterMap ) + { + autbegin(); + + XvpnInitializeUnitMap(); + XvpnClearMapWindow(); + XvpnDisplayUnitMap(); + + autend(); + } +} diff --git a/alliance/src/xvpn/src/XMV_map.h b/alliance/src/xvpn/src/XMV_map.h new file mode 100644 index 00000000..57bec313 --- /dev/null +++ b/alliance/src/xvpn/src/XMV_map.h @@ -0,0 +1,102 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Map.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_MAP +# define XVPN_MAP + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XVPN_B1UP 0 +# define XVPN_B2UP 1 +# define XVPN_B3UP 2 + +# define XVPN_VIEW_MAP_X 25 +# define XVPN_VIEW_MAP_Y 520 + +# define XVPN_DEFAULT_MAP_X 0 +# define XVPN_DEFAULT_MAP_Y 0 +# define XVPN_DEFAULT_MAP_DX 40 +# define XVPN_DEFAULT_MAP_DY 40 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern Widget XvpnMapPanel; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnComputeUnitMap(); + extern void XvpnInitializeUnitMap(); + extern void XvpnDisplayUnitMap(); + + extern void XvpnEnterMapPanel(); + extern void XvpnClearMapWindow(); + extern void XvpnResizeMapWindow(); + extern void XvpnRefreshMapWindow(); + extern void XvpnInitializeMapWindow(); + + extern void CallbackCloseMap(); + extern void CallbackMapCompute(); + extern void CallbackMapResize(); + extern void CallbackMapExpose(); + extern void CallbackMapEvent(); + +# endif diff --git a/alliance/src/xvpn/src/XMV_menu.c b/alliance/src/xvpn/src/XMV_menu.c new file mode 100644 index 00000000..d588868a --- /dev/null +++ b/alliance/src/xvpn/src/XMV_menu.c @@ -0,0 +1,282 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XMV.h" + +# include "XMV_menu.h" +# include "XMV_dialog.h" +# include "XMV_view.h" +# include "XMV_map.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + short XvpnFirstViewLayer = 1; + +/*------------------------------------------------------------\ +| | +| Menu | +| | +\------------------------------------------------------------*/ + + XvpnMenuItem XvpnViewMenu[] = + + { + { + "Zoom", + 'Z', + "MetaZ", + "Meta Z", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackViewZoom, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XvpnMenuItem *)NULL + } + , + { + "Layers ", + 'L', + "MetaL", + "Meta L", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackViewLayer, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XvpnMenuItem *)NULL + } + , + { + "Map", + 'M', + "MetaP", + "Meta P", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackViewMap, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XvpnMenuItem *)NULL + } + , + { + "Arrows ", + 'A', + "MetaA", + "Meta A", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackViewArrows, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XvpnMenuItem *)NULL + } + , + { + "Grid ", + 'G', + "MetaG", + "Meta G", + &xmPushButtonGadgetClass, + False, + False, + False, + CallbackViewGrid, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + (XvpnMenuItem *)NULL + } + , + { NULL } + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback For Menu | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackViewLayer | +| | +\------------------------------------------------------------*/ + +void CallbackViewLayer( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + if ( XvpnFirstViewLayer ) + { + XvpnFirstViewLayer = 0; + + XvpnInitializeLayer(); + } + + XvpnEnterPanel( &XvpnViewLayerPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewGrid | +| | +\------------------------------------------------------------*/ + +void CallbackViewGrid( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnEnterPanel( &XvpnViewGridPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewArrows | +| | +\------------------------------------------------------------*/ + +void CallbackViewArrows( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnEnterPanel( &XvpnViewArrowsPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewZoom | +| | +\------------------------------------------------------------*/ + +void CallbackViewZoom( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnEnterPanel( &XvpnViewZoomPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackViewMap | +| | +\------------------------------------------------------------*/ + +void CallbackViewMap( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnEnterMapPanel(); + + autend(); +} diff --git a/alliance/src/xvpn/src/XMV_menu.h b/alliance/src/xvpn/src/XMV_menu.h new file mode 100644 index 00000000..c77e037b --- /dev/null +++ b/alliance/src/xvpn/src/XMV_menu.h @@ -0,0 +1,82 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_VIEW_MENU +# define XVPN_VIEW_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback View Menu | +| | +\------------------------------------------------------------*/ + + + extern void CallbackViewZoom(); + extern void CallbackViewGrid(); + extern void CallbackViewLayer(); + extern void CallbackViewMap(); + extern void CallbackViewArrows(); + +# endif diff --git a/alliance/src/xvpn/src/XMV_message.c b/alliance/src/xvpn/src/XMV_message.c new file mode 100644 index 00000000..8fc24f7d --- /dev/null +++ b/alliance/src/xvpn/src/XMV_message.c @@ -0,0 +1,155 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Message.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XMX.h" +# include "XTB.h" +# include "XMV.h" +# include "XMV_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnPromptZoomIn | +| | +\------------------------------------------------------------*/ + +void XvpnPromptZoomIn() + +{ + autbegin(); + + XvpnDisplayMessage( XVPN_MESSAGE_MODE, "Zoom In" ); + XvpnDisplayMessage( XVPN_MESSAGE_INFO, "Select window" ); + + switch ( XvpnCountEventZoom ) + { + case 0 : + + XvpnDisplayMessage( XVPN_MESSAGE_PROMPT, "Enter first corner" ); + + break; + + case 1 : + + XvpnDisplayMessage( XVPN_MESSAGE_PROMPT, "Enter second corner" ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnPromptZoomPan | +| | +\------------------------------------------------------------*/ + +void XvpnPromptZoomPan() + +{ + autbegin(); + + XvpnDisplayMessage( XVPN_MESSAGE_MODE, "Zoom Pan" ); + XvpnDisplayMessage( XVPN_MESSAGE_INFO, "Select line" ); + + switch ( XvpnCountEventZoom ) + { + case 0 : + + XvpnDisplayMessage( XVPN_MESSAGE_PROMPT, "Enter source point" ); + + break; + + case 1 : + + XvpnDisplayMessage( XVPN_MESSAGE_PROMPT, "Enter target point" ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnPromptZoomCenter | +| | +\------------------------------------------------------------*/ + +void XvpnPromptZoomCenter() + +{ + autbegin(); + + XvpnDisplayMessage( XVPN_MESSAGE_MODE, "Zoom Center" ); + XvpnDisplayMessage( XVPN_MESSAGE_INFO, "Select point" ); + XvpnDisplayMessage( XVPN_MESSAGE_PROMPT, "Enter center point" ); + + autend(); +} + diff --git a/alliance/src/xvpn/src/XMV_message.h b/alliance/src/xvpn/src/XMV_message.h new file mode 100644 index 00000000..cc9f9a62 --- /dev/null +++ b/alliance/src/xvpn/src/XMV_message.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Message.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_MESSAGE +# define XVPN_MESSAGE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnPromptZoomIn(); + extern void XvpnPromptZoomCenter(); + extern void XvpnPromptZoomPan(); + +# endif diff --git a/alliance/src/xvpn/src/XMV_panel.c b/alliance/src/xvpn/src/XMV_panel.c new file mode 100644 index 00000000..4992d70f --- /dev/null +++ b/alliance/src/xvpn/src/XMV_panel.c @@ -0,0 +1,2040 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XMV.h" + +# include "XMV_panel.h" +# include "XMV_dialog.h" +# include "XMV_view.h" +# include "XMV_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Panel Pixmap | +| | +\------------------------------------------------------------*/ + + static char XvpnPixmapDownArrow[] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xfe, 0xff, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, + 0x00, 0x02, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, + 0x00, 0x02, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, + 0xf0, 0x03, 0x80, 0x1f, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, + 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x20, 0x00, 0x00, 0x08, + 0x40, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, + 0x00, 0x02, 0x80, 0x00, 0x00, 0x04, 0x40, 0x00, 0x00, 0x08, 0x20, 0x00, + 0x00, 0x10, 0x10, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x40, 0x04, 0x00, + 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + static char XvpnPixmapLeftArrow[] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x0f, 0x00, 0x00, 0x40, 0x08, 0x00, 0x00, 0x20, 0x08, 0x00, + 0x00, 0x10, 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x04, 0xf8, 0x1f, + 0x00, 0x02, 0x00, 0x10, 0x00, 0x01, 0x00, 0x10, 0x80, 0x00, 0x00, 0x10, + 0x40, 0x00, 0x00, 0x10, 0x20, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, + 0x08, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x20, 0x00, 0x00, 0x10, + 0x40, 0x00, 0x00, 0x10, 0x80, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00, 0x10, + 0x00, 0x02, 0x00, 0x10, 0x00, 0x04, 0xf8, 0x1f, 0x00, 0x08, 0x08, 0x00, + 0x00, 0x10, 0x08, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x40, 0x08, 0x00, + 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + static char XvpnPixmapRightArrow[] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xf0, 0x01, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x10, 0x04, 0x00, + 0x00, 0x10, 0x08, 0x00, 0x00, 0x10, 0x10, 0x00, 0xf8, 0x1f, 0x20, 0x00, + 0x08, 0x00, 0x40, 0x00, 0x08, 0x00, 0x80, 0x00, 0x08, 0x00, 0x00, 0x01, + 0x08, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x04, 0x08, 0x00, 0x00, 0x08, + 0x08, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x04, + 0x08, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x01, 0x08, 0x00, 0x80, 0x00, + 0x08, 0x00, 0x40, 0x00, 0xf8, 0x1f, 0x20, 0x00, 0x00, 0x10, 0x10, 0x00, + 0x00, 0x10, 0x08, 0x00, 0x00, 0x10, 0x04, 0x00, 0x00, 0x10, 0x02, 0x00, + 0x00, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + static char XvpnPixmapUpArrow[] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x20, 0x02, 0x00, + 0x00, 0x10, 0x04, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x04, 0x10, 0x00, + 0x00, 0x02, 0x20, 0x00, 0x00, 0x01, 0x40, 0x00, 0x80, 0x00, 0x80, 0x00, + 0x40, 0x00, 0x00, 0x01, 0x20, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x04, + 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x08, + 0x08, 0x00, 0x00, 0x08, 0xf8, 0x01, 0xc0, 0x0f, 0x00, 0x01, 0x40, 0x00, + 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x40, 0x00, + 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x40, 0x00, + 0x00, 0x01, 0x40, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + +/*------------------------------------------------------------\ +| | +| Panel Arrows | +| | +\------------------------------------------------------------*/ + + static char *XvpnPanelArrowsButtonName[] = + + { + "Left", + "Up", + "Down", + "Right", + "Move Set", + "Close" + }; + + static XvpnPanelButtonItem XvpnViewArrowsButton[] = + + { + { + &XvpnPanelArrowsButtonName[0], + NULL, XvpnPixmapLeftArrow, 32, 32, + NULL, + NULL, + 0, 0, + 1, 2, + CallbackLeftArrow, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnPanelArrowsButtonName[1], + NULL, XvpnPixmapUpArrow, 32, 32, + NULL, + NULL, + 1, 0, + 1, 2, + CallbackUpArrow, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnPanelArrowsButtonName[2], + NULL, XvpnPixmapDownArrow, 32, 32, + NULL, + NULL, + 0, 2, + 1, 2, + CallbackDownArrow, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnPanelArrowsButtonName[3], + NULL, XvpnPixmapRightArrow, 32, 32, + NULL, + NULL, + 1, 2, + 1, 2, + CallbackRightArrow, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnPanelArrowsButtonName[4], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 4, + 2, 1, + CallbackMoveSet, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnPanelArrowsButtonName[5], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 5, + 2, 1, + CallbackCloseArrows, + (XtPointer)NULL, + (Widget)NULL + } + , + { NULL } + }; + + XvpnPanelItem XvpnViewArrowsPanel = + + { + "Arrows", + 1, + 0, + XVPN_VIEW_ARROWS_X, + XVPN_VIEW_ARROWS_Y, + 100, + 125, + 2, + 6, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XvpnViewArrowsButton + }; + + int XvpnViewArrowsDefaultValues[ 5 ] = + + { + XVPN_VIEW_ARROWS_X, + XVPN_VIEW_ARROWS_Y, + 100, 125 , 1 + }; + +/*------------------------------------------------------------\ +| | +| Panel Zoom | +| | +\------------------------------------------------------------*/ + + static char *XvpnPanelZoomButtonName[] = + + { + "Refresh", + "UnZoom", + "Zoom", + "Mooz", + "Zoom Set", + "Zoom In", + "Center", + "Goto", + "Pan", + "Fit", + "Close" + }; + + + XvpnPanelButtonItem XvpnViewZoomButton[] = + + { + { + &XvpnPanelZoomButtonName[0], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackZoomRefresh, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnPanelZoomButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 1, + 1, 1, + CallbackZoomPrevious, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnPanelZoomButtonName[2], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 2, + 1, 1, + CallbackZoomMore, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnPanelZoomButtonName[3], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 3, + 1, 1, + CallbackZoomLess, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnPanelZoomButtonName[4], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 4, + 1, 1, + CallbackZoomSet, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnPanelZoomButtonName[5], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 5, + 1, 1, + CallbackZoomIn, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnPanelZoomButtonName[6], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 6, + 1, 1, + CallbackZoomCenter, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnPanelZoomButtonName[7], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 7, + 1, 1, + CallbackZoomGoto, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnPanelZoomButtonName[8], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 8, + 1, 1, + CallbackZoomPan, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnPanelZoomButtonName[9], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 9, + 1, 1, + CallbackZoomFit, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnPanelZoomButtonName[10], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 10, + 1, 1, + CallbackCloseZoom, + (XtPointer)NULL, + (Widget)NULL + } + , + { NULL } + }; + + XvpnPanelItem XvpnViewZoomPanel = + + { + "Zoom", + 1, + 0, + XVPN_VIEW_ZOOM_X, + XVPN_VIEW_ZOOM_Y, + 100, + 275, + 1, + 11, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XvpnViewZoomButton + }; + + int XvpnViewZoomDefaultValues[ 5 ] = + + { + XVPN_VIEW_ZOOM_X, + XVPN_VIEW_ZOOM_Y, + 100, 275, 1 + }; + +/*------------------------------------------------------------\ +| | +| Panel Grid | +| | +\------------------------------------------------------------*/ + + static char *XvpnPanelGridButtonName[] = + + { + "Grid X", + "Grid Y", + "Grid Off", + "Close" + }; + + + XvpnPanelButtonItem XvpnViewGridButton[] = + + { + { + &XvpnPanelGridButtonName[0], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackSetGridX, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnPanelGridButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 1, + 1, 1, + CallbackSetGridY, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnPanelGridButtonName[2], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 2, + 1, 1, + CallbackGridOnOff, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnPanelGridButtonName[3], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 3, + 1, 1, + CallbackCloseGrid, + (XtPointer)NULL, + (Widget)NULL + } + , + { NULL } + }; + + XvpnPanelItem XvpnViewGridPanel = + + { + "Grid", + 1, + 0, + XVPN_VIEW_GRID_X, + XVPN_VIEW_GRID_Y, + 100, + 100, + 1, + 4, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XvpnViewGridButton + }; + + int XvpnViewGridDefaultValues[ 5 ] = + + { + XVPN_VIEW_GRID_X, + XVPN_VIEW_GRID_Y, + 100, 100, 0 + }; + +/*------------------------------------------------------------\ +| | +| Panel Layer | +| | +\------------------------------------------------------------*/ + + static char *XvpnViewLayerButtonBackground = "Black"; + static char *XvpnViewLayerButtonForeground = "White"; + + static char *XvpnPanelLayerButtonName[] = + + { + "All visible", + "All invisible", + "Place Text", + "Trans Text", + "Apply", + "Close" + }; + + static char *XvpnViewLayerCursorType[] = + + { + "Invert", + "Xor" + }; + + static char *XvpnViewLayerForceDisplay[] = + + { + "Quick display", + "Force display" + }; + + XvpnPanelButtonItem XvpnViewLayerButton[] = + + { + { + &XvpnPanelLayerButtonName[0], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 0, + 1, 1, + CallbackLayerAllVisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnPanelLayerButtonName[1], + NULL, NULL, 0, 0, + NULL, + NULL, + 1, 0, + 1, 1, + CallbackLayerAllInvisible, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XVPN_LAYER_NAME_TABLE[ 0 ][ 0 ], + NULL, NULL, 0, 0, + &XVPN_LAYER_NAME_TABLE[ 0 ][ 1 ], + &XVPN_LAYER_NAME_TABLE[ 0 ][ 2 ], + 0, 1, + 1, 1, + CallbackLayerVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + &XVPN_LAYER_NAME_TABLE[ 0 ][ 0 ], + NULL, NULL, 0, 0, + &XVPN_LAYER_NAME_TABLE[ 0 ][ 1 ], + &XVPN_LAYER_NAME_TABLE[ 0 ][ 2 ], + 1, 1, + 1, 1, + CallbackLayerInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + &XVPN_LAYER_NAME_TABLE[ 1 ][ 0 ], + NULL, NULL, 0, 0, + &XVPN_LAYER_NAME_TABLE[ 1 ][ 1 ], + &XVPN_LAYER_NAME_TABLE[ 1 ][ 2 ], + 0, 2, + 1, 1, + CallbackLayerVisible, + (XtPointer)1, + (Widget)NULL + } + , + { + &XVPN_LAYER_NAME_TABLE[ 1 ][ 0 ], + NULL, NULL, 0, 0, + &XVPN_LAYER_NAME_TABLE[ 1 ][ 1 ], + &XVPN_LAYER_NAME_TABLE[ 1 ][ 2 ], + 1, 2, + 1, 1, + CallbackLayerInvisible, + (XtPointer)1, + (Widget)NULL + } + , + { + &XVPN_LAYER_NAME_TABLE[ 2 ][ 0 ], + NULL, NULL, 0, 0, + &XVPN_LAYER_NAME_TABLE[ 2 ][ 1 ], + &XVPN_LAYER_NAME_TABLE[ 2 ][ 2 ], + 0, 3, + 1, 1, + CallbackLayerVisible, + (XtPointer)2, + (Widget)NULL + } + , + { + &XVPN_LAYER_NAME_TABLE[ 2 ][ 0 ], + NULL, NULL, 0, 0, + &XVPN_LAYER_NAME_TABLE[ 2 ][ 1 ], + &XVPN_LAYER_NAME_TABLE[ 2 ][ 2 ], + 1, 3, + 1, 1, + CallbackLayerInvisible, + (XtPointer)2, + (Widget)NULL + } + , + { + &XVPN_LAYER_NAME_TABLE[ 3 ][ 0 ], + NULL, NULL, 0, 0, + &XVPN_LAYER_NAME_TABLE[ 3 ][ 1 ], + &XVPN_LAYER_NAME_TABLE[ 3 ][ 2 ], + 0, 4, + 1, 1, + CallbackLayerVisible, + (XtPointer)3, + (Widget)NULL + } + , + { + &XVPN_LAYER_NAME_TABLE[ 3 ][ 0 ], + NULL, NULL, 0, 0, + &XVPN_LAYER_NAME_TABLE[ 3 ][ 1 ], + &XVPN_LAYER_NAME_TABLE[ 3 ][ 2 ], + 1, 4, + 1, 1, + CallbackLayerInvisible, + (XtPointer)3, + (Widget)NULL + } + , + { + &XVPN_LAYER_NAME_TABLE[ 4 ][ 0 ], + NULL, NULL, 0, 0, + &XVPN_LAYER_NAME_TABLE[ 4 ][ 1 ], + &XVPN_LAYER_NAME_TABLE[ 4 ][ 2 ], + 0, 5, + 1, 1, + CallbackLayerVisible, + (XtPointer)4, + (Widget)NULL + } + , + { + &XVPN_LAYER_NAME_TABLE[ 4 ][ 0 ], + NULL, NULL, 0, 0, + &XVPN_LAYER_NAME_TABLE[ 4 ][ 1 ], + &XVPN_LAYER_NAME_TABLE[ 4 ][ 2 ], + 1, 5, + 1, 1, + CallbackLayerInvisible, + (XtPointer)4, + (Widget)NULL + } + , + { + &XVPN_LAYER_NAME_TABLE[ 5 ][ 0 ], + NULL, NULL, 0, 0, + &XVPN_LAYER_NAME_TABLE[ 5 ][ 1 ], + &XVPN_LAYER_NAME_TABLE[ 5 ][ 2 ], + 0, 6, + 1, 1, + CallbackLayerVisible, + (XtPointer)5, + (Widget)NULL + } + , + { + &XVPN_LAYER_NAME_TABLE[ 5 ][ 0 ], + NULL, NULL, 0, 0, + &XVPN_LAYER_NAME_TABLE[ 5 ][ 1 ], + &XVPN_LAYER_NAME_TABLE[ 5 ][ 2 ], + 1, 6, + 1, 1, + CallbackLayerInvisible, + (XtPointer)5, + (Widget)NULL + } + , + { + &XVPN_LAYER_NAME_TABLE[ 6 ][ 0 ], + NULL, NULL, 0, 0, + &XVPN_LAYER_NAME_TABLE[ 6 ][ 1 ], + &XVPN_LAYER_NAME_TABLE[ 6 ][ 2 ], + 0, 7, + 1, 1, + CallbackLayerVisible, + (XtPointer)6, + (Widget)NULL + } + , + { + &XVPN_LAYER_NAME_TABLE[ 6 ][ 0 ], + NULL, NULL, 0, 0, + &XVPN_LAYER_NAME_TABLE[ 6 ][ 1 ], + &XVPN_LAYER_NAME_TABLE[ 6 ][ 2 ], + 1, 7, + 1, 1, + CallbackLayerInvisible, + (XtPointer)6, + (Widget)NULL + } + , + { + &XVPN_LAYER_NAME_TABLE[ 7 ][ 0 ], + NULL, NULL, 0, 0, + &XVPN_LAYER_NAME_TABLE[ 7 ][ 1 ], + &XVPN_LAYER_NAME_TABLE[ 7 ][ 2 ], + 0, 8, + 1, 1, + CallbackLayerVisible, + (XtPointer)7, + (Widget)NULL + } + , + { + &XVPN_LAYER_NAME_TABLE[ 7 ][ 0 ], + NULL, NULL, 0, 0, + &XVPN_LAYER_NAME_TABLE[ 7 ][ 1 ], + &XVPN_LAYER_NAME_TABLE[ 7 ][ 2 ], + 1, 8, + 1, 1, + CallbackLayerInvisible, + (XtPointer)7, + (Widget)NULL + } + , + { + &XVPN_LAYER_NAME_TABLE[ 8 ][ 0 ], + NULL, NULL, 0, 0, + &XVPN_LAYER_NAME_TABLE[ 8 ][ 1 ], + &XVPN_LAYER_NAME_TABLE[ 8 ][ 2 ], + 0, 9, + 1, 1, + CallbackLayerVisible, + (XtPointer)8, + (Widget)NULL + } + , + { + &XVPN_LAYER_NAME_TABLE[ 8 ][ 0 ], + NULL, NULL, 0, 0, + &XVPN_LAYER_NAME_TABLE[ 8 ][ 1 ], + &XVPN_LAYER_NAME_TABLE[ 8 ][ 2 ], + 1, 9, + 1, 1, + CallbackLayerInvisible, + (XtPointer)8, + (Widget)NULL + } + , + { + &XVPN_LAYER_NAME_TABLE[ 9 ][ 0 ], + NULL, NULL, 0, 0, + &XVPN_LAYER_NAME_TABLE[ 9 ][ 1 ], + &XVPN_LAYER_NAME_TABLE[ 9 ][ 2 ], + 0, 10, + 1, 1, + CallbackLayerVisible, + (XtPointer)9, + (Widget)NULL + } + , + { + &XVPN_LAYER_NAME_TABLE[ 9 ][ 0 ], + NULL, NULL, 0, 0, + &XVPN_LAYER_NAME_TABLE[ 9 ][ 1 ], + &XVPN_LAYER_NAME_TABLE[ 9 ][ 2 ], + 1, 10, + 1, 1, + CallbackLayerInvisible, + (XtPointer)9, + (Widget)NULL + } + , + { + &XvpnPanelLayerButtonName[2], + NULL, NULL, 0, 0, + &XvpnViewLayerButtonForeground, + &XvpnViewLayerButtonBackground, + 0, 11, + 1, 1, + CallbackNameVisible, + (XtPointer)0, + (Widget)NULL + } + , + { + &XvpnPanelLayerButtonName[2], + NULL, NULL, 0, 0, + &XvpnViewLayerButtonForeground, + &XvpnViewLayerButtonBackground, + 1, 11, + 1, 1, + CallbackNameInvisible, + (XtPointer)0, + (Widget)NULL + } + , + { + &XvpnPanelLayerButtonName[3], + NULL, NULL, 0, 0, + &XvpnViewLayerButtonForeground, + &XvpnViewLayerButtonBackground, + 0, 12, + 1, 1, + CallbackNameVisible, + (XtPointer)1, + (Widget)NULL + } + , + { + &XvpnPanelLayerButtonName[3], + NULL, NULL, 0, 0, + &XvpnViewLayerButtonForeground, + &XvpnViewLayerButtonBackground, + 1, 12, + 1, 1, + CallbackNameInvisible, + (XtPointer)1, + (Widget)NULL + } + , + { + &XvpnViewLayerCursorType[0], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 13, + 1, 1, + CallbackLayerCursor, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnViewLayerForceDisplay[0], + NULL, NULL, 0, 0, + NULL, + NULL, + 1, 13, + 1, 1, + CallbackLayerForceDisplay, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnPanelLayerButtonName[4], + NULL, NULL, 0, 0, + NULL, + NULL, + 0, 14, + 1, 1, + CallbackLayerApply, + (XtPointer)NULL, + (Widget)NULL + } + , + { + &XvpnPanelLayerButtonName[5], + NULL, NULL, 0, 0, + NULL, + NULL, + 1, 14, + 1, 1, + CallbackCloseLayer, + (XtPointer)NULL, + (Widget)NULL + } + , + { NULL } + }; + + XvpnPanelItem XvpnViewLayerPanel = + + { + "Layer", + 1, + 0, + XVPN_VIEW_LAYER_X, + XVPN_VIEW_LAYER_Y, + 200, + 375, + 2, + 15, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + (Widget)NULL, + XvpnViewLayerButton + }; + + int XvpnViewLayerDefaultValues[ 5 ] = + + { + XVPN_VIEW_LAYER_X, + XVPN_VIEW_LAYER_Y, + 200, 375, 0 + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback For Arrows | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackLeftArrow | +| | +\------------------------------------------------------------*/ + +void CallbackLeftArrow( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnZoomLeft(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackRightArrow | +| | +\------------------------------------------------------------*/ + +void CallbackRightArrow( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnZoomRight(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackUpArrow | +| | +\------------------------------------------------------------*/ + +void CallbackUpArrow( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnZoomUp(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackDownArrow | +| | +\------------------------------------------------------------*/ + +void CallbackDownArrow( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnZoomDown(); + + autend(); +} + + +/*------------------------------------------------------------\ +| | +| CallbackMoveSet | +| | +\------------------------------------------------------------*/ + +void CallbackMoveSet( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnEnterDialog( &XvpnViewMoveSetDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCloseArrows | +| | +\------------------------------------------------------------*/ + +void CallbackCloseArrows( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnExitPanel( &XvpnViewArrowsPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Zoom Callback | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackZoomRefresh | +| | +\------------------------------------------------------------*/ + +void CallbackZoomRefresh( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnZoomRefresh(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomPrevious | +| | +\------------------------------------------------------------*/ + +void CallbackZoomPrevious( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnZoomUndo(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomLess | +| | +\------------------------------------------------------------*/ + +void CallbackZoomLess( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnZoomLess(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomMore | +| | +\------------------------------------------------------------*/ + +void CallbackZoomMore( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnZoomMore(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomSet | +| | +\------------------------------------------------------------*/ + +void CallbackZoomSet( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnEnterDialog( &XvpnViewZoomSetDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCloseZoom | +| | +\------------------------------------------------------------*/ + +void CallbackCloseZoom( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnExitPanel( &XvpnViewZoomPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomIn | +| | +\------------------------------------------------------------*/ + +void CallbackZoomIn( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnChangeEditMode( XVPN_ZOOM_IN, + XvpnPromptZoomIn ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomCenter | +| | +\------------------------------------------------------------*/ + +void CallbackZoomCenter( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnChangeEditMode( XVPN_ZOOM_CENTER, + XvpnPromptZoomCenter ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomGoto | +| | +\------------------------------------------------------------*/ + +void CallbackZoomGoto( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnEnterDialog( &XvpnViewZoomGotoDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomPan | +| | +\------------------------------------------------------------*/ + +void CallbackZoomPan( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnChangeEditMode( XVPN_ZOOM_PAN, + XvpnPromptZoomPan ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackZoomFit | +| | +\------------------------------------------------------------*/ + +void CallbackZoomFit( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnZoomFit(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Grid | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackSetGridX | +| | +\------------------------------------------------------------*/ + +void CallbackSetGridX( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnEnterDialog( &XvpnViewGridXDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackSetGridY | +| | +\------------------------------------------------------------*/ + +void CallbackSetGridY( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnEnterDialog( &XvpnViewGridYDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackGridOnOff | +| | +\------------------------------------------------------------*/ + +void CallbackGridOnOff( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + XmString Label; + + autbegin(); + + XvpnUnitUserGrid = ! XvpnUnitUserGrid; + + if ( XvpnUnitUserGrid == XVPN_FALSE ) + { + Label = XmStringCreateSimple( "Grid Off" ); + } + else + { + Label = XmStringCreateSimple( "Grid On" ); + } + + XtVaSetValues( MyWidget, XmNlabelString, Label, + XmNresizable , False, + NULL ); + XmStringFree( Label ); + + XvpnZoomRefresh(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCloseGrid | +| | +\------------------------------------------------------------*/ + +void CallbackCloseGrid( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnExitPanel( &XvpnViewGridPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Callback For Layer | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| CallbackLayerAllVisible | +| | +\------------------------------------------------------------*/ + +void CallbackLayerAllVisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnLayerAllVisible(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerAllInvisible | +| | +\------------------------------------------------------------*/ + +void CallbackLayerAllInvisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnLayerAllInvisible(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerVisible | +| | +\------------------------------------------------------------*/ + +void CallbackLayerVisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + if ( XVPN_ACTIVE_LAYER_TABLE[ (int)ClientData ] == 0 ) + { + XvpnSetLayerVisible( (int)ClientData ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerInvisible | +| | +\------------------------------------------------------------*/ + +void CallbackLayerInvisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + if ( XVPN_ACTIVE_LAYER_TABLE[ (int)ClientData ] ) + { + XvpnSetLayerInvisible( (int)ClientData ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackNameVisible | +| | +\------------------------------------------------------------*/ + +void CallbackNameVisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + if ( XVPN_ACTIVE_NAME_TABLE[ (int)ClientData ] == 0 ) + { + XvpnSetNameVisible( ClientData ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackNameInvisible | +| | +\------------------------------------------------------------*/ + +void CallbackNameInvisible( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + if ( XVPN_ACTIVE_NAME_TABLE[ (int)ClientData ] ) + { + XvpnSetNameInvisible( ClientData ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerCursor | +| | +\------------------------------------------------------------*/ + +void CallbackLayerCursor( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XVPN_XOR_CURSOR = ! XVPN_XOR_CURSOR; + XvpnChangeCursor( XVPN_XOR_CURSOR ); + + XvpnChangeCursorContext(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerForceDisplay | +| | +\------------------------------------------------------------*/ + +void CallbackLayerForceDisplay( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XVPN_FORCE_DISPLAY = ! XVPN_FORCE_DISPLAY; + XvpnChangeForceDisplay( XVPN_FORCE_DISPLAY ); + + autend(); +} + + +/*------------------------------------------------------------\ +| | +| XvpnChangeCursor | +| | +\------------------------------------------------------------*/ + +void XvpnChangeCursor( Type ) + + char Type; +{ + int Pos; + XmString Label; + + autbegin(); + + Pos = 2 + ( ( XVPN_MAX_LAYER + XVPN_MAX_ACTIVE_NAME ) << 1 ); + Label = XmStringCreateSimple( XvpnViewLayerCursorType[ Type ] ); + + XtVaSetValues( XvpnViewLayerButton[ Pos ].BUTTON, + XmNlabelString, Label, + XmNresizable , False, + NULL ); + + XmStringFree( Label ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnChangeForceDisplay | +| | +\------------------------------------------------------------*/ + +void XvpnChangeForceDisplay( Index ) + + char Index; +{ + int Pos; + XmString Label; + + autbegin(); + + Pos = 3 + ( ( XVPN_MAX_LAYER + XVPN_MAX_ACTIVE_NAME ) << 1 ); + Label = XmStringCreateSimple( XvpnViewLayerForceDisplay[ Index ] ); + + XtVaSetValues( XvpnViewLayerButton[ Pos ].BUTTON, + XmNlabelString, Label, + XmNresizable , False, + NULL ); + + XmStringFree( Label ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackLayerApply | +| | +\------------------------------------------------------------*/ + +void CallbackLayerApply( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnZoomRefresh(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackCloseLayer | +| | +\------------------------------------------------------------*/ + +void CallbackCloseLayer( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + autbegin(); + + XvpnExitPanel( &XvpnViewLayerPanel ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnSetLayerVisible | +| | +\------------------------------------------------------------*/ + +void XvpnSetLayerVisible( Layer ) + + int Layer; +{ + int Index; + char *Background; + char *Foreground; + + autbegin(); + + Index = ( Layer << 1 ) + 2; + + if ( XvpnViewLayerButton[ Index ].BUTTON != NULL ) + { + XVPN_ACTIVE_LAYER_TABLE[ Layer ] = 1; + + XtVaSetValues( XvpnViewLayerButton[ Index + 1 ].BUTTON, + XtVaTypedArg , + XmNbackground , + XmRString , + XVPN_BLACK_COLOR_NAME , + strlen( XVPN_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + XtVaSetValues( XvpnViewLayerButton[ Index + 1 ].BUTTON, + XtVaTypedArg , + XmNforeground , + XmRString , + XVPN_BLACK_COLOR_NAME , + strlen( XVPN_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + Background = *XvpnViewLayerButton[ Index ].BACKGROUND; + Foreground = *XvpnViewLayerButton[ Index ].FOREGROUND; + + XtVaSetValues( XvpnViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNbackground , + XmRString , + Background , + strlen( Background ) + 1, + NULL + ); + + XtVaSetValues( XvpnViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNforeground , + XmRString , + Foreground , + strlen( Foreground ) + 1, + NULL + ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnSetNameVisible | +| | +\------------------------------------------------------------*/ + +void XvpnSetNameVisible( Name ) + + int Name; +{ + int Index; + char *Background; + char *Foreground; + + autbegin(); + + Index = 2 + ( ( XVPN_MAX_LAYER + Name ) << 1 ); + + if ( XvpnViewLayerButton[ Index ].BUTTON != NULL ) + { + XVPN_ACTIVE_NAME_TABLE[ Name ] = 1; + + XtVaSetValues( XvpnViewLayerButton[ Index + 1 ].BUTTON, + XtVaTypedArg , + XmNbackground , + XmRString , + XVPN_BLACK_COLOR_NAME , + strlen( XVPN_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + XtVaSetValues( XvpnViewLayerButton[ Index + 1 ].BUTTON, + XtVaTypedArg , + XmNforeground , + XmRString , + XVPN_BLACK_COLOR_NAME , + strlen( XVPN_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + Background = *XvpnViewLayerButton[ Index ].BACKGROUND; + Foreground = *XvpnViewLayerButton[ Index ].FOREGROUND; + + XtVaSetValues( XvpnViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNbackground , + XmRString , + Background , + strlen( Background ) + 1, + NULL + ); + + XtVaSetValues( XvpnViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNforeground , + XmRString , + Foreground , + strlen( Foreground ) + 1, + NULL + ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnSetLayerInvisible | +| | +\------------------------------------------------------------*/ + +void XvpnSetLayerInvisible( Layer ) + + int Layer; +{ + int Index; + char *Background; + char *Foreground; + + autbegin(); + + Index = 3 + ( Layer << 1 ); + + if ( XvpnViewLayerButton[ Index ].BUTTON != NULL ) + { + XVPN_ACTIVE_LAYER_TABLE[ Layer ] = 0; + + XtVaSetValues( XvpnViewLayerButton[ Index - 1 ].BUTTON, + XtVaTypedArg , + XmNbackground , + XmRString , + XVPN_BLACK_COLOR_NAME , + strlen( XVPN_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + XtVaSetValues( XvpnViewLayerButton[ Index - 1 ].BUTTON, + XtVaTypedArg , + XmNforeground , + XmRString , + XVPN_BLACK_COLOR_NAME , + strlen( XVPN_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + Background = *XvpnViewLayerButton[ Index ].BACKGROUND; + Foreground = *XvpnViewLayerButton[ Index ].FOREGROUND; + + XtVaSetValues( XvpnViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNbackground , + XmRString , + Background , + strlen( Background ) + 1 , + NULL + ); + + XtVaSetValues( XvpnViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNforeground , + XmRString , + Foreground , + strlen( Foreground ) + 1 , + NULL + ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnSetNameInvisible | +| | +\------------------------------------------------------------*/ + +void XvpnSetNameInvisible( Name ) + + int Name; +{ + int Index; + char *Background; + char *Foreground; + + autbegin(); + + Index = 3 + ( ( XVPN_MAX_LAYER + Name ) << 1 ); + + if ( XvpnViewLayerButton[ Index ].BUTTON != NULL ) + { + XVPN_ACTIVE_NAME_TABLE[ Name ] = 0; + + XtVaSetValues( XvpnViewLayerButton[ Index - 1 ].BUTTON, + XtVaTypedArg , + XmNbackground , + XmRString , + XVPN_BLACK_COLOR_NAME , + strlen( XVPN_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + XtVaSetValues( XvpnViewLayerButton[ Index - 1 ].BUTTON, + XtVaTypedArg , + XmNforeground , + XmRString , + XVPN_BLACK_COLOR_NAME , + strlen( XVPN_BLACK_COLOR_NAME ) + 1 , + NULL + ); + + Background = *XvpnViewLayerButton[ Index ].BACKGROUND; + Foreground = *XvpnViewLayerButton[ Index ].FOREGROUND; + + XtVaSetValues( XvpnViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNbackground , + XmRString , + Background , + strlen( Background ) + 1 , + NULL + ); + + XtVaSetValues( XvpnViewLayerButton[ Index ].BUTTON , + XtVaTypedArg , + XmNforeground , + XmRString , + Foreground , + strlen( Foreground ) + 1 , + NULL + ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnLayerAllVisible | +| | +\------------------------------------------------------------*/ + +void XvpnLayerAllVisible() + +{ + int Index; + + autbegin(); + + for ( Index = 0; Index < XVPN_MAX_LAYER; Index++ ) + { + XvpnSetLayerVisible( Index ); + } + + for ( Index = 0; Index < XVPN_MAX_ACTIVE_NAME; Index++ ) + { + XvpnSetNameVisible( Index ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnInitializeLayer | +| | +\------------------------------------------------------------*/ + +void XvpnInitializeLayer() + +{ + int Index; + + autbegin(); + + for ( Index = 0; Index < XVPN_MAX_LAYER; Index++ ) + { + if ( XVPN_ACTIVE_LAYER_TABLE[ Index ] == 0 ) + { + XvpnSetLayerInvisible( Index ); + } + else + { + XvpnSetLayerVisible( Index ); + } + } + + for ( Index = 0; Index < XVPN_MAX_ACTIVE_NAME; Index++ ) + { + if ( XVPN_ACTIVE_NAME_TABLE[ Index ] == 0 ) + { + XvpnSetNameInvisible( Index ); + } + else + { + XvpnSetNameVisible( Index ); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnLayerAllInvisible | +| | +\------------------------------------------------------------*/ + +void XvpnLayerAllInvisible() + +{ + int Index; + + autbegin(); + + for ( Index = 0; Index < XVPN_MAX_LAYER; Index++ ) + { + XvpnSetLayerInvisible( Index ); + } + + for ( Index = 0; Index < XVPN_MAX_ACTIVE_NAME; Index++ ) + { + XvpnSetNameInvisible( Index ); + } + + autend(); +} diff --git a/alliance/src/xvpn/src/XMV_panel.h b/alliance/src/xvpn/src/XMV_panel.h new file mode 100644 index 00000000..f45f375f --- /dev/null +++ b/alliance/src/xvpn/src/XMV_panel.h @@ -0,0 +1,131 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_VIEW_PANEL +# define XVPN_VIEW_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XVPN_VIEW_ARROWS_X 990 +# define XVPN_VIEW_ARROWS_Y 80 +# define XVPN_VIEW_ZOOM_X 990 +# define XVPN_VIEW_ZOOM_Y 230 +# define XVPN_VIEW_GRID_X 470 +# define XVPN_VIEW_GRID_Y 330 +# define XVPN_VIEW_LAYER_X 430 +# define XVPN_VIEW_LAYER_Y 190 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Callback View Panel | +| | +\------------------------------------------------------------*/ + + extern void CallbackLeftArrow(); + extern void CallbackRightArrow(); + extern void CallbackUpArrow(); + extern void CallbackDownArrow(); + extern void CallbackMoveSet(); + extern void CallbackCloseArrows(); + + extern void CallbackZoomRefresh(); + extern void CallbackZoomPrevious(); + extern void CallbackZoomLess(); + extern void CallbackZoomMore(); + extern void CallbackZoomSet(); + extern void CallbackZoomIn(); + extern void CallbackZoomFit(); + extern void CallbackZoomCenter(); + extern void CallbackZoomGoto(); + extern void CallbackZoomPan(); + extern void CallbackCloseZoom(); + + extern void CallbackSetGridX(); + extern void CallbackSetGridY(); + extern void CallbackGridOnOff(); + extern void CallbackCloseGrid(); + + extern void CallbackLayerAllVisible(); + extern void CallbackLayerAllInvisible(); + extern void CallbackLayerVisible(); + extern void CallbackLayerInvisible(); + extern void CallbackNameVisible(); + extern void CallbackNameInvisible(); + extern void CallbackLayerApply(); + extern void CallbackLayerCursor(); + extern void CallbackLayerForceDisplay(); + extern void CallbackLayerApply(); + extern void CallbackCloseLayer(); + + extern void XvpnChangeForceDisplay(); + extern void XvpnChangeCursor(); + + extern void XvpnSetLayerVisible(); + extern void XvpnSetLayerInvisible(); + extern void XvpnSetNameVisible(); + extern void XvpnSetNameInvisible(); + extern void XvpnLayerAllVisible(); + extern void XvpnLayerAllInvisible(); + +# endif diff --git a/alliance/src/xvpn/src/XMV_view.c b/alliance/src/xvpn/src/XMV_view.c new file mode 100644 index 00000000..5f05421c --- /dev/null +++ b/alliance/src/xvpn/src/XMV_view.c @@ -0,0 +1,672 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : View.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" +# include "XSB.h" +# include "XTB.h" +# include "XVP.h" +# include "XMX.h" +# include "XMV.h" + +# include "XMV_view.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + xvpnzoom *XvpnHeadZoom = (xvpnzoom *)NULL; + + int XvpnPercentZoom = XVPN_PERCENT_ZOOM; + int XvpnPercentMoveX = XVPN_PERCENT_MOVE; + int XvpnPercentMoveY = XVPN_PERCENT_MOVE; + +/*------------------------------------------------------------\ +| | +| Menu | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnAllocZoom | +| | +\------------------------------------------------------------*/ + +xvpnzoom *XvpnAllocZoom () + +{ + return ( (xvpnzoom *) autallocheap( sizeof ( xvpnzoom ))); +} + +/*------------------------------------------------------------\ +| | +| XvpnFreeZoom | +| | +\------------------------------------------------------------*/ + +void XvpnFreeZoom ( FreeZoom ) + + xvpnzoom *FreeZoom; + +{ + autfreeheap( (char *)FreeZoom, sizeof(FreeZoom) ); +} + +/*------------------------------------------------------------\ +| | +| XvpnAddZoom | +| | +\------------------------------------------------------------*/ + +void XvpnAddZoom () + +{ + xvpnzoom *XvpnZoom; + + autbegin(); + + XvpnZoom = XvpnAllocZoom (); + XvpnZoom->X = XvpnUnitGridX; + XvpnZoom->Y = XvpnUnitGridY; + XvpnZoom->DX = XvpnUnitGridDx; + XvpnZoom->DY = XvpnUnitGridDy; + XvpnZoom->NEXT = XvpnHeadZoom; + XvpnHeadZoom = XvpnZoom; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnDelZoom | +| | +\------------------------------------------------------------*/ + +char XvpnDelZoom() + +{ + xvpnzoom *XvpnZoom; + + if ( XvpnHeadZoom != (xvpnzoom *) NULL ) + { + autbegin(); + + XvpnZoom = XvpnHeadZoom; + XvpnHeadZoom = XvpnHeadZoom->NEXT; + XvpnFreeZoom( XvpnZoom ); + + autend(); + return( XVPN_TRUE ); + } + + return( XVPN_FALSE ); +} + +/*------------------------------------------------------------\ +| | +| XvpnInitializeZoom | +| | +\------------------------------------------------------------*/ + +void XvpnInitializeZoom() + +{ + autbegin(); + + while( XvpnDelZoom() != XVPN_FALSE ); + + if ( XvpnComputeBound() == XVPN_FALSE ) + { + XvpnInitializeUnitGrid(); + } + else + { + XvpnUnitGridX = ( XvpnBoundXmin / XVPN_UNIT ) - 1; + XvpnUnitGridY = ( XvpnBoundYmin / XVPN_UNIT ) - 1; + XvpnUnitGridDx = ( XvpnBoundXmax / XVPN_UNIT ); + XvpnUnitGridDy = ( XvpnBoundYmax / XVPN_UNIT ); + XvpnUnitGridDx = XvpnUnitGridDx - XvpnUnitGridX + 1; + XvpnUnitGridDy = XvpnUnitGridDy - XvpnUnitGridY + 1; + + XvpnComputeUnitGrid(); + } + + XvpnComputeAndDisplayMap(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnZoomUndo | +| | +\------------------------------------------------------------*/ + +void XvpnZoomUndo() + +{ + autbegin(); + + if ( XvpnHeadZoom == (xvpnzoom *)NULL ) + { + XvpnErrorMessage( XvpnMainWindow, "No previous zoom !" ); + } + else + { + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_WATCH_CURSOR ); + + XvpnUnitGridX = XvpnHeadZoom->X; + XvpnUnitGridY = XvpnHeadZoom->Y; + XvpnUnitGridDx = XvpnHeadZoom->DX; + XvpnUnitGridDy = XvpnHeadZoom->DY; + + XvpnComputeUnitGrid(); + XvpnComputeAndDisplayMap(); + + XvpnDisplayFigure( 0, 0, + XvpnGraphicDx, XvpnGraphicDy ); + + XvpnRefreshGraphicWindow( 0, 0, + XvpnGraphicDx, XvpnGraphicDy); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_NORMAL_CURSOR ); + + XvpnDelZoom(); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnZoomRight | +| | +\------------------------------------------------------------*/ + +void XvpnZoomRight() + +{ + long Delta; + long Offset; + long XvpnOldPixelGridX; + + autbegin(); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_WATCH_CURSOR ); + + Delta = ( XvpnPercentMoveX * XvpnUnitGridDx ) / 100; + + if ( Delta == 0 ) Delta = 1; + + XvpnUnitGridX = XvpnUnitGridX + Delta; + XvpnOldPixelGridX = XvpnPixelGridX; + XvpnPixelGridX = (float)(XvpnUnitGridX) * XvpnUnitGridStep; + Offset = XvpnPixelGridX - XvpnOldPixelGridX; + + XCopyArea( XvpnGraphicDisplay, + XvpnGraphicPixmap, + XvpnGraphicPixmap, + XvpnBackgroundGC, + Offset, 0, + XvpnGraphicDx - Offset, + XvpnGraphicDy, + 0, 0 + ); + + XvpnComputeAndDisplayMap(); + XvpnDisplayFigure( XvpnGraphicDx - Offset, 0, + XvpnGraphicDx, XvpnGraphicDy ); + XvpnRefreshGraphicWindow( 0, 0, + XvpnGraphicDx, XvpnGraphicDy); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnZoomLeft | +| | +\------------------------------------------------------------*/ + +void XvpnZoomLeft() + +{ + long Delta; + long Offset; + long XvpnOldPixelGridX; + + autbegin(); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_WATCH_CURSOR ); + + Delta = ( XvpnPercentMoveX * XvpnUnitGridDx ) / 100; + + if ( Delta == 0 ) Delta = 1; + + XvpnUnitGridX = XvpnUnitGridX - Delta; + XvpnOldPixelGridX = XvpnPixelGridX; + XvpnPixelGridX = (float)(XvpnUnitGridX) * XvpnUnitGridStep; + Offset = XvpnOldPixelGridX - XvpnPixelGridX; + + XCopyArea( XvpnGraphicDisplay, + XvpnGraphicPixmap, + XvpnGraphicPixmap, + XvpnBackgroundGC, + 0, 0, + XvpnGraphicDx - Offset, + XvpnGraphicDy, + Offset, 0 + ); + + XvpnComputeAndDisplayMap(); + XvpnDisplayFigure( 0, 0, Offset, XvpnGraphicDy ); + XvpnRefreshGraphicWindow( 0, 0, XvpnGraphicDx, XvpnGraphicDy); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnZoomDown | +| | +\------------------------------------------------------------*/ + +void XvpnZoomDown() + +{ + long Delta; + long Offset; + long XvpnOldPixelGridY; + + autbegin(); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_WATCH_CURSOR ); + + Delta = ( XvpnPercentMoveY * XvpnUnitGridDy ) / 100; + + if ( Delta == 0 ) Delta = 1; + + XvpnUnitGridY = XvpnUnitGridY - Delta; + XvpnOldPixelGridY = XvpnPixelGridY; + XvpnPixelGridY = (float)(XvpnUnitGridY) * XvpnUnitGridStep; + Offset = XvpnOldPixelGridY - XvpnPixelGridY; + + XCopyArea( XvpnGraphicDisplay, + XvpnGraphicPixmap, + XvpnGraphicPixmap, + XvpnBackgroundGC, + 0, Offset, + XvpnGraphicDx, + XvpnGraphicDy - Offset, + 0, 0 + ); + + XvpnComputeAndDisplayMap(); + XvpnDisplayFigure( 0, 0, XvpnGraphicDx, Offset ); + XvpnRefreshGraphicWindow( 0, 0, XvpnGraphicDx, XvpnGraphicDy); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnZoomUp | +| | +\------------------------------------------------------------*/ + +void XvpnZoomUp() + +{ + long Delta; + long Offset; + long XvpnOldPixelGridY; + + autbegin(); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_WATCH_CURSOR ); + + Delta = ( XvpnPercentMoveY * XvpnUnitGridDy ) / 100; + + if ( Delta == 0 ) Delta = 1; + + XvpnUnitGridY = XvpnUnitGridY + Delta; + XvpnOldPixelGridY = XvpnPixelGridY; + XvpnPixelGridY = (float)(XvpnUnitGridY) * XvpnUnitGridStep; + Offset = XvpnPixelGridY - XvpnOldPixelGridY; + + XCopyArea( XvpnGraphicDisplay, + XvpnGraphicPixmap, + XvpnGraphicPixmap, + XvpnBackgroundGC, + 0, 0, + XvpnGraphicDx, + XvpnGraphicDy - Offset, + 0, Offset + ); + + XvpnComputeAndDisplayMap(); + XvpnDisplayFigure( 0, XvpnGraphicDy - Offset, + XvpnGraphicDx, XvpnGraphicDy ); + XvpnRefreshGraphicWindow( 0, 0, XvpnGraphicDx, XvpnGraphicDy); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnZoomMore | +| | +\------------------------------------------------------------*/ + +void XvpnZoomMore() + +{ + long DeltaX; + long DeltaY; + + autbegin(); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_WATCH_CURSOR ); + + DeltaX = ( XvpnPercentZoom * XvpnUnitGridDx ) / 100; + DeltaY = ( XvpnPercentZoom * XvpnUnitGridDy ) / 100; + + if ( ( DeltaX >= 2 ) && + ( DeltaY >= 2 ) ) + { + XvpnAddZoom(); + + XvpnUnitGridX = XvpnUnitGridX + (DeltaX >> 1); + XvpnUnitGridY = XvpnUnitGridY + (DeltaY >> 1); + XvpnUnitGridDx = XvpnUnitGridDx - DeltaX; + XvpnUnitGridDy = XvpnUnitGridDy - DeltaY; + + XvpnComputeUnitGrid(); + XvpnComputeAndDisplayMap(); + XvpnDisplayFigure( 0, 0, XvpnGraphicDx, XvpnGraphicDy ); + XvpnRefreshGraphicWindow( 0, 0, XvpnGraphicDx, XvpnGraphicDy ); + } + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnZoomLess | +| | +\------------------------------------------------------------*/ + +void XvpnZoomLess() + +{ + long DeltaX; + long DeltaY; + + autbegin(); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_WATCH_CURSOR ); + + DeltaX = 100 * XvpnUnitGridDx / ( 100 - XvpnPercentZoom ); + DeltaY = 100 * XvpnUnitGridDy / ( 100 - XvpnPercentZoom ); + + XvpnAddZoom(); + + XvpnUnitGridX = XvpnUnitGridX - ((DeltaX - XvpnUnitGridDx) >> 1); + XvpnUnitGridY = XvpnUnitGridY - ((DeltaY - XvpnUnitGridDy) >> 1); + XvpnUnitGridDx = DeltaX; + XvpnUnitGridDy = DeltaY; + + XvpnComputeUnitGrid(); + XvpnComputeAndDisplayMap(); + XvpnDisplayFigure( 0, 0, XvpnGraphicDx, XvpnGraphicDy ); + XvpnRefreshGraphicWindow( 0, 0, XvpnGraphicDx, XvpnGraphicDy ); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnZoomFit | +| | +\------------------------------------------------------------*/ + +void XvpnZoomFit() + +{ + autbegin(); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_WATCH_CURSOR ); + + if ( XvpnComputeBound() == XVPN_FALSE ) + { + XvpnErrorMessage( XvpnMainWindow, "No element to display !" ); + } + else + { + XvpnAddZoom(); + + XvpnUnitGridX = ( XvpnBoundXmin / XVPN_UNIT ) - 1; + XvpnUnitGridY = ( XvpnBoundYmin / XVPN_UNIT ) - 1; + XvpnUnitGridDx = XvpnBoundXmax / XVPN_UNIT; + XvpnUnitGridDy = XvpnBoundYmax / XVPN_UNIT; + XvpnUnitGridDx = XvpnUnitGridDx - XvpnUnitGridX + 1; + XvpnUnitGridDy = XvpnUnitGridDy - XvpnUnitGridY + 1; + + XvpnComputeUnitGrid(); + XvpnComputeAndDisplayMap(); + XvpnDisplayFigure( 0, 0, XvpnGraphicDx, XvpnGraphicDy ); + XvpnRefreshGraphicWindow( 0, 0, XvpnGraphicDx, XvpnGraphicDy ); + } + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnZoomCenter | +| | +\------------------------------------------------------------*/ + +void XvpnZoomCenter( UnitX, UnitY ) + + long UnitX; + long UnitY; +{ + autbegin(); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_WATCH_CURSOR ); + + XvpnUnitGridX = UnitX - ( XvpnUnitGridDx >> 1 ); + XvpnUnitGridY = UnitY - ( XvpnUnitGridDy >> 1 ); + + XvpnComputeUnitGrid(); + XvpnComputeAndDisplayMap(); + XvpnDisplayFigure( 0, 0, XvpnGraphicDx, XvpnGraphicDy ); + XvpnRefreshGraphicWindow( 0, 0, XvpnGraphicDx, XvpnGraphicDy ); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnZoomIn | +| | +\------------------------------------------------------------*/ + +void XvpnZoomIn( UnitX1, UnitY1, UnitX2, UnitY2 ) + + long UnitX1; + long UnitY1; + long UnitX2; + long UnitY2; +{ + long Swap; + + autbegin(); + + if ( ( UnitX1 != UnitX2 ) && + ( UnitY1 != UnitY2 ) ) + { + if ( UnitX1 > UnitX2 ) + { + Swap = UnitX1; UnitX1 = UnitX2; UnitX2 = Swap; + } + + if ( UnitY1 > UnitY2 ) + { + Swap = UnitY1; UnitY1 = UnitY2; UnitY2 = Swap; + } + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_WATCH_CURSOR ); + + XvpnAddZoom(); + + XvpnUnitGridX = UnitX1; + XvpnUnitGridY = UnitY1; + XvpnUnitGridDx = UnitX2 - UnitX1; + XvpnUnitGridDy = UnitY2 - UnitY1; + + XvpnComputeUnitGrid(); + XvpnComputeAndDisplayMap(); + XvpnDisplayFigure( 0, 0, XvpnGraphicDx, XvpnGraphicDy ); + XvpnRefreshGraphicWindow( 0, 0, XvpnGraphicDx, XvpnGraphicDy ); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_NORMAL_CURSOR ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnZoomPan | +| | +\------------------------------------------------------------*/ + +void XvpnZoomPan( UnitX1, UnitY1, UnitX2, UnitY2 ) + + long UnitX1; + long UnitY1; + long UnitX2; + long UnitY2; +{ + if ( ( UnitX1 != UnitX2 ) || + ( UnitY1 != UnitY2 ) ) + { + autbegin(); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_WATCH_CURSOR ); + + XvpnUnitGridX = XvpnUnitGridX + ( UnitX1 - UnitX2 ); + XvpnUnitGridY = XvpnUnitGridY + ( UnitY1 - UnitY2 ); + + XvpnComputeUnitGrid(); + XvpnComputeAndDisplayMap(); + XvpnDisplayFigure( 0, 0, XvpnGraphicDx, XvpnGraphicDy ); + XvpnRefreshGraphicWindow( 0, 0, XvpnGraphicDx, XvpnGraphicDy ); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_NORMAL_CURSOR ); + + autend(); + } +} + +/*------------------------------------------------------------\ +| | +| XvpnZoomRefresh | +| | +\------------------------------------------------------------*/ + +void XvpnZoomRefresh() + +{ + autbegin(); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_WATCH_CURSOR ); + + XvpnDisplayFigure( 0, 0, XvpnGraphicDx, XvpnGraphicDy ); + XvpnRefreshGraphicWindow( 0, 0, XvpnGraphicDx, XvpnGraphicDy ); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_NORMAL_CURSOR ); + + autend(); +} diff --git a/alliance/src/xvpn/src/XMV_view.h b/alliance/src/xvpn/src/XMV_view.h new file mode 100644 index 00000000..7b62ad8f --- /dev/null +++ b/alliance/src/xvpn/src/XMV_view.h @@ -0,0 +1,95 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : View.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_VIEW +# define XVPN_VIEW + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XVPN_PERCENT_ZOOM 30 +# define XVPN_PERCENT_ZOOM_MIN 5 +# define XVPN_PERCENT_ZOOM_MAX 95 + +# define XVPN_PERCENT_MOVE 30 +# define XVPN_PERCENT_MOVE_MIN 5 +# define XVPN_PERCENT_MOVE_MAX 95 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct xvpnzoom + { + struct xvpnzoom *NEXT; + + long X; + long Y; + long DX; + long DY; + + } xvpnzoom; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern int XvpnPercentZoom; + extern int XvpnPercentMove; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xvpn/src/XMX.h b/alliance/src/xvpn/src/XMX.h new file mode 100644 index 00000000..51ea0711 --- /dev/null +++ b/alliance/src/xvpn/src/XMX.h @@ -0,0 +1,275 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : XMX.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_XMX +# define XVPN_XMX + +/*------------------------------------------------------------\ +| | +| Graphic Context | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Colors Define | +| | +\------------------------------------------------------------*/ + +# define XVPN_BLACK_COLOR_NAME "Black" + +/*------------------------------------------------------------\ +| | +| Xvpn Message | +| | +\------------------------------------------------------------*/ + +# define XVPN_MAX_MESSAGE 7 + +# define XVPN_MESSAGE_X 0 +# define XVPN_MESSAGE_Y 1 +# define XVPN_MESSAGE_DX 2 +# define XVPN_MESSAGE_DY 3 +# define XVPN_MESSAGE_MODE 4 +# define XVPN_MESSAGE_INFO 5 +# define XVPN_MESSAGE_PROMPT 6 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Xvpn Widget | +| | +\------------------------------------------------------------*/ + + extern XtAppContext XvpnApplication; + extern Widget XvpnTopLevel; + extern Widget XvpnMainWindow; + extern Widget XvpnMainForm; + + extern Widget XvpnMenuBar; + + extern Widget XvpnGraphicFrame; + extern Widget XvpnGraphicWindow; + extern Display *XvpnGraphicDisplay; + + extern Widget XvpnMessageMainPaned; + extern Widget XvpnMessageMainForm; + extern Widget XvpnMessageForm [ XVPN_MAX_MESSAGE ]; + extern Widget XvpnMessageText [ XVPN_MAX_MESSAGE ]; + extern Widget XvpnMessageLabel [ XVPN_MAX_MESSAGE ]; + extern Widget XvpnMessageFrame [ XVPN_MAX_MESSAGE ]; + +/*------------------------------------------------------------\ +| | +| Xvpn Graphic Context | +| | +\------------------------------------------------------------*/ + + extern GC XvpnBackgroundGC; + extern GC XvpnGridGC; + extern GC XvpnXorGC; + extern GC XvpnAcceptDrawGC; + extern GC XvpnConnectDrawGC; + extern GC XvpnLayerDrawGC[ XVPN_MAX_LAYER ]; + extern GC XvpnSmallTextGC; + extern GC XvpnMediumTextGC; + extern GC XvpnLargeTextGC; + + extern XFontStruct *XvpnSmallTextFont; + extern XFontStruct *XvpnLargeTextFont; + extern XFontStruct *XvpnMediumTextFont; + +/*------------------------------------------------------------\ +| | +| Xvpn Graphic Pixmap | +| | +\------------------------------------------------------------*/ + + extern Pixmap XvpnGraphicPixmap; + +/*------------------------------------------------------------\ +| | +| Xvpn Graphic Size | +| | +\------------------------------------------------------------*/ + + extern Dimension XvpnOldGraphicDx; + extern Dimension XvpnOldGraphicDy; + extern Dimension XvpnGraphicDx; + extern Dimension XvpnGraphicDy; + +/*------------------------------------------------------------\ +| | +| Xvpn Unit Grid | +| | +\------------------------------------------------------------*/ + + extern float XvpnUnitGridStep; + extern long XvpnUnitGridX; + extern long XvpnUnitGridY; + extern long XvpnUnitGridDx; + extern long XvpnUnitGridDy; + extern long XvpnPixelGridX; + extern long XvpnPixelGridY; + +/*------------------------------------------------------------\ +| | +| User Unit Grid | +| | +\------------------------------------------------------------*/ + + extern long XvpnUnitUserGridDx; + extern long XvpnUnitUserGridDy; + extern short XvpnUnitUserGrid; + +/*------------------------------------------------------------\ +| | +| Xvpn Cursor | +| | +\------------------------------------------------------------*/ + + extern long XvpnUnitCursorX; + extern long XvpnUnitCursorY; + +/*------------------------------------------------------------\ +| | +| Xvpn Event | +| | +\------------------------------------------------------------*/ + + extern short XvpnCountEventZoom; + extern short XvpnCountEventEdit; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnInitializeRessources | +| | +\------------------------------------------------------------*/ + + extern void XvpnInitializeRessources(); + +/*------------------------------------------------------------\ +| | +| Xvpn Change Title | +| | +\------------------------------------------------------------*/ + + extern void XvpnChangeTopLevelTitle(); + +/*------------------------------------------------------------\ +| | +| Xvpn Edit Mode | +| | +\------------------------------------------------------------*/ + + extern void XvpnChangeEditMode(); + extern void XvpnContinueEditMode(); + +/*------------------------------------------------------------\ +| | +| XvpnDisplayMessage | +| | +\------------------------------------------------------------*/ + + extern void XvpnDisplayMessage(); + extern void XvpnPromptEditIdentify(); + +/*------------------------------------------------------------\ +| | +| Xvpn Graphic Window | +| | +\------------------------------------------------------------*/ + + extern void XvpnClearGraphicWindow(); + extern void XvpnResizeGraphicWindow(); + extern void XvpnRefreshGraphicWindow(); + +/*------------------------------------------------------------\ +| | +| Xvpn Unit Grid | +| | +\------------------------------------------------------------*/ + + extern void XvpnComputeUnitGrid(); + extern void XvpnResizeUnitGrid(); + extern void XvpnInitializeUnitGrid(); + +/*------------------------------------------------------------\ +| | +| Xvpn Display Figure | +| | +\------------------------------------------------------------*/ + + extern void XvpnDisplayFigure(); + extern void XvpnDisplayObject(); + +/*------------------------------------------------------------\ +| | +| Xvpn Cursor | +| | +\------------------------------------------------------------*/ + + extern void XvpnDisplayCursor(); + extern void XvpnUndisplayCursor(); + +# endif diff --git a/alliance/src/xvpn/src/XMX_color.c b/alliance/src/xvpn/src/XMX_color.c new file mode 100644 index 00000000..10b2c9fa --- /dev/null +++ b/alliance/src/xvpn/src/XMX_color.c @@ -0,0 +1,343 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Colors.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XMX.h" +# include "XMX_color.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + GC XvpnBackgroundGC; + GC XvpnGridGC; + GC XvpnAcceptDrawGC; + GC XvpnConnectDrawGC; + GC XvpnLayerDrawGC[ XVPN_MAX_LAYER ]; + + GC XvpnSmallTextGC; + GC XvpnMediumTextGC; + GC XvpnLargeTextGC; + GC XvpnXorGC; + GC XvpnXorGCXor; + GC XvpnXorGCInvert; + + XFontStruct *XvpnLargeTextFont; + XFontStruct *XvpnMediumTextFont; + XFontStruct *XvpnSmallTextFont; + + Colormap XvpnColorMap; + +/*------------------------------------------------------------\ +| | +| Layer Color Define | +| | +\------------------------------------------------------------*/ + + static char **XvpnColorName[ 5 ] = + + { + &XVPN_BACKGROUND_COLOR_NAME, + &XVPN_FOREGROUND_COLOR_NAME, + &XVPN_CURSOR_COLOR_NAME, + &XVPN_ACCEPT_COLOR_NAME, + &XVPN_CONNECT_COLOR_NAME + }; + + static int XvpnColor[ XVPN_MAX_COLOR ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnSwitchColormap | +| | +\------------------------------------------------------------*/ + +void XvpnInitializeColorMap() +{ + Display *ADisplay; + Screen *AScreen; + + ADisplay = XtDisplay( XvpnTopLevel ); + AScreen = XtScreen( XvpnTopLevel ); + XvpnColorMap = DefaultColormapOfScreen( AScreen ); + + if ( XVPN_SWITCH_COLOR_MAP ) + { + XvpnColorMap = XCopyColormapAndFree( ADisplay, XvpnColorMap ); + XInstallColormap( ADisplay, XvpnColorMap ); + XtVaSetValues( XvpnTopLevel, XmNcolormap, XvpnColorMap, NULL ); + } +} + +/*------------------------------------------------------------\ +| | +| XvpnInitializeColors | +| | +\------------------------------------------------------------*/ + +void XvpnInitializeColors() + +{ + XColor ForgetIt; + XColor GetIt; + int Counter; + char Error; + char *ColorName; + + autbegin(); + + Error = False; + + for ( Counter = 0; Counter < XVPN_MAX_COLOR; Counter++ ) + { + if ( Counter < 5 ) + { + ColorName = *XvpnColorName[ Counter ]; + } + else + { + ColorName = XVPN_LAYER_NAME_TABLE[ Counter - 5 ][ 1 ]; + } + + if ( ColorName != (char *)NULL ) + { + if ( ! XAllocNamedColor( XvpnGraphicDisplay, + XvpnColorMap, ColorName, + &GetIt, &ForgetIt ) ) + { + fprintf ( stderr, "\nXmx: Unable to allocate color '%s' !\n", + ColorName ); + + Error = True; + } + + XvpnColor[ Counter ] = GetIt.pixel; + } + else + { + XvpnColor[ Counter ] = XvpnColor[ 0 ]; + } + } + + if ( Error == True ) exit( 1 ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnChangeCursorContext | +| | +\------------------------------------------------------------*/ + +void XvpnChangeCursorContext() +{ + if ( XVPN_XOR_CURSOR == XVPN_TRUE ) + { + XvpnXorGC = XvpnXorGCXor; + } + else + { + XvpnXorGC = XvpnXorGCInvert; + } +} + +/*------------------------------------------------------------\ +| | +| XvpnInitializeGraphicContext | +| | +\------------------------------------------------------------*/ + +void XvpnInitializeGraphicContext() + +{ + XGCValues GraphicValue; + int Counter; + Window Root; + + autbegin(); + + XvpnLargeTextFont = XLoadQueryFont( XvpnGraphicDisplay, + XVPN_LARGE_TEXT_FONT_NAME ); + + XvpnMediumTextFont = XLoadQueryFont( XvpnGraphicDisplay, + XVPN_MEDIUM_TEXT_FONT_NAME ); + + XvpnSmallTextFont = XLoadQueryFont( XvpnGraphicDisplay, + XVPN_SMALL_TEXT_FONT_NAME ); + + GraphicValue.foreground = XvpnColor[ 0 ]; /* Black */ + GraphicValue.background = XvpnColor[ 0 ]; + GraphicValue.plane_mask = AllPlanes; + + Root = RootWindowOfScreen ( XtScreen ( XvpnGraphicWindow ) ), + + XvpnBackgroundGC = XCreateGC ( XvpnGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + GraphicValue.foreground = XvpnColor[ 1 ]; /* White */ + + XvpnGridGC = XCreateGC ( XvpnGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + GraphicValue.foreground = XvpnColor[ 1 ]; /* Text */ + + XvpnSmallTextGC = XCreateGC ( XvpnGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + XvpnMediumTextGC = XCreateGC ( XvpnGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + XvpnLargeTextGC = XCreateGC ( XvpnGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + XSetFont( XvpnGraphicDisplay, + XvpnSmallTextGC, XvpnSmallTextFont->fid ); + + XSetFont( XvpnGraphicDisplay, + XvpnMediumTextGC, XvpnMediumTextFont->fid ); + + XSetFont( XvpnGraphicDisplay, + XvpnLargeTextGC, XvpnLargeTextFont->fid ); + + GraphicValue.background = XvpnColor[ 2 ]; /* Xor Color */ + GraphicValue.foreground = XvpnColor[ 2 ]; /* Xor Color */ + GraphicValue.function = GXxor; + + XvpnXorGCXor = XCreateGC ( XvpnGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCFunction | + GCPlaneMask ), + &GraphicValue ); + + GraphicValue.function = GXinvert; + + XvpnXorGCInvert = XCreateGC ( XvpnGraphicDisplay, + Root, + ( GCFunction | + GCPlaneMask ), + &GraphicValue ); + + XvpnChangeCursorContext(); + + GraphicValue.background = XvpnColor[ 0 ]; /* Black */ + GraphicValue.foreground = XvpnColor[ 3 ]; /* Accept Color */ + + XvpnAcceptDrawGC = XCreateGC ( XvpnGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + GraphicValue.foreground = XvpnColor[ 4 ]; /* Connect Color */ + + XvpnConnectDrawGC = XCreateGC ( XvpnGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + + for ( Counter = 0; Counter < XVPN_MAX_LAYER; Counter++ ) + { + GraphicValue.foreground = XvpnColor[ Counter + 5 ]; + + XvpnLayerDrawGC[ Counter ] = + + XCreateGC ( XvpnGraphicDisplay, + Root, + ( GCForeground | + GCBackground | + GCPlaneMask ), + &GraphicValue ); + } + + autend(); +} diff --git a/alliance/src/xvpn/src/XMX_color.h b/alliance/src/xvpn/src/XMX_color.h new file mode 100644 index 00000000..20d49bc7 --- /dev/null +++ b/alliance/src/xvpn/src/XMX_color.h @@ -0,0 +1,87 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Color.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_COLOR +# define XVPN_COLOR + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Pattern | +| | +\------------------------------------------------------------*/ + +# define XVPN_MAX_COLOR ( 5 + XVPN_MAX_LAYER ) + +# define XVPN_LARGE_TEXT_FONT_NAME "9x15" +# define XVPN_MEDIUM_TEXT_FONT_NAME "7x13" +# define XVPN_SMALL_TEXT_FONT_NAME "5x8" + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnInitializeGraphicContext(); + extern void XvpnInitializeColors(); + extern void XpatChangeCursorContext(); + extern void XpatInitializeColorMap(); + +# endif diff --git a/alliance/src/xvpn/src/XMX_cursor.c b/alliance/src/xvpn/src/XMX_cursor.c new file mode 100644 index 00000000..c353c0ae --- /dev/null +++ b/alliance/src/xvpn/src/XMX_cursor.c @@ -0,0 +1,514 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Cursor.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XMX.h" +# include "XMX_grid.h" +# include "XMX_cursor.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Buffer | +| | +\------------------------------------------------------------*/ + + static char XvpnCursorBuffer[ XVPN_MAX_CURSOR_BUFFER ]; + +/*------------------------------------------------------------\ +| | +| Coordinates | +| | +\------------------------------------------------------------*/ + + Position XvpnCursorX = 0; + Position XvpnCursorY = 0; + Position XvpnCursorSaveX = 0; + Position XvpnCursorSaveY = 0; + short XvpnCursorSaved = XVPN_FALSE; + short XvpnCursorInside = XVPN_FALSE; + short XvpnCursorType = XVPN_INPUT_HALF_BOX; + + long XvpnUnitCursorX = 0; + long XvpnUnitCursorY = 0; + long XvpnPixelCursorX = 0; + long XvpnPixelCursorY = 0; + + long XvpnUnitCursorSaveX[ 2 ] = { 0, 0 }; + long XvpnUnitCursorSaveY[ 2 ] = { 0, 0 }; + short XvpnCursorIndex = 0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnComputeCursor | +| | +\------------------------------------------------------------*/ + +void XvpnComputeCursor( X, Y ) + + Position X; + Position Y; +{ + autbegin(); + + Y = XvpnGraphicDy - Y; + + XvpnUnitCursorX = X + XvpnPixelGridX; + XvpnUnitCursorY = Y + XvpnPixelGridY; + + if ( XvpnUnitCursorX < 0 ) + { + XvpnUnitCursorX = ((float)(XvpnUnitCursorX) / XvpnUnitGridStep) - 0.5 ; + } + else + { + XvpnUnitCursorX = ((float)(XvpnUnitCursorX) / XvpnUnitGridStep) + 0.5 ; + } + + if ( XvpnUnitCursorY < 0 ) + { + XvpnUnitCursorY = ((float)(XvpnUnitCursorY) / XvpnUnitGridStep) - 0.5 ; + } + else + { + XvpnUnitCursorY = ((float)(XvpnUnitCursorY) / XvpnUnitGridStep) + 0.5 ; + } + + XvpnPixelCursorX = ((float)(XvpnUnitCursorX) * XvpnUnitGridStep); + XvpnPixelCursorY = ((float)(XvpnUnitCursorY) * XvpnUnitGridStep); + + XvpnCursorX = XvpnPixelCursorX - XvpnPixelGridX; + XvpnCursorY = XvpnPixelCursorY - XvpnPixelGridY; + XvpnCursorY = XvpnGraphicDy - XvpnCursorY; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnDisplayCoordinates | +| | +\------------------------------------------------------------*/ + +void XvpnDisplayCoordinates() + +{ + autbegin(); + + sprintf( XvpnCursorBuffer, "%ld", XvpnUnitCursorX ); + XvpnDisplayMessage( XVPN_MESSAGE_X, XvpnCursorBuffer ); + + sprintf( XvpnCursorBuffer, "%ld", XvpnUnitCursorY ); + XvpnDisplayMessage( XVPN_MESSAGE_Y, XvpnCursorBuffer ); + + sprintf( XvpnCursorBuffer, "%ld", XvpnUnitCursorX - XvpnUnitCursorSaveX[0] ); + XvpnDisplayMessage( XVPN_MESSAGE_DX, XvpnCursorBuffer ); + + sprintf( XvpnCursorBuffer, "%ld", XvpnUnitCursorY - XvpnUnitCursorSaveY[0] ); + XvpnDisplayMessage( XVPN_MESSAGE_DY, XvpnCursorBuffer ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnPointCursor | +| | +\------------------------------------------------------------*/ + +void XvpnPointCursor() + +{ + autbegin(); + + XvpnUndisplayCursor(); + + XvpnUnitCursorSaveX[ XvpnCursorIndex ] = XvpnUnitCursorX; + XvpnUnitCursorSaveY[ XvpnCursorIndex ] = XvpnUnitCursorY; + + XvpnCursorIndex = XvpnCursorIndex + 1; + + XvpnDisplayCursor(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnResetCursor | +| | +\------------------------------------------------------------*/ + +void XvpnResetCursor() + +{ + autbegin(); + + XvpnUndisplayCursor(); + + XvpnCursorIndex = XvpnCursorIndex - 1; + + XvpnDisplayCursor(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnChangeCursor | +| | +\------------------------------------------------------------*/ + +void XvpnChangeCursorType( ArrayX, ArrayY, Index, Type ) + + long *ArrayX; + long *ArrayY; + short Index; + short Type; +{ + autbegin(); + + XvpnUndisplayCursor(); + + XvpnCursorType = Type; + XvpnCursorIndex = Index; + + if ( Index != 0 ) + { + XvpnUnitCursorSaveX[ 0 ] = ArrayX[0]; + XvpnUnitCursorSaveY[ 0 ] = ArrayY[0]; + XvpnUnitCursorSaveX[ 1 ] = ArrayX[1]; + XvpnUnitCursorSaveY[ 1 ] = ArrayY[1]; + } + + XvpnDisplayCursor(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnDrawCursor | +| | +\------------------------------------------------------------*/ + +void XvpnDrawCursor() + +{ + long X1; + long Y1; + long X2; + long Y2; + long DeltaX; + long DeltaY; + long Swap; + short DrawLine; + + autbegin(); + + XDrawLine( XvpnGraphicDisplay, + XtWindow( XvpnGraphicWindow ), + XvpnXorGC, + XvpnCursorSaveX - XVPN_CURSOR_SIZE, + XvpnCursorSaveY - XVPN_CURSOR_SIZE, + XvpnCursorSaveX + XVPN_CURSOR_SIZE, + XvpnCursorSaveY + XVPN_CURSOR_SIZE ); + + XDrawLine( XvpnGraphicDisplay, + XtWindow( XvpnGraphicWindow ), + XvpnXorGC, + XvpnCursorSaveX - XVPN_CURSOR_SIZE, + XvpnCursorSaveY + XVPN_CURSOR_SIZE, + XvpnCursorSaveX + XVPN_CURSOR_SIZE, + XvpnCursorSaveY - XVPN_CURSOR_SIZE ); + + if ( XvpnCursorIndex > 0 ) + { + X1 = (float)(XvpnUnitCursorSaveX[0]) * XvpnUnitGridStep; + Y1 = (float)(XvpnUnitCursorSaveY[0]) * XvpnUnitGridStep; + X1 = X1 - XvpnPixelGridX; + Y1 = Y1 - XvpnPixelGridY; + Y1 = XvpnGraphicDy - Y1; + + if ( XvpnCursorIndex == 1 ) + { + X2 = XvpnCursorSaveX; + Y2 = XvpnCursorSaveY; + } + else + { + X2 = (float)(XvpnUnitCursorSaveX[1]) * XvpnUnitGridStep; + Y2 = (float)(XvpnUnitCursorSaveY[1]) * XvpnUnitGridStep; + X2 = X2 - XvpnPixelGridX; + Y2 = Y2 - XvpnPixelGridY; + Y2 = XvpnGraphicDy - Y2; + } + + switch( XvpnCursorType ) + { + case XVPN_INPUT_POINT : + + break; + + case XVPN_INPUT_LINE : + + XDrawLine( XvpnGraphicDisplay, + XtWindow( XvpnGraphicWindow ), + XvpnXorGC, + X1, Y1, X2, Y2 ); + break; + + case XVPN_INPUT_HALF_BOX : + + XDrawLine( XvpnGraphicDisplay, + XtWindow( XvpnGraphicWindow ), + XvpnXorGC, + X1, Y1, X2, Y1 ); + + XDrawLine( XvpnGraphicDisplay, + XtWindow( XvpnGraphicWindow ), + XvpnXorGC, + X2, Y1, X2, Y2 ); + break; + + case XVPN_INPUT_ORTHO : + case XVPN_INPUT_SORTHO : + case XVPN_INPUT_LSTRING : + + DeltaX = X2 - X1; if ( DeltaX < 0 ) DeltaX = - DeltaX; + DeltaY = Y2 - Y1; if ( DeltaY < 0 ) DeltaY = - DeltaY; + + if ( DeltaX > DeltaY ) + { + Y2 = Y1; + + if ( X1 > X2 ) { Swap = X1; X1 = X2; X2 = Swap; } + + if ( X1 < 0 ) X1 = 0; + if ( X2 > XvpnGraphicDx ) X2 = XvpnGraphicDx; + + if ( ( X1 < X2 ) && + ( Y1 >= 0 ) && + ( Y1 <= XvpnGraphicDy ) ) + { + XDrawLine( XvpnGraphicDisplay, + XtWindow( XvpnGraphicWindow ), + XvpnXorGC, + X1, Y1, X2, Y2 ); + } + } + else + { + X2 = X1; + + if ( Y1 > Y2 ) { Swap = Y1; Y1 = Y2; Y2 = Swap; } + + if ( Y1 < 0 ) Y1 = 0; + if ( Y2 > XvpnGraphicDy ) Y2 = XvpnGraphicDy; + + if ( ( Y1 < Y2 ) && + ( X1 >= 0 ) && + ( X1 <= XvpnGraphicDx ) ) + { + XDrawLine( XvpnGraphicDisplay, + XtWindow( XvpnGraphicWindow ), + XvpnXorGC, + X1, Y1, X2, Y2 ); + } + } + + break; + + case XVPN_INPUT_BOX : + + if ( X1 > X2 ) { Swap = X1; X1 = X2; X2 = Swap; } + if ( Y1 > Y2 ) { Swap = Y1; Y1 = Y2; Y2 = Swap; } + + DrawLine = 0; + + if ( X1 < 0 ) { X1 = 0; DrawLine |= XVPN_WEST; } + if ( X2 > XvpnGraphicDx ) { X2 = XvpnGraphicDx; DrawLine |= XVPN_EAST; } + if ( Y1 < 0 ) { Y1 = 0; DrawLine |= XVPN_SOUTH; } + if ( Y2 > XvpnGraphicDy ) { Y2 = XvpnGraphicDy; DrawLine |= XVPN_NORTH; } + + if ( DrawLine == 0 ) + { + XDrawRectangle( XvpnGraphicDisplay, + XtWindow( XvpnGraphicWindow ), + XvpnXorGC, + X1, Y1, + X2 - X1, Y2 - Y1 ); + } + else + { + if ( ( DrawLine & XVPN_WEST ) == 0 ) + { + XDrawLine( XvpnGraphicDisplay, + XtWindow( XvpnGraphicWindow ), + XvpnXorGC, + X1, Y2, + X1, Y1 ); + } + + if ( ( DrawLine & XVPN_EAST ) == 0 ) + { + XDrawLine( XvpnGraphicDisplay, + XtWindow( XvpnGraphicWindow ), + XvpnXorGC, + X2, Y2, + X2, Y1 ); + } + + if ( ( DrawLine & XVPN_SOUTH ) == 0 ) + { + XDrawLine( XvpnGraphicDisplay, + XtWindow( XvpnGraphicWindow ), + XvpnXorGC, + X1, Y1, + X2, Y1 ); + } + + if ( ( DrawLine & XVPN_NORTH ) == 0 ) + { + XDrawLine( XvpnGraphicDisplay, + XtWindow( XvpnGraphicWindow ), + XvpnXorGC, + X1, Y2, + X2, Y2 ); + } + } + + break; + + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnUndisplayCursor | +| | +\------------------------------------------------------------*/ + +void XvpnUndisplayCursor() + +{ + autbegin(); + + if ( XvpnCursorInside == XVPN_TRUE ) + { + if ( XvpnCursorSaved == XVPN_TRUE ) + { + XvpnDrawCursor(); + } + + XvpnCursorSaved = XVPN_FALSE; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnDisplayCursor | +| | +\------------------------------------------------------------*/ + +void XvpnDisplayCursor() + +{ + autbegin(); + + if ( XvpnCursorInside == XVPN_TRUE ) + { + if ( XvpnCursorSaved == XVPN_TRUE ) + { + XvpnDrawCursor(); + + XvpnCursorSaved = XVPN_FALSE; + } + + if ( ( XvpnCursorY >= 0 ) && + ( XvpnCursorX <= (Position)XvpnGraphicDx ) ) + { + XvpnCursorSaveX = XvpnCursorX; + XvpnCursorSaveY = XvpnCursorY; + + XvpnDrawCursor(); + + XvpnCursorSaved = XVPN_TRUE; + } + } + + autend(); +} diff --git a/alliance/src/xvpn/src/XMX_cursor.h b/alliance/src/xvpn/src/XMX_cursor.h new file mode 100644 index 00000000..26fe100c --- /dev/null +++ b/alliance/src/xvpn/src/XMX_cursor.h @@ -0,0 +1,95 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Cursor.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_CURSOR +# define XVPN_CURSOR + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XVPN_MAX_CURSOR_BUFFER 128 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern Position XvpnCursorX; + extern Position XvpnCursorY; + extern Position XvpnCursorSaveX; + extern Position XvpnCursorSaveY; + extern short XvpnCursorSaved; + extern short XvpnCursorInside; + extern long XvpnLambdaCursorX; + extern long XvpnLambdaCursorY; + + extern long XvpnPixelCursorX; + extern long XvpnPixelCursorY; + + extern long XvpnPixelCursorX1; + extern long XvpnPixelCursorY1; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnComputeCursor(); + extern void XvpnChangeCursorType(); + extern void XvpnPointCursor(); + extern void XvpnResetCursor(); + extern void XvpnDisplayCoordinates(); + +# endif diff --git a/alliance/src/xvpn/src/XMX_dialog.c b/alliance/src/xvpn/src/XMX_dialog.c new file mode 100644 index 00000000..f263be0a --- /dev/null +++ b/alliance/src/xvpn/src/XMX_dialog.c @@ -0,0 +1,102 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XTB.h" +# include "XMF.h" +# include "XMV.h" +# include "XMT.h" +# include "XME.h" +# include "XMS.h" +# include "XMH.h" +# include "XMX.h" + +# include "XMX_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnInitializeDialog | +| | +\------------------------------------------------------------*/ + +void XvpnInitializeDialog() + +{ + autbegin(); + + XvpnBuildFileDialog(); + XvpnBuildEditDialog(); + XvpnBuildViewDialog(); + + autend(); +} diff --git a/alliance/src/xvpn/src/XMX_dialog.h b/alliance/src/xvpn/src/XMX_dialog.h new file mode 100644 index 00000000..9d66c1e8 --- /dev/null +++ b/alliance/src/xvpn/src/XMX_dialog.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_DIALOG +# define XVPN_DIALOG + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnInitializeDialog(); + +# endif diff --git a/alliance/src/xvpn/src/XMX_event.c b/alliance/src/xvpn/src/XMX_event.c new file mode 100644 index 00000000..e9f600e9 --- /dev/null +++ b/alliance/src/xvpn/src/XMX_event.c @@ -0,0 +1,788 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Event.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XMX.h" +# include "XTB.h" +# include "XME.h" +# include "XMV.h" +# include "XMF.h" +# include "XMS.h" +# include "XMH.h" + +# include "XMX_motif.h" +# include "XMX_grid.h" +# include "XMX_cursor.h" +# include "XMX_event.h" +# include "XMX_message.h" +# include "XMX_graphic.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Translation | +| | +\------------------------------------------------------------*/ + + static String XvpnEventTranslation = + + ": CallbackEvent( 0 )\n\ + : CallbackEvent( 1 )\n\ + : CallbackEvent( 2 )\n\ + : CallbackEvent( 3 )\n\ + : CallbackEvent( 4 )\n\ + osfUp: CallbackEvent( 5 )\n\ + osfDown: CallbackEvent( 6 )\n\ + osfLeft: CallbackEvent( 7 )\n\ + osfRight: CallbackEvent( 8 )\n\ + Z: CallbackEvent( 9 )\n\ + M: CallbackEvent( 10 )\n\ + F: CallbackEvent( 11 )\n\ + R: CallbackEvent( 12 )\n\ + U: CallbackEvent( 13 )\n\ + I: CallbackEvent( 14 )\n\ + C: CallbackEvent( 15 )\n\ + P: CallbackEvent( 16 )\n\ + +: CallbackEvent( 17 )\n\ + -: CallbackEvent( 18 )\n"; + +/*------------------------------------------------------------\ +| | +| Event Count | +| | +\------------------------------------------------------------*/ + + static short XvpnMaxEventEditTable[] = + + { + 2, /* XVPN_EDIT_MEASURE */ + 1, /* XVPN_EDIT_IDENTIFY */ + 1 /* XVPN_EDIT_CONNECTED */ + }; + + static short XvpnInputEventEditTable[] = + + { + XVPN_INPUT_HALF_BOX, /* XVPN_EDIT_MEASURE */ + XVPN_INPUT_POINT, /* XVPN_EDIT_IDENTIFY */ + XVPN_INPUT_POINT /* XVPN_EDIT_CONNECTED */ + }; + + static short XvpnMaxEventZoomTable[] = + + { + 1, /* XVPN_ZOOM_CENTER */ + 2, /* XVPN_ZOOM_IN */ + 2 /* XVPN_ZOOM_PAN */ + }; + + static short XvpnInputEventZoomTable[] = + + { + XVPN_INPUT_POINT, /* XVPN_ZOOM_CENTER */ + XVPN_INPUT_BOX, /* XVPN_ZOOM_IN */ + XVPN_INPUT_LINE /* XVPN_ZOOM_PAN */ + }; + +/*------------------------------------------------------------\ +| | +| Translation | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Expose Edit Zoom | +| | +\------------------------------------------------------------*/ + + static long XvpnUnitEventZoomX[ 2 ] = { 0, 0 }; + static long XvpnUnitEventZoomY[ 2 ] = { 0, 0 }; + static short XvpnMaxEventZoom = 0; + short XvpnCountEventZoom = 0; + + static long XvpnUnitEventEditX[ 2 ] = { 0, 0 }; + static long XvpnUnitEventEditY[ 2 ] = { 0, 0 }; + static short XvpnMaxEventEdit = 1; + short XvpnCountEventEdit = 0; + + static short XvpnFirstExpose = XVPN_TRUE; + +/*------------------------------------------------------------\ +| | +| Input | +| | +\------------------------------------------------------------*/ + + static short XvpnInputMode = XVPN_INPUT_POINT; + static short XvpnSaveInputMode = XVPN_INPUT_POINT; + static short XvpnEditMode = XVPN_EDIT_IDENTIFY; + static short XvpnSaveEditMode = XVPN_EDIT_IDENTIFY; + +/*------------------------------------------------------------\ +| | +| Edit Message | +| | +\------------------------------------------------------------*/ + + static void (*XvpnPromptMessage)() = XvpnPromptEditIdentify; + static void (*XvpnSavePromptMessage)() = XvpnPromptEditIdentify; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnChangeEditMode | +| | +\------------------------------------------------------------*/ + +void XvpnChangeEditMode( EditMode , PromptMessage ) + + short EditMode; + void (*PromptMessage)(); +{ + autbegin(); + + if ( EditMode & XVPN_ZOOM_MARK ) + { + EditMode = EditMode & ~XVPN_ZOOM_MARK; + + XvpnCountEventZoom = 0; + XvpnMaxEventZoom = XvpnMaxEventZoomTable[ EditMode ]; + + if ( ! ( XvpnEditMode & XVPN_ZOOM_MARK ) ) + { + XvpnSaveEditMode = XvpnEditMode; + XvpnSaveInputMode = XvpnInputMode; + XvpnSavePromptMessage = XvpnPromptMessage; + } + + XvpnInputMode = XvpnInputEventZoomTable[ EditMode ]; + XvpnPromptMessage = PromptMessage; + XvpnEditMode = EditMode | XVPN_ZOOM_MARK; + + XvpnChangeCursorType( NULL, NULL, 0, XvpnInputMode ); + } + else + { + if ( XvpnEditMode & XVPN_ZOOM_MARK ) + { + XvpnSaveEditMode = EditMode; + XvpnSaveInputMode = XvpnInputEventEditTable[ EditMode ]; + XvpnSavePromptMessage = PromptMessage; + XvpnCountEventEdit = 0; + XvpnMaxEventEdit = XvpnMaxEventEditTable[ EditMode ]; + } + else + { + if ( XvpnEditMode != EditMode ) + { + XvpnCountEventEdit = 0; + XvpnMaxEventEdit = XvpnMaxEventEditTable[ EditMode ]; + XvpnEditMode = EditMode; + XvpnInputMode = XvpnInputEventEditTable[ EditMode ]; + XvpnPromptMessage = PromptMessage; + + XvpnChangeCursorType( NULL, NULL, 0, XvpnInputMode ); + } + } + + XvpnEditUnselectAll(); + } + + XvpnPromptMessage(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnContinueEditMode | +| | +\------------------------------------------------------------*/ + +void XvpnContinueEditMode( EditMode , PromptMessage, CountEvent ) + + short EditMode; + void (*PromptMessage)(); + short CountEvent; +{ + autbegin(); + + if ( XvpnEditMode & XVPN_ZOOM_MARK ) + { + XvpnSaveEditMode = EditMode; + XvpnSaveInputMode = XvpnInputEventEditTable[ EditMode ]; + XvpnSavePromptMessage = PromptMessage; + XvpnCountEventEdit = CountEvent; + XvpnMaxEventEdit = XvpnMaxEventEditTable[ EditMode ]; + } + else + { + XvpnCountEventEdit = CountEvent; + XvpnMaxEventEdit = XvpnMaxEventEditTable[ EditMode ]; + XvpnEditMode = EditMode; + XvpnInputMode = XvpnInputEventEditTable[ EditMode ]; + XvpnPromptMessage = PromptMessage; + + XvpnChangeCursorType( XvpnUnitEventEditX, + XvpnUnitEventEditY, + XvpnCountEventEdit, + XvpnInputMode ); + + } + + XvpnPromptMessage(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnTreatEventZoom | +| | +\------------------------------------------------------------*/ + +void XvpnTreatEventZoom() + +{ + autbegin(); + + XvpnChangeCursorType( XvpnUnitEventEditX, + XvpnUnitEventEditY, + XvpnCountEventEdit, + XvpnSaveInputMode ); + + switch ( XvpnEditMode ) + { + case XVPN_ZOOM_CENTER : + + XvpnZoomCenter( XvpnUnitEventZoomX[ 0 ], + XvpnUnitEventZoomY[ 0 ] ); + break; + + case XVPN_ZOOM_IN : + + XvpnZoomIn( XvpnUnitEventZoomX[ 0 ], + XvpnUnitEventZoomY[ 0 ], + XvpnUnitEventZoomX[ 1 ], + XvpnUnitEventZoomY[ 1 ] ); + break; + + case XVPN_ZOOM_PAN : + + XvpnZoomPan( XvpnUnitEventZoomX[ 0 ], + XvpnUnitEventZoomY[ 0 ], + XvpnUnitEventZoomX[ 1 ], + XvpnUnitEventZoomY[ 1 ] ); + break; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnTreatEventEdit | +| | +\------------------------------------------------------------*/ + +void XvpnTreatEventEdit() + +{ + long DeltaX; + long DeltaY; + long X1; + long X2; + long Y1; + long Y2; + + autbegin(); + + X1 = XvpnUnitEventEditX[0]; + X2 = XvpnUnitEventEditX[1]; + Y1 = XvpnUnitEventEditY[0]; + Y2 = XvpnUnitEventEditY[1]; + + if ( ( XvpnInputMode == XVPN_INPUT_LSTRING ) || + ( XvpnInputMode == XVPN_INPUT_ORTHO ) || + ( XvpnInputMode == XVPN_INPUT_SORTHO ) ) + { + DeltaX = X1 - X2; + DeltaY = Y1 - Y2; + + if ( DeltaX < 0 ) DeltaX = - DeltaX; + if ( DeltaY < 0 ) DeltaY = - DeltaY; + + if ( DeltaX > DeltaY ) + { + Y2 = Y1; + + XvpnUnitEventEditX[0] = X2; + XvpnUnitEventEditY[0] = Y2; + } + else + { + X2 = X1; + + XvpnUnitEventEditX[0] = X2; + XvpnUnitEventEditY[0] = Y2; + } + } + + if ( XvpnInputMode == XVPN_INPUT_LSTRING ) + { + XvpnChangeCursorType( XvpnUnitEventEditX, + XvpnUnitEventEditY, + 1, XvpnInputMode ); + + XvpnCountEventEdit = 1; + } + else + { + XvpnChangeCursorType( NULL, NULL, 0, + XvpnInputMode ); + + XvpnCountEventEdit = 0; + } + + switch ( XvpnEditMode ) + { + case XVPN_EDIT_MEASURE : + + break; + + case XVPN_EDIT_IDENTIFY : + + XvpnEditIdentify( X1, Y1 ); + + break; + + case XVPN_EDIT_CONNECTED : + + XvpnEditConnected( X1, Y1 ); + + break; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackEvent | +| | +\------------------------------------------------------------*/ + +void CallbackEvent ( MyWidget, Event, Args, Argc ) + + Widget MyWidget; + XButtonEvent *Event; + String *Args; + int *Argc; +{ + Display *EventDisplay; + short MouseEvent; + Position OldUnitCursorX; + Position OldUnitCursorY; + + autbegin(); + + EventDisplay = Event->display; + + MouseEvent = atoi( Args[ 0 ] ); + + if ( MouseEvent == XVPN_LEAVE ) + { + XvpnUndisplayCursor(); + XvpnCursorInside = XVPN_FALSE; + } + else + { + OldUnitCursorX = XvpnUnitCursorX; + OldUnitCursorY = XvpnUnitCursorY; + + XvpnComputeCursor( Event->x, Event->y ); + + switch ( MouseEvent ) + { + case XVPN_B1DN : + + if ( XvpnEditMode & XVPN_ZOOM_MARK ) + { + if ( XvpnCountEventZoom < XvpnMaxEventZoom ) + { + XvpnUnitEventZoomX[ XvpnCountEventZoom ] = XvpnUnitCursorX; + XvpnUnitEventZoomY[ XvpnCountEventZoom ] = XvpnUnitCursorY; + + XvpnCountEventZoom = XvpnCountEventZoom + 1; + + XvpnPointCursor(); + + if ( XvpnCountEventZoom == XvpnMaxEventZoom ) + { + XvpnTreatEventZoom(); + + XvpnInputMode = XvpnSaveInputMode; + XvpnEditMode = XvpnSaveEditMode; + XvpnPromptMessage = XvpnSavePromptMessage; + XvpnSaveEditMode = XVPN_EDIT_IDENTIFY; + XvpnSaveInputMode = XVPN_INPUT_POINT; + XvpnCountEventZoom = 0; + XvpnMaxEventZoom = 0; + + XvpnComputeCursor( Event->x, Event->y ); + XvpnDisplayCursor(); + } + } + } + else + { + if ( XvpnCountEventEdit < XvpnMaxEventEdit ) + { + XvpnUnitEventEditX[ XvpnCountEventEdit ] = XvpnUnitCursorX; + XvpnUnitEventEditY[ XvpnCountEventEdit ] = XvpnUnitCursorY; + + XvpnCountEventEdit = XvpnCountEventEdit + 1; + + XvpnPointCursor(); + + if ( XvpnCountEventEdit == XvpnMaxEventEdit ) + { + XvpnTreatEventEdit(); + + XvpnDisplayCursor(); + } + } + } + + XvpnPromptMessage(); + + break; + + case XVPN_B3DN : + + if ( XvpnEditMode & XVPN_ZOOM_MARK ) + { + if ( XvpnCountEventZoom != 0 ) + { + XvpnCountEventZoom = XvpnCountEventZoom - 1; + + XvpnResetCursor(); + } + else + { + XvpnChangeCursorType( XvpnUnitEventEditX, + XvpnUnitEventEditY, + XvpnCountEventEdit, + XvpnSaveInputMode ); + + XvpnInputMode = XvpnSaveInputMode; + XvpnEditMode = XvpnSaveEditMode; + XvpnPromptMessage = XvpnSavePromptMessage; + XvpnSaveEditMode = XVPN_EDIT_IDENTIFY; + XvpnSaveInputMode = XVPN_INPUT_POINT; + XvpnSavePromptMessage = XvpnPromptEditIdentify; + XvpnCountEventZoom = 0; + XvpnMaxEventZoom = 0; + } + } + else + { + if ( XvpnCountEventEdit != 0 ) + { + XvpnCountEventEdit = XvpnCountEventEdit - 1; + + XvpnResetCursor(); + } + else + { + XvpnEditUnselectAll(); + + XvpnChangeCursorType( NULL, NULL, 0, + XVPN_INPUT_POINT ); + + XvpnInputMode = XVPN_INPUT_POINT; + XvpnEditMode = XVPN_EDIT_IDENTIFY; + XvpnPromptMessage = XvpnPromptEditIdentify; + XvpnCountEventEdit = 0; + XvpnMaxEventEdit = 1; + } + } + + XvpnPromptMessage(); + + break; + + case XVPN_MOTION : + + break; + + case XVPN_ENTER : XvpnCursorInside = XVPN_TRUE; + XvpnDisplayCursor(); + break; + + case XVPN_KEY_UP : XvpnZoomUp(); + + break; + + case XVPN_KEY_DN : XvpnZoomDown(); + + break; + + case XVPN_KEY_LEFT : XvpnZoomLeft(); + + break; + + case XVPN_KEY_RIGHT : XvpnZoomRight(); + + break; + + case XVPN_KEY_MORE : XvpnZoomMore(); + + break; + + case XVPN_KEY_LESS : XvpnZoomLess(); + + break; + + case XVPN_KEY_FIT : XvpnZoomFit(); + + break; + + case XVPN_KEY_REFRESH : XvpnZoomRefresh(); + + break; + + case XVPN_KEY_UNZOOM : XvpnZoomUndo(); + + break; + + case XVPN_KEY_ZOOM_IN : + + XvpnChangeEditMode( XVPN_ZOOM_IN, XvpnPromptZoomIn ); + + break; + + case XVPN_KEY_CENTER : + + XvpnChangeEditMode( XVPN_ZOOM_CENTER, XvpnPromptZoomCenter ); + + break; + + case XVPN_KEY_PAN : + + XvpnChangeEditMode( XVPN_ZOOM_PAN, XvpnPromptZoomPan ); + + break; + + case XVPN_KEY_NEXT : + + XvpnFileNextSlide(); + + break; + + case XVPN_KEY_PREV : + + XvpnFilePrevSlide(); + + break; + } + + if ( ( OldUnitCursorX != XvpnUnitCursorX ) || + ( OldUnitCursorY != XvpnUnitCursorY ) ) + { + XvpnDisplayCoordinates(); + XvpnDisplayCursor(); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| CallbackResize | +| | +\------------------------------------------------------------*/ + +void CallbackResize( MyWidget, ClientData, CallData ) + + Widget MyWidget; + XtPointer ClientData; + XmDrawingAreaCallbackStruct *CallData; +{ + if ( XvpnFirstExpose == XVPN_FALSE ) + { + autbegin(); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_WATCH_CURSOR ); + XvpnUndisplayCursor(); + + XvpnResizeGraphicWindow(); + XvpnRefreshGraphicWindow( 0, 0, + XvpnGraphicDx, XvpnGraphicDy ); + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_NORMAL_CURSOR ); + XvpnDisplayCursor(); + + autend(); + } +} + +/*------------------------------------------------------------\ +| | +| CallbackExpose | +| | +\------------------------------------------------------------*/ + +void CallbackExpose( MyWidget, ClientData, CallData ) + + Widget MyWidget; + XtPointer ClientData; + XmDrawingAreaCallbackStruct *CallData; +{ + XExposeEvent *ExposeEvent; + + ExposeEvent = (XExposeEvent *)CallData->event; + + autbegin(); + + if ( XvpnFirstExpose == XVPN_TRUE ) + { + XvpnFirstExpose = XVPN_FALSE; + + XvpnInitializeGraphicWindow(); + XvpnUndisplayCursor(); + + XvpnLoadConfig( XVPN_FALSE ); + + if ( XvpnFirstFileName != (char *)NULL ) + { + XvpnDisplayCursor(); + XvpnFileOpen( XvpnFirstFileName ); + + XvpnFirstFileName = (char *)NULL; + } + else + { + XvpnChangeTopLevelTitle( (char *)NULL ); + + XvpnRefreshGraphicWindow( 0, 0, XvpnGraphicDx, XvpnGraphicDy ); + XvpnDisplayCursor(); + } + + XvpnEnterPresentPanel(); + } + else + { + XvpnUndisplayCursor(); + XvpnRefreshGraphicWindow( ExposeEvent->x, ExposeEvent->y, + ExposeEvent->width, ExposeEvent->height ); + XvpnDisplayCursor(); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnInitializeEvent | +| | +\------------------------------------------------------------*/ + +void XvpnInitializeEvent() + +{ + XtActionsRec NewActions; + + autbegin(); + + XtVaSetValues( XvpnGraphicWindow, + XmNtranslations, + XtParseTranslationTable( XvpnEventTranslation ), + NULL + ); + + NewActions.string = "CallbackEvent"; + NewActions.proc = CallbackEvent; + + XtAppAddActions( XvpnApplication, &NewActions, 1 ); + + XtAddCallback( XvpnGraphicWindow, + XmNresizeCallback, + CallbackResize, NULL ); + + XtAddCallback( XvpnGraphicWindow, + XmNexposeCallback, + CallbackExpose, NULL ); + + autend(); +} diff --git a/alliance/src/xvpn/src/XMX_event.h b/alliance/src/xvpn/src/XMX_event.h new file mode 100644 index 00000000..d71a6341 --- /dev/null +++ b/alliance/src/xvpn/src/XMX_event.h @@ -0,0 +1,101 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Event.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_EVENT +# define XVPN_EVENT + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XVPN_B1DN 0 +# define XVPN_B3DN 1 +# define XVPN_MOTION 2 +# define XVPN_ENTER 3 +# define XVPN_LEAVE 4 + +# define XVPN_KEY_UP 5 +# define XVPN_KEY_DN 6 +# define XVPN_KEY_LEFT 7 +# define XVPN_KEY_RIGHT 8 + +# define XVPN_KEY_MORE 9 +# define XVPN_KEY_LESS 10 + +# define XVPN_KEY_FIT 11 +# define XVPN_KEY_REFRESH 12 +# define XVPN_KEY_UNZOOM 13 + +# define XVPN_KEY_ZOOM_IN 14 +# define XVPN_KEY_CENTER 15 +# define XVPN_KEY_PAN 16 + +# define XVPN_KEY_NEXT 17 +# define XVPN_KEY_PREV 18 + +# define XVPN_MAX_EVENT_BUFFER 128 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnInitializeEvent(); + extern void XvpnDisplayEditMeasure(); + +# endif diff --git a/alliance/src/xvpn/src/XMX_graphic.c b/alliance/src/xvpn/src/XMX_graphic.c new file mode 100644 index 00000000..920ff05c --- /dev/null +++ b/alliance/src/xvpn/src/XMX_graphic.c @@ -0,0 +1,314 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Graphic.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" + +# include "XMX_graphic.h" +# include "XMX_grid.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + Widget XvpnGraphicFrame; + Widget XvpnGraphicWindow; + Display *XvpnGraphicDisplay = (Display *)NULL; + + Dimension XvpnGraphicDx = 0; + Dimension XvpnGraphicDy = 0; + Dimension XvpnOldGraphicDx = 0; + Dimension XvpnOldGraphicDy = 0; + + Pixmap XvpnGraphicPixmap = (Pixmap)NULL; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnInitializeGraphicWindow | +| | +\------------------------------------------------------------*/ + +void XvpnInitializeGraphicWindow() + +{ + autbegin(); + + XtVaGetValues( XvpnGraphicWindow, + XmNwidth, &XvpnGraphicDx, + XmNheight, &XvpnGraphicDy, + NULL + ); + + XvpnOldGraphicDx = XvpnGraphicDx; + XvpnOldGraphicDy = XvpnGraphicDy; + + XvpnGraphicPixmap = + + XCreatePixmap ( XvpnGraphicDisplay, + RootWindowOfScreen( XtScreen ( XvpnGraphicWindow ) ), + XvpnGraphicDx, + XvpnGraphicDy, + DefaultDepthOfScreen ( XtScreen ( XvpnGraphicWindow ) ) + ); + + XvpnClearGraphicWindow( 0, 0, XvpnGraphicDx, XvpnGraphicDy ); + XvpnInitializeUnitGrid(); + + XvpnSetMouseCursor( XvpnGraphicWindow, XVPN_NORMAL_CURSOR ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnClearGraphicWindow | +| | +\------------------------------------------------------------*/ + +void XvpnClearGraphicWindow( GraphicX, GraphicY, GraphicDx, GraphicDy ) + + long GraphicX; + long GraphicY; + long GraphicDx; + long GraphicDy; +{ + XFillRectangle( XvpnGraphicDisplay, + XvpnGraphicPixmap, + XvpnBackgroundGC, + GraphicX, GraphicY, + GraphicDx, + GraphicDy ); +} + +/*------------------------------------------------------------\ +| | +| XvpnRefreshGraphicWindow | +| | +\------------------------------------------------------------*/ + +void XvpnRefreshGraphicWindow( GraphicX, GraphicY, GraphicDx, GraphicDy ) + + Dimension GraphicX; + Dimension GraphicY; + Dimension GraphicDx; + Dimension GraphicDy; +{ + autbegin(); + + XvpnUndisplayCursor(); + + XCopyArea( XvpnGraphicDisplay, + XvpnGraphicPixmap, + XtWindow ( XvpnGraphicWindow ), + XvpnBackgroundGC, + GraphicX, GraphicY, + GraphicDx, GraphicDy, + GraphicX, GraphicY + ); + + XvpnDisplayUnitGrid( GraphicX, GraphicY, + GraphicX + GraphicDx, + GraphicY + GraphicDy ); + XvpnUndisplayCursor(); + + autend(); +} + + +/*------------------------------------------------------------\ +| | +| XvpnResizeGraphicWindow | +| | +\------------------------------------------------------------*/ + +void XvpnResizeGraphicWindow() + +{ + Pixmap OldPixmap; + Dimension SourceY; + Dimension TargetY; + Dimension TargetDx; + Dimension TargetDy; + + autbegin(); + + XvpnOldGraphicDx = XvpnGraphicDx; + XvpnOldGraphicDy = XvpnGraphicDy; + + XtVaGetValues( XvpnGraphicWindow, + XmNwidth, &XvpnGraphicDx, + XmNheight, &XvpnGraphicDy, + NULL + ); + + if ( ( XvpnOldGraphicDx != XvpnGraphicDx ) || + ( XvpnOldGraphicDy != XvpnGraphicDy ) ) + { + OldPixmap = XvpnGraphicPixmap; + + XvpnGraphicPixmap = + + XCreatePixmap ( XvpnGraphicDisplay, + RootWindowOfScreen( XtScreen ( XvpnGraphicWindow ) ), + XvpnGraphicDx, + XvpnGraphicDy, + DefaultDepthOfScreen ( XtScreen ( XvpnGraphicWindow ) ) + ); + + XvpnClearGraphicWindow( 0, 0, XvpnGraphicDx, XvpnGraphicDy ); + + XvpnResizeUnitGrid(); + + if ( XvpnOldGraphicDx < XvpnGraphicDx ) + { + TargetDx = XvpnOldGraphicDx; + + XvpnDisplayFigure( TargetDx, 0, + XvpnGraphicDx, XvpnGraphicDy ); + } + else + { + TargetDx = XvpnGraphicDx; + } + + if ( XvpnOldGraphicDy < XvpnGraphicDy ) + { + SourceY = 0; + TargetDy = XvpnOldGraphicDy; + TargetY = XvpnGraphicDy - XvpnOldGraphicDy; + + XvpnDisplayFigure( 0, TargetDy, + TargetDx, XvpnGraphicDy ); + } + else + { + TargetDy = XvpnGraphicDy; + TargetY = 0; + SourceY = XvpnOldGraphicDy - XvpnGraphicDy; + } + + XCopyArea( XvpnGraphicDisplay, + OldPixmap, + XvpnGraphicPixmap, + XvpnBackgroundGC, + 0, SourceY, + TargetDx, TargetDy, + 0, TargetY + ); + + XFreePixmap( XvpnGraphicDisplay, OldPixmap ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnInitializeGraphic | +| | +\------------------------------------------------------------*/ + +void XvpnInitializeGraphic() + +{ + autbegin(); + + XvpnGraphicFrame = XtVaCreateManagedWidget( "XvpnGraphicFrame", + xmFrameWidgetClass, + XvpnMainForm, + XmNshadowType , XmSHADOW_ETCHED_IN, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 1, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 191, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 1, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 199, + NULL ); + + XvpnGraphicWindow = XtVaCreateManagedWidget( + "XvpnGraphicWindow", + xmDrawingAreaWidgetClass, + XvpnGraphicFrame, + XmNtopAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNbackground, 1, + XmNforeground, 0, + NULL + ); + + XvpnGraphicDisplay = XtDisplay( XvpnGraphicWindow ); + + autend(); +} diff --git a/alliance/src/xvpn/src/XMX_graphic.h b/alliance/src/xvpn/src/XMX_graphic.h new file mode 100644 index 00000000..13732536 --- /dev/null +++ b/alliance/src/xvpn/src/XMX_graphic.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Graphic.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_GRAPHIC +# define XVPN_GRAPHIC + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnInitializeGraphic(); + extern void XvpnInitializeGraphicWindow(); + +# endif diff --git a/alliance/src/xvpn/src/XMX_grid.c b/alliance/src/xvpn/src/XMX_grid.c new file mode 100644 index 00000000..ecfd58ac --- /dev/null +++ b/alliance/src/xvpn/src/XMX_grid.c @@ -0,0 +1,310 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Grid.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XMX.h" + +# include "XMX_grid.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Unit Grid | +| | +\------------------------------------------------------------*/ + + float XvpnUnitGridStep; + + long XvpnUnitGridX; + long XvpnUnitGridY; + long XvpnUnitGridDx; + long XvpnUnitGridDy; + + long XvpnPixelGridX; + long XvpnPixelGridY; + +/*------------------------------------------------------------\ +| | +| User Unit Grid | +| | +\------------------------------------------------------------*/ + + long XvpnUnitUserGridDx; + long XvpnUnitUserGridDy; + short XvpnUnitUserGrid; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnInitializeUnitGrid | +| | +\------------------------------------------------------------*/ + +void XvpnInitializeUnitGrid() + +{ + autbegin(); + + XvpnUnitGridX = XVPN_DEFAULT_GRID_X; + XvpnUnitGridY = XVPN_DEFAULT_GRID_Y; + XvpnUnitGridDx = XVPN_DEFAULT_GRID_DX; + XvpnUnitGridDy = XVPN_DEFAULT_GRID_DY; + XvpnUnitUserGridDx = 4; + XvpnUnitUserGridDy = 4; + XvpnUnitUserGrid = XVPN_FALSE; + + XvpnComputeUnitGrid(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnComputeUnitGrid | +| | +\------------------------------------------------------------*/ + +void XvpnComputeUnitGrid() + +{ + float StepX; + float StepY; + + autbegin(); + + StepX = (float)(XvpnGraphicDx) / (float)(XvpnUnitGridDx); + StepY = (float)(XvpnGraphicDy) / (float)(XvpnUnitGridDy); + + if ( StepX < StepY ) + { + XvpnUnitGridStep = StepX; + XvpnUnitGridDy = 1 + ( XvpnGraphicDy / StepX ); + } + else + { + XvpnUnitGridStep = StepY; + XvpnUnitGridDx = 1 + ( XvpnGraphicDx / StepY ); + } + + XvpnPixelGridX = (float)(XvpnUnitGridX) * XvpnUnitGridStep; + XvpnPixelGridY = (float)(XvpnUnitGridY) * XvpnUnitGridStep; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnResizeUnitGrid | +| | +\------------------------------------------------------------*/ + +void XvpnResizeUnitGrid() + +{ + autbegin(); + + XvpnUnitGridDx = 1 + ( XvpnGraphicDx / XvpnUnitGridStep ); + XvpnUnitGridDy = 1 + ( XvpnGraphicDy / XvpnUnitGridStep ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnDisplayUnitGrid | +| | +\------------------------------------------------------------*/ + +short XvpnDisplayUnitGrid( GraphicX1, GraphicY1, GraphicX2, GraphicY2 ) + + Dimension GraphicX1; + Dimension GraphicY1; + Dimension GraphicX2; + Dimension GraphicY2; +{ + long X; + long Y; + long MaxGridX; + long MaxGridY; + long PixelX; + long PixelY; + long Xmin; + long Ymin; + short UserGrid; + short UnitGrid; + float Check; + + autbegin(); + + if ( XvpnUnitGridStep < XVPN_LOWER_GRID_STEP ) + { + UnitGrid = 0; + } + else + { + UnitGrid = 1; + } + + if ( XvpnUnitUserGrid == 1 ) + { + if ( XvpnUnitUserGridDx > XvpnUnitUserGridDy ) + { + Check = ( XVPN_LOWER_GRID_STEP * 2 / XvpnUnitUserGridDy ); + } + else + { + Check = ( XVPN_LOWER_GRID_STEP * 2 / XvpnUnitUserGridDy ); + } + + if ( XvpnUnitGridStep < Check ) UserGrid = 0; + else UserGrid = 1; + } + else + { + UserGrid = 0; + } + + if ( ( UserGrid == 0 ) && + ( UnitGrid == 0 ) ) + { + autend(); + return( XVPN_FALSE ); + } + + MaxGridX = XvpnUnitGridX + XvpnUnitGridDx; + MaxGridY = XvpnUnitGridY + XvpnUnitGridDy; + + if ( UnitGrid ) + { + for ( X = XvpnUnitGridX; X < MaxGridX; X = X + 1 ) + { + PixelX = ((float)(X) * XvpnUnitGridStep); + PixelX = PixelX - XvpnPixelGridX; + + if ( ( PixelX <= GraphicX2 ) && + ( PixelX >= GraphicX1 ) ) + + for ( Y = XvpnUnitGridY; Y < MaxGridY; Y = Y + 1 ) + { + PixelY = ((float)(Y) * XvpnUnitGridStep); + PixelY = PixelY - XvpnPixelGridY; + PixelY = XvpnGraphicDy - PixelY; + + if ( ( PixelY <= GraphicY2 ) && + ( PixelY >= GraphicY1 ) ) + { + XDrawPoint( XvpnGraphicDisplay, + XtWindow( XvpnGraphicWindow ), + XvpnGridGC, + PixelX, PixelY ); + } + } + } + } + + if ( UserGrid ) + { + Xmin = ( XvpnUnitGridX / XvpnUnitUserGridDx ) * XvpnUnitUserGridDx; + Ymin = ( XvpnUnitGridY / XvpnUnitUserGridDy ) * XvpnUnitUserGridDy; + + for ( X = Xmin; X < MaxGridX ; X = X + XvpnUnitUserGridDx ) + { + PixelX = ((float)(X) * XvpnUnitGridStep); + PixelX = PixelX - XvpnPixelGridX; + + if ( ( PixelX <= GraphicX2 ) && + ( PixelX >= GraphicX1 ) ) + + for ( Y = Ymin; Y < MaxGridY; Y = Y + XvpnUnitUserGridDy ) + { + PixelY = ((float)(Y) * XvpnUnitGridStep); + PixelY = PixelY - XvpnPixelGridY; + PixelY = XvpnGraphicDy - PixelY; + + if ( ( PixelY <= GraphicY2 ) && + ( PixelY >= GraphicY1 ) ) + { + XDrawLine( XvpnGraphicDisplay, + XtWindow( XvpnGraphicWindow ), + XvpnGridGC, + PixelX - 2, PixelY, + PixelX + 2, PixelY ); + + XDrawLine( XvpnGraphicDisplay, + XtWindow( XvpnGraphicWindow ), + XvpnGridGC, + PixelX, PixelY + 2, + PixelX, PixelY - 2 ); + } + } + } + } + + autend(); + return( XVPN_TRUE ); +} diff --git a/alliance/src/xvpn/src/XMX_grid.h b/alliance/src/xvpn/src/XMX_grid.h new file mode 100644 index 00000000..840f7ccb --- /dev/null +++ b/alliance/src/xvpn/src/XMX_grid.h @@ -0,0 +1,78 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Grid.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_GRID +# define XVPN_GRID + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XVPN_DEFAULT_GRID_X 0 +# define XVPN_DEFAULT_GRID_Y 0 +# define XVPN_DEFAULT_GRID_DX 40 +# define XVPN_DEFAULT_GRID_DY 40 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern short XvpnDisplayUnitGrid(); + +# endif diff --git a/alliance/src/xvpn/src/XMX_icon.c b/alliance/src/xvpn/src/XMX_icon.c new file mode 100644 index 00000000..09b4d033 --- /dev/null +++ b/alliance/src/xvpn/src/XMX_icon.c @@ -0,0 +1,131 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Icon.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" + +# include "XMX_icon.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static char IconBits[] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x40, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x08, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x87, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x88, 0x8f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x87, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x40, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x08, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x40, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x12, 0x40, 0x02, 0x00, 0x00, 0x00, 0x1f, 0x0e, 0x80, + 0xc3, 0x07, 0x00, 0xc0, 0x60, 0x0e, 0x80, 0x33, 0x18, 0x00, 0x20, 0x80, + 0x1e, 0xc0, 0x0b, 0x20, 0x00, 0x20, 0x80, 0x00, 0x00, 0x08, 0x20, 0x00, + 0x10, 0x00, 0x01, 0x00, 0x04, 0x40, 0x00, 0x10, 0x00, 0x01, 0x00, 0x04, + 0x40, 0x00, 0x10, 0x00, 0x01, 0x00, 0x04, 0x40, 0x00, 0x10, 0x00, 0x01, + 0x00, 0x04, 0x40, 0x00, 0x10, 0x00, 0x01, 0x00, 0x04, 0x40, 0x00, 0x20, + 0x80, 0x00, 0x00, 0x08, 0x20, 0x00, 0x20, 0x80, 0x00, 0x00, 0x08, 0x20, + 0x00, 0xc0, 0x60, 0x00, 0x00, 0x30, 0x18, 0x00, 0x00, 0x1f, 0x00, 0x00, + 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00 + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnInitializeIcon | +| | +\------------------------------------------------------------*/ + +void XvpnInitializeIcon() + +{ + autbegin(); + + XvpnSetIcon( XvpnTopLevel, + IconBits, IconWidth, IconHeight ); + + autend(); +} diff --git a/alliance/src/xvpn/src/XMX_icon.h b/alliance/src/xvpn/src/XMX_icon.h new file mode 100644 index 00000000..7384935d --- /dev/null +++ b/alliance/src/xvpn/src/XMX_icon.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Icon.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_ICON +# define XVPN_ICON + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define IconWidth 50 +# define IconHeight 50 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnInitializeIcon(); + +# endif diff --git a/alliance/src/xvpn/src/XMX_menu.c b/alliance/src/xvpn/src/XMX_menu.c new file mode 100644 index 00000000..845136a6 --- /dev/null +++ b/alliance/src/xvpn/src/XMX_menu.c @@ -0,0 +1,201 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XTB.h" +# include "XMF.h" +# include "XME.h" +# include "XMV.h" +# include "XMT.h" +# include "XMS.h" +# include "XMH.h" +# include "XMX.h" + +# include "XMX_menu.h" + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + Widget XvpnMenuBar; + + XvpnMenuItem XvpnMainMenu[] = + + { + { + "File", + 'F', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + XvpnFileMenu + } + , + { + "Edit", + 'E', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + XvpnEditMenu + } + , + { + "View", + 'V', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + XvpnViewMenu + } + , + { + "Tools", + 'T', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + XvpnToolsMenu + } + , + { + "Setup", + 'S', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + False, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + XvpnSetupMenu + } + , + { + "Help", + 'H', + NULL, + NULL, + &xmCascadeButtonGadgetClass, + False, + False, + True, + NULL, + (XtPointer)NULL, + (Widget)NULL, + (Widget)NULL, + XvpnHelpMenu + } + , + { NULL } + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnInitializeMenu | +| | +\------------------------------------------------------------*/ + +void XvpnInitializeMenu() + +{ + autbegin(); + + XvpnMenuBar = XmCreateMenuBar( XvpnMainWindow, + "XvpnMenuBar", NULL, 0 ); + + XvpnBuildMenus( XvpnMenuBar, XvpnMainMenu ); + + XtManageChild( XvpnMenuBar ); + + autend(); +} + diff --git a/alliance/src/xvpn/src/XMX_menu.h b/alliance/src/xvpn/src/XMX_menu.h new file mode 100644 index 00000000..eb09007c --- /dev/null +++ b/alliance/src/xvpn/src/XMX_menu.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_MENU +# define XVPN_MENU + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern XvpnMenuItem XvpnMainMenu[]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnInitializeMenu(); + +# endif diff --git a/alliance/src/xvpn/src/XMX_message.c b/alliance/src/xvpn/src/XMX_message.c new file mode 100644 index 00000000..4b4e5b1e --- /dev/null +++ b/alliance/src/xvpn/src/XMX_message.c @@ -0,0 +1,288 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Message.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XMX_message.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + Widget XvpnMessageMainForm; + Widget XvpnMessageText [ XVPN_MAX_MESSAGE ]; + Widget XvpnMessageLabel [ XVPN_MAX_MESSAGE ]; + Widget XvpnMessageFrame [ XVPN_MAX_MESSAGE ]; + Widget XvpnMessageForm [ XVPN_MAX_MESSAGE ]; + + static char *XvpnMessageLabelName [ XVPN_MAX_MESSAGE ] = + + { + "X :", + "Y :", + "Dx :", + "Dy :", + NULL, + NULL, + NULL + }; + + static char *XvpnMessageTextName [ XVPN_MAX_MESSAGE ] = + + { + "0", + "0", + "0", + "0", + "Identify", + "Select object", + "Enter select point" + }; + + static char *XvpnMessageFormName [ XVPN_MAX_MESSAGE ] = + + { + "XvpnMessageFormX", + "XvpnMessageFormY", + "XvpnMessageFormDx", + "XvpnMessageFormDy", + "XvpnMessageFormMode", + "XvpnMessageFormInfo", + "XvpnMessageFormPrompt" + }; + + static char *XvpnMessageFrameName [ XVPN_MAX_MESSAGE ] = + + { + "XvpnMessageFrameX", + "XvpnMessageFrameY", + "XvpnMessageFrameDx", + "XvpnMessageFrameDy", + "XvpnMessageFrameMode", + "XvpnMessageFrameInfo", + "XvpnMessageFramePrompt" + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnDisplayMessage | +| | +\------------------------------------------------------------*/ + +void XvpnDisplayMessage( Where, Text ) + + short Where; + char *Text; +{ + XmString TextString; + + autbegin(); + + TextString = XmStringCreateSimple( Text ); + + XtVaSetValues( XvpnMessageText[ Where ], XmNlabelString, TextString, NULL ); + + XmStringFree( TextString ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnPromptEditMeasure | +| | +\------------------------------------------------------------*/ + +void XvpnPromptEditMeasure() + +{ + autbegin(); + + XvpnDisplayMessage( XVPN_MESSAGE_MODE , "Measure" ); + XvpnDisplayMessage( XVPN_MESSAGE_PROMPT, "Enter base point" ); + XvpnDisplayMessage( XVPN_MESSAGE_INFO , "Select point" ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnInitializeMessage | +| | +\------------------------------------------------------------*/ + +void XvpnInitializeMessage() + +{ + int Counter; + int Column; + int Left; + int Width; + + autbegin(); + + XvpnMessageMainForm = + + XtVaCreateManagedWidget( "XvpnMessageMainForm", + xmFormWidgetClass , + XvpnMainForm , + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , 193, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , 199, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , 0, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 200, + XmNfractionBase , 200, + NULL ); + + Column = 1; + Width = 17; + + for ( Counter = 0; Counter < XVPN_MAX_MESSAGE; Counter++ ) + { + if ( Counter == 4 ) Width = 22; + if ( Counter == 5 ) Width = 68; + if ( Counter == 6 ) Width = 40; + + XvpnMessageFrame[ Counter ] = + + XtVaCreateManagedWidget( XvpnMessageFrameName[ Counter ], + xmFrameWidgetClass, + XvpnMessageMainForm, + XmNshadowType , XmSHADOW_ETCHED_IN, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , Column, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , Column + Width, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + NULL + ); + + XvpnMessageForm[ Counter ] = + + XtVaCreateManagedWidget( XvpnMessageFormName[ Counter ], + xmFormWidgetClass , + XvpnMessageFrame[ Counter ], + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNfractionBase , 18, + NULL + ); + + if ( XvpnMessageLabelName[ Counter ] != (char *)NULL ) + { + XvpnMessageLabel [ Counter ] = + + XtVaCreateManagedWidget( XvpnMessageLabelName[ Counter ], + xmLabelWidgetClass, + XvpnMessageForm [ Counter ], + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , 6, + XmNbottomAttachment , XmATTACH_FORM, + XmNtopAttachment , XmATTACH_FORM, + XmNrecomputeSize , False, + NULL + ); + Left = 6; + } + else + { + Left = 0; + } + + XvpnMessageText [ Counter ] = + + XtVaCreateManagedWidget( XvpnMessageTextName[ Counter ], + xmLabelWidgetClass, + XvpnMessageForm [ Counter ], + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , Left, + XmNrecomputeSize , False, + NULL + ); + + Column = Column + Width; + } + + autend(); +} diff --git a/alliance/src/xvpn/src/XMX_message.h b/alliance/src/xvpn/src/XMX_message.h new file mode 100644 index 00000000..f5f11ccb --- /dev/null +++ b/alliance/src/xvpn/src/XMX_message.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Message.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_MESSAGE +# define XVPN_MESSAGE + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnInitializeMessage(); + extern void XvpnPromptEditMeasure(); + +# endif diff --git a/alliance/src/xvpn/src/XMX_motif.c b/alliance/src/xvpn/src/XMX_motif.c new file mode 100644 index 00000000..cd2857d8 --- /dev/null +++ b/alliance/src/xvpn/src/XMX_motif.c @@ -0,0 +1,196 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Motif.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XTB.h" +# include "XMX.h" +# include "XMS.h" +# include "XMV.h" + +# include "XMX_motif.h" +# include "XMX_graphic.h" +# include "XMX_event.h" +# include "XMX_message.h" +# include "XMX_menu.h" +# include "XMX_color.h" +# include "XMX_panel.h" +# include "XMX_dialog.h" +# include "XMX_icon.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + XtAppContext XvpnApplication; + Widget XvpnTopLevel; + Widget XvpnMainWindow; + Widget XvpnMainForm; + + static String XvpnFallBacks [] = + + { + "*.XvpnMainWindow.iconName : Xvpn", + "*XvpnMenuBar*fontList : -*-helvetica-bold-r-*--14-*", + "*foreground : black", + "*background : gray", + "*fontList : -*-helvetica-medium-r-*--12-*", + "*pathMode : XmPATH_MODE_RELATIVE", + NULL + }; + + static char XvpnTopLevelTitle[ 128 ] = "Xvpn : "; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnChangeTopLevelTitle | +| | +\------------------------------------------------------------*/ + +void XvpnChangeTopLevelTitle( Title ) + + char *Title; +{ + autbegin(); + + if ( Title != (char *)NULL ) + { + strcpy( XvpnTopLevelTitle + 7, Title ); + } + else + { + XvpnTopLevelTitle[ 7 ] = '\0'; + } + + XtVaSetValues( XvpnTopLevel, XmNtitle, XvpnTopLevelTitle, NULL ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnInitializeRessources | +| | +\------------------------------------------------------------*/ + +void XvpnInitializeRessources( argc, argv ) + + int *argc; + char *argv[]; +{ + Arg Args[ 1 ]; + + autbegin(); + + XvpnTopLevel = XtVaAppInitialize( + &XvpnApplication, + "xvpn.xrdb", + NULL, + 0, + argc, + argv, + XvpnFallBacks, + NULL + ); + + XvpnLoadTopLevelConfig(); + + XvpnInitializeColorMap(); + + XvpnMainWindow = XtVaCreateManagedWidget( "XvpnMainWindow", + xmMainWindowWidgetClass, + XvpnTopLevel, + NULL); + + XvpnMainForm = XtVaCreateManagedWidget( "XvpnMainForm", + xmFormWidgetClass, + XvpnMainWindow, + XmNfractionBase, + 200, + NULL ); + + XvpnInitializeIcon(); + XvpnInitializeMenu(); + XvpnInitializeMessage(); + XvpnInitializePanel(); + XvpnInitializeGraphic(); + XvpnInitializeEvent(); + XvpnBuildPanelMap(); + XvpnInitializeMapEvent(); + XvpnInitializeColors(); + XvpnInitializeGraphicContext(); + XvpnInitializeDialog(); + + XtSetArg( Args[0], XmNallowShellResize, True ); + XtSetValues( XvpnTopLevel, Args, 1 ); + + XtRealizeWidget( XvpnTopLevel ); + + autend(); +} diff --git a/alliance/src/xvpn/src/XMX_motif.h b/alliance/src/xvpn/src/XMX_motif.h new file mode 100644 index 00000000..b42c0400 --- /dev/null +++ b/alliance/src/xvpn/src/XMX_motif.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Motif.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_MOTIF +# define XVPN_MOTIF + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xvpn/src/XMX_panel.c b/alliance/src/xvpn/src/XMX_panel.c new file mode 100644 index 00000000..bd987a98 --- /dev/null +++ b/alliance/src/xvpn/src/XMX_panel.c @@ -0,0 +1,111 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XTB.h" +# include "XMF.h" +# include "XME.h" +# include "XMV.h" +# include "XMT.h" +# include "XMS.h" +# include "XMH.h" +# include "XMX.h" + +# include "XMX_panel.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnInitializePanel | +| | +\------------------------------------------------------------*/ + +void XvpnInitializePanel() + +{ + autbegin(); + + XvpnBuildPanel( XvpnMainWindow, &XvpnViewArrowsPanel ); + XvpnBuildPanel( XvpnMainWindow, &XvpnViewZoomPanel ); + XvpnBuildPanel( XvpnMainWindow, &XvpnViewGridPanel ); + XvpnBuildPanel( XvpnMainWindow, &XvpnViewLayerPanel ); + XvpnBuildPanel( XvpnMainWindow, &XvpnEditSearchViewPanel ); + XvpnBuildPanel( XvpnMainWindow, &XvpnEditSelectPanel ); + XvpnBuildPanel( XvpnMainWindow, &XvpnEditIdentifyPanel ); + XvpnBuildPanel( XvpnMainWindow, &XvpnEditDescriptionPanel ); + XvpnBuildPanel( XvpnMainWindow, &XvpnToolsMessagePanel ); + XvpnBuildPanel( XvpnMainWindow, &XvpnSetupInformationsPanel ); + + XvpnBuildPresentPanel(); + + autend(); +} diff --git a/alliance/src/xvpn/src/XMX_panel.h b/alliance/src/xvpn/src/XMX_panel.h new file mode 100644 index 00000000..034da0d3 --- /dev/null +++ b/alliance/src/xvpn/src/XMX_panel.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_PANEL +# define XVPN_PANEL + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnInitializePanel(); + +# endif diff --git a/alliance/src/xvpn/src/XMX_view.c b/alliance/src/xvpn/src/XMX_view.c new file mode 100644 index 00000000..4dbca09e --- /dev/null +++ b/alliance/src/xvpn/src/XMX_view.c @@ -0,0 +1,699 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : View.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" +# include "XSB.h" +# include "XVP.h" +# include "XMX.h" + +# include "XMX_view.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static long XvpnGraphicX1; + static long XvpnGraphicX2; + static long XvpnGraphicY1; + static long XvpnGraphicY2; + static XFontStruct *XvpnTextFont; + static GC XvpnTextGC; + static GC XvpnDrawGC; + static char XvpnInterrupt = 0; + static char XvpnCheckInt = 0; + + static xvpnview_list *XvpnHeadView = (xvpnview_list *)NULL; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Alloc Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnAllocView | +| | +\------------------------------------------------------------*/ + +xvpnview_list *XvpnAllocView() +{ + return( (xvpnview_list *)autallocheap( sizeof( xvpnview_list ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Free Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnFreeView | +| | +\------------------------------------------------------------*/ + +void XvpnFreeView( FreeView ) + + xvpnview_list *FreeView; +{ + autfreeheap( (char *)FreeView, sizeof( xvpnview_list ) ); +} + +/*------------------------------------------------------------\ +| | +| XvpnAddViewLater | +| | +\------------------------------------------------------------*/ + +void XvpnAddViewLater( Obj ) + + xvpnobj_list *Obj; +{ + xvpnview_list *View; + + autbegin(); + + View = XvpnAllocView(); + + View->OBJECT = Obj; + View->NEXT = XvpnHeadView; + XvpnHeadView = View; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnDelView | +| | +\------------------------------------------------------------*/ + +void XvpnDelView() +{ + xvpnview_list *DelView; + xvpnview_list *View; + + autbegin(); + + View = XvpnHeadView; + XvpnHeadView = (xvpnview_list *)NULL; + + while( View != (xvpnview_list *)NULL ) + { + DelView = View; + View = View->NEXT; + + XvpnFreeView( DelView ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnCheckInterrupt | +| | +\------------------------------------------------------------*/ + +char XvpnCheckInterrupt() +{ + XEvent Event; + KeySym Key; + char Text; + + autbegin(); + + if ( XvpnCheckInt ) + { + if ( XCheckTypedEvent( XvpnGraphicDisplay, KeyPress, &Event ) ) + { + XLookupString( &Event.xkey, &Text, 1, &Key, 0 ); + + if ( Text == '\003' ) + { + XvpnInterrupt = 1; + + XBell( XvpnGraphicDisplay, 0 ); + } + } + } + + XvpnCheckInt = 0; + + autend(); + + return( XvpnInterrupt ); +} + +/*------------------------------------------------------------\ +| | +| XvpnInterruptDisplay | +| | +\------------------------------------------------------------*/ + +void XvpnInterruptDisplay() +{ + autbegin(); + + XvpnCheckInt = 1; + + signal( SIGALRM, XvpnInterruptDisplay ); + alarm( 1 ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnFlushEventDisplay | +| | +\------------------------------------------------------------*/ + +void XvpnFlushEventDisplay() +{ + XEvent Event; + + autbegin(); + + while ( XCheckTypedEvent( XvpnGraphicDisplay, KeyPress, &Event ) ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnDisplayArrow | +| | +\------------------------------------------------------------*/ + +char XvpnComputeArrow( X1, Y1, X2, Y2, Points ) + + long X1; + long Y1; + long X2; + long Y2; + XPoint *Points; +{ + float LineX; + float LineY; + float HalfX; + float HalfY; + float CrossX; + float CrossY; + float Norm; + + LineX = (float)( X2 - X1 ); + LineY = (float)( Y2 - Y1 ); + + if ( ( LineX != 0.0 ) || + ( LineY != 0.0 ) ) + { + Norm = sqrt( ( LineX * LineX ) + ( LineY * LineY ) ); + Norm = Norm / XvpnUnitGridStep; + LineX = LineX / Norm; + LineY = LineY / Norm; + HalfX = LineX / 2; + HalfY = LineY / 2; + CrossX = - HalfY; + CrossY = HalfX; + + Points[ 0 ].x = X1 + LineX; + Points[ 0 ].y = Y1 + LineY; + Points[ 1 ].x = Points[ 0 ].x + LineX + HalfX + CrossX; + Points[ 1 ].y = Points[ 0 ].y + LineY + HalfY + CrossY; + Points[ 2 ].x = Points[ 0 ].x + LineX + HalfX - CrossX; + Points[ 2 ].y = Points[ 0 ].y + LineY + HalfY - CrossY; + + return( XVPN_TRUE ); + } + + return( XVPN_FALSE ); +} + +/*------------------------------------------------------------\ +| | +| XvpnDisplayOneObject | +| | +\------------------------------------------------------------*/ + +void XvpnDisplayOneObject( Obj ) + + xvpnobj_list *Obj; +{ + XPoint Arrow[ 3 ]; + long X1r; + long X2r; + long Y1r; + long Y2r; + long DeltaX; + long DeltaY; + long WidthText; + long HeightText; + int Length; + + if ( IsXvpnLineLeft( Obj ) ) + { + X1r = Obj->X + Obj->DX; + X2r = Obj->X; + } + else + { + X1r = Obj->X; + X2r = Obj->X + Obj->DX; + } + + if ( IsXvpnLineDown( Obj ) ) + { + Y1r = Obj->Y + Obj->DY; + Y2r = Obj->Y; + } + else + { + Y1r = Obj->Y; + Y2r = Obj->Y + Obj->DY; + } + + X1r = (float)( X1r ) * XvpnUnitGridStep; + Y1r = (float)( Y1r ) * XvpnUnitGridStep; + X2r = (float)( X2r ) * XvpnUnitGridStep; + Y2r = (float)( Y2r ) * XvpnUnitGridStep; + + X1r = ( X1r / XVPN_UNIT ) - XvpnPixelGridX; + X2r = ( X2r / XVPN_UNIT ) - XvpnPixelGridX; + Y1r = ( Y1r / XVPN_UNIT ) - XvpnPixelGridY; + Y2r = ( Y2r / XVPN_UNIT ) - XvpnPixelGridY; + + DeltaX = X2r - X1r; + DeltaY = Y2r - Y1r; + + if ( DeltaX <= 0 ) DeltaX = 1; + if ( DeltaY <= 0 ) DeltaY = 1; + + switch ( GetXvpnObjectType( Obj ) ) + { + case XVPN_OBJECT_LINE : + + XDrawLine( XvpnGraphicDisplay, + XvpnGraphicPixmap, + XvpnDrawGC, + X1r, XvpnGraphicDy - Y1r, + X2r, XvpnGraphicDy - Y2r ); + break; + + case XVPN_OBJECT_ARROW : + + XDrawLine( XvpnGraphicDisplay, + XvpnGraphicPixmap, + XvpnDrawGC, + X1r, XvpnGraphicDy - Y1r, + X2r, XvpnGraphicDy - Y2r ); + + if ( XvpnComputeArrow( X1r, Y1r, X2r, Y2r, Arrow ) ) + { + Arrow[ 0 ].y = XvpnGraphicDy - Arrow[ 0 ].y; + Arrow[ 1 ].y = XvpnGraphicDy - Arrow[ 1 ].y; + Arrow[ 2 ].y = XvpnGraphicDy - Arrow[ 2 ].y; + + XFillPolygon( XvpnGraphicDisplay, + XvpnGraphicPixmap, + XvpnDrawGC, Arrow, 3, + Convex, + CoordModeOrigin ); + } + + break; + + case XVPN_OBJECT_CIRCLE : + + XFillArc( XvpnGraphicDisplay, + XvpnGraphicPixmap, + XvpnDrawGC, + X1r, XvpnGraphicDy - Y2r, + DeltaX, + DeltaY, 0, 23040 ); + break; + + case XVPN_OBJECT_RECTANGLE : + + XFillRectangle( XvpnGraphicDisplay, + XvpnGraphicPixmap, + XvpnDrawGC, + X1r, XvpnGraphicDy - Y2r, + DeltaX, DeltaY ); + + break; + + case XVPN_OBJECT_TEXT : + + Length = strlen( Obj->NAME ); + HeightText = XvpnTextFont->ascent; + + if ( IsXvpnTrans( Obj ) ) + { + XDrawString( XvpnGraphicDisplay, + XvpnGraphicPixmap, + XvpnTextGC, + X1r, + XvpnGraphicDy - (( Y1r + Y2r - HeightText ) >> 1), + Obj->NAME, Length ); + } + else + { + WidthText = XTextWidth( XvpnTextFont, Obj->NAME, Length ); + + XDrawString( XvpnGraphicDisplay, + XvpnGraphicPixmap, + XvpnTextGC, + (( X1r + X2r - WidthText ) >> 1), + XvpnGraphicDy - (( Y1r + Y2r - HeightText ) >> 1), + Obj->NAME, Length ); + } + + break; + } +} + +/*------------------------------------------------------------\ +| | +| XvpnDisplayFigure | +| | +\------------------------------------------------------------*/ + +void XvpnDisplayFigure( GraphicX1, GraphicY1, GraphicX2, GraphicY2 ) + + long GraphicX1; + long GraphicY1; + long GraphicX2; + long GraphicY2; +{ + xvpnview_list *View; + xvpnobj_list *Obj; + long X1; + long Y1; + long X2; + long Y2; + int Layer; + char DisplayTextTrans; + char DisplayTextPlace; + + autbegin(); + + DisplayTextTrans = XVPN_ACTIVE_NAME_TABLE[ XVPN_ACTIVE_NAME_TRANS ]; + DisplayTextPlace = XVPN_ACTIVE_NAME_TABLE[ XVPN_ACTIVE_NAME_PLACE ]; + + XvpnGraphicX1 = GraphicX1; + XvpnGraphicX2 = GraphicX2; + XvpnGraphicY1 = GraphicY1; + XvpnGraphicY2 = GraphicY2; + + if ( XvpnUnitGridStep > 15.0 ) + { + XvpnTextGC = XvpnLargeTextGC; + XvpnTextFont = XvpnLargeTextFont; + } + else + if ( XvpnUnitGridStep > 10.0 ) + { + XvpnTextGC = XvpnMediumTextGC; + XvpnTextFont = XvpnMediumTextFont; + } + else + if ( ( XvpnUnitGridStep > 6.0 ) || + ( XVPN_FORCE_DISPLAY ) ) + { + XvpnTextGC = XvpnSmallTextGC; + XvpnTextFont = XvpnSmallTextFont; + } + else + { + DisplayTextTrans = 0; + DisplayTextPlace = 0; + } + + XvpnClearGraphicWindow( GraphicX1, + XvpnGraphicDy - GraphicY2, + GraphicX2 - GraphicX1, + GraphicY2 - GraphicY1 ); + + if ( XvpnFigure == (xvpnfig_list *)NULL ) return; + + X1 = GraphicX1 + XvpnPixelGridX; + X2 = GraphicX2 + XvpnPixelGridX; + Y1 = GraphicY1 + XvpnPixelGridY; + Y2 = GraphicY2 + XvpnPixelGridY; + + X1 = ( X1 / XvpnUnitGridStep ); + Y1 = ( Y1 / XvpnUnitGridStep ); + X2 = ( X2 / XvpnUnitGridStep ); + Y2 = ( Y2 / XvpnUnitGridStep ); + + if ( X2 >= 0 ) { X2 = X2 + 1; } + if ( Y2 >= 0 ) { Y2 = Y2 + 1; } + if ( X1 <= 0 ) { X1 = X1 - 1; } + if ( Y1 <= 0 ) { Y1 = Y1 - 1; } + + X1 = X1 * XVPN_UNIT; + X2 = X2 * XVPN_UNIT; + Y1 = Y1 * XVPN_UNIT; + Y2 = Y2 * XVPN_UNIT; + + XvpnInterrupt = 0; + XvpnCheckInt = 0; + + signal( SIGALRM, XvpnInterruptDisplay ); + alarm( 1 ); + + for ( Layer = 0; Layer < XVPN_MAX_LAYER; Layer++ ) + { + if ( XvpnCheckInterrupt() ) break; + + if ( XVPN_ACTIVE_LAYER_TABLE[ Layer ] == 0 ) continue; + + XvpnDrawGC = XvpnLayerDrawGC[ Layer ]; + + for ( Obj = XvpnFigure->OBJECT[ Layer ]; + Obj != (xvpnobj_list *)NULL; + Obj = Obj->NEXT ) + { + if ( XvpnCheckInterrupt() ) break; + + if ( XVPN_ACTIVE_LAYER_TABLE[ Obj->LAYER ] == 0 ) continue; + + if ( ( Obj->X <= X2 ) && + ( Obj->Y <= Y2 ) && + ( Obj->X + Obj->DX >= X1 ) && + ( Obj->Y + Obj->DY >= Y1 ) ) + { + if ( ( IsXvpnAccept( Obj ) ) || + ( IsXvpnConnect( Obj ) ) ) + { + XvpnAddViewLater( Obj ); + } + else + { + XvpnDisplayOneObject( Obj ); + } + } + } + } + + for ( View = XvpnHeadView; + View != (xvpnview_list *)NULL; + View = View->NEXT ) + { + Obj = View->OBJECT; + + if ( IsXvpnAccept( Obj ) ) + { + XvpnDrawGC = XvpnAcceptDrawGC; + } + else + { + XvpnDrawGC = XvpnConnectDrawGC; + } + + XvpnDisplayOneObject( Obj ); + } + + XvpnDelView(); + + for ( Layer = 0; Layer < XVPN_MAX_LAYER; Layer++ ) + { + if ( XvpnCheckInterrupt() ) break; + + if ( XVPN_ACTIVE_LAYER_TABLE[ Layer ] == 0 ) continue; + + for ( Obj = XvpnFigure->TEXT[ Layer ]; + Obj != (xvpnobj_list *)NULL; + Obj = Obj->NEXT ) + { + if ( XvpnCheckInterrupt() ) break; + + if ( XVPN_ACTIVE_LAYER_TABLE[ Obj->LAYER ] == 0 ) continue; + + if ( ( Obj->X <= X2 ) && + ( Obj->Y <= Y2 ) && + ( Obj->X + Obj->DX >= X1 ) && + ( Obj->Y + Obj->DY >= Y1 ) ) + { + if ( ( IsXvpnTrans( Obj ) && DisplayTextTrans ) || + ( IsXvpnPlace( Obj ) && DisplayTextPlace ) || + ( IsXvpnProc( Obj ) && DisplayTextPlace ) ) + { + XvpnDisplayOneObject( Obj ); + } + } + } + } + + alarm( 0 ); + XvpnFlushEventDisplay(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnDisplayObject | +| | +\------------------------------------------------------------*/ + +void XvpnDisplayObject( Obj ) + + xvpnobj_list *Obj; +{ + xvpnobj_list *ScanObj; + long Xmin; + long Ymin; + long Xmax; + long Ymax; + + autbegin(); + + Xmin = Obj->X; + Ymin = Obj->Y; + Xmax = Xmin + Obj->DX; + Ymax = Ymin + Obj->DY; + + ScanObj = Obj->LINK; + + while ( ScanObj != Obj ) + { + if ( Xmin > ScanObj->X ) + { + Xmin = ScanObj->X; + } + + if ( Xmax < ( ScanObj->X + ScanObj->DX ) ) + { + Xmax = ScanObj->X + ScanObj->DX; + } + + if ( Ymin > ScanObj->Y ) + { + Ymin = ScanObj->Y; + } + + if ( Ymax < ( ScanObj->Y + ScanObj->DY ) ) + { + Ymax = ScanObj->Y + ScanObj->DY; + } + + ScanObj = ScanObj->LINK; + } + + Xmin = (float)( Xmin - XVPN_UNIT ) * XvpnUnitGridStep; + Ymin = (float)( Ymin - XVPN_UNIT ) * XvpnUnitGridStep; + Xmax = (float)( Xmax + XVPN_UNIT ) * XvpnUnitGridStep; + Ymax = (float)( Ymax + XVPN_UNIT ) * XvpnUnitGridStep; + + Xmin = ( Xmin / XVPN_UNIT ) - XvpnPixelGridX - 1; + Xmax = ( Xmax / XVPN_UNIT ) - XvpnPixelGridX + 1; + Ymin = ( Ymin / XVPN_UNIT ) - XvpnPixelGridY - 1; + Ymax = ( Ymax / XVPN_UNIT ) - XvpnPixelGridY + 1; + + if ( Xmin < 0 ) Xmin = 0; + if ( Ymin < 0 ) Ymin = 0; + + if ( Xmax > XvpnGraphicDx ) Xmax = XvpnGraphicDx; + if ( Ymax > XvpnGraphicDy ) Ymax = XvpnGraphicDy; + + if ( ( Xmax > 0 ) && + ( Ymax > 0 ) && + ( Xmin < XvpnGraphicDx ) && + ( Ymin < XvpnGraphicDy ) ) + { + XvpnDisplayFigure( Xmin, Ymin , Xmax, Ymax ); + + XvpnRefreshGraphicWindow( Xmin, XvpnGraphicDy - Ymax, + Xmax - Xmin, Ymax - Ymin ); + } + + autend(); +} diff --git a/alliance/src/xvpn/src/XMX_view.h b/alliance/src/xvpn/src/XMX_view.h new file mode 100644 index 00000000..20ba8666 --- /dev/null +++ b/alliance/src/xvpn/src/XMX_view.h @@ -0,0 +1,78 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : View.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_VIEW +# define XVPN_VIEW + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct xvpnview_list + { + struct xvpnview_list *NEXT; + xvpnobj_list *OBJECT; + + } xvpnview_list; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xvpn/src/XSB.h b/alliance/src/xvpn/src/XSB.h new file mode 100644 index 00000000..f94da187 --- /dev/null +++ b/alliance/src/xvpn/src/XSB.h @@ -0,0 +1,195 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : XSB.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_XSB +# define XVPN_XSB + +/*------------------------------------------------------\ +| | +| Alloc | +| | +\------------------------------------------------------*/ + +# define XVPN_ALLOC_BLOCK 0 +# define XVPN_ALLOC_HEAP 1 + +/*------------------------------------------------------\ +| | +| Others | +| | +\------------------------------------------------------*/ + +# define XVPN_TRUE 1 +# define XVPN_FALSE 0 + +# define XVPN_ERROR 1 +# define XVPN_OK 0 + +# define XVPN_NORTH 0 +# define XVPN_SOUTH 1 +# define XVPN_EAST 2 +# define XVPN_WEST 3 + +# define XVPN_NORTH_MASK 1 +# define XVPN_SOUTH_MASK 2 +# define XVPN_WEST_MASK 4 +# define XVPN_EAST_MASK 8 + +# define XVPN_DEFAULT_FIGURE_NAME "NONAME" + +/*------------------------------------------------------\ +| | +| Layer | +| | +\------------------------------------------------------*/ + +# define XVPN_LAYER_PROCESS 0 +# define XVPN_LAYER_FUNCTION 1 +# define XVPN_LAYER_WAIT 2 +# define XVPN_LAYER_ASSIGN 3 +# define XVPN_LAYER_GUARDED 4 +# define XVPN_LAYER_ACT_GUARDED 5 +# define XVPN_LAYER_TOKEN 6 + +# define XVPN_MAX_LAYER 10 + +/*------------------------------------------------------\ +| | +| Active Name | +| | +\------------------------------------------------------*/ + +# define XVPN_ACTIVE_NAME_PLACE 0 +# define XVPN_ACTIVE_NAME_TRANS 1 +# define XVPN_MAX_ACTIVE_NAME 2 + +/*------------------------------------------------------------\ +| | +| Edit Mode | +| | +\------------------------------------------------------------*/ + +# define XVPN_EDIT_MEASURE (short)0x00 +# define XVPN_EDIT_IDENTIFY (short)0x01 +# define XVPN_EDIT_CONNECTED (short)0x02 + +# define XVPN_ZOOM_CENTER (short)0x80 +# define XVPN_ZOOM_IN (short)0x81 +# define XVPN_ZOOM_PAN (short)0x82 + +# define XVPN_ZOOM_MARK (short)0x80 + +/*------------------------------------------------------------\ +| | +| Input Mode | +| | +\------------------------------------------------------------*/ + +# define XVPN_INPUT_POINT 0 +# define XVPN_INPUT_ORTHO 1 +# define XVPN_INPUT_LINE 2 +# define XVPN_INPUT_LSTRING 3 +# define XVPN_INPUT_BOX 4 +# define XVPN_INPUT_SORTHO 5 +# define XVPN_INPUT_HALF_BOX 6 + +/*------------------------------------------------------------\ +| | +| Fill Mode | +| | +\------------------------------------------------------------*/ + +# define XVPN_FILL_MODE_OUTLINE 0 +# define XVPN_FILL_MODE_FILL 1 +# define XVPN_FILL_MODE_PATTERN 2 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern short XVPN_ACTIVE_LAYER_TABLE[ XVPN_MAX_LAYER ]; + extern short XVPN_ACTIVE_NAME_TABLE[ XVPN_MAX_ACTIVE_NAME ]; + + extern char *XVPN_CURSOR_COLOR_NAME; + extern char *XVPN_BACKGROUND_COLOR_NAME; + extern char *XVPN_FOREGROUND_COLOR_NAME; + extern char *XVPN_ACCEPT_COLOR_NAME; + extern char *XVPN_CONNECT_COLOR_NAME; + + extern long XVPN_CURSOR_SIZE; + extern float XVPN_LOWER_GRID_STEP; + extern long XVPN_UNIT; + extern char *XVPN_LAYER_NAME_TABLE[ XVPN_MAX_LAYER ][ 3 ]; + extern char *XVPN_PARAM_NAME; + extern char XVPN_DEBUG_ON; + + extern char *XVPN_VHDL_LIBLST; + extern char *XVPN_VHDL_BEHSFX; + extern char *XVPN_XMS_FILE_NAME; + + extern char *XvpnFirstFileName; + + extern char XVPN_FORCE_DISPLAY; + extern char XVPN_XOR_CURSOR; + extern char XVPN_SWITCH_COLOR_MAP; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern char *XvpnPostTreatString(); + extern void XvpnLoadParameters(); + extern void Xvpngetenv(); + +# endif diff --git a/alliance/src/xvpn/src/XSB_error.c b/alliance/src/xvpn/src/XSB_error.c new file mode 100644 index 00000000..56fcd1ed --- /dev/null +++ b/alliance/src/xvpn/src/XSB_error.c @@ -0,0 +1,190 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Xsb Errors | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XSB_error.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +void XsbError( ErrorType, Message, Data ) + + char ErrorType; + char *Message; + long Data; +{ + fflush(stdout); + + switch ( ErrorType ) + { + case DEFINE_MISSING : + + fprintf( stderr, "Xsb: Some defines missing\n"); + break; + + case TABLE_MISSING : + + fprintf( stderr, "Xsb: Some tables missing\n"); + break; + + case LINE_EXPECTED : + + fprintf( stderr, "Xsb: %s expected line %lu\n", + Message, Data ); + break; + + case UNKNOWN_DEFINE : + + fprintf( stderr, "Xsb: Unknown define %s line %lu\n", + Message, Data ); + break; + + case NOT_DEFINED : + + fprintf( stderr, "Xsb: %s not defined line %lu\n", + Message, Data ); + break; + + case TOO_SMAL : + + fprintf( stderr, "Xsb: %s too smal line %lu\n", + Message, Data ); + break; + + case MISSING_VALUE : + + fprintf( stderr, "Xsb: Missing value at line %lu\n", + Data ); + break; + + case MISSING_NAME : + + fprintf( stderr, "Xsb: Missing name of %s line %lu\n", + Message, Data ); + break; + + case UNEXPECTED_LINE : + + fprintf( stderr, "Xsb: %s unexpected line %lu\n", + Message, Data ); + break; + + case UNEXPECTED_EOF : + + fprintf( stderr, "Xsb: Unexpected end of file, missing definitions\n"); + break; + + case TOO_MANY_WORDS : + + fprintf( stderr, "Xsb: Too many words %s unexpected line %lu\n", + Message, Data ); + break; + + case MISSING_TABLE : + + fprintf( stderr, "Xsb: Missing value in %s table line %lu\n", + Message, Data ); + break; + + case OPEN_FILE : + + fprintf( stderr, "Xsb: Parameters file %s can't be opened\n", + Message ); + break; + + case UNKNOWN_TABLE : + + fprintf( stderr, "Xsb: Unknown table %s line %lu\n", + Message , Data ); + break; + + case SYNTAX_ERROR : + + fprintf( stderr, "Xsb: Syntax Error %s at line %lu\n", + Message , Data ); + break; + + case ILLEGAL_FLOAT : + + fprintf( stderr, "Xsb: Illegal floating point number %s line %lu\n", + Message , Data ); + break; + + case FREE_ERROR : + + fprintf( stderr, "Xsb: Free error\n" ); + + break; + + case ALLOC_ERROR : + + fprintf( stderr, "Xsb: Alloc error\n" ); + + break; + } + + exit( 1 ); +} diff --git a/alliance/src/xvpn/src/XSB_error.h b/alliance/src/xvpn/src/XSB_error.h new file mode 100644 index 00000000..5ceb2532 --- /dev/null +++ b/alliance/src/xvpn/src/XSB_error.h @@ -0,0 +1,92 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Xsb Errors | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSB_ERROR +# define XSB_ERROR + +/*------------------------------------------------------------\ +| | +| Rpr Error Constants | +| | +\------------------------------------------------------------*/ + +# define DEFINE_MISSING 0 +# define TABLE_MISSING 1 +# define LINE_EXPECTED 2 +# define UNKNOWN_DEFINE 3 +# define NOT_DEFINED 4 +# define TOO_SMAL 5 +# define MISSING_VALUE 6 +# define MISSING_NAME 7 +# define UNEXPECTED_LINE 8 +# define UNEXPECTED_EOF 9 +# define TOO_MANY_WORDS 10 +# define MISSING_TABLE 11 +# define OPEN_FILE 12 +# define UNKNOWN_TABLE 13 +# define SYNTAX_ERROR 14 +# define ILLEGAL_FLOAT 15 +# define FREE_ERROR 16 +# define ALLOC_ERROR 17 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XsbError(); + +# endif diff --git a/alliance/src/xvpn/src/XSB_parse.c b/alliance/src/xvpn/src/XSB_parse.c new file mode 100644 index 00000000..f31c10c0 --- /dev/null +++ b/alliance/src/xvpn/src/XSB_parse.c @@ -0,0 +1,687 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : XsbParse.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XSB_error.h" +# include "XSB_parse.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Private Variables | +| | +\------------------------------------------------------------*/ + + static char *XvpnDefaultTechnoName = XVPN_DEFAULT_PARAM_NAME; + +/*------------------------------------------------------------\ +| | +| Keywords variables | +| | +\------------------------------------------------------------*/ + + char *XVPN_NOT_DEFINE = ""; + + static short KeywordDefined = 0; + + static char *DefineKeyword; + static char *TableKeyword; + static char *EndTableKeyword; + static char *EndRecordKeyword; + static char *LowerGridStepKeyword; + static char *CursorColorNameKeyword; + static char *BackgroundColorNameKeyword; + static char *ForegroundColorNameKeyword; + static char *AcceptColorNameKeyword; + static char *ConnectColorNameKeyword; + static char *CursorSizeKeyword; + static char *UnitKeyword; + static char *LayerNameKeyword; + + static keyword KeywordDefine[ XSB_MAX_KEYWORD ] = + + { + { "None", 0 } + }; + +/*------------------------------------------------------------\ +| | +| File variables | +| | +\------------------------------------------------------------*/ + + static FILE *XsbFile; + static char XsbBuffer[ XSB_MAX_BUFFER ]; + static long XsbCurrentLine; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Xsb File Get String | +| | +\------------------------------------------------------------*/ + +char *XsbFileGetString( String, Size ) + + char *String; + int Size; +{ + register char *RegisterString; + register Register; + + autbegin(); + + RegisterString = String; + + while (--Size > 0 && (Register = getc( XsbFile )) != EOF ) + { + if ((*RegisterString++ = Register) == '\\') + { + if ((Register = getc( XsbFile )) == '\n') + { + *(RegisterString - 1) = ' '; + } + else + { + ungetc( Register, XsbFile ); + } + } + else + { + if ( Register == '\n') break; + } + } + + *RegisterString = '\0'; + + autend(); + return ( ( Register == EOF ) && + ( RegisterString == String ) ) ? (char *)NULL : String; +} + +/*------------------------------------------------------------\ +| | +| Xsb File Get Line | +| | +\------------------------------------------------------------*/ + +void XsbGetLine( Buffer ) + + char *Buffer; +{ + char *Check; + char *String; + char OneComment; + + autbegin(); + + do + { + OneComment = 0; + + Check = XsbFileGetString( Buffer, XSB_MAX_BUFFER ); + + if ( Check != (char *)NULL ) + { + XsbCurrentLine++; + } + else + { + XsbError( UNEXPECTED_EOF, (char *)NULL, XsbCurrentLine ); + } + + if ( ( String = strchr( Buffer, XSB_COMMENT_CHAR ) ) ) + { + if ( String == Buffer ) + { + OneComment = 1; + } + else + { + *(String - 1) = '\0'; + } + } + + while (*Buffer != '\0' && strchr( XSB_SEPARATORS_STRING, *Buffer)) + { + Buffer = Buffer + 1;; + } + + if (*Buffer == '\0') OneComment = 1; + + } + while ( OneComment == 1); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Xsb Check Keyword | +| | +\------------------------------------------------------------*/ + +char XsbCheckKeyword( Word ) + + char *Word; +{ + if ( ( Word == DefineKeyword ) || + ( Word == TableKeyword ) ) + { + return 1; + } + else + { + return 0; + } +} + +/*------------------------------------------------------------\ +| | +| Xsb Get First word | +| | +\------------------------------------------------------------*/ + +char *XsbGetFirstWord( Buffer, IsKeyword, Hash ) + + char *Buffer; + char IsKeyword; + char Hash; +{ + char *String; + char *Text; + int Index; + + autbegin(); + + if ( ( String = (char *)strtok( Buffer, XSB_SEPARATORS_STRING ) ) ) + { + if ( Hash ) + { + String = namealloc( String ); + } + else + { + Text = autallocblock( strlen( String ) + 1 ); + strcpy( Text, String ); + String = Text; + + for ( Index = 0; Text[ Index ]; Index++ ) + { + if ( Text[ Index ] == '_' ) Text[ Index ] = ' '; + } + } + + if ( ( IsKeyword ) && XsbCheckKeyword( String ) ) + { + XsbError( UNEXPECTED_LINE, String, XsbCurrentLine ); + } + } + + autend(); + return( String ); +} + +/*------------------------------------------------------------\ +| | +| Xsb Get Next word | +| | +\------------------------------------------------------------*/ + +char *XsbGetNextWord( IsKeyword, Hash ) + + char IsKeyword; + char Hash; +{ + char *String; + char *Text; + int Index; + + autbegin(); + + if ( ( String = (char *)strtok( (char *)NULL, XSB_SEPARATORS_STRING ) ) ) + { + if ( Hash ) + { + String = namealloc( String ); + } + else + { + Text = autallocblock( strlen( String ) + 1 ); + strcpy( Text, String ); + String = Text; + + for ( Index = 0; Text[ Index ]; Index++ ) + { + if ( Text[ Index ] == '_' ) Text[ Index ] = ' '; + } + } + + if ( ( IsKeyword ) && XsbCheckKeyword( String ) ) + { + XsbError( UNEXPECTED_LINE, String, XsbCurrentLine ); + } + } + + autend(); + return( String ); +} + +/*------------------------------------------------------------\ +| | +| Xsb Keyword Compare | +| | +\------------------------------------------------------------*/ + +int XsbKeywordCompare( FirstKey, SecondKey ) + + keyword *FirstKey; + keyword *SecondKey; +{ + return strcmp( FirstKey->NAME, SecondKey->NAME ); +} + +/*------------------------------------------------------------\ +| | +| Xsb Get String Value | +| | +\------------------------------------------------------------*/ + +long XsbGetStringValue( String ) + + char *String; +{ + long Value; + keyword *Keyword; + keyword Entry; + + autbegin(); + + if ( sscanf( String, "%ld", &Value) ) + { + autend(); + return ( Value ); + } + + Entry.NAME = String; + + Keyword = (keyword *)bsearch( (char *)(&Entry), + (char *)KeywordDefine, + XSB_MAX_KEYWORD, sizeof( keyword ), + XsbKeywordCompare ); + + if ( Keyword == (keyword *)NULL ) + { + XsbError( UNEXPECTED_LINE, String, XsbCurrentLine ); + } + + autend(); + return( Keyword->VALUE ); +} + +/*------------------------------------------------------------\ +| | +| Xsb Get String Float | +| | +\------------------------------------------------------------*/ + +float XsbGetStringFloat( String ) + + char *String; +{ + float Value; + + autbegin(); + + if ( ! sscanf( String, "%g", &Value) ) + { + XsbError( ILLEGAL_FLOAT, String, XsbCurrentLine ); + } + + autend(); + return ( Value ); +} + +/*------------------------------------------------------------\ +| | +| Xsb Get Number | +| | +\------------------------------------------------------------*/ + +long XsbGetNumber( String ) + + char *String; +{ + long Value; + + autbegin(); + + if ( ! sscanf( String, "%ld", &Value )) + { + XsbError( UNEXPECTED_LINE, "number", XsbCurrentLine ); + } + + autend(); + return Value; +} + + +/*------------------------------------------------------------\ +| | +| Xsb Read Layer Name | +| | +\------------------------------------------------------------*/ + +void XsbReadLayerName() + +{ + short Layer; + short LayerCount; + short EndTable; + short Field; + char *FirstWord; + + autbegin(); + + EndTable = 0; + LayerCount = 0; + + while ( ( EndTable != 1 ) && + ( LayerCount <= XVPN_MAX_LAYER ) ) + { + XsbGetLine( XsbBuffer ); + + FirstWord = XsbGetFirstWord( XsbBuffer, 1, 1 ); + + if ( FirstWord == EndTableKeyword ) + { + EndTable = 1; + } + else + if ( LayerCount < XVPN_MAX_LAYER ) + { + Layer = XsbGetStringValue( FirstWord ); + + for ( Field = 0; Field < 3; Field++ ) + { + FirstWord = XsbGetNextWord( 1, 0 ); + + if ( FirstWord == EndRecordKeyword ) + { + XsbError( MISSING_VALUE, (char *)NULL, XsbCurrentLine ); + } + else + { + XVPN_LAYER_NAME_TABLE [ Layer ][ Field ] = FirstWord; + } + } + + FirstWord = XsbGetNextWord( 0, 1 ); + + if ( FirstWord != EndRecordKeyword ) + { + XsbError( TOO_MANY_WORDS, FirstWord, XsbCurrentLine ); + } + } + + LayerCount = LayerCount + 1; + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Xsb Read Parameters | +| | +\------------------------------------------------------------*/ + +void XsbReadParam() + +{ + char *FirstWord; + char *SecondWord; + long Continue; + + autbegin(); + + Continue = 0; + + while ( Continue != XSB_ALL_DEFINED_MASK ) + { + XsbGetLine( XsbBuffer ); + + FirstWord = XsbGetFirstWord( XsbBuffer, 0, 1); + + if ( FirstWord == DefineKeyword ) + { + FirstWord = XsbGetNextWord( 1, 1 ); + + if (! FirstWord ) + { + XsbError( MISSING_NAME, DefineKeyword, XsbCurrentLine ); + } + + SecondWord = XsbGetNextWord( 1, 0 ); + + if (! SecondWord ) + { + XsbError( MISSING_VALUE, SecondWord, XsbCurrentLine ); + } + + if ( FirstWord == LowerGridStepKeyword ) + { + XVPN_LOWER_GRID_STEP = XsbGetStringFloat( SecondWord ); + + Continue |= XSB_LOWER_GRID_STEP_MASK; + } + else + if ( FirstWord == CursorColorNameKeyword ) + { + XVPN_CURSOR_COLOR_NAME = SecondWord; + + Continue |= XSB_CURSOR_COLOR_NAME_MASK; + } + else + if ( FirstWord == BackgroundColorNameKeyword ) + { + XVPN_BACKGROUND_COLOR_NAME = SecondWord; + + Continue |= XSB_BACKGROUND_COLOR_NAME_MASK; + } + else + if ( FirstWord == ForegroundColorNameKeyword ) + { + XVPN_FOREGROUND_COLOR_NAME = SecondWord; + + Continue |= XSB_FOREGROUND_COLOR_NAME_MASK; + } + else + if ( FirstWord == AcceptColorNameKeyword ) + { + XVPN_ACCEPT_COLOR_NAME = SecondWord; + + Continue |= XSB_ACCEPT_COLOR_NAME_MASK; + } + else + if ( FirstWord == ConnectColorNameKeyword ) + { + XVPN_CONNECT_COLOR_NAME = SecondWord; + + Continue |= XSB_CONNECT_COLOR_NAME_MASK; + } + else + if ( FirstWord == CursorSizeKeyword ) + { + XVPN_CURSOR_SIZE = XsbGetStringValue( SecondWord ); + + Continue |= XSB_CURSOR_SIZE_MASK; + } + else + if ( FirstWord == UnitKeyword ) + { + XVPN_UNIT = XsbGetStringValue( SecondWord ); + + Continue |= XSB_UNIT_MASK; + } + else + { + XsbError( UNKNOWN_DEFINE, FirstWord, XsbCurrentLine ); + } + } + else + if ( FirstWord == TableKeyword ) + { + if (!( FirstWord = XsbGetNextWord(1, 1))) + { + XsbError( MISSING_NAME, TableKeyword ); + } + + if ( FirstWord == LayerNameKeyword ) + { + XsbReadLayerName(); + + Continue |= XSB_LAYER_NAME_MASK; + } + else + { + XsbError( UNKNOWN_TABLE, FirstWord, XsbCurrentLine ); + } + } + else + { + XsbError( SYNTAX_ERROR, FirstWord, XsbCurrentLine ); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Xsb Load Parameters | +| | +\------------------------------------------------------------*/ + +void XvpnLoadParameters() + +{ + short Layer; + + autbegin(); + + XVPN_PARAM_NAME = mbkgetenv( "XVPN_PARAM_NAME" ); + + if ( XVPN_PARAM_NAME == (char *)NULL ) + { + XVPN_PARAM_NAME = XvpnDefaultTechnoName; + } + + if ( ! KeywordDefined ) + { + DefineKeyword = namealloc( DEFINE_KEYWORD ); + TableKeyword = namealloc( TABLE_KEYWORD ); + EndTableKeyword = namealloc( END_TABLE_KEYWORD ); + EndRecordKeyword = namealloc( END_RECORD_KEYWORD ); + LowerGridStepKeyword = namealloc( LOWER_GRID_STEP_KEYWORD ); + CursorColorNameKeyword = namealloc( CURSOR_COLOR_NAME_KEYWORD ); + BackgroundColorNameKeyword = namealloc( BACKGROUND_COLOR_NAME_KEYWORD ); + ForegroundColorNameKeyword = namealloc( FOREGROUND_COLOR_NAME_KEYWORD ); + AcceptColorNameKeyword = namealloc( ACCEPT_COLOR_NAME_KEYWORD ); + ConnectColorNameKeyword = namealloc( CONNECT_COLOR_NAME_KEYWORD ); + CursorSizeKeyword = namealloc( CURSOR_SIZE_KEYWORD ); + UnitKeyword = namealloc( UNIT_KEYWORD ); + LayerNameKeyword = namealloc( LAYER_NAME_KEYWORD ); + + KeywordDefined = 1; + } + + XVPN_LOWER_GRID_STEP = 0.0; + + XVPN_CURSOR_COLOR_NAME = (char *)NULL; + XVPN_BACKGROUND_COLOR_NAME = (char *)NULL; + XVPN_FOREGROUND_COLOR_NAME = (char *)NULL; + XVPN_ACCEPT_COLOR_NAME = (char *)NULL; + XVPN_CONNECT_COLOR_NAME = (char *)NULL; + + XVPN_CURSOR_SIZE = 5; + XVPN_UNIT = 4; + + for ( Layer = 0; Layer < XVPN_MAX_LAYER; Layer++ ) + { + XVPN_LAYER_NAME_TABLE[ Layer ][0] = XVPN_NOT_DEFINE; + XVPN_LAYER_NAME_TABLE[ Layer ][1] = (char *)NULL; + XVPN_LAYER_NAME_TABLE[ Layer ][2] = (char *)NULL; + } + + if ( !( XsbFile = fopen( XVPN_PARAM_NAME, "r"))) + + XsbError( OPEN_FILE, XVPN_PARAM_NAME, 0); + + XsbReadParam(); + + fclose( XsbFile ); + + autend(); +} diff --git a/alliance/src/xvpn/src/XSB_parse.h b/alliance/src/xvpn/src/XSB_parse.h new file mode 100644 index 00000000..36867bbd --- /dev/null +++ b/alliance/src/xvpn/src/XSB_parse.h @@ -0,0 +1,112 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XSB | +| | +| File : Xsbparse.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSB_PARSE +# define XSB_PARSE + +# define XSB_MAX_BUFFER 255 +# define XSB_MAX_KEYWORD 1 + +# define XSB_SEPARATORS_STRING " \t\n" +# define XSB_COMMENT_CHAR '#' + +/*------------------------------------------------------------\ +| | +| Keyword Constants | +| | +\------------------------------------------------------------*/ + +# define DEFINE_KEYWORD "DEFINE" +# define TABLE_KEYWORD "TABLE" +# define END_TABLE_KEYWORD "END" +# define END_RECORD_KEYWORD NULL + +# define LOWER_GRID_STEP_KEYWORD "XVPN_LOWER_GRID_STEP" +# define CURSOR_COLOR_NAME_KEYWORD "XVPN_CURSOR_COLOR_NAME" +# define BACKGROUND_COLOR_NAME_KEYWORD "XVPN_BACKGROUND_COLOR_NAME" +# define FOREGROUND_COLOR_NAME_KEYWORD "XVPN_FOREGROUND_COLOR_NAME" +# define ACCEPT_COLOR_NAME_KEYWORD "XVPN_ACCEPT_COLOR_NAME" +# define CONNECT_COLOR_NAME_KEYWORD "XVPN_CONNECT_COLOR_NAME" +# define CURSOR_SIZE_KEYWORD "XVPN_CURSOR_SIZE" +# define UNIT_KEYWORD "XVPN_UNIT" +# define LAYER_NAME_KEYWORD "XVPN_LAYER_NAME" + +# define XSB_LOWER_GRID_STEP_MASK 0x00001 +# define XSB_CURSOR_COLOR_NAME_MASK 0x00002 +# define XSB_BACKGROUND_COLOR_NAME_MASK 0x00004 +# define XSB_FOREGROUND_COLOR_NAME_MASK 0x00008 +# define XSB_ACCEPT_COLOR_NAME_MASK 0x00010 +# define XSB_CONNECT_COLOR_NAME_MASK 0x00020 +# define XSB_CURSOR_SIZE_MASK 0x00040 +# define XSB_UNIT_MASK 0x00080 +# define XSB_LAYER_NAME_MASK 0x00100 + +# define XSB_ALL_DEFINED_MASK 0x001FF + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct keyword + { + char *NAME; + char VALUE; + + } keyword; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xvpn/src/XSB_share.c b/alliance/src/xvpn/src/XSB_share.c new file mode 100644 index 00000000..635f3169 --- /dev/null +++ b/alliance/src/xvpn/src/XSB_share.c @@ -0,0 +1,175 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Share.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XSB.h" +# include "XSB_share.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + short XVPN_ACTIVE_NAME_TABLE [ XVPN_MAX_ACTIVE_NAME ] = + { + 1, /* PLACE TEXT */ + 1 /* PLACE TRANS */ + }; + + short XVPN_ACTIVE_LAYER_TABLE [ XVPN_MAX_LAYER ] = + { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + }; + + char *XvpnFirstFileName = (char *)NULL; + char *XVPN_XMS_FILE_NAME = (char *)NULL; + + char XVPN_FORCE_DISPLAY = XVPN_FALSE; + char XVPN_XOR_CURSOR = XVPN_FALSE; + char XVPN_SWITCH_COLOR_MAP = XVPN_FALSE; + +/*------------------------------------------------------------\ +| | +| Table variables | +| | +\------------------------------------------------------------*/ + + char *XVPN_CURSOR_COLOR_NAME; + char *XVPN_BACKGROUND_COLOR_NAME; + char *XVPN_FOREGROUND_COLOR_NAME; + char *XVPN_ACCEPT_COLOR_NAME; + char *XVPN_CONNECT_COLOR_NAME; + + long XVPN_CURSOR_SIZE; + float XVPN_LOWER_GRID_STEP; + long XVPN_UNIT; + +/*------------------------------------------------------------\ +| | +| Global Variables | +| | +\------------------------------------------------------------*/ + + char *XVPN_PARAM_NAME = (char *)NULL; + char *XVPN_LAYER_NAME_TABLE[ XVPN_MAX_LAYER ][ 3 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnPostTreatString | +| | +\------------------------------------------------------------*/ + +char *XvpnPostTreatString( Text ) + + char *Text; +{ + char OnlySpace; + int Counter; + + autbegin(); + + if ( Text != (char *)NULL ) + { + OnlySpace = 1; + + for ( Counter = 0; Text[ Counter ]; Counter++ ) + { + if ( Text[ Counter ] != ' ' ) OnlySpace = 0; + } + + if ( OnlySpace ) Text = (char *)NULL; + } + + autend(); + return( Text ); +} + +/*------------------------------------------------------------\ +| | +| Xvpngetenv | +| | +\------------------------------------------------------------*/ + +void Xvpngetenv() +{ + char *Env; + + Env = mbkgetenv( "HOME" ); + + if ( Env == (char *)NULL ) + { + XVPN_XMS_FILE_NAME = XMS_FILE_NAME; + } + else + { + XVPN_XMS_FILE_NAME = + + (char *)autallocblock( strlen( Env ) + strlen( XMS_FILE_NAME ) + 2 ); + + strcpy( XVPN_XMS_FILE_NAME, Env ); + strcat( XVPN_XMS_FILE_NAME, "/" ); + strcat( XVPN_XMS_FILE_NAME, XMS_FILE_NAME ); + } +} diff --git a/alliance/src/xvpn/src/XSB_share.h b/alliance/src/xvpn/src/XSB_share.h new file mode 100644 index 00000000..9ce57262 --- /dev/null +++ b/alliance/src/xvpn/src/XSB_share.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Share.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XSB_SHARE +# define XSB_SHARE + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xvpn/src/XTB.h b/alliance/src/xvpn/src/XTB.h new file mode 100644 index 00000000..f908cb47 --- /dev/null +++ b/alliance/src/xvpn/src/XTB.h @@ -0,0 +1,216 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : XTB.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_XTB +# define XVPN_XTB + +/*------------------------------------------------------------\ +| | +| MouseCursors | +| | +\------------------------------------------------------------*/ + +# define XVPN_NORMAL_CURSOR 0 +# define XVPN_WATCH_CURSOR 1 +# define XVPN_PIRATE_CURSOR 2 +# define XVPN_CROSS_CURSOR 3 +# define XVPN_NO_CURSOR 4 + +# define XVPN_MAX_CURSOR 5 + +/*------------------------------------------------------------\ +| | +| DialogBoxType | +| | +\------------------------------------------------------------*/ + +# define XVPN_DIALOG_MESSAGE 0 +# define XVPN_DIALOG_ERROR 1 +# define XVPN_DIALOG_INFO 2 +# define XVPN_DIALOG_QUESTION 3 +# define XVPN_DIALOG_WARNING 4 +# define XVPN_DIALOG_WORKING 5 +# define XVPN_DIALOG_FILE 6 +# define XVPN_DIALOG_PROMPT 7 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnDialogBox | +| | +\------------------------------------------------------------*/ + + typedef struct XvpnDialogItem + + { + char *LABEL; + short TYPE; + Widget WIDGET; + void (*CALLBACK_OK)(); + XtPointer CALLDATA_OK; + void (*CALLBACK_CANCEL)(); + XtPointer CALLDATA_CANCEL; + + } XvpnDialogItem; + + +/*------------------------------------------------------------\ +| | +| XvpnMenuItem | +| | +\------------------------------------------------------------*/ + + typedef struct XvpnMenuItem + + { + char *LABEL; + short MNEMONIC; + char *SHORT_KEY; + char *SHORT_KEY_TEXT; + WidgetClass *CLASS; + Boolean SEPARATOR; + Boolean TITLE; + Boolean HELP; + void (*CALLBACK)(); + XtPointer CALLDATA; + Widget BUTTON; + Widget MENU; + struct XvpnMenuItem *NEXT; + + } XvpnMenuItem; + +/*------------------------------------------------------------\ +| | +| XvpnPanelButtonItem | +| | +\------------------------------------------------------------*/ + + typedef struct XvpnPanelButtonItem + + { + char **LABEL; + char *TEXT; + char *BITMAP; + int WIDTH; + int HEIGHT; + char **FOREGROUND; + char **BACKGROUND; + unsigned short X; + unsigned short Y; + unsigned short DX; + unsigned short DY; + void (*CALLBACK)(); + XtPointer CALLDATA; + Widget BUTTON; + + } XvpnPanelButtonItem; + +/*------------------------------------------------------------\ +| | +| XvpnPanelItem | +| | +\------------------------------------------------------------*/ + + typedef struct XvpnPanelItem + + { + char *TITLE; + short COMPUTE; + short MANAGED; + int X; + int Y; + int WIDTH; + int HEIGHT; + unsigned short COLUMN; + unsigned short ROW; + Widget PANEL; + Widget PANEL_FORM; + Widget FRAME; + Widget FORM; + XvpnPanelButtonItem *LIST; + + } XvpnPanelItem; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char *XvpnPanelButtonDisable; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnDestroyDialogCallback(); + extern void XvpnExitDialogCallback(); + + extern void XvpnSetMouseCursor(); + extern Pixmap XvpnCreatePixmap(); + extern void XvpnSetIcon(); + extern void XvpnBuildMenus(); + extern void XvpnBuildPanel(); + extern void XvpnEnterPanel(); + extern void XvpnExitPanel(); + extern void XvpnBuildDialog(); + extern void XvpnEnterDialog(); + extern void XvpnReEnterDialog(); + extern void XvpnExitDialog(); + extern void XvpnWarningMessage(); + extern void XvpnErrorMessage(); + extern void XvpnLimitedLoop(); + +# endif diff --git a/alliance/src/xvpn/src/XTB_cursor.c b/alliance/src/xvpn/src/XTB_cursor.c new file mode 100644 index 00000000..ab95ceb9 --- /dev/null +++ b/alliance/src/xvpn/src/XTB_cursor.c @@ -0,0 +1,175 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : cursor.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "XTB.h" +# include "XSB.h" +# include "XTB_cursor.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static XvpnMouseCursor XvpnMouseCursorArray [ XVPN_MAX_CURSOR ] = + + { + { XC_left_ptr , True }, + { XC_watch , True }, + { XC_pirate , True }, + { XC_cross_reverse , True }, + { 0 , True } + }; + + static char XvpnCursorMaskOr [ 8 ] = + + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + static char XvpnCursorMaskAnd [ 8 ] = + + { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnSetMouseCursor | +| | +\------------------------------------------------------------*/ + +void XvpnSetMouseCursor( MainWidget, CursorType ) + + Widget MainWidget; + short CursorType; +{ + Display *DisplayId; + Window MainWindow; + XColor White; + XColor Black; + XColor ForgetIt; + Colormap ColorMap; + Pixmap MaskOr; + Pixmap MaskAnd; + Cursor Type; + Cursor NewCursor; + + autbegin(); + + DisplayId = XtDisplay( MainWidget ); + MainWindow = XtWindow( MainWidget ); + + Type = XvpnMouseCursorArray[ CursorType ].CURSOR; + + if ( XvpnMouseCursorArray[ CursorType ].MAKE == True ) + { + if ( Type != 0 ) + { + NewCursor = XCreateFontCursor( DisplayId, Type ); + } + else + { + ColorMap = DefaultColormapOfScreen ( XtScreen( MainWidget ) ); + + XAllocNamedColor( DisplayId, ColorMap, "black", &Black, &ForgetIt ); + XAllocNamedColor( DisplayId, ColorMap, "white", &White, &ForgetIt ); + + MaskOr = + + XCreatePixmapFromBitmapData( DisplayId, + MainWindow, + XvpnCursorMaskOr, + 8, 8, + Black.pixel, + White.pixel, 1 ); + + MaskAnd = + + XCreatePixmapFromBitmapData( DisplayId, + MainWindow, + XvpnCursorMaskAnd, + 8, 8, + Black.pixel, + White.pixel, 1 ); + + NewCursor = XCreatePixmapCursor( DisplayId, + MaskAnd, MaskOr, + &Black, &White, 0, 0 ); + } + + XvpnMouseCursorArray[ CursorType ].CURSOR = NewCursor; + XvpnMouseCursorArray[ CursorType ].MAKE = False; + + Type = NewCursor; + } + + XDefineCursor( DisplayId, MainWindow, Type ); + + XmUpdateDisplay( MainWidget ); + + autend(); +} diff --git a/alliance/src/xvpn/src/XTB_cursor.h b/alliance/src/xvpn/src/XTB_cursor.h new file mode 100644 index 00000000..45b6bbe8 --- /dev/null +++ b/alliance/src/xvpn/src/XTB_cursor.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : cursor.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_XTB_CURSOR +# define XVPN_XTB_CURSOR + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct XvpnMouseCursor + { + Cursor CURSOR; + Boolean MAKE; + + } XvpnMouseCursor; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xvpn/src/XTB_dialog.c b/alliance/src/xvpn/src/XTB_dialog.c new file mode 100644 index 00000000..7fe724b1 --- /dev/null +++ b/alliance/src/xvpn/src/XTB_dialog.c @@ -0,0 +1,467 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : dialog.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XTB.h" +# include "XSB.h" +# include "XTB_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static XvpnLockLoop = 0; + + static XvpnDialogItem XvpnWarningDialog = + + { + "Warning", + XVPN_DIALOG_WARNING, + (Widget)NULL, + (void *)NULL, + (XtPointer)NULL, + (void *)NULL, + (XtPointer)NULL + }; + + static XvpnDialogItem XvpnErrorDialog = + + { + "Error", + XVPN_DIALOG_ERROR, + (Widget)NULL, + (void *)NULL, + (XtPointer)NULL, + (void *)NULL, + (XtPointer)NULL + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnDestroyDialogCallback | +| | +\------------------------------------------------------------*/ + +void XvpnDestroyDialogCallback( MyWidget, ClientData, CallData ) + + Widget MyWidget; + caddr_t ClientData; + caddr_t CallData; +{ + XvpnLockLoop = 0; + XvpnExitErrorMessage( 1 ); +} + +/*------------------------------------------------------------\ +| | +| XvpnExitDialogCallback | +| | +\------------------------------------------------------------*/ + +void XvpnExitDialogCallback() + +{ + autbegin(); + + XvpnExitDialog(); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnBuildDialog | +| | +\------------------------------------------------------------*/ + +void XvpnBuildDialog( Father, Dialog ) + + Widget Father; + XvpnDialogItem *Dialog; +{ + Arg Args[3]; + XmString Label; + + autbegin(); + + Label = XmStringCreateLtoR( Dialog->LABEL, + XmSTRING_DEFAULT_CHARSET ); + + if ( Dialog->TYPE < XVPN_DIALOG_FILE ) + { + XtSetArg( Args[0], XmNmessageString , Label); + } + else + { + XtSetArg( Args[0], XmNselectionLabelString, Label); + } + + XtSetArg( Args[1], XmNdeleteResponse, XmDESTROY ); + XtSetArg( Args[2], XmNtitle, " " ); + + switch ( Dialog->TYPE ) + { + case XVPN_DIALOG_MESSAGE : + + Dialog->WIDGET = + + XmCreateMessageDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case XVPN_DIALOG_ERROR : + + Dialog->WIDGET = + + XmCreateErrorDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case XVPN_DIALOG_INFO : + + Dialog->WIDGET = + + XmCreateInformationDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case XVPN_DIALOG_QUESTION : + + Dialog->WIDGET = + + XmCreateQuestionDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case XVPN_DIALOG_WARNING : + + Dialog->WIDGET = + + XmCreateWarningDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case XVPN_DIALOG_WORKING : + + Dialog->WIDGET = + + XmCreateWorkingDialog( Father, Dialog->LABEL, Args, 3); + + break; + + case XVPN_DIALOG_FILE : + + Dialog->WIDGET = + + XmCreateFileSelectionDialog( Father, Dialog->LABEL, Args, 3); + + XtUnmanageChild( XmFileSelectionBoxGetChild( Dialog->WIDGET, + XmDIALOG_FILTER_LABEL ) ); + + XtUnmanageChild( XmFileSelectionBoxGetChild( Dialog->WIDGET, + XmDIALOG_FILTER_TEXT ) ); + + break; + + case XVPN_DIALOG_PROMPT : + + Dialog->WIDGET = + + XmCreatePromptDialog( Father, Dialog->LABEL, Args, 3); + + XtUnmanageChild( XmSelectionBoxGetChild( Dialog->WIDGET, + XmDIALOG_HELP_BUTTON ) ); + } + + XmStringFree( Label ); + + XtAddCallback (Dialog->WIDGET, XmNdestroyCallback, + XvpnDestroyDialogCallback, NULL ); + + if ( Dialog->TYPE < XVPN_DIALOG_FILE ) + { + XtUnmanageChild( XmMessageBoxGetChild( Dialog->WIDGET, + XmDIALOG_HELP_BUTTON ) ); + } + + if ( ( Dialog->CALLBACK_OK == NULL ) && + ( Dialog->CALLBACK_CANCEL == NULL ) ) + { + XtAddCallback( Dialog->WIDGET, XmNokCallback, + XvpnExitDialogCallback, NULL ); + } + else + { + if ( Dialog->CALLBACK_OK == NULL ) + { + XtUnmanageChild( XmMessageBoxGetChild( Dialog->WIDGET, + XmDIALOG_OK_BUTTON ) ); + } + else + { + XtAddCallback( Dialog->WIDGET, XmNokCallback, + Dialog->CALLBACK_OK, + Dialog->CALLDATA_OK ); + } + } + + if ( Dialog->CALLBACK_CANCEL == NULL ) + { + XtUnmanageChild( XmMessageBoxGetChild( Dialog->WIDGET, + XmDIALOG_CANCEL_BUTTON ) ); + } + else + { + XtAddCallback( Dialog->WIDGET, XmNcancelCallback, + Dialog->CALLBACK_CANCEL, + Dialog->CALLDATA_CANCEL ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnLimitedLoop | +| | +\------------------------------------------------------------*/ + +void XvpnLimitedLoop( MyWidget ) + + Widget MyWidget; +{ + Widget DialogShell, WShell; + XEvent Event; + XAnyEvent *AnyEvent; + XtAppContext Context; + + autbegin(); + + Context = XtWidgetToApplicationContext( MyWidget ); + + XvpnLockLoop = 1; + + for ( WShell = MyWidget; + ! XtIsShell( WShell ); + WShell = XtParent( WShell ) ); + + while( XvpnLockLoop == 1 ) + { + XtAppNextEvent( Context, &Event ); + + AnyEvent = (XAnyEvent *)( &Event ); + + for ( DialogShell = XtWindowToWidget( AnyEvent->display, AnyEvent->window ); + ((DialogShell != NULL ) && (!XtIsShell( DialogShell ))); + DialogShell = XtParent(DialogShell)); + + switch ( AnyEvent->type ) + { + case KeyRelease : + case ButtonRelease : + + if (WShell == DialogShell) XtDispatchEvent(&Event); + + break; + + case KeyPress : + case ButtonPress : + + if (WShell != DialogShell) + { + XBell( AnyEvent->display, 0 ); + XtPopup( WShell, XtGrabNone ); + } + else + { + XtDispatchEvent( &Event ); + } + break; + + default : + + XtDispatchEvent( &Event ); + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnEnterDialog | +| | +\------------------------------------------------------------*/ + +void XvpnEnterDialog( Dialog ) + + XvpnDialogItem *Dialog; +{ + autbegin(); + + XtManageChild ( Dialog->WIDGET ); + + XvpnLimitedLoop( Dialog->WIDGET ); + + XtUnmanageChild( Dialog->WIDGET ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnReEnterDialog | +| | +\------------------------------------------------------------*/ + +void XvpnReEnterDialog() +{ + XvpnLockLoop = 1; +} + +/*------------------------------------------------------------\ +| | +| XvpnExitDialog | +| | +\------------------------------------------------------------*/ + +void XvpnExitDialog() + +{ + XvpnLockLoop = 0; +} + +/*------------------------------------------------------------\ +| | +| XvpnWarningMessage | +| | +\------------------------------------------------------------*/ + +void XvpnWarningMessage( Father, Subject ) + + Widget Father; + char *Subject; +{ + XmString Label; + + autbegin(); + + if ( XvpnWarningDialog.WIDGET == (Widget)NULL ) + { + XvpnBuildDialog( Father, &XvpnWarningDialog ); + } + + Label = XmStringCreateLtoR( Subject, + XmSTRING_DEFAULT_CHARSET ); + + XtVaSetValues( XvpnWarningDialog.WIDGET, + XmNmessageString, + Label, NULL ); + + XmStringFree( Label ); + + XvpnEnterDialog( &XvpnWarningDialog ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnErrorMessage | +| | +\------------------------------------------------------------*/ + +void XvpnErrorMessage( Father, Subject ) + + Widget Father; + char *Subject; +{ + XmString Label; + + autbegin(); + + if ( XvpnErrorDialog.WIDGET == (Widget)NULL ) + { + XvpnBuildDialog( Father, &XvpnErrorDialog ); + } + + Label = XmStringCreateLtoR( Subject, + XmSTRING_DEFAULT_CHARSET ); + + XtVaSetValues( XvpnErrorDialog.WIDGET, + XmNmessageString, + Label, NULL ); + + XmStringFree( Label ); + + XvpnEnterDialog( &XvpnErrorDialog ); + + autend(); +} diff --git a/alliance/src/xvpn/src/XTB_dialog.h b/alliance/src/xvpn/src/XTB_dialog.h new file mode 100644 index 00000000..ead450e1 --- /dev/null +++ b/alliance/src/xvpn/src/XTB_dialog.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : dialog.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_XTB_DIALOG +# define XVPN_XTB_DIALOG + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnExitErrorMessage(); + +# endif diff --git a/alliance/src/xvpn/src/XTB_icon.c b/alliance/src/xvpn/src/XTB_icon.c new file mode 100644 index 00000000..970b3948 --- /dev/null +++ b/alliance/src/xvpn/src/XTB_icon.c @@ -0,0 +1,105 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : icon.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "XTB.h" +# include "XSB.h" +# include "XTB_icon.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnSetIcon | +| | +\------------------------------------------------------------*/ + +void XvpnSetIcon( ShellWidget, IconBits, IconWidth, IconHeight ) + + Widget ShellWidget; + char *IconBits; + int IconWidth; + int IconHeight; +{ + Pixmap IconPixmap; + + autbegin(); + + IconPixmap = XCreatePixmapFromBitmapData( XtDisplay( ShellWidget ), + RootWindowOfScreen( XtScreen( ShellWidget ) ), + IconBits, IconWidth, IconHeight, + WhitePixelOfScreen( XtScreen( ShellWidget ) ), + BlackPixelOfScreen( XtScreen( ShellWidget ) ), + DefaultDepthOfScreen( XtScreen( ShellWidget ) ) ); + XtVaSetValues( ShellWidget, + XmNiconPixmap, IconPixmap, + XmNiconic, False, + NULL ); + + autend(); +} + diff --git a/alliance/src/xvpn/src/XTB_icon.h b/alliance/src/xvpn/src/XTB_icon.h new file mode 100644 index 00000000..c65ea644 --- /dev/null +++ b/alliance/src/xvpn/src/XTB_icon.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : icon.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_XTB_ICON +# define XVPN_XTB_ICON + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xvpn/src/XTB_menu.c b/alliance/src/xvpn/src/XTB_menu.c new file mode 100644 index 00000000..d2f8c6de --- /dev/null +++ b/alliance/src/xvpn/src/XTB_menu.c @@ -0,0 +1,196 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : menu.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "XTB.h" +# include "XSB.h" +# include "XTB_menu.h" + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static char MenuBuffer [ MENU_BUFFER_SIZE ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnBuildMenus | +| | +\------------------------------------------------------------*/ + +void XvpnBuildMenus( Father, Menu ) + + Widget Father; + XvpnMenuItem *Menu; +{ + + Widget Button; + Widget SubMenu; + XmString Text; + Arg Args[ 2 ]; + int Counter; + + autbegin(); + + for ( Counter = 0; + Menu[ Counter ].LABEL != NULL; + Counter++ ) + { + if ( Menu[ Counter ].SEPARATOR == True ) + { + XtCreateManagedWidget( "Separator", + xmSeparatorWidgetClass, Father, + NULL , + 0 ); + } + + Button = XtVaCreateManagedWidget( Menu[ Counter ].LABEL, + *Menu[ Counter ].CLASS, Father, + XmNmnemonic, + Menu[ Counter ].MNEMONIC, + NULL ); + Menu[ Counter ].BUTTON = Button; + + if ( Menu[ Counter ].SHORT_KEY != NULL ) + { + XtVaSetValues( Button, + XmNaccelerator, + Menu[ Counter ].SHORT_KEY, + NULL ); + } + + if ( Menu[ Counter ].SHORT_KEY != NULL ) + { + Text = XmStringCreateSimple( Menu[ Counter ].SHORT_KEY_TEXT ); + + XtVaSetValues( Button, + XmNacceleratorText, + Text, + NULL ); + + XmStringFree( Text ); + } + + if ( Menu[ Counter ].CALLBACK != NULL ) + { + XtAddCallback( Button, + XmNactivateCallback, + Menu[ Counter ].CALLBACK, + Menu[ Counter ].CALLDATA ); + } + + if ( Menu[ Counter ].HELP == True ) + { + XtSetArg( Args[ 0 ], XmNmenuHelpWidget, Button ); + + XtSetValues( Father, Args, 1 ); + } + + if ( Menu[ Counter ].NEXT != NULL) + { + strcpy( MenuBuffer, Menu[ Counter ].LABEL ); + strcat( MenuBuffer, " Menu" ); + + SubMenu = XmCreatePulldownMenu( Father, + MenuBuffer, + Args, 0 ); + + Menu[ Counter ].MENU = SubMenu; + + if ( Menu[ Counter ].TITLE == True ) + { + Text = XmStringCreateLtoR( MenuBuffer, XmSTRING_DEFAULT_CHARSET ); + + XtVaCreateManagedWidget( "MenuTitle", + xmLabelWidgetClass, + SubMenu, + XmNlabelString, Text, + NULL ); + + XmStringFree( Text ); + + XtCreateManagedWidget( "Separator", + xmSeparatorWidgetClass, + SubMenu, + NULL, + 0 ); + } + + XtSetArg( Args[ 0 ], XmNsubMenuId, SubMenu ); + XtSetValues( Button, Args, 1 ); + + XvpnBuildMenus( SubMenu, Menu[ Counter ].NEXT ); + } + else Menu[ Counter ].MENU = (Widget)NULL; + } + + autend(); +} + diff --git a/alliance/src/xvpn/src/XTB_menu.h b/alliance/src/xvpn/src/XTB_menu.h new file mode 100644 index 00000000..8b6bd7f2 --- /dev/null +++ b/alliance/src/xvpn/src/XTB_menu.h @@ -0,0 +1,67 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : menu.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_XTB_MENU +# define XVPN_XTB_MENU + +# define MENU_BUFFER_SIZE 80 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xvpn/src/XTB_panel.c b/alliance/src/xvpn/src/XTB_panel.c new file mode 100644 index 00000000..1389b864 --- /dev/null +++ b/alliance/src/xvpn/src/XTB_panel.c @@ -0,0 +1,377 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : panel.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "XTB.h" +# include "XSB.h" + +# include "XTB_panel.h" +# include "XTB_dialog.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static char *XvpnPanelButtonDisable = "xxxx"; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnBuildPanel | +| | +\------------------------------------------------------------*/ + +void XvpnBuildPanel( Father, Panel ) + + Widget Father; + XvpnPanelItem *Panel; +{ + Arg Args[13]; + XvpnPanelButtonItem *Button; + char *Label; + int Counter; + int Fraction; + int X1; + int Y1; + int X2; + int Y2; + Pixmap ButtonPixmap; + + autbegin(); + + Fraction = Panel->ROW * Panel->COLUMN; + + XtSetArg( Args[0], XmNshadowType, XmSHADOW_ETCHED_IN ); + XtSetArg( Args[1], XmNdeleteResponse, XmDESTROY); + XtSetArg( Args[2], XmNtitle , Panel->TITLE ); + + Panel->PANEL = XmCreateFormDialog( Father, Panel->TITLE, Args, 3); + + XtAddCallback( Panel->PANEL, XmNdestroyCallback, + XvpnDestroyDialogCallback, NULL ); + + Panel->PANEL_FORM = XtVaCreateManagedWidget( "", + xmFormWidgetClass, + Panel->PANEL, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , 100, + NULL + ); + + Panel->FRAME = XtVaCreateManagedWidget( "", + xmFrameWidgetClass, + Panel->PANEL_FORM, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + NULL + ); + + Panel->FORM = XtVaCreateManagedWidget( "", + xmFormWidgetClass, + Panel->FRAME, + XmNtopAttachment , XmATTACH_FORM, + XmNbottomAttachment , XmATTACH_FORM, + XmNleftAttachment , XmATTACH_FORM, + XmNrightAttachment , XmATTACH_FORM, + XmNfractionBase , Fraction, + NULL + ); + Button = Panel->LIST; + + for ( Counter = 0; + Button[ Counter ].LABEL != NULL; + Counter++ ) + { + X1 = Button[ Counter ].X * Panel->ROW; + Y1 = Button[ Counter ].Y * Panel->COLUMN; + X2 = X1 + Button[ Counter ].DX * Panel->ROW; + Y2 = Y1 + Button[ Counter ].DY * Panel->COLUMN; + + if ( *Button[ Counter ].LABEL[0] != '\0' ) + { + Label = *Button[ Counter ].LABEL; + } + else + { + Label = XvpnPanelButtonDisable; + } + + if ( ( Button[ Counter ].TEXT != (char *)NULL ) && + ( Button[ Counter ].BITMAP != (char *)NULL ) ) + { + XtSetArg( Args[0] , XmNtopAttachment , XmATTACH_POSITION ); + XtSetArg( Args[1] , XmNtopPosition , Y1 ); + XtSetArg( Args[2] , XmNbottomAttachment , XmATTACH_POSITION ); + XtSetArg( Args[3] , XmNbottomPosition , Y2 ); + XtSetArg( Args[4] , XmNrightAttachment , XmATTACH_POSITION ); + XtSetArg( Args[5] , XmNrightPosition , X2 ); + XtSetArg( Args[6] , XmNleftAttachment , XmATTACH_POSITION ); + XtSetArg( Args[7] , XmNleftPosition , X1 ); + XtSetArg( Args[8] , XmNscrollBarDisplayPolicy, XmSTATIC ); + XtSetArg( Args[9] , XmNscrollHorizontal , True ); + XtSetArg( Args[10] , XmNscrollVertical , True ); + XtSetArg( Args[11] , XmNlistSizePolicy , XmCONSTANT ); + XtSetArg( Args[12] , XmNselectionPolicy , XmMULTIPLE_SELECT ); + + Button[ Counter ].BUTTON = + + XmCreateScrolledList( Panel->FORM, Button[ Counter ].TEXT, Args, 13 ); + + XtManageChild ( Button[ Counter ].BUTTON ); + } + else + if ( Button[ Counter ].TEXT != (char *)NULL ) + { + XtSetArg( Args[0] , XmNrows , 10 ); + XtSetArg( Args[1] , XmNeditable , False ); + XtSetArg( Args[2] , XmNeditMode , XmMULTI_LINE_EDIT ); + XtSetArg( Args[3] , XmNcursorPositionVisible, False ); + XtSetArg( Args[4] , XmNtopAttachment , XmATTACH_POSITION ); + XtSetArg( Args[5] , XmNtopPosition , Y1 ); + XtSetArg( Args[6] , XmNleftAttachment , XmATTACH_POSITION ); + XtSetArg( Args[7] , XmNleftPosition , X1 ); + XtSetArg( Args[8] , XmNbottomAttachment , XmATTACH_POSITION ); + XtSetArg( Args[9] , XmNbottomPosition , Y2 ); + XtSetArg( Args[10], XmNrightAttachment , XmATTACH_POSITION ); + XtSetArg( Args[11], XmNrightPosition , X2 ); + + Button[ Counter ].BUTTON = + + XmCreateScrolledText( Panel->FORM, Button[ Counter ].TEXT, Args, 12); + + XtManageChild ( Button[ Counter ].BUTTON ); + } + else + if ( Button[ Counter ].BITMAP != (char *)NULL ) + { + ButtonPixmap = XvpnCreatePixmap( Father, + Button[ Counter ].BITMAP, + Button[ Counter ].WIDTH, + Button[ Counter ].HEIGHT ); + Button[ Counter ].BUTTON = + + XtVaCreateManagedWidget( Label, + xmPushButtonWidgetClass, + Panel->FORM, + XmNlabelType , XmPIXMAP, + XmNlabelPixmap , ButtonPixmap, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , X1, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , X2, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , Y1, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , Y2, + NULL + ); + } + else + { + Button[ Counter ].BUTTON = + + XtVaCreateManagedWidget( Label, + xmPushButtonWidgetClass, + Panel->FORM, + XmNleftAttachment , XmATTACH_POSITION, + XmNleftPosition , X1, + XmNrightAttachment , XmATTACH_POSITION, + XmNrightPosition , X2, + XmNtopAttachment , XmATTACH_POSITION, + XmNtopPosition , Y1, + XmNbottomAttachment , XmATTACH_POSITION, + XmNbottomPosition , Y2, + NULL + ); + } + + + if ( Label != XvpnPanelButtonDisable ) + { + if ( Button[ Counter ].FOREGROUND != NULL ) + { + XtVaSetValues ( Button[ Counter ].BUTTON , + XtVaTypedArg , XmNforeground, + XmRString , + *Button[ Counter ].FOREGROUND , + strlen ( *Button[ Counter ].FOREGROUND ) + 1, + NULL + ); + } + + if ( Button[ Counter ].BACKGROUND != NULL ) + { + XtVaSetValues ( Button[ Counter ].BUTTON , + XtVaTypedArg , XmNbackground, + XmRString , + *Button[ Counter ].BACKGROUND , + strlen ( *Button[ Counter ].BACKGROUND ) + 1, + NULL + ); + } + + if ( Button[ Counter ].CALLBACK != NULL ) + { + if ( ( Button[ Counter ].TEXT != (char *)NULL ) && + ( Button[ Counter ].BITMAP != (char *)NULL ) ) + { + XtAddCallback( Button[ Counter ].BUTTON, + XmNdefaultActionCallback, + Button[ Counter ].CALLBACK, + (XtPointer)NULL ); + + XtAddCallback( Button[ Counter ].BUTTON, + XmNmultipleSelectionCallback, + Button[ Counter ].CALLBACK, + Button[ Counter ].CALLDATA ); + + } + else + { + XtAddCallback( Button[ Counter ].BUTTON, + XmNactivateCallback, + Button[ Counter ].CALLBACK, + Button[ Counter ].CALLDATA ); + } + } + } + else + { + Button[ Counter ].BUTTON = NULL; + } + } + + XtVaSetValues( Panel->PANEL , + XmNresizable , False, + XmNx , Panel->X, + XmNy , Panel->Y, + XmNheight , Panel->HEIGHT, + XmNwidth , Panel->WIDTH, + NULL ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnEnterPanel | +| | +\------------------------------------------------------------*/ + +void XvpnEnterPanel( Panel ) + + XvpnPanelItem *Panel; +{ + autbegin(); + + XtManageChild( Panel->PANEL ); + + if ( Panel->COMPUTE == 1 ) + { + XtVaSetValues( Panel->PANEL , + XmNresizable , False, + XmNx , Panel->X, + XmNy , Panel->Y, + XmNheight , Panel->HEIGHT, + XmNwidth , Panel->WIDTH, + NULL ); + + Panel->COMPUTE = 0; + } + + Panel->MANAGED = 1; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnExitPanel | +| | +\------------------------------------------------------------*/ + +void XvpnExitPanel( Panel ) + + XvpnPanelItem *Panel; +{ + autbegin(); + + XtUnmanageChild( Panel->PANEL ); + + Panel->MANAGED = 0; + + autend(); +} diff --git a/alliance/src/xvpn/src/XTB_panel.h b/alliance/src/xvpn/src/XTB_panel.h new file mode 100644 index 00000000..320e7b50 --- /dev/null +++ b/alliance/src/xvpn/src/XTB_panel.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : panel.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_XTB_PANEL +# define XVPN_XTB_PANEL + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xvpn/src/XTB_pixmap.c b/alliance/src/xvpn/src/XTB_pixmap.c new file mode 100644 index 00000000..b73bda8d --- /dev/null +++ b/alliance/src/xvpn/src/XTB_pixmap.c @@ -0,0 +1,106 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Pixmap.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "XTB.h" +# include "XSB.h" + +# include "XTB_pixmap.h" + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnCreatePixmap | +| | +\------------------------------------------------------------*/ + +Pixmap XvpnCreatePixmap( MainWidget, IconBits, IconWidth, IconHeight ) + + Widget MainWidget; + char *IconBits; + int IconWidth; + int IconHeight; +{ + Pixel Foreground; + Pixel Background; + Pixmap IconPixmap; + + autbegin(); + + XtVaGetValues( MainWidget, XmNforeground, &Foreground, + XmNbackground, &Background, NULL ); + + IconPixmap = XCreatePixmapFromBitmapData( XtDisplay( MainWidget ), + RootWindowOfScreen( XtScreen( MainWidget ) ), + IconBits, IconWidth, IconHeight, + Foreground, Background, + DefaultDepthOfScreen( XtScreen( MainWidget ) ) ); + + autend(); + return( IconPixmap ); +} + diff --git a/alliance/src/xvpn/src/XTB_pixmap.h b/alliance/src/xvpn/src/XTB_pixmap.h new file mode 100644 index 00000000..5d7e151e --- /dev/null +++ b/alliance/src/xvpn/src/XTB_pixmap.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : pixmap.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_XTB_PIXMAP +# define XVPN_XTB_PIXMAP + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xvpn/src/XVP.h b/alliance/src/xvpn/src/XVP.h new file mode 100644 index 00000000..c8f0a179 --- /dev/null +++ b/alliance/src/xvpn/src/XVP.h @@ -0,0 +1,325 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : XVP.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_XVP +# define XVPN_XVP + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XVPN_OBJECT_CIRCLE 0x00000 +# define XVPN_OBJECT_LINE 0x00001 +# define XVPN_OBJECT_RECTANGLE 0x00002 +# define XVPN_OBJECT_ARROW 0x00003 +# define XVPN_OBJECT_TEXT 0x00004 +# define XVPN_OBJECT_TYPE 0x0000F + +# define XVPN_OBJECT_PLACE 0x00010 +# define XVPN_OBJECT_TRANS 0x00020 +# define XVPN_OBJECT_ARC_TRANS 0x00040 +# define XVPN_OBJECT_ARC_PLACE 0x00080 +# define XVPN_OBJECT_PROC 0x00100 +# define XVPN_OBJECT_FUNC 0x00200 + +# define XVPN_OBJECT_LINE_DOWN 0x01000 +# define XVPN_OBJECT_LINE_LEFT 0x02000 + +# define XVPN_OBJECT_SELECT 0x04000 +# define XVPN_OBJECT_ACCEPT 0x08000 +# define XVPN_OBJECT_CONNECT 0x10000 + +/*------------------------------------------------------------\ +| | +| Macros | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Object | +| | +\------------------------------------------------------------*/ + +# define GetXvpnObjectType( X ) ( ( X )->TYPE & XVPN_OBJECT_TYPE ) + +# define IsXvpnLineDown( X ) ( ( X )->TYPE & XVPN_OBJECT_LINE_DOWN ) +# define IsXvpnLineLeft( X ) ( ( X )->TYPE & XVPN_OBJECT_LINE_LEFT ) +# define IsXvpnPlace( X ) ( ( X )->TYPE & XVPN_OBJECT_PLACE ) +# define IsXvpnTrans( X ) ( ( X )->TYPE & XVPN_OBJECT_TRANS ) +# define IsXvpnArcTrans( X ) ( ( X )->TYPE & XVPN_OBJECT_ARC_TRANS ) +# define IsXvpnArcPlace( X ) ( ( X )->TYPE & XVPN_OBJECT_ARC_PLACE ) +# define IsXvpnProc( X ) ( ( X )->TYPE & XVPN_OBJECT_PROC ) +# define IsXvpnFunc( X ) ( ( X )->TYPE & XVPN_OBJECT_FUNC ) + +# define SetXvpnLineDown( X ) ( ( X )->TYPE |= XVPN_OBJECT_LINE_DOWN ) +# define SetXvpnLineLeft( X ) ( ( X )->TYPE |= XVPN_OBJECT_LINE_LEFT ) +# define SetXvpnPlace( X ) ( ( X )->TYPE |= XVPN_OBJECT_PLACE ) +# define SetXvpnTrans( X ) ( ( X )->TYPE |= XVPN_OBJECT_TRANS ) +# define SetXvpnArcTrans( X ) ( ( X )->TYPE |= XVPN_OBJECT_ARC_TRANS ) +# define SetXvpnArcPlace( X ) ( ( X )->TYPE |= XVPN_OBJECT_ARC_PLACE ) +# define SetXvpnProc( X ) ( ( X )->TYPE |= XVPN_OBJECT_PROC ) +# define SetXvpnFunc( X ) ( ( X )->TYPE |= XVPN_OBJECT_FUNC ) + +# define ClearXvpnLineDown( X ) ( ( X )->TYPE &= ~XVPN_OBJECT_LINE_DOWN ) +# define ClearXvpnLineLeft( X ) ( ( X )->TYPE &= ~XVPN_OBJECT_LINE_LEFT ) +# define ClearXvpnPlace( X ) ( ( X )->TYPE &= ~XVPN_OBJECT_PLACE ) +# define ClearXvpnTrans( X ) ( ( X )->TYPE &= ~XVPN_OBJECT_TRANS ) +# define ClearXvpnArcTrans( X ) ( ( X )->TYPE &= ~XVPN_OBJECT_ARC_TRANS ) +# define ClearXvpnArcPlace( X ) ( ( X )->TYPE &= ~XVPN_OBJECT_ARC_PLACE ) +# define ClearXvpnProc( X ) ( ( X )->TYPE &= ~XVPN_OBJECT_PROC ) +# define ClearXvpnFunc( X ) ( ( X )->TYPE &= ~XVPN_OBJECT_FUNC ) + +/*------------------------------------------------------------\ +| | +| Select | +| | +\------------------------------------------------------------*/ + +# define IsXvpnSelect( X ) ( ( X )->TYPE & XVPN_OBJECT_SELECT ) +# define SetXvpnSelect( X ) ( ( X )->TYPE |= XVPN_OBJECT_SELECT ) +# define ClearXvpnSelect( X ) ( ( X )->TYPE &= ~XVPN_OBJECT_SELECT ) + +/*------------------------------------------------------------\ +| | +| Accept | +| | +\------------------------------------------------------------*/ + +# define IsXvpnAccept( X ) ( ( X )->TYPE & XVPN_OBJECT_ACCEPT ) +# define SetXvpnAccept( X ) ( ( X )->TYPE |= XVPN_OBJECT_ACCEPT ) +# define ClearXvpnAccept( X ) ( ( X )->TYPE &= ~XVPN_OBJECT_ACCEPT ) + +/*------------------------------------------------------------\ +| | +| Connect | +| | +\------------------------------------------------------------*/ + +# define IsXvpnConnect( X ) ( ( X )->TYPE & XVPN_OBJECT_CONNECT ) +# define SetXvpnConnect( X ) ( ( X )->TYPE |= XVPN_OBJECT_CONNECT ) +# define ClearXvpnConnect( X ) ( ( X )->TYPE &= ~XVPN_OBJECT_CONNECT ) + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Object | +| | +\------------------------------------------------------------*/ + + typedef struct xvpnobj_list + { + struct xvpnobj_list *NEXT; + struct xvpnobj_list *LINK; + char *NAME; + short LAYER; + long TYPE; + long X; + long Y; + long DX; + long DY; + void *USER; + + } xvpnobj_list; + + typedef struct xvpnfig_list + { + struct xvpnfig_list *NEXT; + char *NAME; + xvpnobj_list *OBJECT [ XVPN_MAX_LAYER ]; + xvpnobj_list *TEXT [ XVPN_MAX_LAYER ]; + + } xvpnfig_list; + +/*------------------------------------------------------------\ +| | +| Select | +| | +\------------------------------------------------------------*/ + + typedef struct xvpnselect_list + { + struct xvpnselect_list *NEXT; + xvpnobj_list *OBJECT; + + } xvpnselect_list; + +/*------------------------------------------------------------\ +| | +| Vpn Type | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern long XvpnBoundXmin; + extern long XvpnBoundYmin; + extern long XvpnBoundXmax; + extern long XvpnBoundYmax; + extern char XvpnRecomputeBound; + + extern xvpnfig_list *XvpnFigure; + extern vpnfig_list *XvpnFigureVpn; + + extern xvpnselect_list *XvpnHeadSelect; + extern xvpnselect_list *XvpnHeadConnect; + + extern int XvpnReduce; + extern int XvpnReduceAfter; + extern int XvpnElaborate; + extern int XvpnBdd; + extern int XvpnBound; + extern int XvpnSimp; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Add Functions | +| | +\------------------------------------------------------------*/ + + extern xvpnfig_list *XvpnAddFigure(); + extern xvpnobj_list *XvpnAddCircle(); + extern xvpnobj_list *XvpnAddLine(); + extern xvpnobj_list *XvpnAddText(); + +/*------------------------------------------------------------\ +| | +| Del Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnDelFigure(); + +/*------------------------------------------------------------\ +| | +| Elaborate Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnElaborateFigure(); + +/*------------------------------------------------------------\ +| | +| Flag Set & Clear Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnSelectObject(); + extern void XvpnUnselectObject(); + extern void XvpnAcceptObject(); + extern void XvpnRejectObject(); + extern void XvpnConnectObject(); + extern void XvpnDisconnectObject(); + +/*------------------------------------------------------------\ +| | +| Select Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnAddSelect(); + extern void XvpnDelSelect(); + extern void XvpnPurgeSelect(); + +/*------------------------------------------------------------\ +| | +| Connect Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnAddConnect(); + extern void XvpnDelConnect(); + +/*------------------------------------------------------------\ +| | +| Bound Compute | +| | +\------------------------------------------------------------*/ + + extern char XvpnComputeBound(); + +/*------------------------------------------------------------\ +| | +| Load Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnLoadFigure(); + +/*------------------------------------------------------------\ +| | +| Vex Functions | +| | +\------------------------------------------------------------*/ + + extern char *XvpnVex2String(); + +/*------------------------------------------------------------\ +| | +| Error Message Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnInitializeErrorMessage(); + + extern char *XvpnGetErrorMessage(); + extern void XvpnExitErrorMessage(); + +/*------------------------------------------------------------\ +| | +| Informations Functions | +| | +\------------------------------------------------------------*/ + + extern char *XvpnGetInformations(); + +# endif diff --git a/alliance/src/xvpn/src/XVP_bound.c b/alliance/src/xvpn/src/XVP_bound.c new file mode 100644 index 00000000..dd7b4003 --- /dev/null +++ b/alliance/src/xvpn/src/XVP_bound.c @@ -0,0 +1,148 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Bound.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" +# include "XSB.h" +# include "XVP.h" +# include "XVP_bound.h" + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + long XvpnBoundXmin = 0; + long XvpnBoundYmin = 0; + long XvpnBoundXmax = 0; + long XvpnBoundYmax = 0; + + char XvpnRecomputeBound = XVPN_TRUE; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnComputeBound | +| | +\------------------------------------------------------------*/ + +char XvpnComputeBound() + +{ + xvpnobj_list *Obj; + short Layer; + short FirstBound; + + if ( XvpnFigure == (xvpnfig_list *)NULL ) + { + return( XVPN_FALSE ); + } + + if ( XvpnRecomputeBound == XVPN_FALSE ) + { + return( XVPN_TRUE ); + } + + autbegin(); + + FirstBound = 1; + + for ( Layer = 0; Layer < XVPN_MAX_LAYER; Layer++ ) + { + for ( Obj = XvpnFigure->OBJECT[ Layer ]; + Obj != (xvpnobj_list *)NULL; + Obj = Obj->NEXT ) + { + if ( FirstBound ) + { + XvpnBoundXmin = Obj->X; + XvpnBoundYmin = Obj->Y; + XvpnBoundXmax = Obj->X + Obj->DX; + XvpnBoundYmax = Obj->Y + Obj->DY; + FirstBound = 0; + } + else + { + if ( Obj->X < XvpnBoundXmin ) + { + XvpnBoundXmin = Obj->X; + } + + if ( Obj->Y < XvpnBoundYmin ) + { + XvpnBoundYmin = Obj->Y; + } + + if ( ( Obj->X + Obj->DX ) > XvpnBoundXmax ) + { + XvpnBoundXmax = Obj->X + Obj->DX; + } + + if ( ( Obj->Y + Obj->DY ) > XvpnBoundYmax ) + { + XvpnBoundYmax = Obj->Y + Obj->DY; + } + } + } + } + + XvpnBoundXmin = XvpnBoundXmin - ( XVPN_UNIT << 1 ); + XvpnBoundYmin = XvpnBoundYmin - ( XVPN_UNIT << 1 ); + XvpnBoundXmax = XvpnBoundXmax + ( XVPN_UNIT << 1 ); + XvpnBoundYmax = XvpnBoundYmax + ( XVPN_UNIT << 1 ); + + XvpnRecomputeBound = XVPN_FALSE; + + autend(); + return( XVPN_TRUE ); +} diff --git a/alliance/src/xvpn/src/XVP_bound.h b/alliance/src/xvpn/src/XVP_bound.h new file mode 100644 index 00000000..49170aeb --- /dev/null +++ b/alliance/src/xvpn/src/XVP_bound.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Bound.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVP_BOUND +# define XVP_BOUND + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XVPN_DEFAULT_BOUND_XMIN 0 +# define XVPN_DEFAULT_BOUND_YMIN 0 +# define XVPN_DEFAULT_BOUND_XMAX 100 +# define XVPN_DEFAULT_BOUND_YMAX 100 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xvpn/src/XVP_error.c b/alliance/src/xvpn/src/XVP_error.c new file mode 100644 index 00000000..fa6faed1 --- /dev/null +++ b/alliance/src/xvpn/src/XVP_error.c @@ -0,0 +1,411 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Error.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" +# include "XSB.h" +# include "XVP.h" +# include "XVP_error.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static FILE *XvpnStreamErr = (FILE *)0; + static FILE *XvpnStreamOut = (FILE *)0; + static FILE *XvpnStreamAll = (FILE *)0; + + static char XvpnErrFileName[ 40 ]; + static char XvpnOutFileName[ 40 ]; + static char XvpnAllFileName[ 40 ]; + + static char XvpnNormalMode = 1; + +/*------------------------------------------------------------\ +| | +| Xvpn Error Message | +| | +\------------------------------------------------------------*/ + + static char *XvpnErrorBuffer = (char *)NULL; + +/*------------------------------------------------------------\ +| | +| Xvpn Informations | +| | +\------------------------------------------------------------*/ + + static char XvpnInformationsBuffer[ XVPN_INFORMATIONS_BUFFER_SIZE ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Xvpn Error Message Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnExitErrorMessage | +| | +\------------------------------------------------------------*/ + +void XvpnExitErrorMessage( Error ) + + int Error; +{ + autbegin(); + + if ( XvpnStreamErr != (FILE *)0 ) + { + fclose( XvpnStreamErr ); + unlink( XvpnErrFileName ); + } + + if ( XvpnStreamAll != (FILE *)0 ) + { + fclose( XvpnStreamAll ); + unlink( XvpnAllFileName ); + } + + if ( ( XvpnNormalMode ) && + ( XvpnStreamOut != (FILE *)0 ) ) + { + fclose( XvpnStreamOut ); + unlink( XvpnOutFileName ); + } + + exit( Error ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnInitializeErrorMessage | +| | +\------------------------------------------------------------*/ + +void XvpnInitializeErrorMessage( Debug ) + + char Debug; +{ + autbegin(); + + XvpnNormalMode = ! Debug; + + if ( XvpnNormalMode ) + { + sprintf( XvpnOutFileName, "/tmp/%s_out_%d", XVPN_TOOL_NAME, (int)getpid() ); + } + + sprintf( XvpnErrFileName, "/tmp/%s_err_%d", XVPN_TOOL_NAME, (int)getpid() ); + sprintf( XvpnAllFileName, "/tmp/%s_all_%d", XVPN_TOOL_NAME, (int)getpid() ); + + XvpnStreamErr = freopen( XvpnErrFileName, "w+", stderr); + XvpnStreamAll = fopen ( XvpnAllFileName, "w+" ); + + if ( XvpnNormalMode ) + { + XvpnStreamOut = freopen( XvpnOutFileName, "w+", stdout); + } + else + { + XvpnStreamOut = XvpnStreamErr; + } + + if ( ( XvpnStreamAll == (FILE *)NULL ) || + ( XvpnStreamOut == (FILE *)NULL ) || + ( XvpnStreamErr == (FILE *)NULL ) ) + { + fprintf( stdout, "Grm: Unable to open trace window !\n"); + exit( 1 ); + } + + if ( XvpnNormalMode ) + { + unlink( XvpnOutFileName ); + } + + unlink( XvpnErrFileName ); + + signal( SIGINT, XvpnExitErrorMessage ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnFlushErrorMessage | +| | +\------------------------------------------------------------*/ + +void XvpnFlushErrorMessage() +{ + int Data; + + autbegin(); + + fflush( XvpnStreamErr ); + fseek( XvpnStreamErr, 0L, 0 ); + + while( ( Data = fgetc( XvpnStreamErr ) ) != EOF ) + { + fputc( Data, XvpnStreamAll ); + } + + fclose( XvpnStreamErr ); + + XvpnStreamErr = freopen( XvpnErrFileName, "w+", stderr ); + + if ( XvpnNormalMode ) + { + fflush( XvpnStreamOut ); + fseek( XvpnStreamOut, 0L, 0 ); + + while( ( Data = fgetc( XvpnStreamOut ) ) != EOF ) + { + fputc( Data, XvpnStreamAll ); + } + + fclose( XvpnStreamOut ); + + XvpnStreamOut = freopen( XvpnOutFileName, "w+", stdout ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnGetErrorMessage | +| | +\------------------------------------------------------------*/ + +char *XvpnGetErrorMessage() + +{ + char *Message; + long Length; + long Index; + int Data; + + autbegin(); + + XvpnFlushErrorMessage(); + + fflush( XvpnStreamAll ); + + Length = ftell( XvpnStreamAll ); + + if ( XvpnErrorBuffer != (char *)NULL ) + { + autfreeblock( XvpnErrorBuffer ); + } + + XvpnErrorBuffer = autallocblock( Length + 1 ); + Index = 0; + + while ( ( ( Data = fgetc( XvpnStreamAll ) ) != EOF ) && + ( Index < Length ) ) + { + XvpnErrorBuffer[ Index++ ] = (char)Data; + } + + rewind( XvpnStreamAll ); + + XvpnErrorBuffer[ Index ] = '\0'; + + if ( Index == 0 ) + { + Message = (char *)NULL; + } + else + { + Message = XvpnErrorBuffer; + } + + autend(); + return( Message ); +} + +/*------------------------------------------------------------\ +| | +| XvpnGetInformations | +| | +\------------------------------------------------------------*/ + +char *XvpnGetInformations() + +{ + vpndecl_list *VpnDeclar; + vpnattr_list *VpnAttr; + vpnline_list *VpnLine; + char *Scan; + int Type; + + autbegin(); + + XvpnComputeBound(); + + Scan = XvpnInformationsBuffer; + + if ( XvpnFigureVpn != (vpnfig_list *)NULL ) + { + sprintf( Scan, " FIGURE : %s\n\n NUMBER_PLACE : %ld\n NUMBER_TRANS : %ld\n NUMBER_ARC : %ld\n\n", + XvpnFigureVpn->NAME, + GetVpnNumPlace( XvpnFigureVpn ), + GetVpnNumTrans( XvpnFigureVpn ), + GetVpnNumArc( XvpnFigureVpn ) ); + } + else + { + sprintf( Scan, " FIGURE : No current figure !\n\n" ); + } + + Scan = Scan + strlen( Scan ); + + sprintf( Scan, " BOUNDING BOX : \n\n XMIN : %ld\n YMIN : %ld\n XMAX : %ld\n YMAX : %ld\n\n", + XvpnBoundXmin / XVPN_UNIT, XvpnBoundYmin / XVPN_UNIT, + XvpnBoundXmax / XVPN_UNIT, XvpnBoundYmax / XVPN_UNIT ); + + Scan = Scan + strlen( Scan ); + + sprintf( Scan, " XVPN PARAM : %s\n\n", XVPN_PARAM_NAME ); + Scan = Scan + strlen( Scan ); + + if ( XvpnFigureVpn != (vpnfig_list *)0 ) + { + sprintf( Scan, "\n DECLAR : \n\n" ); + Scan = Scan + strlen( Scan ); + + for ( Type = 0; Type < VPN_MAX_DECLAR_TYPE; Type++ ) + { + for ( VpnDeclar = XvpnFigureVpn->DECLAR[ Type ]; + VpnDeclar != (vpndecl_list *)0; + VpnDeclar = VpnDeclar->NEXT ) + { + strcpy( Scan, " LINE :" ); + Scan += 8; + + for ( VpnLine = VpnDeclar->LINE; + VpnLine != (vpnline_list *)0; + VpnLine = VpnLine->NEXT ) + { + sprintf( Scan, " [%ld]", VpnLine->LINE ); + Scan = Scan + strlen( Scan ); + } + + Scan = Scan + strlen( Scan ); + + sprintf( Scan, "\n NAME: %s\n", XvpnVex2String( VpnDeclar->VEX_ATOM ) ); + Scan = Scan + strlen( Scan ); + + sprintf( Scan, " - INIT: %s\n - DIR : %s\n - TYPE: %s\n - KIND: %s\n - CLASS: %s\n - BASE: %s\n", + XvpnVex2String( VpnDeclar->VEX_INIT ), + VPN_DIR_TYPE[ VpnDeclar->DIR ], + VPN_DECLAR_TYPE[ VpnDeclar->TYPE ], + VPN_KIND_TYPE[ VpnDeclar->KIND ], + VPN_CLASS_TYPE[ VpnDeclar->CLASS ], + VEX_TYPE_NAME[ VpnDeclar->BASE ] ); + Scan = Scan + strlen( Scan ); + } + } + + sprintf( Scan, "\n ATTRIBUTE :\n\n" ); + Scan = Scan + strlen( Scan ); + + for ( VpnAttr = XvpnFigureVpn->ATTRIBUTE; + VpnAttr != (vpnattr_list *)0; + VpnAttr = VpnAttr->NEXT ) + { + strcpy( Scan, " LINE :" ); + Scan += 8; + + for ( VpnLine = VpnAttr->LINE; + VpnLine != (vpnline_list *)0; + VpnLine = VpnLine->NEXT ) + { + sprintf( Scan, " [%ld]", VpnLine->LINE ); + Scan = Scan + strlen( Scan ); + } + + Scan = Scan + strlen( Scan ); + + sprintf( Scan, "\n NAME: %s\n", VpnAttr->NAME ); + Scan = Scan + strlen( Scan ); + + sprintf( Scan, " - ENTITY : %s\n - TYPE : %s\n - VALUE : %s\n", + VpnAttr->ENTITY, + VPN_ATTRIBUTE_TYPE[ VpnAttr->TYPE ], + VpnAttr->VALUE ); + Scan = Scan + strlen( Scan ); + } + } + + autend(); + return( XvpnInformationsBuffer ); +} diff --git a/alliance/src/xvpn/src/XVP_error.h b/alliance/src/xvpn/src/XVP_error.h new file mode 100644 index 00000000..2663923e --- /dev/null +++ b/alliance/src/xvpn/src/XVP_error.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Error.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVP_ERROR +# define XVP_ERROR + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XVPN_INFORMATIONS_BUFFER_SIZE 8196 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void XvpnFlushErrorMessage(); + +# endif diff --git a/alliance/src/xvpn/src/XVP_object.c b/alliance/src/xvpn/src/XVP_object.c new file mode 100644 index 00000000..c82698ef --- /dev/null +++ b/alliance/src/xvpn/src/XVP_object.c @@ -0,0 +1,1233 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Object.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "vex.h" +# include "vpn.h" +# include "vtl.h" +# include "XSB.h" +# include "XVP.h" +# include "XVP_object.h" +# include "XVP_error.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + xvpnfig_list *XvpnFigure = (xvpnfig_list *)0; + vpnfig_list *XvpnFigureVpn = (vpnfig_list *)0; + + int XvpnReduce = 1; + int XvpnReduceAfter = 0; + int XvpnElaborate = 0; + int XvpnBdd = 0; + int XvpnSimp = 0; + int XvpnBound = 0; + + static long XvpnMinY = 0; + +/*------------------------------------------------------------\ +| | +| For Set Long Jump | +| | +\------------------------------------------------------------*/ + + static jmp_buf XvpnJumpBuffer; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Xvpn Exit Handler Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnExitHandler | +| | +\------------------------------------------------------------*/ + +void XvpnExitHandler() +{ + XvpnFlushErrorMessage(); + + longjmp( XvpnJumpBuffer, 1); +} + +/*------------------------------------------------------------\ +| | +| XvpnActiveExitHandler | +| | +\------------------------------------------------------------*/ + +void XvpnActiveExitHandler() +{ + MBK_EXIT_FUNCTION = XvpnExitHandler; +} + +/*------------------------------------------------------------\ +| | +| XvpnResetExitHandler | +| | +\------------------------------------------------------------*/ + +void XvpnResetExitHandler() +{ + MBK_EXIT_FUNCTION = NULL; +} + +/*------------------------------------------------------------\ +| | +| Xvpngetvpnfig | +| | +\------------------------------------------------------------*/ + +vpnfig_list *Xvpngetvpnfig( FileName ) + + char *FileName; +{ + vpnfig_list *FigureVpn; + + autbegin(); + + XvpnActiveExitHandler(); + + if ( setjmp( XvpnJumpBuffer ) == 0 ) + { + FigureVpn = addvpnfig( FileName ); + loadvpnfig( FigureVpn, FileName, XvpnReduce ); + + if ( XvpnSimp ) + { + simpvpnfig( FigureVpn ); + } +/*\ + if ( XvpnReduceAfter ) + { + reducevhlvpnfig( FigureVpn ); + } + + if ( XvpnBdd ) + { + BddSystem = createbddsystem( 100, 1000, 100, 5000000 ); + + makevhlbddcircuit( FigureVpn, BddSystem ); + makevhlbddnode( FigureVpn ); + convertvhlbddnode( FigureVpn ); + + destroybddcircuit( FigureVpn->CIRCUIT ); + destroybddsystem( BddSystem ); + } + + if ( XvpnElaborate ) + { + elaboratevhlvpnfig( FigureVpn ); + } +\*/ + + XvpnResetExitHandler(); + + autend(); + return( FigureVpn ); + } + + XvpnResetExitHandler(); + + delvpnfig( FileName ); + + autend(); + return( (vpnfig_list *)0 ); +} + +/*------------------------------------------------------------\ +| | +| Alloc Functions | +| | +\------------------------------------------------------------*/ + +xvpnfig_list *XvpnAllocFigure() +{ + return( (xvpnfig_list *)autallocblock( sizeof( xvpnfig_list ) ) ); +} + +xvpnobj_list *XvpnAllocObject() +{ + return( (xvpnobj_list *)autallocheap( sizeof( xvpnobj_list ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Free Functions | +| | +\------------------------------------------------------------*/ + +void XvpnFreeFigure( Figure ) + + xvpnfig_list *Figure; +{ + autfreeblock( Figure ); +} + +void XvpnFreeObject( Object ) + + xvpnobj_list *Object; +{ + autfreeheap( Object, sizeof( xvpnobj_list ) ); +} + +/*------------------------------------------------------------\ +| | +| Add Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnAddCircle | +| | +\------------------------------------------------------------*/ + +xvpnobj_list *XvpnAddCircle( X, Y, R, Layer ) + + long X; + long Y; + long R; + short Layer; +{ + xvpnobj_list *Object; + + autbegin(); + + Object = XvpnAllocObject(); + Object->TYPE = XVPN_OBJECT_CIRCLE; + Object->LAYER = Layer; + Object->NEXT = XvpnFigure->OBJECT[ Layer ]; + Object->X = X - R; + Object->Y = Y - R; + Object->DX = ( R << 1 ); + Object->DY = ( R << 1 ); + + XvpnFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XvpnAddLine | +| | +\------------------------------------------------------------*/ + +xvpnobj_list *XvpnAddLine( X1, Y1, X2, Y2, LayerFrom, LayerTo ) + + long X1; + long Y1; + long X2; + long Y2; + short LayerFrom; + short LayerTo; +{ + xvpnobj_list *Object; + + autbegin(); + + Object = XvpnAllocObject(); + Object->LAYER = LayerFrom; + Object->TYPE = XVPN_OBJECT_LINE; + Object->NEXT = XvpnFigure->OBJECT[ LayerTo ]; + + if ( X1 > X2 ) + { + SetXvpnLineLeft( Object ); + + Object->X = X2; + Object->DX = X1 - X2; + } + else + { + Object->X = X1; + Object->DX = X2 - X1; + } + + if ( Y1 > Y2 ) + { + SetXvpnLineDown( Object ); + + Object->Y = Y2; + Object->DY = Y1 - Y2; + } + else + { + Object->Y = Y1; + Object->DY = Y2 - Y1; + } + + XvpnFigure->OBJECT[ LayerTo ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XvpnAddArrow | +| | +\------------------------------------------------------------*/ + +xvpnobj_list *XvpnAddArrow( X1, Y1, X2, Y2, LayerFrom, LayerTo ) + + long X1; + long Y1; + long X2; + long Y2; + short LayerFrom; + short LayerTo; +{ + xvpnobj_list *Object; + + autbegin(); + + Object = XvpnAllocObject(); + Object->LAYER = LayerFrom; + Object->TYPE = XVPN_OBJECT_ARROW; + Object->NEXT = XvpnFigure->OBJECT[ LayerTo ]; + + if ( X1 > X2 ) + { + SetXvpnLineLeft( Object ); + + Object->X = X2; + Object->DX = X1 - X2; + } + else + { + Object->X = X1; + Object->DX = X2 - X1; + } + + if ( Y1 > Y2 ) + { + SetXvpnLineDown( Object ); + + Object->Y = Y2; + Object->DY = Y1 - Y2; + } + else + { + Object->Y = Y1; + Object->DY = Y2 - Y1; + } + + XvpnFigure->OBJECT[ LayerTo ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XvpnAddRectangle | +| | +\------------------------------------------------------------*/ + +xvpnobj_list *XvpnAddRectangle( X, Y, DX, DY, Layer ) + + long X; + long Y; + long DX; + long DY; + short Layer; +{ + xvpnobj_list *Object; + + autbegin(); + + Object = XvpnAllocObject(); + Object->TYPE = XVPN_OBJECT_RECTANGLE; + Object->LAYER = Layer; + Object->NEXT = XvpnFigure->OBJECT[ Layer ]; + Object->X = X; + Object->Y = Y; + Object->DX = DX; + Object->DY = DY; + + XvpnFigure->OBJECT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XvpnAddText | +| | +\------------------------------------------------------------*/ + +xvpnobj_list *XvpnAddText( X, Y, Name, Layer ) + + long X; + long Y; + char *Name; + short Layer; +{ + xvpnobj_list *Object; + int Length; + char Buffer[ 40 ]; + + autbegin(); + + Length = strlen( Name ); + + if ( Length > 20 ) + { + strncpy( Buffer, Name, 17 ); + strcpy( Buffer + 17, "..." ); + + Name = namealloc( Buffer ); + } + + Object = XvpnAllocObject(); + Object->LAYER = Layer; + Object->TYPE = XVPN_OBJECT_TEXT; + Object->NEXT = XvpnFigure->TEXT[ Layer ]; + Object->NAME = namealloc( Name ); + Object->X = X; + Object->Y = Y; + + XvpnFigure->TEXT[ Layer ] = Object; + + autend(); + return( Object ); +} + +/*------------------------------------------------------------\ +| | +| XvpnAddProc | +| | +\------------------------------------------------------------*/ + +xvpnobj_list *XvpnAddProc( Process, X, Y ) + + vpnproc_list *Process; + long X; + long Y; +{ + xvpnobj_list *Circle; + xvpnobj_list *Text; + + autbegin(); + + X = X * XVPN_UNIT; + Y = Y * XVPN_UNIT; + + Circle = XvpnAddCircle( X, Y, XVPN_UNIT, XVPN_LAYER_PROCESS ); + Text = XvpnAddText( X, Y - ( ( 3 * XVPN_UNIT ) >> 1 ), + Process->NAME, XVPN_LAYER_PROCESS ); + + SetXvpnProc( Circle ); + SetXvpnProc( Text ); + + Circle->USER = (void *)Process; + Text->USER = (void *)Process; + + Circle->LINK = Text; + Text->LINK = Circle; + + Process->USER = (void *)Circle; + + autend(); + return( Circle ); +} + +/*------------------------------------------------------------\ +| | +| XvpnAddFunc | +| | +\------------------------------------------------------------*/ + +xvpnobj_list *XvpnAddFunc( Function, X, Y ) + + vpnfunc_list *Function; + long X; + long Y; +{ + xvpnobj_list *Circle; + xvpnobj_list *Text; + + autbegin(); + + X = X * XVPN_UNIT; + Y = Y * XVPN_UNIT; + + Circle = XvpnAddCircle( X, Y, XVPN_UNIT, XVPN_LAYER_FUNCTION ); + Text = XvpnAddText( X, Y - ( ( 3 * XVPN_UNIT ) >> 1 ), + Function->NAME, XVPN_LAYER_FUNCTION ); + + SetXvpnFunc( Circle ); + SetXvpnFunc( Text ); + + Circle->USER = (void *)Function; + Text->USER = (void *)Function; + + Circle->LINK = Text; + Text->LINK = Circle; + + Function->USER = (void *)Circle; + + autend(); + return( Circle ); +} + +/*------------------------------------------------------------\ +| | +| XvpnAddPlace | +| | +\------------------------------------------------------------*/ + +xvpnobj_list *XvpnAddPlace( Place, X, Y ) + + vpnplace_list *Place; + long X; + long Y; +{ + xvpnobj_list *Circle; + xvpnobj_list *Text; + xvpnobj_list *Token; + xvpncoord *Coord; + + autbegin(); + + Coord = XVPN_COORD( Place ); + Coord->X = X; + Coord->Y = Y; + + X = X * XVPN_UNIT; + Y = Y * XVPN_UNIT; + + Circle = XvpnAddCircle( X, Y, XVPN_UNIT, Place->FATHER ); + Text = XvpnAddText( X, Y - ( ( 3 * XVPN_UNIT ) >> 1 ), + Place->NAME, Place->FATHER ); + + SetXvpnPlace( Circle ); + SetXvpnPlace( Text ); + + Circle->USER = (void *)Place; + Text->USER = (void *)Place; + + Circle->LINK = Text; + + if ( Place->TOKEN ) + { + Token = XvpnAddCircle( X, Y, ( XVPN_UNIT >> 1 ), XVPN_LAYER_TOKEN ); + Token->LINK = Token; + } + + Text->LINK = Circle; + Coord->OBJECT = Circle; + + autend(); + return( Circle ); +} + +/*------------------------------------------------------------\ +| | +| XvpnAddTrans | +| | +\------------------------------------------------------------*/ + +xvpnobj_list *XvpnAddTrans( Trans, X, Y ) + + vpntrans_list *Trans; + long X; + long Y; +{ + xvpnobj_list *Rectangle; + xvpnobj_list *Text; + xvpncoord *Coord; + int TypeSize; + short Layer; + long DX; + long DY; + + autbegin(); + + Coord = XVPN_COORD( Trans ); + Coord->X = X; + Coord->Y = Y; + + TypeSize = ( Trans->TYPE << 1 ) + 1; + + X = ( X - 1 ) * XVPN_UNIT; + Y = ( Y ) * XVPN_UNIT - TypeSize; + DX = ( XVPN_UNIT << 1 ); + DY = ( TypeSize << 1 ); + + switch ( Trans->TYPE ) + { + case VPN_TRANS_ACT_EXEC : + case VPN_TRANS_ACT_EXEC_CONC : Layer = XVPN_LAYER_ASSIGN; + break; + + case VPN_TRANS_SUP_WAIT : + case VPN_TRANS_INF_WAIT : Layer = XVPN_LAYER_WAIT; + break; + + case VPN_TRANS_GUARDED : Layer = XVPN_LAYER_GUARDED; + break; + + case VPN_TRANS_ACT_GUARDED : + case VPN_TRANS_ACT_GUARDED_CONC : Layer = XVPN_LAYER_ACT_GUARDED; + break; + + default : Layer = Trans->FATHER; + } + + Rectangle = XvpnAddRectangle( X, Y, DX, DY, Layer ); + Text = XvpnAddText( X + DX + ( XVPN_UNIT >> 1 ), Y + ( DY >> 1 ), + Trans->NAME, Layer ); + + Text->LINK = Rectangle; + Rectangle->LINK = Text; + + SetXvpnTrans( Rectangle ); + SetXvpnTrans( Text ); + + Rectangle->USER = (void *)Trans; + Text->USER = (void *)Trans; + + Coord->OBJECT = Rectangle; + + autend(); + return( Rectangle ); +} + +/*------------------------------------------------------------\ +| | +| XvpnAddArcPlace | +| | +\------------------------------------------------------------*/ + +xvpnobj_list *XvpnAddArcPlace( Place, Trans, Tra ) + + vpnplace_list *Place; + vpntrans_list *Trans; + vpnarc *Tra; +{ + xvpncoord *TransCoord; + xvpncoord *PlaceCoord; + xvpnobj_list *Line; + + autbegin(); + + TransCoord = XVPN_COORD( Trans ); + PlaceCoord = XVPN_COORD( Place ); + + Line = XvpnAddArrow( ( TransCoord->X ) * XVPN_UNIT, + ( TransCoord->Y ) * XVPN_UNIT, + ( PlaceCoord->X ) * XVPN_UNIT, + ( PlaceCoord->Y ) * XVPN_UNIT, + Place->FATHER, Place->FATHER ); + Line->LINK = Line; + + SetXvpnArcPlace( Line ); + + Line->USER = (void *)Tra; + Tra->USER = (void *)Line; + + autend(); + return( Line ); +} + +/*------------------------------------------------------------\ +| | +| XvpnAddArcTrans | +| | +\------------------------------------------------------------*/ + +xvpnobj_list *XvpnAddArcTrans( Trans, Place, Pla ) + + vpntrans_list *Trans; + vpnplace_list *Place; + vpnarc *Pla; +{ + xvpncoord *TransCoord; + xvpncoord *PlaceCoord; + xvpnobj_list *FirstLine; + xvpnobj_list *SecondLine; + xvpnobj_list *LastLine; + xvpnobj_list *Arrow; + long ArrowX1; + long ArrowY1; + long ArrowX2; + long ArrowY2; + long DeltaX; + long DeltaY; + + autbegin(); + + TransCoord = XVPN_COORD( Trans ); + PlaceCoord = XVPN_COORD( Place ); + + FirstLine = (xvpnobj_list *)0; + LastLine = (xvpnobj_list *)0; + + ArrowX1 = ( PlaceCoord->X ) * XVPN_UNIT; + ArrowY1 = ( PlaceCoord->Y ) * XVPN_UNIT; + ArrowX2 = ( TransCoord->X ) * XVPN_UNIT; + ArrowY2 = ( TransCoord->Y ) * XVPN_UNIT; + + DeltaX = PlaceCoord->X - TransCoord->X; + DeltaY = PlaceCoord->Y - TransCoord->Y; + + if ( DeltaY >= 0 ) + { + if ( DeltaX > 0 ) DeltaX = ( XVPN_UNIT << 2 ); + else DeltaX = - ( XVPN_UNIT << 2 ); + + FirstLine = XvpnAddLine( ArrowX2, ArrowY2, + ArrowX2, ArrowY2 - XVPN_UNIT, + Place->FATHER, Place->FATHER ); + + SetXvpnArcTrans( FirstLine ); + FirstLine->USER = (void *)Pla; + + ArrowY2 = ArrowY2 - XVPN_UNIT; + + SecondLine = XvpnAddLine( ArrowX2, ArrowY2, + ArrowX2 + DeltaX, ArrowY2, + Place->FATHER, Place->FATHER ); + + SetXvpnArcTrans( SecondLine ); + SecondLine->USER = (void *)Pla; + + ArrowX2 = ArrowX2 + DeltaX; + + LastLine = XvpnAddLine( ArrowX2, ArrowY2, + ArrowX2, ArrowY1, + Place->FATHER, Place->FATHER ); + + SetXvpnArcTrans( LastLine ); + LastLine->USER = (void *)Pla; + + ArrowY2 = ArrowY1; + + FirstLine->LINK = SecondLine; + SecondLine->LINK = LastLine; + } + + Arrow = XvpnAddArrow( ArrowX1, ArrowY1, + ArrowX2, ArrowY2, + Place->FATHER, Place->FATHER ); + + SetXvpnArcTrans( Arrow ); + Arrow->USER = (void *)Pla; + + if ( FirstLine != (xvpnobj_list *)0 ) + { + Arrow->LINK = FirstLine; + LastLine->LINK = Arrow; + } + else + { + Arrow->LINK = Arrow; + } + + Pla->USER = (void *)Arrow; + + autend(); + return( Arrow ); +} + +/*------------------------------------------------------------\ +| | +| XvpnPlacement | +| | +\------------------------------------------------------------*/ + +static long XvpnPlacement( VpnPlace, X, Y ) + + vpnplace_list *VpnPlace; + long X; + long Y; +{ + vpntrans_list *Trans; + vpnplace_list *Place; + vpnarc *ArcTrans; + vpnarc *ArcPlace; + chain_list *ScanChain1; + chain_list *ScanChain2; + + if ( XVPN_COORD_OBJECT( VpnPlace ) == (xvpnobj_list *)0 ) + { + if ( Y < XvpnMinY ) XvpnMinY = Y; + + XvpnAddPlace( VpnPlace, X, Y ); + + Y -= 5; + + for ( ScanChain1 = VpnPlace->TRANS_OUT; + ScanChain1 != (chain_list *)0; + ScanChain1 = ScanChain1->NEXT ) + { + if ( ScanChain1 != VpnPlace->TRANS_OUT ) X += 15; + + ArcTrans = (vpnarc *)( ScanChain1->DATA ); + Trans = (vpntrans_list *)( ArcTrans->TARGET ); + + if ( XVPN_COORD_OBJECT( Trans ) == (xvpnobj_list *)0 ) + { + XvpnAddTrans( Trans, X, Y ); + + for ( ScanChain2 = Trans->PLACE_OUT; + ScanChain2 != (chain_list *)0; + ScanChain2 = ScanChain2->NEXT ) + { + ArcPlace = (vpnarc *)( ScanChain2->DATA ); + Place = (vpnplace_list *)( ArcPlace->TARGET ); + + X = XvpnPlacement( Place, X, Y - 5 ); + + XvpnAddArcTrans( Trans, Place, ArcPlace ); + } + } + + XvpnAddArcPlace( VpnPlace, Trans, ArcTrans ); + } + } + + return( X ); +} + +/*------------------------------------------------------------\ +| | +| XvpnAddPlaceCoord | +| | +\------------------------------------------------------------*/ + +void XvpnAddPlaceCoord( HeadPlace ) + + vpnplace_list *HeadPlace; +{ + vpnplace_list *ScanPlace; + + for ( ScanPlace = HeadPlace; + ScanPlace != (vpnplace_list *)0; + ScanPlace = ScanPlace->NEXT ) + { + ScanPlace->USER = (void *)autallocheap( sizeof( xvpncoord ) ); + } +} + +/*------------------------------------------------------------\ +| | +| XvpnAddTransCoord | +| | +\------------------------------------------------------------*/ + +void XvpnAddTransCoord( HeadTrans ) + + vpntrans_list *HeadTrans; +{ + vpntrans_list *ScanTrans; + + for ( ScanTrans = HeadTrans; + ScanTrans != (vpntrans_list *)0; + ScanTrans = ScanTrans->NEXT ) + { + ScanTrans->USER = (void *)autallocheap( sizeof( xvpncoord ) ); + } +} + +/*------------------------------------------------------------\ +| | +| XvpnDelPlaceCoord | +| | +\------------------------------------------------------------*/ + +void XvpnDelPlaceCoord( HeadPlace ) + + vpnplace_list *HeadPlace; +{ + vpnplace_list *ScanPlace; + void *Pointer; + + for ( ScanPlace = HeadPlace; + ScanPlace != (vpnplace_list *)0; + ScanPlace = ScanPlace->NEXT ) + { + Pointer = ScanPlace->USER; + ScanPlace->USER = (void *)(((xvpncoord *)Pointer)->OBJECT); + + autfreeheap( Pointer, sizeof( xvpncoord ) ); + } +} + +/*------------------------------------------------------------\ +| | +| XvpnDelTransCoord | +| | +\------------------------------------------------------------*/ + +void XvpnDelTransCoord( HeadTrans ) + + vpntrans_list *HeadTrans; +{ + vpntrans_list *ScanTrans; + void *Pointer; + + for ( ScanTrans = HeadTrans; + ScanTrans != (vpntrans_list *)0; + ScanTrans = ScanTrans->NEXT ) + { + Pointer = ScanTrans->USER; + ScanTrans->USER = (void *)(((xvpncoord *)Pointer)->OBJECT); + + autfreeheap( Pointer, sizeof( xvpncoord ) ); + } +} + +/*------------------------------------------------------------\ +| | +| XvpnAddFigure | +| | +\------------------------------------------------------------*/ + +xvpnfig_list *XvpnAddFigure() + +{ + vpnproc_list *ScanProc; + vpnfunc_list *ScanFunc; + vpnplace_list *ScanPlace; + vpnarc *VpnArc; + vpntrans_list *VpnTrans; + long X; + + autbegin(); + + XvpnFigure = XvpnAllocFigure(); + XvpnFigure->NAME = XvpnFigureVpn->NAME; + + for ( ScanProc = XvpnFigureVpn->PROCESS; + ScanProc != (vpnproc_list *)0; + ScanProc = ScanProc->NEXT ) + { + XvpnAddPlaceCoord( ScanProc->PLACE ); + XvpnAddTransCoord( ScanProc->TRANS ); + } + + X = 0; + XvpnMinY = 0; + + for ( ScanProc = XvpnFigureVpn->PROCESS; + ScanProc != (vpnproc_list *)0; + ScanProc = ScanProc->NEXT ) + { + XvpnAddProc( ScanProc, X, 0 ); + + VpnTrans = ScanProc->FIRST; + + if ( VpnTrans == (vpntrans_list *)0 ) + { + VpnTrans = ScanProc->ELABO; + } + + if ( VpnTrans == (vpntrans_list *)0 ) + { + VpnTrans = ScanProc->TRANS; + } + + if ( VpnTrans != (vpntrans_list *)0 ) + { + VpnArc = (vpnarc *)VpnTrans->PLACE_IN->DATA; + ScanPlace = (vpnplace_list *)VpnArc->SOURCE; + + X = 25 + XvpnPlacement( ScanPlace, X, -5 ); + } + + for ( ScanPlace = ScanProc->PLACE; + ScanPlace != (vpnplace_list *)0; + ScanPlace = ScanPlace->NEXT ) + { + if ( XVPN_COORD_OBJECT( ScanPlace ) == (xvpnobj_list *)0 ) + { + X = 25 + XvpnPlacement( ScanPlace, X, -5 ); + } + } + } + + for ( ScanProc = XvpnFigureVpn->PROCESS; + ScanProc != (vpnproc_list *)0; + ScanProc = ScanProc->NEXT ) + { + XvpnDelPlaceCoord( ScanProc->PLACE ); + XvpnDelTransCoord( ScanProc->TRANS ); + } + + for ( ScanFunc = XvpnFigureVpn->FUNCTION; + ScanFunc != (vpnfunc_list *)0; + ScanFunc = ScanFunc->NEXT ) + { + XvpnAddPlaceCoord( ScanFunc->PLACE ); + XvpnAddTransCoord( ScanFunc->TRANS ); + } + + for ( ScanFunc = XvpnFigureVpn->FUNCTION; + ScanFunc != (vpnfunc_list *)0; + ScanFunc = ScanFunc->NEXT ) + { + XvpnAddFunc( ScanFunc, X, 0 ); + + VpnTrans = ScanFunc->FIRST; + + if ( VpnTrans == (vpntrans_list *)0 ) + { + VpnTrans = ScanFunc->ELABO; + } + + if ( VpnTrans == (vpntrans_list *)0 ) + { + VpnTrans = ScanFunc->TRANS; + } + + if ( VpnTrans != (vpntrans_list *)0 ) + { + VpnArc = (vpnarc *)VpnTrans->PLACE_IN->DATA; + ScanPlace = (vpnplace_list *)VpnArc->SOURCE; + + X = 25 + XvpnPlacement( ScanPlace, X, -5 ); + } + + for ( ScanPlace = ScanFunc->PLACE; + ScanPlace != (vpnplace_list *)0; + ScanPlace = ScanPlace->NEXT ) + { + if ( XVPN_COORD_OBJECT( ScanPlace ) == (xvpnobj_list *)0 ) + { + X = 25 + XvpnPlacement( ScanPlace, X, -5 ); + } + } + } + + for ( ScanFunc = XvpnFigureVpn->FUNCTION; + ScanFunc != (vpnfunc_list *)0; + ScanFunc = ScanFunc->NEXT ) + { + XvpnDelPlaceCoord( ScanFunc->PLACE ); + XvpnDelTransCoord( ScanFunc->TRANS ); + } + + autend(); + return( XvpnFigure ); +} + +/*------------------------------------------------------------\ +| | +| Del Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnDelFigure | +| | +\------------------------------------------------------------*/ + +void XvpnDelFigure() +{ + xvpnobj_list *ScanObject; + xvpnobj_list *DelObject; + short Layer; + + if ( XvpnFigure == (xvpnfig_list *)0 ) return; + + autbegin(); + + for ( Layer = 0; Layer < XVPN_MAX_LAYER; Layer++ ) + { + ScanObject = XvpnFigure->OBJECT[ Layer ]; + + while ( ScanObject != (xvpnobj_list *)0 ) + { + DelObject = ScanObject; + ScanObject = ScanObject->NEXT; + + XvpnFreeObject( DelObject ); + } + + ScanObject = XvpnFigure->TEXT[ Layer ]; + + while ( ScanObject != (xvpnobj_list *)0 ) + { + DelObject = ScanObject; + ScanObject = ScanObject->NEXT; + + XvpnFreeObject( DelObject ); + } + } + + XvpnFreeFigure( XvpnFigure ); + + delvpnfig( XvpnFigureVpn->NAME ); + + XvpnFigure = (xvpnfig_list *)0; + XvpnFigureVpn = (vpnfig_list *)0; + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Load Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnLoadFigure | +| | +\------------------------------------------------------------*/ + +void XvpnLoadFigure( FileName ) + + char *FileName; +{ + autbegin(); + + XvpnFigureVpn = Xvpngetvpnfig( FileName ); + + if ( XvpnFigureVpn != (vpnfig_list *)0 ) + { + XvpnAddFigure(); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Vex Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnVex2String | +| | +\------------------------------------------------------------*/ + +char *XvpnVex2String( Expr ) + + vexexpr *Expr; +{ + if ( XvpnBound ) return( viewvexexprstrbound( Expr ) ); + + return( viewvexexprstr( Expr ) ); +} + +/*------------------------------------------------------------\ +| | +| Elaborate Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnElaborateFigure | +| | +\------------------------------------------------------------*/ + +void XvpnElaborateFigure() +{ +/*\ + ScanObject = XvpnFigure->OBJECT[ XVPN_LAYER_TOKEN ]; + XvpnFigure->OBJECT[ XVPN_LAYER_TOKEN ] = (xvpnobj_list *)0; + + while ( ScanObject != (xvpnobj_list *)0 ) + { + DelObject = ScanObject; + ScanObject = ScanObject->NEXT; + + XvpnFreeObject( DelObject ); + } + + elaboratevhlvpnfig( XvpnFigureVpn ); + + for ( ScanProc = XvpnFigureVpn->PROCESS; + ScanProc != (vpnproc_list *)0; + ScanProc = ScanProc->NEXT ) + { + ScanTrans = ScanProc->ELABO; + ScanArc = (vpnarc *)ScanTrans->PLACE_IN->DATA; + ScanPlace = (vpnplace_list *)ScanArc->SOURCE; + + if ( ScanPlace->TOKEN ) + { + ScanObject = (xvpnobj_list *)( ScanPlace->USER ); + + Token = XvpnAddCircle( ScanObject->X + XVPN_UNIT, + ScanObject->Y + XVPN_UNIT, + ( XVPN_UNIT >> 1 ), XVPN_LAYER_TOKEN ); + Token->LINK = Token; + } + } +\*/ +} diff --git a/alliance/src/xvpn/src/XVP_object.h b/alliance/src/xvpn/src/XVP_object.h new file mode 100644 index 00000000..24e45068 --- /dev/null +++ b/alliance/src/xvpn/src/XVP_object.h @@ -0,0 +1,85 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Object.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVP_OBJECT_H +# define XVP_OBJECT_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define XVPN_COORD( P ) (((xvpncoord *)((P)->USER)) ) +# define XVPN_COORD_X( P ) (((xvpncoord *)((P)->USER))->X ) +# define XVPN_COORD_Y( P ) (((xvpncoord *)((P)->USER))->Y ) +# define XVPN_COORD_OBJECT( P ) (((xvpncoord *)((P)->USER))->OBJECT) + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct xvpncoord + { + xvpnobj_list *OBJECT; + long X; + long Y; + + } xvpncoord; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xvpn/src/XVP_select.c b/alliance/src/xvpn/src/XVP_select.c new file mode 100644 index 00000000..a12103e2 --- /dev/null +++ b/alliance/src/xvpn/src/XVP_select.c @@ -0,0 +1,424 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Select.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" +# include "XSB.h" +# include "XVP.h" +# include "XVP_select.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + xvpnselect_list *XvpnHeadSelect = (xvpnselect_list *)NULL; + xvpnselect_list *XvpnHeadConnect = (xvpnselect_list *)NULL; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Alloc Functions | +| | +\------------------------------------------------------------*/ + +xvpnselect_list *XvpnAllocSelect() +{ + return( (xvpnselect_list *)autallocheap( sizeof( xvpnselect_list ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Free Functions | +| | +\------------------------------------------------------------*/ + +void XvpnFreeSelect( Select ) + + xvpnselect_list *Select; +{ + autfreeheap( Select, sizeof( xvpnselect_list ) ); +} + +/*------------------------------------------------------------\ +| | +| Select Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnSelectObject | +| | +\------------------------------------------------------------*/ + +void XvpnSelectObject( Object ) + + xvpnobj_list *Object; +{ + xvpnobj_list *Scan; + + autbegin(); + + Scan = Object; + + do + { + SetXvpnSelect( Scan ); + + Scan = Scan->LINK; + } + while ( Scan != Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnUnselectObject | +| | +\------------------------------------------------------------*/ + +void XvpnUnselectObject( Object ) + + xvpnobj_list *Object; +{ + xvpnobj_list *Scan; + + autbegin(); + + Scan = Object; + + do + { + ClearXvpnSelect( Scan ); + + Scan = Scan->LINK; + } + while ( Scan != Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnAcceptObject | +| | +\------------------------------------------------------------*/ + +void XvpnAcceptObject( Object ) + + xvpnobj_list *Object; +{ + xvpnobj_list *Scan; + + autbegin(); + + Scan = Object; + + do + { + SetXvpnAccept( Scan ); + + Scan = Scan->LINK; + } + while ( Scan != Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnRejectObject | +| | +\------------------------------------------------------------*/ + +void XvpnRejectObject( Object ) + + xvpnobj_list *Object; +{ + xvpnobj_list *Scan; + + autbegin(); + + Scan = Object; + + do + { + ClearXvpnAccept( Scan ); + + Scan = Scan->LINK; + } + while ( Scan != Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnConnectObject | +| | +\------------------------------------------------------------*/ + +void XvpnConnectObject( Object ) + + xvpnobj_list *Object; +{ + xvpnobj_list *Scan; + + autbegin(); + + Scan = Object; + + do + { + SetXvpnConnect( Scan ); + + Scan = Scan->LINK; + } + while ( Scan != Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnDisconnectObject | +| | +\------------------------------------------------------------*/ + +void XvpnDisconnectObject( Object ) + + xvpnobj_list *Object; +{ + xvpnobj_list *Scan; + + autbegin(); + + Scan = Object; + + do + { + ClearXvpnConnect( Scan ); + + Scan = Scan->LINK; + } + while ( Scan != Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Add Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnAddSelect | +| | +\------------------------------------------------------------*/ + +void XvpnAddSelect( Object ) + + xvpnobj_list *Object; +{ + xvpnselect_list *Select; + + autbegin(); + + Select = XvpnAllocSelect(); + Select->NEXT = XvpnHeadSelect; + Select->OBJECT = Object; + XvpnHeadSelect = Select; + + XvpnSelectObject( Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnAddConnect | +| | +\------------------------------------------------------------*/ + +void XvpnAddConnect( Object ) + + xvpnobj_list *Object; +{ + xvpnselect_list *Connect; + + autbegin(); + + Connect = XvpnAllocSelect(); + Connect->NEXT = XvpnHeadConnect; + Connect->OBJECT = Object; + XvpnHeadConnect = Connect; + + XvpnConnectObject( Object ); + + autend(); +} + +/*------------------------------------------------------------\ +| | +| Del Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnDelSelect | +| | +\------------------------------------------------------------*/ + +void XvpnDelSelect() +{ + xvpnselect_list *Select; + xvpnselect_list *DelSelect; + + autbegin(); + + Select = XvpnHeadSelect; + XvpnHeadSelect = (xvpnselect_list *)NULL; + + while ( Select != (xvpnselect_list *)NULL ) + { + XvpnRejectObject( Select->OBJECT ); + + DelSelect = Select; + Select = Select->NEXT; + + XvpnFreeSelect( DelSelect ); + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnPurgeSelect | +| | +\------------------------------------------------------------*/ + +void XvpnPurgeSelect() +{ + xvpnselect_list *DelSelect; + xvpnselect_list *Select; + xvpnselect_list **Previous; + + autbegin(); + + Previous = &XvpnHeadSelect; + Select = XvpnHeadSelect; + + while( Select != (xvpnselect_list *)NULL ) + { + if ( ! IsXvpnAccept( Select->OBJECT ) ) + { + DelSelect = Select; + Select = Select->NEXT; + *Previous = Select; + + XvpnFreeSelect( DelSelect ); + } + else + { + Previous = &Select->NEXT; + Select = Select->NEXT; + } + } + + autend(); +} + +/*------------------------------------------------------------\ +| | +| XvpnDelConnect | +| | +\------------------------------------------------------------*/ + +void XvpnDelConnect() +{ + xvpnselect_list *Connect; + xvpnselect_list *DelConnect; + + autbegin(); + + Connect = XvpnHeadConnect; + XvpnHeadConnect = (xvpnselect_list *)NULL; + + while ( Connect != (xvpnselect_list *)NULL ) + { + XvpnDisconnectObject( Connect->OBJECT ); + + DelConnect = Connect; + Connect = Connect->NEXT; + + XvpnFreeSelect( DelConnect ); + } + + autend(); +} diff --git a/alliance/src/xvpn/src/XVP_select.h b/alliance/src/xvpn/src/XVP_select.h new file mode 100644 index 00000000..460cc3e3 --- /dev/null +++ b/alliance/src/xvpn/src/XVP_select.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : Select.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVP_SELECT_H +# define XVP_SELECT_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/xvpn/src/xvpn.c b/alliance/src/xvpn/src/xvpn.c new file mode 100644 index 00000000..4bea22d8 --- /dev/null +++ b/alliance/src/xvpn/src/xvpn.c @@ -0,0 +1,212 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : xvpn.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +# ident "@(#)XVPN ver 1.01 September 1996" + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" +# include "vtl.h" +# include "XSB.h" +# include "XVP.h" +# include "XMX.h" + +# include "xvpn.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| present | +| | +\------------------------------------------------------------*/ + +void XvpnPresent() +{ + alliancebanner_with_authors( "Xvpn", XVPN_VERSION, + "Graphic Petri Nets Viewer", "1996", + ALLIANCE_VERSION, "Ludovic Jacomme" ); +} + +/*------------------------------------------------------------\ +| | +| main | +| | +\------------------------------------------------------------*/ + +int main( argc, argv ) + + int argc; + char *argv[]; +{ + char Debug = 0; + int Index; + + XvpnPresent(); + + mbkenv(); + autenv(); + vexenv(); + vpnenv(); + Xvpngetenv(); + + for ( Index = 1; + Index < argc; + Index++ ) + { + if ( ! strcmp( argv[ Index ], "-l" ) ) + { + if ( ( Index + 1 ) < argc ) + { + Index = Index + 1; + XvpnFirstFileName = argv[ Index ]; + } + } + else + if ( ! strcmp( argv[ Index ], "-debug" ) ) + { + Debug = 1; + } + else + if ( ! strcmp( argv[ Index ], "-xor" ) ) + { + XVPN_XOR_CURSOR = XVPN_TRUE; + } + else + if ( ! strcmp( argv[ Index ], "-force" ) ) + { + XVPN_FORCE_DISPLAY = XVPN_TRUE; + } + else + if ( ! strcmp( argv[ Index ], "-install" ) ) + { + XVPN_SWITCH_COLOR_MAP = XVPN_TRUE; + } + else + if ( ! strcmp( argv[ Index ], "-I" ) ) + { + if ( ( Index + 1 ) < argc ) + { + Index = Index + 1; + VPN_IN = namealloc( argv[ Index ] ); + } + } + else + if ( ! strcmp( argv[ Index ], "-elaborate" ) ) + { + XvpnElaborate = 1; + } + else + if ( ! strcmp( argv[ Index ], "-bdd" ) ) + { + XvpnBdd = 1; + } + else + if ( ! strcmp( argv[ Index ], "-bound" ) ) + { + XvpnBound = 1; + } + else + if ( ! strcmp( argv[ Index ], "-simp" ) ) + { + XvpnSimp = 1; + } + else + if ( ! strcmp( argv[ Index ], "-noreduce" ) ) + { + XvpnReduce = 0; + } + else + if ( ! strcmp( argv[ Index ], "-reduce_after" ) ) + { + XvpnReduceAfter = 1; + } + else + if ( ! strcmp( argv[ Index ], "-slide" ) ) + { + for ( Index++; Index < argc; Index++ ) + { + XvpnFileAddSlide( argv[ Index ] ); + } + } + } + + if ( Debug ) autdebug(); + + autbegin(); + + XvpnLoadParameters(); + + XvpnInitializeRessources( &argc, argv ); + XvpnInitializeErrorMessage( Debug ); + + XtAppMainLoop( XvpnApplication ); + + autend(); + + return( 0 ); +} diff --git a/alliance/src/xvpn/src/xvpn.h b/alliance/src/xvpn/src/xvpn.h new file mode 100644 index 00000000..de668d1f --- /dev/null +++ b/alliance/src/xvpn/src/xvpn.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU General Public | +| License as published by the Free Software Foundation; | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Tool : XVPN | +| | +| File : xvpn.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# ifndef XVPN_XVPN +# define XVPN_XVPN + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| XvpnInitializeRessources | +| | +\------------------------------------------------------------*/ + +# endif