Jspice3
sced.h
Go to the documentation of this file.
1 /***************************************************************************
2 SCED - Schematic Capture Editor
3 JSPICE3 adaptation of Spice3e2 - Copyright (c) Stephen R. Whiteley 1992
4 Copyright 1990 Regents of the University of California. All rights reserved.
5 Authors: 1981 Giles C. Billingsley (parts of KIC layout editor)
6  1992 Stephen R. Whiteley
7 ****************************************************************************/
8 
9 /*
10  * SCED data structures.
11  *
12  */
13 
14 #include <setjmp.h>
15 #include "cddefs.h"
16 #include "fteinp.h"
17 
18 /*
19  * Environmental data
20  * (this should go somewhere else)
21  */
22 
23 #define DEFAULT_EDIT_FILE "noname"
24 #define DEFAULT_TERMINAL NULL
25 #define INIT_FILE "sced.rc"
26 #define DEFAULT_PATH "."
27 
28 /* name of device library */
29 #define DeviceLibrary "device.lib"
30 #define ModelLibrary "model.lib"
31 
32 
33 /*
34  * There are 100 data base units per micron
35  */
36 #define RESOLUTION 100
37 #define HALFRESOLUTION 50
38 
39 /*
40  * Size of the storage for polygon vertices
41  */
42 #define POLYGONBUFSIZE 600
43 #define MAXPOLYGONVERTICES 300
44 
45 /*
46  * Viewport control flags
47  */
48 #define SPLITSCREEN 'b'
49 #define FULLSCREEN 'o'
50 #define FINEVIEWPORTONLY 'f'
51 #define COARSEVIEWPORTONLY 'c'
52 
53 /*
54  * Menu names
55  */
56 #define BASICMENU 'B'
57 #define AMBIGUITYMENU 'A'
58 
59 /*
60  * Returns from PointLoop() function.
61  */
62 #define PL_ESC 1
63 #define PL_UND 2
64 #define PL_CMD 3
65 #define PL_PCW 4
66 
67 /* colormap indices */
68 /* Oh, bother. X likes the highlighting color
69  * to be 1, but Microsoft mouse insists on
70  * color 15 for the cursor, which also
71  * is highlighted.
72  */
73 #define BackgroundColor 0
74 #define HighlightingColor 1
75 #define MenuTextColor 2
76 #define MenuTextPrefixColor 3
77 #define MenuSelectedColor 4
78 #define MenuSelectedPrefixColor 5
79 #define MenuHighlightingColor 6
80 #define PromptTextColor 7
81 #define MoreTextColor 8
82 #define CoarseGridColor 9
83 #define FineGridColor 10
84 #define InstanceBBColor 11
85 #define InstanceNameColor 12
86 #define ExtraColor1 13
87 #define DrawingColor 14
88 #define ExtraColor2 15
89 
90 /* character that terminates most commands */
91 #define ESCAPE 27
92 
93 
94 struct kl {
95  int klR,klG,klB; /* RGB color */
96 };
97 
98 /*
99  * Cursor desc.
100  */
101 struct kc {
102  long kcPredX,kcPredY,kcX,kcY;
103  long kcRawX,kcRawY;
104  long kcDX,kcDY;
105  int kcInFine;
106 };
107 
108 /*
109  * Area structure.
110  */
111 struct ka {
112  long kaLeft,kaBottom,kaRight,kaTop;
113  long kaX,kaY;
114  double kaWidth,kaHeight;
115 };
116 
117 /*
118  * Structure to keep current area of interest.
119  */
120 struct a {
121  long aLF,aBF,aRF,aTF;
122  long aLC,aBC,aRC,aTC;
123  int aInFine;
125 };
126 
127 /*
128  * Structure used to save windows in window stack.
129  */
130 struct kw {
137  struct kw *kwNext;
138  char kwExpand;
140  char kwName[8];
141 };
142 
143 /*
144  * Layout windows and the viewports they map to.
145  */
146 struct kv {
147  struct ka *kvFineWindow;
153  /* viewport/window */
154  double kvFineRatio;
157  char kvControl;
158 };
159 
160 
161 /* definitions for hypertext */
162 
163 #define HY_END 0
164 #define HY_NODE 1
165 #define HY_BRAN 2
166 #define HY_DEVN 4
167 #define HY_ALL 7
168 #define HY_TEXT 8
169 #define HY_BOGUS 16
170 
171 /* structures for keeping track of coordinate reference */
172 struct parent {
173  struct o *pPointer; /* parent of reference */
174  struct o *pOldPointer; /* for undo */
175  struct parent *pNext; /* link */
176 };
177 
178 struct hyEnt {
179  long hyX; /* coordinate */
180  long hyY;
181  long hyOldX; /* previous coord for undo */
182  long hyOldY;
183  struct o *hyPointer; /* device referenced */
184  struct o *hyOldPointer; /* previous reference for undo */
185  struct parent *hyParent; /* list of parent devices for subckt ref */
186  int hyOrient; /* orientation of branch current */
187  int hyOldOrient; /* previous orient for undo */
188  int hyRefType; /* HY_... NODE, BRAN, DEVN, BOGUS */
189  int hyUndo; /* true if undone */
190 };
191 
192 /* hypertext string list */
193 struct hprlist {
194  int hlRefType; /* HY_... NODE, BRAN, DEVN, TEXT */
195  char *hlText; /* text, if HY_TEXT */
196  struct hyEnt *hlEnt; /* hyEnt struct if not HY_TEXT */
197  struct hprlist *hlNext; /* link */
198 };
199 
200 
201 /*
202  * Parameters that control SCED.
203  */
204 struct kp {
205 
206  /* Symbol desc for current cell */
207  struct s *kpCellDesc;
208 
209  /* Symbol name for current cell */
210  char *kpCellName;
211 
212  /* Symbol desc for top level cell */
213  struct s *kpTopDesc;
214 
215  /* Symbol name for top level cell */
216  char *kpTopName;
217 
218  /* Command selected if any from command menu */
219  char *kpCommand;
220 
221  /* Linked list of saved views */
222  struct kw *kpWindowStack;
223 
224  /* current instance array parameters */
225  int kpNumX;
226  int kpNumY;
227  double kpDX;
228  double kpDY;
229 
230  /* True if subcircuits should be expanded */
232 
233  /* Number of RESOLUTION*lambda between grid points. */
234  long kpGrid;
235 
236  /* grid line pattern */
238 
239  /* If True, display grid */
241 
242  /* If True, put grid below layout geometries */
244 
245  /* If True, grid will be shown in large viewport */
247 
248  /* If False then the SelectQ is never redisplayed (for speed) */
250 
251  /* Current colormap index */
252  int kpColor;
253 
254  /* If true, display subcircuit terminals */
256 
257  /* If True, user pointed inside coarse viewport and Command[0] == EOS */
259 
260  /* True if current cell has been modified */
262 
263  /* Debug parameters */
265 
266  /* If True, user has just pressed the interrupt key */
268 
269  /* If true, show connection points */
271 
272  /* Which types of object will be selected */
273  char kpSelectTypes[8];
274 
275  /*
276  * PointingThreshold is the minimum value of ViewportWidth/WindowWidth
277  * such that it is still comfortable to point with lambda precision.
278  */
280 
281  /* Current transform defined in Selection menu */
282  int kpRotationAngle; /* 0, 90, 180, or 270 */
283  int kpMX;
284  int kpMY;
285 
286  /* True if making hard copy */
288 
289  /* Factor for scaling text labels for hard copy */
291 
292  /* Keep track of cursor location */
294 
295  /* Type of cursor chosen */
297 
298  /* True if full screen cursor in use */
300 
301  /* Beep volume */
303 
304  /* Name of X font used */
305  char kpFontName[81];
306 
307  /*
308  * == COARSEVIEWPORTONLY if coarse window-viewport to be redisplayed
309  * == FINEVIEWPORTONLY if fine window-viewport should be redisplayed
310  * == SPLITSCREEN if both should be redisplayed
311  */
313 
314  /*
315  * Current command menu
316  * == BASICMENU denotes basic menu
317  * == AMBIGUITYMENU denotes ambiguity menu
318  */
319  char kpMenu;
320 };
321 
322 /*
323  * Selection queue.
324  *
325  *
326  * The select Q is a single-linked list of select Q descriptors.
327  * Each desc points to the object descriptor for a selected object.
328  * SelectQHead is the head of the list.
329  * SelectQBB is the BB of ALL of the selected objects.
330  * Move and delete are easily implemented as operations on the Q.
331  */
332 
333 struct ks {
334  struct ks *ksSucc;
335  struct o *ksPointer;
336 };
337 
338 /* Values of Info parameter used to manage objects in SelectQ */
339 
340 /* Previous object not in Q */
341 #define SQ_OLD 0
342 
343 /* Previous object in Q, selected */
344 #define SQ_OLDSEL 1
345 
346 /* Conditionally deleted object */
347 #define SQ_GONE 2
348 
349 /* Newly created object, not selected */
350 #define SQ_NEW 3
351 
352 /* Newly created object, selected */
353 #define SQ_NEWSEL 4
354 
355 /* Partially created object */
356 #define SQ_INCMPLT 5
357 
358 
359 /*
360  * menus.
361  */
362 
363 struct menu {
364  char *mEntry;
365  short mActive;
366  char mPrefix[6];
367 };
368 typedef struct menu MENU;
369 
370 
371 /* coordinate transformation macros */
372 
373 #define CoarseLToP(X,Y,XT,YT) \
374  XT = .5+(X-View->kvCoarseWindow->kaLeft)*View->kvCoarseRatio; \
375  XT += View->kvCoarseViewport->kaLeft; \
376  YT = .5+(Y-View->kvCoarseWindow->kaBottom)*View->kvCoarseRatio; \
377  YT += View->kvCoarseViewport->kaBottom;
378 
379 #define FineLToP(X,Y,XT,YT) \
380  XT = .5+(X-View->kvFineWindow->kaLeft)*View->kvFineRatio; \
381  XT += View->kvFineViewport->kaLeft; \
382  YT = .5+(Y-View->kvFineWindow->kaBottom)*View->kvFineRatio; \
383  YT += View->kvFineViewport->kaBottom;
384 
385 #define ClipVP(Viewport,X,Y) \
386  if(X < Viewport->kaLeft) X = Viewport->kaLeft; \
387  else if(X > Viewport->kaRight) X = Viewport->kaRight; \
388  if(Y < Viewport->kaBottom) Y = Viewport->kaBottom; \
389  else if(Y > Viewport->kaTop) Y = Viewport->kaTop;
390 
391 #include "scedext.h"
struct kw * kpWindowStack
Definition: sced.h:222
long aTF
Definition: sced.h:121
long kwLastWindowY
Definition: sced.h:132
int kvFineViewportOnBottom
Definition: sced.h:156
int hlRefType
Definition: sced.h:194
long kaY
Definition: sced.h:113
short mActive
Definition: sced.h:365
long kwLastWindowWidth
Definition: sced.h:133
long kwLastFineWindowY
Definition: sced.h:135
int kpPointingThreshold
Definition: sced.h:279
char kvControl
Definition: sced.h:157
int kpFullScreenCursor
Definition: sced.h:299
Definition: sced.h:172
long kcRawY
Definition: sced.h:103
struct ka * kvCoarseWindow
Definition: sced.h:149
int kpModified
Definition: sced.h:261
struct ka * kvSmallCoarseViewport
Definition: sced.h:152
Definition: cddefs.h:119
struct o * ksPointer
Definition: sced.h:335
double kvFineRatio
Definition: sced.h:154
double kvCoarseRatio
Definition: sced.h:155
struct s * kpCellDesc
Definition: sced.h:207
char * kpCellName
Definition: sced.h:210
struct o * hyOldPointer
Definition: sced.h:184
long aTC
Definition: sced.h:122
int kpColor
Definition: sced.h:252
struct parent * pNext
Definition: sced.h:175
struct s * kpTopDesc
Definition: sced.h:213
char * mEntry
Definition: sced.h:364
char kwName[8]
Definition: sced.h:140
struct o * pPointer
Definition: sced.h:173
Definition: sced.h:111
int kpGridDisplayed
Definition: sced.h:240
long hyY
Definition: sced.h:180
char kpRedisplayControl
Definition: sced.h:312
int kpExpandInstances
Definition: sced.h:231
long kcY
Definition: sced.h:102
struct hprlist * hlNext
Definition: sced.h:197
struct ka * kvFineViewport
Definition: sced.h:148
Definition: sced.h:193
int kpHardcopyTextScale
Definition: sced.h:290
struct ka * kvLargeCoarseViewport
Definition: sced.h:151
long kwLastFineWindowWidth
Definition: sced.h:136
double kpDY
Definition: sced.h:228
int kpGridLineStyle
Definition: sced.h:237
int hyOrient
Definition: sced.h:186
long kwLastWindowX
Definition: sced.h:131
int kpPointCoarseWindow
Definition: sced.h:258
Definition: sced.h:204
char * kpCommand
Definition: sced.h:219
int klR
Definition: sced.h:95
Definition: sced.h:101
Definition: sced.h:146
int kpDoingHardcopy
Definition: sced.h:287
struct parent * hyParent
Definition: sced.h:185
long hyOldX
Definition: sced.h:181
int kpShowGridInLargeViewport
Definition: sced.h:246
int kpMY
Definition: sced.h:284
Definition: sced.h:94
char kpMenu
Definition: sced.h:319
int hyUndo
Definition: sced.h:189
struct ks * ksSucc
Definition: sced.h:334
long kwLastFineWindowX
Definition: sced.h:134
struct ka * kvCoarseViewport
Definition: sced.h:150
int aInFine
Definition: sced.h:123
char kwExpandFineOnly
Definition: sced.h:139
long kaTop
Definition: sced.h:112
long kcDY
Definition: sced.h:104
int hyRefType
Definition: sced.h:188
char kwExpand
Definition: sced.h:138
struct ka * kvFineWindow
Definition: sced.h:147
Definition: sced.h:120
int kpNumY
Definition: sced.h:226
struct o * pOldPointer
Definition: sced.h:174
char * kpTopName
Definition: sced.h:216
int kpNumGeometries
Definition: sced.h:264
char * hlText
Definition: sced.h:195
int kpShowTerminals
Definition: sced.h:255
int kpRotationAngle
Definition: sced.h:282
long hyOldY
Definition: sced.h:182
Definition: sced.h:178
struct hyEnt * hlEnt
Definition: sced.h:196
Definition: cddefs.h:142
int kpPointBeepVolume
Definition: sced.h:302
int klB
Definition: sced.h:95
int kpEnableSelectQRedisplay
Definition: sced.h:249
int kpShowDots
Definition: sced.h:270
struct kw * kwNext
Definition: sced.h:137
int kpNumX
Definition: sced.h:225
int kpMX
Definition: sced.h:283
long kpGrid
Definition: sced.h:234
Definition: sced.h:333
int klG
Definition: sced.h:95
double kpDX
Definition: sced.h:227
int hyOldOrient
Definition: sced.h:187
double kaWidth
Definition: sced.h:114
int kpCursorShape
Definition: sced.h:296
int kpGridOnTop
Definition: sced.h:243
long hyX
Definition: sced.h:179
int kcInFine
Definition: sced.h:105
int kpLastCursorColumn
Definition: sced.h:293
Definition: sced.h:363
Definition: sced.h:130
struct o * hyPointer
Definition: sced.h:183
int kpSIGINTERRUPT
Definition: sced.h:267
int aInCoarse
Definition: sced.h:124