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

Contents of /trunk/base/generic/compiler/instance_types.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1039 - (show annotations) (download) (as text)
Thu Jan 4 23:21:20 2007 UTC (17 years, 9 months ago) by johnpye
File MIME type: text/x-chdr
File size: 28586 byte(s)
Fixed up some #includes in compiler .[ch] files.
Switched instantiate.c to using 'asc_assert' instead of 'assert'.
Added some missing GPL headers in C++ code.
Silenced some slv3.c debug output.
Switch void-return to int-return in slv9_presolve etc (slv9.c)
Attemping to fix solvernotes.py for the commandline environment (browser==None)
Removed redundant solve(SELF) in thermalequilibrium2.a4c.
Some error reporting from addone_calc (extfntest.c).
Expanded test size in extrelfor.a4c.
Big rearrangement of bboxtest.c for top-down style.
Fixed TestFreesteam.testintegrator, added end-value checks.

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
30 #ifndef ASC_INSTANCE_TYPES_H
31 #define ASC_INSTANCE_TYPES_H
32
33 #include "instance_enum.h"
34 #include "fractions.h"
35 #include "dimen.h"
36 #include "type_desc.h"
37 #include <general/list.h>
38 #include "logical_relation.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 restrict 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 /** future work.
195 * needs parser and interpretter support. Not yet used.
196 * @todo Implement SolverAtomInstance.
197 */
198 struct SolverAtomInstance {
199 enum inst_t t;
200 VOIDPTR interface_ptr;
201 struct gl_list_t *parents; /**< link to parents */
202 struct Instance *alike_ptr; /**< circular linked list of clique members */
203 struct TypeDescription *desc; /**< list of slow children pointers, by name */
204 unsigned long visited; /**< visited counter */
205 unsigned long tmp_num; /**< used when an instance tree is being copied */
206 /* above should match with CommonAtomInstance */
207 /* atom value part */
208 struct gl_list_t *relations; /**< relations where this real appears */
209 double value; /**< value of variable
210 fast children, all sharing dimens */
211 double nominal; /**< value of variable scaling */
212 double lower; /**< value of variable lower bound */
213 double upper; /**< value of variable upper bound */
214 CONST dim_type *dimen; /**< dimensions */
215 struct Instance **carray; /**< array of pointers to slow children.
216 Keep slow children in pools by type.
217 This should be NULL most of the time. */
218 unsigned int flags; /**< boolean flags of the variable, both
219 internal and external. must be at least
220 32 bit int */
221 unsigned int depth; /**< the depth of the last assignment */
222 /*
223 * An even number of child pointers are packed here, the last of which
224 * may not be real because the number of children may be odd.
225 * This extra should be eliminated for LONG pointer machines.
226 */
227 /* After the child pointers comes the data space for the actual
228 * children.
229 */
230 };
231
232 /*
233 * Bit field definition for boolean attributes. room to grow.
234 * Define all these fields so that a default value of (0,OFF,FALSE)
235 * is the appropriate setting for 'typical' uses of ASCEND.
236 */
237 /* internal flags (compiler use) for solveratominstances: */
238 #define SOL_ASSIGNED 0x1 /**< atom value ever assigned */
239 /* external flags (user interface/solver use) for solveratominstances: */
240 #define SOL_FIXED 0x2 /**< variable fixed for solvers */
241 #define SOL_INACTIVELB 0x4 /**< lower bound to be ignored in solving */
242 #define SOL_INACTIVEUB 0x8 /**< upper bound to be ignored in solving */
243 #define SOL_ODESTATE 0x10 /**< variable state for ivp solver */
244 #define SOL_ODEOBSERVE 0x20 /**< variable recording for ivp */
245 #define SOL_ISZERO 0x40 /**< semicontinuous set 0 for sciconic */
246 #define SOL_INTEGER 0x80 /**< integer variable */
247 #define SOL_RELAXEDINT 0x100 /**< integer variable treat as relaxed */
248 #define SOL_INTERVAL 0x200 /**< interval real variable */
249 #define SOL_COMPLEX 0x400 /**< complex variable. lower -> imaginary part
250 upper -> magnitude bound. ASCEND -> pot */
251 #define SOL_DOMAIN 0x800 /**< continuous variable defines domain */
252 #define SOL_ODEINDEP 0x1000 /**< independent variable in ODE/BVP */
253 #define SOL_NODOF 0x2000 /**< user doesn't want to see var in DOF */
254 #define SOL_PARAMETRIC 0x4000 /**< whatever that means to a solver */
255 #define SOL_INTENSIVE 0x8000 /**< physics/che intensive property variable */
256 #define SOL_NONBASIC 0x10000 /**< in DOF of optimization problem
257 2,4,8-0000 reserved for future */
258 /* external flags (solver/interface tool use) for solveratominstances: */
259 #define SOL_TIGHTLB 0x100000 /**< value at or near lower */
260 #define SOL_TIGHTUB 0x200000 /**< value at or near upper */
261 #define SOL_NOELIG 0x400000 /**< variable not eligible to be fixed in DOF */
262
263 /* note that the above bit positions need to be settled on still. */
264
265 /** aligns to 8 on 4 and 8 byte compilers with compiler pad after t, depth */
266 struct IntegerAtomInstance {
267 enum inst_t t;
268 VOIDPTR interface_ptr;
269 struct gl_list_t *parents; /**< link to parents */
270 struct Instance *alike_ptr;
271 struct TypeDescription *desc; /**< usefull type description information */
272 unsigned long visited;
273 unsigned long tmp_num; /**< used when an instance tree is being copied*/
274 unsigned int anon_flags; /**< anonymous field to be manipulated */
275 /* above should match with CommonAtomInstance */
276 /* atom value part */
277 unsigned int assigned; /**< the number of times it has been assigned */
278 struct gl_list_t *whens; /**< link to whens on which it appears */
279 unsigned int depth; /**< the depth of the last assignment */
280 long value; /**< integer value */
281 /*
282 * An even number of child pointers are packed here, the last of which
283 * may not be real because the number of children may be odd.
284 * This extra should be eliminated for LONG pointer machines.
285 */
286 /* After the child pointers comes the data space for the actual
287 * children.
288 */
289 };
290
291 /** this structure aligns (with compiler generated pad after t and flags
292 * on 4 or 8 byte ptr machines. */
293 struct BooleanAtomInstance {
294 enum inst_t t;
295 VOIDPTR interface_ptr;
296 struct gl_list_t *parents; /**< link to parent instances */
297 struct Instance *alike_ptr;
298 struct TypeDescription *desc; /**< description of name,children, and size */
299 unsigned long visited;
300 unsigned long tmp_num; /**< used when an instance tree is being copied*/
301 unsigned int anon_flags; /**< anonymous field to be manipulated */
302 /* above should match with CommonAtomInstance */
303 /* atom value part */
304 struct gl_list_t *logrelations; /**< logrelations where this boolean appears */
305 struct gl_list_t *whens; /**< whens where this boolean appears*/
306 unsigned assigned; /**< the number of times it has been assigned */
307 unsigned depth; /**< the depth of the assignment */
308 unsigned value; /**< 0 false, 1 true */
309 int padding; /**< so that children have a square address */
310 /*
311 * An even number of child pointers are packed here, the last of which
312 * may not be real because the number of children may be odd.
313 * This extra should be eliminated for LONG pointer machines.
314 */
315 /* After the child pointers comes the data space for the actual
316 * children.
317 */
318 };
319
320 /** this aligns to 8 on 4 or 8 byte compilers with compiler pad after t */
321 struct SetAtomInstance {
322 enum inst_t t; /**< type */
323 VOIDPTR interface_ptr;
324 struct gl_list_t *parents; /**< link to parents instances */
325 struct Instance *alike_ptr;
326 struct TypeDescription *desc; /**< description of name,children, and size */
327 unsigned long visited;
328 unsigned long tmp_num; /**< used when an instance tree is being copied */
329 unsigned int anon_flags; /**< anonymous field to be manipulated */
330 /* above should match with CommonAtomInstance */
331 /* atom value part */
332 unsigned int_set; /**< 0 indicates string set,
333 1 indicates integer set */
334 struct set_t *list; /**< list of enumerated values NULL indicates
335 that is has not been assigned */
336 /*
337 * An even number of child pointers are packed here, the last of which
338 * may not be real because the number of children may be odd.
339 * This extra should be eliminated for LONG pointer machines.
340 */
341 /* After the child pointers comes the data space for the actual
342 * children.
343 */
344 };
345
346 /** this aligns to 8 on 4 or 8 byte compilers with compiler pad after t, flags */
347 struct SymbolAtomInstance {
348 enum inst_t t; /**< type */
349 VOIDPTR interface_ptr;
350 struct gl_list_t *parents; /**< link to parent instances */
351 struct Instance *alike_ptr; /**< ALIKE clique link */
352 struct TypeDescription *desc; /**< description of name, children, and size */
353 unsigned long visited;
354 unsigned long tmp_num; /**< used when an instance is being copied */
355 unsigned int anon_flags; /**< anonymous field to be manipulated */
356 /* above should match with CommonAtomInstance */
357 struct gl_list_t *whens; /**< link to whens on which it appears */
358 /* atom value part */
359 symchar *value; /**< NULL indicates unassigned */
360 /*
361 * An even number of child pointers are packed here, the last of which
362 * may not be real because the number of children may be odd.
363 * This extra should be eliminated for LONG pointer machines.
364 */
365 /* After the child pointers comes the data space for the actual
366 * children.
367 */
368 };
369
370 /* CONSTANT INSTANCES */
371 /** The first one is a dummy of some importance. All the Constant
372 * types should be conformable to this structure. It
373 * is not by itself a structure that should ever exist.
374 */
375 struct CommonConstantInstance {
376 enum inst_t t;
377 unsigned int vflag;
378 unsigned long visited; /**< visited counter */
379 unsigned long tmp_num; /**< used when an instance tree is being copied*/
380 VOIDPTR interface_ptr;
381 unsigned int anon_flags; /**< anonymous field to be manipulated
382 vflag is 32 bits with particular meanings: */
383 #define ci_ASSIGNED 0x1 /**< instance assigned yet? */
384 #define ci_BVAL 0x2 /**< boolean const instance value, reserved */
385 /* other binary flags constants need to be added here. */
386 };
387
388 /** @todo RealConstantInstance should probably be pooled, but isn't yet */
389 struct RealConstantInstance {
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 double value;
398 struct gl_list_t *parents; /**< link to parents */
399 struct Instance *alike_ptr; /**< circular linked list of clique members?*/
400 struct TypeDescription *desc; /**< description of name, size */
401 CONST dim_type *dimen;
402 };
403
404 struct IntegerConstantInstance {
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 unsigned int anon_flags; /**< anonymous field to be manipulated */
411 /* above should match with CommonConstantInstance */
412 long value;
413 struct gl_list_t *parents; /**< link to parents */
414 struct gl_list_t *whens; /**< whens where this integer appears*/
415 struct Instance *alike_ptr; /**< circular linked list of clique members?*/
416 struct TypeDescription *desc; /**< description of name, size */
417 };
418
419 struct BooleanConstantInstance {
420 enum inst_t t;
421 unsigned vflag; /**< assigned? */
422 unsigned long visited; /**< visited counter */
423 unsigned long tmp_num; /**< used when an instance tree is being copied*/
424 VOIDPTR interface_ptr;
425 /* above should match with CommonConstantInstance */
426 unsigned int anon_flags; /**< anonymous field to be manipulated */
427 struct gl_list_t *parents; /**< link to parents */
428 struct gl_list_t *whens; /**< whens where this boolean appears*/
429 struct Instance *alike_ptr; /**< circular linked list of clique members?*/
430 struct TypeDescription *desc; /**< description of name, size */
431 };
432
433 struct SymbolConstantInstance {
434 enum inst_t t;
435 unsigned vflag; /**< assigned */
436 unsigned long visited; /**< visited counter */
437 unsigned long tmp_num; /**< used when an instance tree is being copied*/
438 VOIDPTR interface_ptr;
439 unsigned int anon_flags; /**< anonymous field to be manipulated */
440 /* above should match with CommonConstantInstance */
441 struct gl_list_t *parents; /**< link to parents */
442 struct gl_list_t *whens; /**< whens where this symbol appears*/
443 struct Instance *alike_ptr; /**< circular linked list of clique members?*/
444 struct TypeDescription *desc; /**< description of name, size */
445 symchar *value;
446 };
447
448 /** aligns on 4 or 8 byte ptr machines. size 48/88
449 *
450 * @todo RelationInstance should probably be pooled, as RealAtomInstance,
451 * but isn't yet for the same reasons.
452 */
453 struct RelationInstance {
454 enum inst_t t;
455 /* on long pointer machines, we expect C compiler to pad 4 bytes here */
456 VOIDPTR interface_ptr;
457 struct Instance *parent[2]; /**< relations can have only two parents and
458 normally they only have one. They have
459 two only during an ARE_THE_SAME */
460 struct TypeDescription *desc; /**< holds the child list stuff */
461 unsigned long visited;
462 unsigned long tmp_num; /**< used when an instance tree is being copied*/
463 unsigned int anon_flags; /**< anonymous field to be manipulated */
464 enum Expr_enum type; /**< what kind of the 5 possible types of reln
465 type should be down in union RelationUnion*/
466 struct relation *ptr; /**< pointer to an instance relation */
467 struct gl_list_t *whens; /**< link to whens on which the rel appears */
468 struct gl_list_t *logrels; /**< link to satified's on which rel appears */
469 /* So child insts start packing on 8byte address after child ptrs, of
470 * which there are (currently, 2/97) always an even number.
471 */
472 /* Not required anymore:
473 *
474 * #if (LONGCHILDREN == 0)
475 * int padding;
476 * #endif
477 *
478 * Not valid anymore:
479 *
480 * An even number of child pointers are packed here, the last of which
481 * may not be real because the number of children may be odd.
482 * This extra should be eliminated for LONG pointer machines.
483 */
484
485 /* After the child pointers comes the data space for the actual
486 * children.
487 */
488 };
489
490 /** this aligns to 8 bytes with 4 or 8 byte pointers. size 48/88 */
491 struct LogRelInstance {
492 enum inst_t t;
493 /* on long pointer machines, we expect C compiler to pad 4 bytes here */
494 VOIDPTR interface_ptr;
495 struct Instance *parent[2]; /**< log relations can have only two parents
496 and normally they only have one.They have
497 two only during an ARE_THE_SAME */
498 struct TypeDescription *desc; /**< holds the child list stuff */
499 unsigned long visited;
500 unsigned long tmp_num; /**< used when an instance tree is being copied*/
501 struct logrelation *ptr; /**< pointer to an instance logical relation */
502 struct gl_list_t *whens; /**< link to whens on which the logrel appears */
503 struct gl_list_t *logrels; /**< link to satified's on which lrel appears */
504 unsigned int anon_flags; /**< anonymous field to be manipulated */
505 int padding; /**< so child insts start packing on 8byte
506 address after child ptrs */
507 /*
508 * All logrelations are the same type/size, because we require
509 * exactly 1 refinement of the base definition.
510 */
511 /* After the child pointers comes the data space for the actual
512 * children. This space must start on an 8 byte address.
513 */
514 };
515
516 /** Never, ever, allocate either one of these types. it's a dummy for the
517 * instantiator.
518 */
519 struct PendInstance {
520 enum inst_t t;
521 VOIDPTR p;
522 };
523
524
525 /* COMPOUND INSTANCES */
526 /* Note: All the compound instance structs, except ArrayChild,
527 * and Automatic should have
528 enum inst_t t;
529 VOIDPTR pending_entry;
530 * as the first two lines to match PendInstance above.
531 * Relations of any type are NOT compound, other errors in
532 * this file not withstanding.
533 */
534 /** this structure doesn't have to align on 4 byte ptr machines. size 48/88 */
535 struct ModelInstance {
536 enum inst_t t;
537 VOIDPTR pending_entry; /**< hold a word only pending.c can touch */
538 VOIDPTR interface_ptr;
539 struct gl_list_t *parents; /**< link to parent instances */
540 struct gl_list_t *whens; /**< link to whens on which the model appears */
541 struct TypeDescription *desc;
542 struct Instance *alike_ptr;
543 struct BitList *executed; /**< bit list to keep track of which
544 statements have been executed */
545 unsigned long visited;
546 unsigned long tmp_num; /**< used when an instance tree is being copied*/
547 unsigned int anon_flags; /**< anonymous field to be manipulated */
548 #if (LONGCHILDREN == 1)
549 int padding; /**< so ptrs start packing on 8byte address */
550 #endif
551 /* The child pointers of model instances are packed here, but each is
552 * different and there may not even be children. They are not
553 * accessible through the struct, but only through InstanceChild.
554 */
555 };
556
557 /** This struct not in use anywhere yet, pending more semantics */
558 struct AutomaticInstance {
559 enum inst_t t;
560 /* this object never pending since it has no statements */
561 VOIDPTR interface_ptr;
562 struct Instance *sim_parent; /**< exactly one of these */
563 struct TypeDescription *desc; /**< UNIVERSAL and made at startup */
564 unsigned long visited;
565 unsigned long tmp_num; /**< used when an instance tree is being copied*/
566 unsigned int anon_flags; /**< anonymous field to be manipulated */
567
568 struct gl_list_t *children; /**< unique unsorted list of child insts */
569
570 /* struct hashtable *childdata;
571 * hash lookup of children.
572 */
573 /* note that in table there may be multiple names for a child that
574 * occurs once in childdata.
575 */
576 /* HANDS OFF! --Ben */
577 };
578
579 /** First try of a WhenInstance needs to migrate toward the relations
580 *
581 * Would be nice to have a commoneqninstance type (CE_INST)
582 * for rel,log,when.
583 *
584 * doesn't align as never has children.
585 */
586 struct WhenInstance {
587 enum inst_t t;
588 VOIDPTR interface_ptr;
589 struct Instance *parent[2]; /**< relations can have only two parents and
590 normally they only have one. They have
591 two only during an ARE_THE_SAME */
592 struct gl_list_t *whens; /**< used in case of nested whens */
593 struct gl_list_t *cases; /**< list of cases */
594 struct gl_list_t *bvar; /**< list of references to boolean variables */
595 struct TypeDescription *desc; /**< holds the child list stuff */
596 unsigned long visited;
597 unsigned long tmp_num; /**< used when an instance tree is being copied*/
598 unsigned int anon_flags; /**< anonymous field to be manipulated */
599 };
600
601 /** are pooled, and therefore must align, but does so on its own */
602 struct ArrayChild {
603 /* this object never pending, but member inst may be */
604 struct Instance *inst; /**< The instance. */
605 union {
606 symchar *str;
607 long index; /**< The name, may be string or index. */
608 } name;
609 };
610
611 /** never has packed children. see gllist instead. */
612 struct ArrayInstance {
613 enum inst_t t;
614 VOIDPTR pending_entry; /**< hold a word only pending.c can touch */
615 VOIDPTR interface_ptr;
616 struct TypeDescription *desc; /**< holds the child list stuff */
617 struct gl_list_t *parents; /**< link to parent instances */
618 struct gl_list_t *children; /**< link to children */
619 unsigned long indirected; /**< number of times of indirected */
620 unsigned long visited;
621 unsigned long tmp_num; /**< used when an instance tree is being copied*/
622 unsigned int anon_flags; /**< anonymous field to be manipulated */
623 };
624
625 /** CONTAINER INSTANCE for interfaces. never pending.
626 * no packed children, so never need align
627 */
628 struct SimulationInstance {
629 /* these have *no* parents, yet */
630 enum inst_t t;
631 VOIDPTR interface_ptr;
632 struct TypeDescription *desc; /**< copy of the typedesc of its lone child */
633 symchar *name; /**< name of its lone child */
634 struct Instance **extvars; /**< external variables handles hack */
635 unsigned long tmp_num; /**< used when an instance tree is being copied*/
636 unsigned int anon_flags; /**< anonymous field to be manipulated */
637 /* add other interesting stuff here */
638 };
639
640 /** dummy instance for unselected children of models
641 * no alignment issue
642 */
643 struct GlobalDummyInstance {
644 enum inst_t t;
645 /* never pending */
646 VOIDPTR interface_ptr;
647 /**no link to parent instances */
648 /* when instances should ignore dummy completely */
649 struct TypeDescription *desc;
650 /* all dummies are alike -- and the same */
651 /* dummy has not statements */
652 unsigned long visited;
653 unsigned long ref_count; /**< mainly for debugging purposes */
654 unsigned long tmp_num; /**< used when an instance tree is being copied
655 but CopyDummy==dummy always */
656 unsigned int anon_flags; /**< anonymous field to be manipulated */
657 /* why make life hell for the unsuspecting client? */
658 /*
659 * In particular, the DUMMY_INST doesn't look like any category
660 * (EQN,Compound,Atom,Constant) because a single statically allocated
661 * instance of it stands in for all UNSELECTED_INSTANCEs that are
662 * not compiled.
663 * (This has nothing to do with the DummyIndexType.)
664 */
665 };
666
667 #endif /* ASC_INSTANCE_TYPES_H */
668

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