1 |
/* |
2 |
* Real Ascend Instance Types |
3 |
* by Tom Epperly |
4 |
* Version: $Revision: 1.29 $ |
5 |
* Version control file: $RCSfile: instance_types.h,v $ |
6 |
* Date last modified: $Date: 1998/02/05 16:36:22 $ |
7 |
* Last modified by: $Author: ballan $ |
8 |
* |
9 |
* This file is part of the Ascend Language Interpreter. |
10 |
* |
11 |
* Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly |
12 |
* Copyright (C) 1996 Benjamin Andrew Allan |
13 |
* |
14 |
* The Ascend Language Interpreter is free software; you can redistribute |
15 |
* it and/or modify it under the terms of the GNU General Public License as |
16 |
* published by the Free Software Foundation; either version 2 of the |
17 |
* License, or (at your option) any later version. |
18 |
* |
19 |
* The Ascend Language Interpreter is distributed in hope that it will be |
20 |
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
22 |
* General Public License for more details. |
23 |
* |
24 |
* You should have received a copy of the GNU General Public License |
25 |
* along with the program; if not, write to the Free Software Foundation, |
26 |
* Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check the file named |
27 |
* COPYING. |
28 |
* |
29 |
* Fields not to be accessed by any client program |
30 |
* except by the read-only functions in headers. |
31 |
* The write functions in atomvalue.h are also reasonable for |
32 |
* clients to use. |
33 |
* Clients should never have to include much beyond instance_enum.h. |
34 |
*/ |
35 |
|
36 |
#ifndef __INSTANCE_TYPES_H_SEEN__ |
37 |
#define __INSTANCE_TYPES_H_SEEN__ |
38 |
|
39 |
|
40 |
/* |
41 |
* All of the following structures should be a multiple of *8*; |
42 |
* being a multiple of 4 is not sufficient. Pad if necessary. |
43 |
* RealInstance |
44 |
* IntegerInstance |
45 |
* BooleanInstance |
46 |
* SymbolInstance |
47 |
* SetInstance |
48 |
* and in fact any new instances that will be atom children. |
49 |
* Remember that these get *packed* in together and the order of |
50 |
* packing is not predictable in any way. If each is a multiple |
51 |
* of 8, then everybody will be properly aligned. |
52 |
* *AtomInstance and *Rel*Instance also need to be 8 byte |
53 |
* aligned so that we |
54 |
* start children in an 8 byte. |
55 |
* |
56 |
* This has to hold for both 4 and 8 byte ptr/long machines. |
57 |
*/ |
58 |
|
59 |
#if SIZEOF_VOID_P == 8 |
60 |
#define LONGCHILDREN 1 |
61 |
#else |
62 |
#define LONGCHILDREN 0 |
63 |
#endif |
64 |
/* if LONGCHILDREN, then pointers are 8 bytes */ |
65 |
|
66 |
/* at present, I don't believe the following define is needed */ |
67 |
/* # if defined(_HPUX_SOURCE) || defined(_SGI_SOURCE) */ |
68 |
/* # define ALIGNSTUPID 1 */ |
69 |
/* # endif */ |
70 |
/* if ALIGNSTUPID, then 4 byte ptrs must fall on 8 byte boundaries */ |
71 |
/* any architecture with such a restrict should be summarily torched */ |
72 |
|
73 |
|
74 |
/* FUNDAMENTAL INSTANCES */ |
75 |
|
76 |
/* this aligns to 8 bytes with 4 or 8 byte pointers. size 32/40 */ |
77 |
struct RealInstance { |
78 |
enum inst_t t; /* must always be first */ |
79 |
unsigned assigned; /* the number of times it has been assigned */ |
80 |
struct Instance *parent_offset; |
81 |
CONST dim_type *dimen; |
82 |
double value; |
83 |
unsigned depth; /* the depth of the assignment */ |
84 |
int padding; /* required for either type of pointer */ |
85 |
}; |
86 |
|
87 |
/* this aligns to 8 bytes with 4 or 8 byte pointers. size 24/32 */ |
88 |
struct IntegerInstance { |
89 |
enum inst_t t; /* must always be first */ |
90 |
unsigned assigned; /* the number of times it has been assigned */ |
91 |
struct Instance *parent_offset; |
92 |
long value; |
93 |
unsigned depth; /* the depth of the last assignment */ |
94 |
int padding; /* required for either type of pointer */ |
95 |
}; |
96 |
|
97 |
/* size 24/24 */ |
98 |
struct BooleanInstance { |
99 |
enum inst_t t; |
100 |
unsigned assigned; /* the number of times it has been assigned */ |
101 |
struct Instance *parent_offset; |
102 |
unsigned value; /* 0 false, 1 true */ |
103 |
unsigned depth; /* the depth of the last assignment */ |
104 |
#if (LONGCHILDREN == 0) |
105 |
int padding; |
106 |
#endif |
107 |
}; |
108 |
|
109 |
/* this aligns to 8 bytes with 4 or 8 byte pointers. size 16/24 */ |
110 |
struct SetInstance { |
111 |
enum inst_t t; |
112 |
unsigned int_set; /* 0 indicates string set, 1 indicates an */ |
113 |
/* integer set */ |
114 |
struct Instance *parent_offset; |
115 |
struct set_t *list; /* list of enumerated values, NULL */ |
116 |
/* indicates that it has not been assigned */ |
117 |
/* |
118 |
* if HP_sUX 9/10 or SGI is stupid enough to misalign this structure, |
119 |
* we will have to pad it with an int on both sides of *list |
120 |
*/ |
121 |
}; |
122 |
|
123 |
/* this aligns to 8 bytes with 4 or 8 byte pointers. size 16/24 */ |
124 |
struct SymbolInstance { |
125 |
enum inst_t t; |
126 |
unsigned assigned; /* the number of times it has been assigned */ |
127 |
struct Instance *parent_offset; |
128 |
symchar *value; /* NULL indicates unassigned */ |
129 |
}; |
130 |
|
131 |
|
132 |
/* TRUE ATOM INSTANCES */ |
133 |
/* the first one is a dummy of some importance. All the atomic |
134 |
* variable types should be conformable to this structure. It |
135 |
* is not by itself a structure that should ever exist. |
136 |
*/ |
137 |
struct CommonAtomInstance { |
138 |
enum inst_t t; |
139 |
VOIDPTR interface_ptr; |
140 |
struct gl_list_t *parents; /* link to parents */ |
141 |
struct Instance *alike_ptr; /* circular linked list of clique members */ |
142 |
struct TypeDescription *desc; /* list of children pointers */ |
143 |
unsigned long visited; /* visited counter */ |
144 |
unsigned long tmp_num; /* used when an instance tree is being copied*/ |
145 |
unsigned int anon_flags; /* anonymous field to be manipulated */ |
146 |
}; |
147 |
|
148 |
/* |
149 |
* The RealAtomInstance should be reimplemented with a number of |
150 |
* supported attributes (bounds, nominal, several boolean flags) |
151 |
* and then an explicit pointer to the child space since children |
152 |
* are expected to be rare. Making this pointer explicit will allow |
153 |
* the real atoms (of which there are a lot) to be pooled and save |
154 |
* a fair amount of memory on large problems. |
155 |
*/ |
156 |
/* aligns to 8 byte boundaries on 4 or 8 byte machines. size 56/96 */ |
157 |
struct RealAtomInstance { |
158 |
enum inst_t t; |
159 |
VOIDPTR interface_ptr; |
160 |
struct gl_list_t *parents; /* link to parents */ |
161 |
struct Instance *alike_ptr; /* circular linked list of clique members */ |
162 |
struct TypeDescription *desc; /* list of children pointers */ |
163 |
unsigned long visited; /* visited counter */ |
164 |
unsigned long tmp_num; /* used when an instance tree is being copied*/ |
165 |
unsigned int anon_flags; /* anonymous field to be manipulated */ |
166 |
/* above should match with CommonAtomInstance */ |
167 |
/* atom value part */ |
168 |
double value; /* value of real variable */ |
169 |
CONST dim_type *dimen; /* dimensions */ |
170 |
struct gl_list_t *relations; /* relations where this real appears */ |
171 |
unsigned int assigned; /* the number of times it has been assigned */ |
172 |
unsigned int depth; /* the depth of the last assignment */ |
173 |
/* |
174 |
* An even number of child pointers are packed here, the last of which |
175 |
* may not be valid because the number of children may be odd. |
176 |
* This extra should be eliminated for LONG pointer machines. |
177 |
*/ |
178 |
/* After the child pointers comes the data space for the actual |
179 |
* children. |
180 |
*/ |
181 |
}; |
182 |
|
183 |
/* future work. needs parser and interpretter support. Not yet used. */ |
184 |
struct SolverAtomInstance { |
185 |
enum inst_t t; |
186 |
VOIDPTR interface_ptr; |
187 |
struct gl_list_t *parents; /* link to parents */ |
188 |
struct Instance *alike_ptr; /* circular linked list of clique members */ |
189 |
struct TypeDescription *desc; /* list of slow children pointers, by name */ |
190 |
unsigned long visited; /* visited counter */ |
191 |
unsigned long tmp_num; /* used when an instance tree is being copied*/ |
192 |
/* above should match with CommonAtomInstance */ |
193 |
/* atom value part */ |
194 |
struct gl_list_t *relations; /* relations where this real appears */ |
195 |
double value; /* value of variable */ |
196 |
/* fast children, all sharing dimens */ |
197 |
double nominal; /* value of variable scaling */ |
198 |
double lower; /* value of variable lower bound */ |
199 |
double upper; /* value of variable upper bound */ |
200 |
CONST dim_type *dimen; /* dimensions */ |
201 |
struct Instance **carray; /* array of pointers to slow children. |
202 |
Keep slow children in pools by type. |
203 |
This should be NULL most of the time. */ |
204 |
unsigned int flags; /* boolean flags of the variable, both |
205 |
internal and external. must be at least |
206 |
32 bit int */ |
207 |
unsigned int depth; /* the depth of the last assignment */ |
208 |
/* |
209 |
* An even number of child pointers are packed here, the last of which |
210 |
* may not be real because the number of children may be odd. |
211 |
* This extra should be eliminated for LONG pointer machines. |
212 |
*/ |
213 |
/* After the child pointers comes the data space for the actual |
214 |
* children. |
215 |
*/ |
216 |
}; |
217 |
/* |
218 |
* Bit field definition for boolean attributes. room to grow. |
219 |
* Define all these fields so that a default value of (0,OFF,FALSE) |
220 |
* is the appropriate setting for 'typical' uses of ASCEND. |
221 |
*/ |
222 |
/* internal flags (compiler use) for solveratominstances: */ |
223 |
#define SOL_ASSIGNED 0x1 /* atom value ever assigned */ |
224 |
/* external flags (user interface/solver use) for solveratominstances: */ |
225 |
#define SOL_FIXED 0x2 /* variable fixed for solvers */ |
226 |
#define SOL_INACTIVELB 0x4 /* lower bound to be ignored in solving */ |
227 |
#define SOL_INACTIVEUB 0x8 /* upper bound to be ignored in solving */ |
228 |
#define SOL_ODESTATE 0x10 /* variable state for ivp solver */ |
229 |
#define SOL_ODEOBSERVE 0x20 /* variable recording for ivp */ |
230 |
#define SOL_ISZERO 0x40 /* semicontinuous set 0 for sciconic */ |
231 |
#define SOL_INTEGER 0x80 /* integer variable */ |
232 |
#define SOL_RELAXEDINT 0x100 /* integer variable treat as relaxed */ |
233 |
#define SOL_INTERVAL 0x200 /* interval real variable */ |
234 |
#define SOL_COMPLEX 0x400 /* complex variable. lower -> imaginary part |
235 |
upper -> magnitude bound. ASCEND -> pot */ |
236 |
#define SOL_DOMAIN 0x800 /* continuous variable defines domain */ |
237 |
#define SOL_ODEINDEP 0x1000 /* independent variable in ODE/BVP */ |
238 |
#define SOL_NODOF 0x2000 /* user doesn't want to see var in DOF */ |
239 |
#define SOL_PARAMETRIC 0x4000 /* whatever that means to a solver */ |
240 |
#define SOL_INTENSIVE 0x8000 /* physics/che intensive property variable */ |
241 |
#define SOL_NONBASIC 0x10000 /* in DOF of optimization problem */ |
242 |
/* 2,4,8-0000 reserved for future */ |
243 |
/* external flags (solver/interface tool use) for solveratominstances: */ |
244 |
#define SOL_TIGHTLB 0x100000 /* value at or near lower */ |
245 |
#define SOL_TIGHTUB 0x200000 /* value at or near upper */ |
246 |
#define SOL_NOELIG 0x400000 /* variable not eligible to be fixed in DOF */ |
247 |
/* note that the above bit positions need to be settled on still. */ |
248 |
|
249 |
/* aligns to 8 on 4 and 8 byte compilers with compiler pad after t, depth */ |
250 |
struct IntegerAtomInstance { |
251 |
enum inst_t t; |
252 |
VOIDPTR interface_ptr; |
253 |
struct gl_list_t *parents; /* link to parents */ |
254 |
struct Instance *alike_ptr; |
255 |
struct TypeDescription *desc; /* usefull type description information */ |
256 |
unsigned long visited; |
257 |
unsigned long tmp_num; /* used when an instance tree is being copied*/ |
258 |
unsigned int anon_flags; /* anonymous field to be manipulated */ |
259 |
/* above should match with CommonAtomInstance */ |
260 |
/* atom value part */ |
261 |
unsigned int assigned; /* the number of times it has been assigned */ |
262 |
struct gl_list_t *whens; /* link to whens on which it appears */ |
263 |
unsigned int depth; /* the depth of the last assignment */ |
264 |
long value; /* integer value */ |
265 |
/* |
266 |
* An even number of child pointers are packed here, the last of which |
267 |
* may not be real because the number of children may be odd. |
268 |
* This extra should be eliminated for LONG pointer machines. |
269 |
*/ |
270 |
/* After the child pointers comes the data space for the actual |
271 |
* children. |
272 |
*/ |
273 |
}; |
274 |
|
275 |
/* this structure aligns (with compiler generated pad after t and flags |
276 |
* on 4 or 8 byte ptr machines. |
277 |
*/ |
278 |
struct BooleanAtomInstance { |
279 |
enum inst_t t; |
280 |
VOIDPTR interface_ptr; |
281 |
struct gl_list_t *parents; /* link to parent instances */ |
282 |
struct Instance *alike_ptr; |
283 |
struct TypeDescription *desc; /* description of name,children, and size */ |
284 |
unsigned long visited; |
285 |
unsigned long tmp_num; /* used when an instance tree is being copied*/ |
286 |
unsigned int anon_flags; /* anonymous field to be manipulated */ |
287 |
/* above should match with CommonAtomInstance */ |
288 |
/* atom value part */ |
289 |
struct gl_list_t *logrelations; /* logrelations where this boolean appears */ |
290 |
struct gl_list_t *whens; /* whens where this boolean appears*/ |
291 |
unsigned assigned; /* the number of times it has been assigned */ |
292 |
unsigned depth; /* the depth of the assignment */ |
293 |
unsigned value; /* 0 false, 1 true */ |
294 |
int padding; /* so that children have a square address */ |
295 |
/* |
296 |
* An even number of child pointers are packed here, the last of which |
297 |
* may not be real because the number of children may be odd. |
298 |
* This extra should be eliminated for LONG pointer machines. |
299 |
*/ |
300 |
/* After the child pointers comes the data space for the actual |
301 |
* children. |
302 |
*/ |
303 |
}; |
304 |
|
305 |
/* this aligns to 8 on 4 or 8 byte compilers with compiler pad after t */ |
306 |
struct SetAtomInstance { |
307 |
enum inst_t t; /* type */ |
308 |
VOIDPTR interface_ptr; |
309 |
struct gl_list_t *parents; /* link to parents instances */ |
310 |
struct Instance *alike_ptr; |
311 |
struct TypeDescription *desc; /* description of name,children, and size */ |
312 |
unsigned long visited; |
313 |
unsigned long tmp_num; /* used when an instance tree is being copied*/ |
314 |
unsigned int anon_flags; /* anonymous field to be manipulated */ |
315 |
/* above should match with CommonAtomInstance */ |
316 |
/* atom value part */ |
317 |
unsigned int_set; /* 0 indicates string set, 1 indicates */ |
318 |
struct set_t *list; /* list of enumerated values NULL indicates */ |
319 |
/* that is has not been assigned */ |
320 |
/* integer set */ |
321 |
/* |
322 |
* An even number of child pointers are packed here, the last of which |
323 |
* may not be real because the number of children may be odd. |
324 |
* This extra should be eliminated for LONG pointer machines. |
325 |
*/ |
326 |
/* After the child pointers comes the data space for the actual |
327 |
* children. |
328 |
*/ |
329 |
}; |
330 |
|
331 |
/* this aligns to 8 on 4 or 8 byte compilers with compiler pad after t, flags*/ |
332 |
struct SymbolAtomInstance { |
333 |
enum inst_t t; /* type */ |
334 |
VOIDPTR interface_ptr; |
335 |
struct gl_list_t *parents; /* link to parent instances */ |
336 |
struct Instance *alike_ptr; /* ALIKE clique link */ |
337 |
struct TypeDescription *desc; /* description of name, children, and size */ |
338 |
unsigned long visited; |
339 |
unsigned long tmp_num; /* used when an instance is being copied */ |
340 |
unsigned int anon_flags; /* anonymous field to be manipulated */ |
341 |
/* above should match with CommonAtomInstance */ |
342 |
struct gl_list_t *whens; /* link to whens on which it appears */ |
343 |
/* atom value part */ |
344 |
symchar *value; /* NULL indicates unassigned */ |
345 |
/* |
346 |
* An even number of child pointers are packed here, the last of which |
347 |
* may not be real because the number of children may be odd. |
348 |
* This extra should be eliminated for LONG pointer machines. |
349 |
*/ |
350 |
/* After the child pointers comes the data space for the actual |
351 |
* children. |
352 |
*/ |
353 |
}; |
354 |
|
355 |
/* CONSTANT INSTANCES */ |
356 |
/* The first one is a dummy of some importance. All the Constant |
357 |
* types should be conformable to this structure. It |
358 |
* is not by itself a structure that should ever exist. |
359 |
*/ |
360 |
struct CommonConstantInstance { |
361 |
enum inst_t t; |
362 |
unsigned int vflag; |
363 |
unsigned long visited; /* visited counter */ |
364 |
unsigned long tmp_num; /* used when an instance tree is being copied*/ |
365 |
VOIDPTR interface_ptr; |
366 |
unsigned int anon_flags; /* anonymous field to be manipulated */ |
367 |
/* vflag is 32 bits with particular meanings: */ |
368 |
#define ci_ASSIGNED 0x1 /* instance assigned yet? */ |
369 |
#define ci_BVAL 0x2 /* boolean const instance value, reserved */ |
370 |
/* other binary flags constants need to be added here. */ |
371 |
}; |
372 |
|
373 |
/* RealConstantInstance should probably be pooled, but isn't yet */ |
374 |
struct RealConstantInstance { |
375 |
enum inst_t t; |
376 |
unsigned vflag; /* assigned? */ |
377 |
unsigned long visited; /* visited counter */ |
378 |
unsigned long tmp_num; /* used when an instance tree is being copied*/ |
379 |
VOIDPTR interface_ptr; |
380 |
unsigned int anon_flags; /* anonymous field to be manipulated */ |
381 |
/* above should match with CommonConstantInstance */ |
382 |
double value; |
383 |
struct gl_list_t *parents; /* link to parents */ |
384 |
struct Instance *alike_ptr; /* circular linked list of clique members?*/ |
385 |
struct TypeDescription *desc; /* description of name, size */ |
386 |
CONST dim_type *dimen; |
387 |
}; |
388 |
|
389 |
struct IntegerConstantInstance { |
390 |
enum inst_t t; |
391 |
unsigned vflag; /* assigned? */ |
392 |
unsigned long visited; /* visited counter */ |
393 |
unsigned long tmp_num; /* used when an instance tree is being copied*/ |
394 |
VOIDPTR interface_ptr; |
395 |
unsigned int anon_flags; /* anonymous field to be manipulated */ |
396 |
/* above should match with CommonConstantInstance */ |
397 |
long value; |
398 |
struct gl_list_t *parents; /* link to parents */ |
399 |
struct gl_list_t *whens; /* whens where this integer appears*/ |
400 |
struct Instance *alike_ptr; /* circular linked list of clique members?*/ |
401 |
struct TypeDescription *desc; /* description of name, size */ |
402 |
}; |
403 |
|
404 |
struct BooleanConstantInstance { |
405 |
enum inst_t t; |
406 |
unsigned vflag; /* assigned? */ |
407 |
unsigned long visited; /* visited counter */ |
408 |
unsigned long tmp_num; /* used when an instance tree is being copied*/ |
409 |
VOIDPTR interface_ptr; |
410 |
/* above should match with CommonConstantInstance */ |
411 |
unsigned int anon_flags; /* anonymous field to be manipulated */ |
412 |
struct gl_list_t *parents; /* link to parents */ |
413 |
struct gl_list_t *whens; /* whens where this boolean appears*/ |
414 |
struct Instance *alike_ptr; /* circular linked list of clique members?*/ |
415 |
struct TypeDescription *desc; /* description of name, size */ |
416 |
}; |
417 |
|
418 |
struct SymbolConstantInstance { |
419 |
enum inst_t t; |
420 |
unsigned vflag; /* assigned */ |
421 |
unsigned long visited; /* visited counter */ |
422 |
unsigned long tmp_num; /* used when an instance tree is being copied*/ |
423 |
VOIDPTR interface_ptr; |
424 |
unsigned int anon_flags; /* anonymous field to be manipulated */ |
425 |
/* above should match with CommonConstantInstance */ |
426 |
struct gl_list_t *parents; /* link to parents */ |
427 |
struct gl_list_t *whens; /* whens where this symbol appears*/ |
428 |
struct Instance *alike_ptr; /* circular linked list of clique members?*/ |
429 |
struct TypeDescription *desc; /* description of name, size */ |
430 |
symchar *value; |
431 |
}; |
432 |
|
433 |
/* RelationInstance should probably be pooled, as RealAtomInstance, |
434 |
* but isn't yet for the same reasons. |
435 |
*/ |
436 |
/* aligns on 4 or 8 byte ptr machines. size 48/88 */ |
437 |
struct RelationInstance { |
438 |
enum inst_t t; |
439 |
/* on long pointer machines, we expect C compiler to pad 4 bytes here */ |
440 |
VOIDPTR interface_ptr; |
441 |
struct Instance *parent[2]; /* relations can have only two parents and */ |
442 |
/* normally they only have one. They have */ |
443 |
/* two only during an ARE_THE_SAME */ |
444 |
struct TypeDescription *desc; /* holds the child list stuff */ |
445 |
unsigned long visited; |
446 |
unsigned long tmp_num; /* used when an instance tree is being copied*/ |
447 |
unsigned int anon_flags; /* anonymous field to be manipulated */ |
448 |
enum Expr_enum type; /* what kind of the 5 possible types of reln */ |
449 |
/* type should be down in union RelationUnion*/ |
450 |
struct relation *ptr; /* pointer to an instance relation */ |
451 |
struct gl_list_t *whens; /* link to whens on which the rel appears */ |
452 |
struct gl_list_t *logrels; /* link to satified's on which rel appears */ |
453 |
/* So child insts start packing on 8byte address after child ptrs, of |
454 |
* which there are (currently, 2/97) always an even number. |
455 |
*/ |
456 |
/* Not required anymore: |
457 |
* |
458 |
* #if (LONGCHILDREN == 0) |
459 |
* int padding; |
460 |
* #endif |
461 |
* |
462 |
* Not valid anymore: |
463 |
* |
464 |
* An even number of child pointers are packed here, the last of which |
465 |
* may not be real because the number of children may be odd. |
466 |
* This extra should be eliminated for LONG pointer machines. |
467 |
*/ |
468 |
|
469 |
/* After the child pointers comes the data space for the actual |
470 |
* children. |
471 |
*/ |
472 |
}; |
473 |
|
474 |
|
475 |
/* this aligns to 8 bytes with 4 or 8 byte pointers. size 48/88 */ |
476 |
struct LogRelInstance { |
477 |
enum inst_t t; |
478 |
/* on long pointer machines, we expect C compiler to pad 4 bytes here */ |
479 |
VOIDPTR interface_ptr; |
480 |
struct Instance *parent[2]; /* log relations can have only two parents */ |
481 |
/* and normally they only have one.They have */ |
482 |
/* two only during an ARE_THE_SAME */ |
483 |
struct TypeDescription *desc; /* holds the child list stuff */ |
484 |
unsigned long visited; |
485 |
unsigned long tmp_num; /* used when an instance tree is being copied*/ |
486 |
struct logrelation *ptr; /* pointer to an instance logical relation */ |
487 |
struct gl_list_t *whens; /* link to whens on which the logrel appears */ |
488 |
struct gl_list_t *logrels; /* link to satified's on which lrel appears */ |
489 |
unsigned int anon_flags; /* anonymous field to be manipulated */ |
490 |
int padding; |
491 |
/* so child insts start packing on 8byte address after child ptrs */ |
492 |
/* |
493 |
* All logrelations are the same type/size, because we require |
494 |
* exactly 1 refinement of the base definition. |
495 |
*/ |
496 |
/* After the child pointers comes the data space for the actual |
497 |
* children. This space must start on an 8 byte address. |
498 |
*/ |
499 |
}; |
500 |
|
501 |
/* Never, ever, allocate either one of these types. it's a dummy for the |
502 |
* instantiator. |
503 |
*/ |
504 |
struct PendInstance { |
505 |
enum inst_t t; |
506 |
VOIDPTR p; |
507 |
}; |
508 |
|
509 |
|
510 |
/* COMPOUND INSTANCES */ |
511 |
/* Note: All the compound instance structs, except ArrayChild, |
512 |
* and Automatic should have |
513 |
enum inst_t t; |
514 |
VOIDPTR pending_entry; |
515 |
* as the first two lines to match PendInstance above. |
516 |
* Relations of any type are NOT compound, other errors in |
517 |
* this file not withstanding. |
518 |
*/ |
519 |
/* this structure doesn't have to align on 4 byte ptr machines. size 48/88 */ |
520 |
struct ModelInstance { |
521 |
enum inst_t t; |
522 |
VOIDPTR pending_entry; /* hold a word only pending.c can touch */ |
523 |
VOIDPTR interface_ptr; |
524 |
struct gl_list_t *parents; /* link to parent instances */ |
525 |
struct gl_list_t *whens; /* link to whens on which the model appears */ |
526 |
struct TypeDescription *desc; |
527 |
struct Instance *alike_ptr; |
528 |
struct BitList *executed; /* bit list to keep track of which */ |
529 |
/* statements have been executed */ |
530 |
unsigned long visited; |
531 |
unsigned long tmp_num; /* used when an instance tree is being copied*/ |
532 |
unsigned int anon_flags; /* anonymous field to be manipulated */ |
533 |
#if (LONGCHILDREN == 1) |
534 |
int padding; /* so ptrs start packing on 8byte address */ |
535 |
#endif |
536 |
/* The child pointers of model instances are packed here, but each is |
537 |
* different and there may not even be children. They are not |
538 |
* accessible through the struct, but only through InstanceChild. |
539 |
* |
540 |
*/ |
541 |
}; |
542 |
|
543 |
/* This struct not in use anywhere yet, pending more semantics */ |
544 |
struct AutomaticInstance { |
545 |
enum inst_t t; |
546 |
/* this object never pending since it has no statements */ |
547 |
VOIDPTR interface_ptr; |
548 |
struct Instance *sim_parent; /* exactly one of these */ |
549 |
struct TypeDescription *desc; /* UNIVERSAL and made at startup */ |
550 |
unsigned long visited; |
551 |
unsigned long tmp_num; /* used when an instance tree is being copied*/ |
552 |
unsigned int anon_flags; /* anonymous field to be manipulated */ |
553 |
|
554 |
struct gl_list_t *children; /* unique unsorted list of child insts */ |
555 |
|
556 |
/* struct hashtable *childdata; |
557 |
* hash lookup of children. |
558 |
*/ |
559 |
/* note that in table there may be multiple names for a child that |
560 |
* occurs once in childdata. |
561 |
*/ |
562 |
/* HANDS OFF! --Ben */ |
563 |
}; |
564 |
|
565 |
/* First try of a WhenInstance needs to migrate toward the relations */ |
566 |
/* would be nice to have a commoneqninstance type (CE_INST) |
567 |
* for rel,log,when. |
568 |
*/ |
569 |
/* doesn't align as never has children. */ |
570 |
struct WhenInstance { |
571 |
enum inst_t t; |
572 |
VOIDPTR interface_ptr; |
573 |
struct Instance *parent[2]; /* relations can have only two parents and */ |
574 |
/* normally they only have one. They have */ |
575 |
/* two only during an ARE_THE_SAME */ |
576 |
struct gl_list_t *whens; /* used in case of nested whens */ |
577 |
struct gl_list_t *cases; /* list of cases */ |
578 |
struct gl_list_t *bvar ; /* list of references to boolean variables */ |
579 |
struct TypeDescription *desc; /* holds the child list stuff */ |
580 |
unsigned long visited; |
581 |
unsigned long tmp_num; /* used when an instance tree is being copied*/ |
582 |
unsigned int anon_flags; /* anonymous field to be manipulated */ |
583 |
}; |
584 |
|
585 |
/* are pooled, and therefore must align, but does so on its own */ |
586 |
struct ArrayChild { |
587 |
/* this object never pending, but member inst may be */ |
588 |
struct Instance *inst; |
589 |
union { |
590 |
symchar *str; |
591 |
long index; |
592 |
} name; |
593 |
}; |
594 |
|
595 |
/* never has packed children. see gllist instead. */ |
596 |
struct ArrayInstance { |
597 |
enum inst_t t; |
598 |
VOIDPTR pending_entry; /* hold a word only pending.c can touch */ |
599 |
VOIDPTR interface_ptr; |
600 |
struct TypeDescription *desc; /* holds the child list stuff */ |
601 |
struct gl_list_t *parents; /* link to parent instances */ |
602 |
struct gl_list_t *children; /* link to children */ |
603 |
unsigned long indirected; /* number of times of indirected */ |
604 |
unsigned long visited; |
605 |
unsigned long tmp_num; /* used when an instance tree is being copied*/ |
606 |
unsigned int anon_flags; /* anonymous field to be manipulated */ |
607 |
}; |
608 |
|
609 |
/* CONTAINER INSTANCE for interfaces. never pending. */ |
610 |
/* no packed children, so never need align */ |
611 |
struct SimulationInstance { /* these have *no* parents, yet */ |
612 |
enum inst_t t; |
613 |
VOIDPTR interface_ptr; |
614 |
struct TypeDescription *desc; /* copy of the typedesc of its lone child */ |
615 |
symchar *name; /* name of its lone child */ |
616 |
struct Instance **extvars; /* external variables handles hack */ |
617 |
unsigned long tmp_num; /* used when an instance tree is being copied*/ |
618 |
unsigned int anon_flags; /* anonymous field to be manipulated */ |
619 |
/* add other interesting stuff here */ |
620 |
}; |
621 |
|
622 |
/* dummy instance for unselected children of models */ |
623 |
/* no alignment issue */ |
624 |
struct GlobalDummyInstance { |
625 |
enum inst_t t; |
626 |
/* never pending */ |
627 |
VOIDPTR interface_ptr; |
628 |
/* no link to parent instances */ |
629 |
/* when instances should ignore dummy completely */ |
630 |
struct TypeDescription *desc; |
631 |
/* all dummies are alike -- and the same */ |
632 |
/* dummy has not statements */ |
633 |
unsigned long visited; |
634 |
unsigned long ref_count; /* mainly for debugging purposes */ |
635 |
unsigned long tmp_num; /* used when an instance tree is being copied*/ |
636 |
/* but CopyDummy==dummy always */ |
637 |
unsigned int anon_flags; /* anonymous field to be manipulated */ |
638 |
/* why make life hell for the unsuspecting client? */ |
639 |
/* |
640 |
* In particular, the DUMMY_INST doesn't look like any category |
641 |
* (EQN,Compound,Atom,Constant) because a single statically allocated |
642 |
* instance of it stands in for all UNSELECTED_INSTANCEs that are |
643 |
* not compiled. |
644 |
* (This has nothing to do with the DummyIndexType.) |
645 |
*/ |
646 |
}; |
647 |
|
648 |
#endif /* __INSTANCE_TYPES_H_SEEN__ */ |