/[ascend]/trunk/ascend/compiler/instance_types.h
ViewVC logotype

Contents of /trunk/ascend/compiler/instance_types.h

Parent Directory Parent Directory | Revision Log Revision Log


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

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22